Skip to content

Commit

Permalink
Don't break with \stdClass returns
Browse files Browse the repository at this point in the history
Signed-off-by: Joas Schilling <[email protected]>
  • Loading branch information
nickvergessen committed Dec 8, 2023
1 parent 41365f0 commit 8a351f6
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions generate-spec
Original file line number Diff line number Diff line change
Expand Up @@ -742,13 +742,16 @@ foreach ($scopePaths as $scope => $paths) {
foreach ($urlRoutes as $httpMethod => $routeData) {
foreach ($routeData['responses'] as $statusCode => $responseData) {
if (isset($responseData['content']['application/json'])) {
$usedSchemas = array_merge($usedSchemas, Helpers::collectUsedRefs($responseData['content']['application/json']['schema']));
if (is_array($responseData['content']['application/json']['schema'])) {
$newSchemas = Helpers::collectUsedRefs($responseData['content']['application/json']['schema']);
$usedSchemas = array_merge($usedSchemas, $newSchemas);
}
} elseif (isset($responseData['content']['*/*']['schema']['type'], $responseData['content']['*/*']['schema']['format'])
&& $responseData['content']['*/*']['schema']['type'] === 'string'
&& $responseData['content']['*/*']['schema']['format'] === 'binary') {
Logger::info("app", "Binary response from '$httpMethod $url' - Skipping schema reading");
} else {
Logger::warning("app", "Could not read used schemas for response to '$httpMethod $url' with status code $statusCode");
Logger::info("app", "Could not read used schemas for response to '$httpMethod $url' with status code $statusCode");
}
}
}
Expand Down

0 comments on commit 8a351f6

Please sign in to comment.