From 0723449b2b613b4cdf523a522fe4c1f2f1ce4e4c Mon Sep 17 00:00:00 2001 From: provokateurin Date: Thu, 12 Mar 2026 15:02:06 +0100 Subject: [PATCH 1/2] refactor: Fix variable name Signed-off-by: provokateurin --- generate-spec.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/generate-spec.php b/generate-spec.php index 1408b8c..546ff62 100755 --- a/generate-spec.php +++ b/generate-spec.php @@ -519,8 +519,8 @@ ]; } - $classMethodInfo = ControllerMethod::parse($routeName, $definitions, $methodFunction, $isPublic, $isAdmin, $isDeprecated, $isPasswordConfirmation, $isCORS, $isOCS); - if (count($classMethodInfo->responses) === 0) { + $controllerMethod = ControllerMethod::parse($routeName, $definitions, $methodFunction, $isPublic, $isAdmin, $isDeprecated, $isPasswordConfirmation, $isCORS, $isOCS); + if (count($controllerMethod->responses) === 0) { Logger::error($routeName, 'Returns no responses'); continue; } @@ -537,7 +537,7 @@ } } - $docStatusCodes = array_map(fn (ControllerMethodResponse $response): int => $response->statusCode, array_filter($classMethodInfo->responses, fn (?ControllerMethodResponse $response): bool => $response != null)); + $docStatusCodes = array_map(fn (ControllerMethodResponse $response): int => $response->statusCode, array_filter($controllerMethod->responses, fn (?ControllerMethodResponse $response): bool => $response != null)); $missingDocStatusCodes = array_unique(array_filter(array_diff($codeStatusCodes, $docStatusCodes), fn (int $code): bool => $code < 500)); if ($missingDocStatusCodes !== []) { @@ -569,7 +569,7 @@ $url, $requirements, $defaults, - $classMethodInfo, + $controllerMethod, $isOCS, $isCORS, $isNoCSRFRequired, From f647cc8115743f97064972a4ed1371bdd7edf671 Mon Sep 17 00:00:00 2001 From: provokateurin Date: Thu, 12 Mar 2026 15:15:56 +0100 Subject: [PATCH 2/2] feat: Warn about limit parameters missing boundaries Signed-off-by: provokateurin --- generate-spec.php | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/generate-spec.php b/generate-spec.php index 546ff62..ebfa43e 100755 --- a/generate-spec.php +++ b/generate-spec.php @@ -545,6 +545,21 @@ continue; } + foreach ($controllerMethod->parameters as $parameter) { + if ($parameter->name !== 'limit') { + continue; + } + + if ($parameter->type->type !== 'integer') { + Logger::debug($routeName . ': @param: ' . $parameter->name, 'Type was not an integer: ' . $parameter->type->type); + continue; + } + + if ($parameter->type->minimum === null || $parameter->type->maximum === null) { + Logger::warning($routeName . ': @param: ' . $parameter->name, 'A parameter to limit the results should have a minimum and maximum.'); + } + } + $operationId = [ $tagName, ...Helpers::splitOnUppercaseFollowedByNonUppercase($methodName)