Skip to content

Commit 58faec8

Browse files
committed
fix(openapi): not forbidden response on openAPI doc
1 parent f8dae8e commit 58faec8

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/OpenApi/Factory/OpenApiFactory.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -408,6 +408,13 @@ private function collectPaths(ApiResource $resource, ResourceMetadataCollection
408408
}
409409
}
410410

411+
if (true === $overrideResponses && !isset($existingResponses[403]) && $security = $operation->getSecurity()) {
412+
$openapiOperation = $openapiOperation->withResponse(403, new Response(\sprintf(
413+
'Forbidden: You must meet the following condition(s) to access this resource: %s.',
414+
$security
415+
)));
416+
}
417+
411418
if (true === $overrideResponses && !$operation instanceof CollectionOperationInterface && 'POST' !== $operation->getMethod()) {
412419
if (!isset($existingResponses[404])) {
413420
$openapiOperation = $openapiOperation->withResponse(404, new Response('Resource not found'));

0 commit comments

Comments
 (0)