Skip to content

Commit

Permalink
fix(openapi): not forbidden response on openAPI doc
Browse files Browse the repository at this point in the history
  • Loading branch information
vinceAmstoutz committed Dec 24, 2024
1 parent f8dae8e commit 5e272a1
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/OpenApi/Factory/OpenApiFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -367,6 +367,13 @@ private function collectPaths(ApiResource $resource, ResourceMetadataCollection

$openapiOperation = $openapiOperation->withParameters($openapiParameters);

if ($security = $operation->getSecurity()) {
$openapiOperation = $openapiOperation->withResponse(403, new Response(\sprintf(
'Access forbidden: You must meet the following condition(s) to access this resource: %s.',
$security
)));
}

$existingResponses = $openapiOperation?->getResponses() ?: [];
$overrideResponses = $operation->getExtraProperties()[self::OVERRIDE_OPENAPI_RESPONSES] ?? $this->openApiOptions->getOverrideResponses();
if ($operation instanceof HttpOperation && null !== ($errors = $operation->getErrors())) {
Expand Down

0 comments on commit 5e272a1

Please sign in to comment.