@@ -302,7 +302,7 @@ private function loadProductFixtures(string $resourceClass): void
302302 }
303303
304304 #[DataProvider('openApiParameterDocumentationProvider ' )]
305- public function testOpenApiParameterDocumentation (string $ parameterName , bool $ shouldHaveArrayNotation , string $ expectedStyle , bool $ expectedExplode , ?string $ expectedSchemaType = null , string $ expectedDescription = '' ): void
305+ public function testOpenApiParameterDocumentation (string $ parameterName , bool $ shouldHaveArrayNotation , string $ expectedStyle , bool $ expectedExplode , ?string $ expectedSchemaType = null , string $ expectedDescription = '' , ? array $ expectedSchema = null ): void
306306 {
307307 if ($ this ->isMongoDB ()) {
308308 $ this ->markTestSkipped ('Not tested with mongodb. ' );
@@ -342,6 +342,11 @@ public function testOpenApiParameterDocumentation(string $parameterName, bool $s
342342 if (isset ($ foundParameter ['expectedDescription ' ])) {
343343 $ this ->assertSame ($ expectedDescription , $ foundParameter ['description ' ] ?? '' , \sprintf ('Description should be %s ' , $ expectedDescription ));
344344 }
345+
346+ if ($ expectedSchema ) {
347+ $ this ->assertSame ($ expectedSchema , $ foundParameter ['schema ' ], 'Parameter schema should match expected schema ' );
348+ }
349+
345350 $ this ->assertSame ($ expectedStyle , $ foundParameter ['style ' ] ?? 'form ' , \sprintf ('Style should be %s ' , $ expectedStyle ));
346351 $ this ->assertSame ($ expectedExplode , $ foundParameter ['explode ' ] ?? false , \sprintf ('Explode should be %s ' , $ expectedExplode ? 'true ' : 'false ' ));
347352 }
@@ -354,7 +359,8 @@ public static function openApiParameterDocumentationProvider(): array
354359 'shouldHaveArrayNotation ' => true ,
355360 'expectedStyle ' => 'deepObject ' ,
356361 'expectedExplode ' => true ,
357- 'expectedSchemaType ' => 'string ' ,
362+ 'expectedSchemaType ' => null ,
363+ 'expectedSchema ' => ['type ' => 'array ' , 'items ' => ['type ' => 'string ' ]],
358364 ],
359365 'default behavior with an extra description ' => [
360366 'parameterName ' => 'brandWithDescription ' ,
@@ -370,13 +376,23 @@ public static function openApiParameterDocumentationProvider(): array
370376 'expectedStyle ' => 'form ' ,
371377 'expectedExplode ' => false ,
372378 'expectedSchemaType ' => 'string ' ,
379+ 'expectedSchema ' => null ,
373380 ],
374381 'castToArray false should not use array notation ' => [
375382 'parameterName ' => 'exactCategory ' ,
376383 'shouldHaveArrayNotation ' => false ,
377384 'expectedStyle ' => 'form ' ,
378385 'expectedExplode ' => false ,
379386 'expectedSchemaType ' => 'string ' ,
387+ 'expectedSchema ' => null ,
388+ ],
389+ 'with schema and default castToArray should wrap schema in array type ' => [
390+ 'parameterName ' => 'tags ' ,
391+ 'shouldHaveArrayNotation ' => true ,
392+ 'expectedStyle ' => 'deepObject ' ,
393+ 'expectedExplode ' => true ,
394+ 'expectedSchemaType ' => null ,
395+ 'expectedSchema ' => ['type ' => 'array ' , 'items ' => ['anyOf ' => [['type ' => 'array ' , 'items ' => ['type ' => 'string ' ]], ['type ' => 'string ' ]]]],
380396 ],
381397 ];
382398 }
0 commit comments