Skip to content

Commit

Permalink
handle wildcard status
Browse files Browse the repository at this point in the history
  • Loading branch information
chriskapp committed Dec 7, 2024
1 parent 844c358 commit 53b94f8
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions src/Generator/Spec/OpenAPI.php
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,7 @@ private function getQueryParameters(OperationInterface $operation, DefinitionsIn
private function getBodyArgument(OperationInterface $operation): ?Argument
{
$arguments = $operation->getArguments();
foreach ($arguments->getAll() as $argumentName => $argument) {
foreach ($arguments->getAll() as $argument) {
if ($argument->getIn() === Argument::IN_BODY) {
return $argument;
}
Expand Down Expand Up @@ -369,7 +369,16 @@ private function getResponses(OperationInterface $operation, DefinitionsInterfac
$result[strval($operation->getReturn()->getCode())] = $this->getResponse($operation->getReturn(), $definitions);

foreach ($operation->getThrows() as $throw) {
$result[strval($throw->getCode())] = $this->getResponse($throw, $definitions);
if ($throw->getCode() === 999) {
$result['4XX'] = $this->getResponse($throw, $definitions);
$result['5XX'] = $this->getResponse($throw, $definitions);
} elseif ($throw->getCode() === 499) {
$result['4XX'] = $this->getResponse($throw, $definitions);
} elseif ($throw->getCode() === 599) {
$result['5XX'] = $this->getResponse($throw, $definitions);
} else {
$result[strval($throw->getCode())] = $this->getResponse($throw, $definitions);
}
}

return $result;
Expand Down

0 comments on commit 53b94f8

Please sign in to comment.