@@ -304,18 +304,19 @@ namespace App\Entity;
304
304
305
305
use ApiPlatform\Metadata\ApiResource;
306
306
use ApiPlatform\Metadata\Post;
307
+ use ApiPlatform\OpenApi\Model;
307
308
use App\Controller\RandomRabbit;
308
309
309
310
#[ApiResource]
310
311
#[Post(
311
312
name: 'create_rabbit',
312
313
uriTemplate: '/rabbit/create',
313
314
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( [
319
320
'application/json' => [
320
321
'schema' => [
321
322
'type' => 'object',
@@ -329,9 +330,9 @@ use App\Controller\RandomRabbit;
329
330
'description' => 'Pink Rabbit'
330
331
]
331
332
]
332
- ]
333
- ]
334
- ]
333
+ ])
334
+ )
335
+ )
335
336
)]
336
337
class Rabbit
337
338
{
@@ -347,7 +348,7 @@ resources:
347
348
class : ApiPlatform\Metadata\Post
348
349
path : ' /rabbit/create'
349
350
controller : App\Controller\RandomRabbit
350
- openapiContext :
351
+ openapi :
351
352
summary : Random rabbit picture
352
353
description : >
353
354
# Pop a great rabbit picture by color!
@@ -378,7 +379,7 @@ resources:
378
379
<operations >
379
380
<operation class =" ApiPlatform\Metadata\Post" name =" create_rabbit" uriTemplate =" /rabbit/create"
380
381
controller =" App\Controller\RandomRabbit" >
381
- <openapiContext >
382
+ <openapi >
382
383
<values >
383
384
<value name =" summary" >Create a rabbit picture </value >
384
385
<value name =" description" ># Pop a great rabbit picture by color!!
@@ -412,7 +413,7 @@ resources:
412
413
</values >
413
414
</value >
414
415
</values >
415
- </openapiContext >
416
+ </openapi >
416
417
</operation >
417
418
</operations >
418
419
</resource >
0 commit comments