Skip to content

Commit

Permalink
TASK: Remove the '[]' postfix from collection parameters as those wil…
Browse files Browse the repository at this point in the history
…l use deepObject style now
  • Loading branch information
mficzel committed Jun 7, 2024
1 parent 074774e commit 36fd249
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Classes/Domain/Path/OpenApiParameter.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public static function fromReflectionParameter(\ReflectionParameter $reflectionP
$parameterSchema = OpenApiSchema::fromReflectionClass($reflectionClass);

return new self(
name: $reflectionParameter->name . (($parameterAttribute->in === ParameterLocation::LOCATION_QUERY && $parameterSchema->type === 'array') ? '[]' : ''),
name: $reflectionParameter->name,
in: $parameterAttribute->in,
description: $parameterAttribute->description ?: $schemaAttribute->description,
required: !$reflectionParameter->isDefaultValueAvailable(),
Expand Down
4 changes: 2 additions & 2 deletions Tests/Unit/Application/ParameterFactoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -118,9 +118,9 @@ public static function parameterProvider(): iterable
$collectionParametersRequest = ActionRequest::fromHttpRequest(
(new ServerRequest(
HttpMethod::METHOD_GET->value,
new Uri('https://acme.site/?identifierCollection[]=foo&identifierCollection[]=bar&identifier=baz')
new Uri('https://acme.site/?identifierCollection=foo&identifierCollection=bar&identifier=baz')
))->withQueryParams([
'identifierCollection' => ['foo','bar'],
'identifierCollection' => '["foo","bar"]',
'identifier' => 'baz'
])
);
Expand Down
2 changes: 1 addition & 1 deletion Tests/Unit/Domain/OpenApiDocumentFactoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -480,7 +480,7 @@ public function testFromClassNameCreatesDefinitionsForValidClasses(): void
style: ParameterStyle::STYLE_FORM
),
new OpenApiParameter(
name: 'identifierCollection[]',
name: 'identifierCollection',
description: '',
in: ParameterLocation::LOCATION_QUERY,
required: true,
Expand Down

0 comments on commit 36fd249

Please sign in to comment.