File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 545545 continue ;
546546 }
547547
548+ $ hasLimitParameter = false ;
548549 foreach ($ controllerMethod ->parameters as $ parameter ) {
549550 if ($ parameter ->name !== 'limit ' ) {
550551 continue ;
551552 }
552553
554+ $ hasLimitParameter = true ;
555+
553556 if ($ parameter ->type ->type !== 'integer ' ) {
554557 Logger::debug ($ routeName . ': @param: ' . $ parameter ->name , 'Type was not an integer: ' . $ parameter ->type ->type );
555558 continue ;
560563 }
561564 }
562565
566+ foreach ($ controllerMethod ->responses as $ response ) {
567+ if ($ response ->type === null ) {
568+ continue ;
569+ }
570+
571+ // maxItems=0 is list<empty> which is just for the legacy [] empty response.
572+ if ($ response ->type ->type === 'array ' && $ response ->type ->maxItems !== 0 && !$ hasLimitParameter ) {
573+ Logger::warning ($ routeName , 'The endpoint returns a list, but has no parameter to limit the number of items. ' );
574+ // Only show the warning once, even if multiple responses contain lists.
575+ break ;
576+ }
577+ }
578+
563579 $ operationId = [
564580 $ tagName ,
565581 ...Helpers::splitOnUppercaseFollowedByNonUppercase ($ methodName )
You can’t perform that action at this time.
0 commit comments