@@ -206,6 +206,62 @@ public static function provideInvalidOpenAPIs(): Generator
206206 })(),
207207 InvalidOpenAPI::duplicateOperationIds ('duplicate-id ' , '/firstpath ' , 'get ' , '/secondpath ' , 'get ' ),
208208 ];
209+
210+ yield 'path with parameter missing both schema and content ' => [
211+ (function () use ($ openAPI , $ openAPIPath ) {
212+ $ openAPIArray = $ openAPI ;
213+ $ path = $ openAPIPath ('get-first-path ' );
214+ $ path ['parameters ' ] = [['name ' => 'param ' , 'in ' => 'query ' ]];
215+ $ openAPIArray ['paths ' ] = ['/firstpath ' => ['get ' => $ path ]];
216+ return json_encode ($ openAPIArray );
217+ })(),
218+ InvalidOpenAPI::mustHaveSchemaXorContent ('param ' ),
219+ ];
220+
221+ yield 'path with parameter both schema and content ' => [
222+ (function () use ($ openAPI , $ openAPIPath ) {
223+ $ openAPIArray = $ openAPI ;
224+ $ openAPIArray ['paths ' ] = ['/firstpath ' => [
225+ 'parameters ' => [[
226+ 'name ' => 'param ' ,
227+ 'in ' => 'query ' ,
228+ 'schema ' => ['type ' => 'string ' ],
229+ 'content ' => ['application/json ' => ['type ' => 'string ' ]]
230+ ]],
231+ 'get ' => $ openAPIPath ('get-first-path ' )
232+ ],];
233+ return json_encode ($ openAPIArray );
234+ })(),
235+ InvalidOpenAPI::mustHaveSchemaXorContent ('param ' ),
236+ ];
237+
238+ yield 'path with operation missing both schema and content ' => [
239+ (function () use ($ openAPI , $ openAPIPath ) {
240+ $ openAPIArray = $ openAPI ;
241+ $ openAPIArray ['paths ' ] = ['/firstpath ' => [
242+ 'parameters ' => [['name ' => 'param ' , 'in ' => 'query ' ]],
243+ 'get ' => $ openAPIPath ('get-first-path ' )
244+ ]];
245+ return json_encode ($ openAPIArray );
246+ })(),
247+ InvalidOpenAPI::mustHaveSchemaXorContent ('param ' ),
248+ ];
249+
250+ yield 'path with operation both schema and content ' => [
251+ (function () use ($ openAPI , $ openAPIPath ) {
252+ $ openAPIArray = $ openAPI ;
253+ $ path = $ openAPIPath ('get-first-path ' );
254+ $ path ['parameters ' ] = [[
255+ 'name ' => 'param ' ,
256+ 'in ' => 'query ' ,
257+ 'schema ' => ['type ' => 'string ' ],
258+ 'content ' => ['application/json ' => ['type ' => 'string ' ]]
259+ ]];
260+ $ openAPIArray ['paths ' ] = ['/firstpath ' => ['get ' => $ path ],];
261+ return json_encode ($ openAPIArray );
262+ })(),
263+ InvalidOpenAPI::mustHaveSchemaXorContent ('param ' ),
264+ ];
209265 }
210266
211267 #[Test]
0 commit comments