@@ -304,18 +304,19 @@ namespace App\Entity;
304304
305305use ApiPlatform\Metadata\ApiResource;
306306use ApiPlatform\Metadata\Post;
307+ use ApiPlatform\OpenApi\Model;
307308use App\Controller\RandomRabbit;
308309
309310#[ApiResource]
310311#[Post(
311312 name: 'create_rabbit',
312313 uriTemplate: '/rabbit/create',
313314 controller: RandomRabbit::class,
314- openapiContext: [
315- ' summary' => 'Create a rabbit picture',
316- ' description' => '# Pop a great rabbit picture by color!\n\n',
317- ' requestBody' => [
318- ' content' => [
315+ openapi: new Model\Operation(
316+ summary: 'Create a rabbit picture',
317+ description: '# Pop a great rabbit picture by color!\n\n',
318+ requestBody: new Model\RequestBody(
319+ content: new \ArrayObject( [
319320 'application/json' => [
320321 'schema' => [
321322 'type' => 'object',
@@ -329,9 +330,9 @@ use App\Controller\RandomRabbit;
329330 'description' => 'Pink Rabbit'
330331 ]
331332 ]
332- ]
333- ]
334- ]
333+ ])
334+ )
335+ )
335336)]
336337class Rabbit
337338{
@@ -347,7 +348,7 @@ resources:
347348 class : ApiPlatform\Metadata\Post
348349 path : ' /rabbit/create'
349350 controller : App\Controller\RandomRabbit
350- openapiContext :
351+ openapi :
351352 summary : Random rabbit picture
352353 description : >
353354 # Pop a great rabbit picture by color!
@@ -378,7 +379,7 @@ resources:
378379 <operations >
379380 <operation class =" ApiPlatform\Metadata\Post" name =" create_rabbit" uriTemplate =" /rabbit/create"
380381 controller =" App\Controller\RandomRabbit" >
381- <openapiContext >
382+ <openapi >
382383 <values >
383384 <value name =" summary" >Create a rabbit picture </value >
384385 <value name =" description" ># Pop a great rabbit picture by color!!
@@ -412,7 +413,7 @@ resources:
412413 </values >
413414 </value >
414415 </values >
415- </openapiContext >
416+ </openapi >
416417 </operation >
417418 </operations >
418419 </resource >
0 commit comments