From a8547a4d4d6a88807ab0852d0c71773ce2aa7a07 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Fri, 10 Nov 2023 11:20:17 +0100 Subject: [PATCH] Don't break on files responses Signed-off-by: Joas Schilling --- generate-spec | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/generate-spec b/generate-spec index 1e89404..d5359fb 100755 --- a/generate-spec +++ b/generate-spec @@ -735,7 +735,11 @@ foreach ($scopePaths as $scope => $paths) { foreach ($paths as $url => $urlRoutes) { foreach ($urlRoutes as $httpMethod => $routeData) { foreach ($routeData['responses'] as $statusCode => $responseData) { - $usedSchemas = array_merge($usedSchemas, Helpers::collectUsedRefs($responseData['content']['application/json']['schema'])); + if (isset($responseData['content']['application/json'])) { + $usedSchemas = array_merge($usedSchemas, Helpers::collectUsedRefs($responseData['content']['application/json']['schema'])); + } else { + Logger::warning("app", "Could not read used schemas for response to '$httpMethod $url' with status code $statusCode"); + } } } }