@@ -19,15 +19,10 @@ class ProductController
1919 *
2020 * @param ?int $product_id the product id
2121 */
22- #[OAT \Get(path: '/products/{product_id} ' , tags: ['products ' ], operationId: 'getProducts ' )]
23- #[OAT \Response(
24- response: 200 ,
25- description: 'successful operation ' ,
26- content: [new OAT \MediaType (mediaType: 'application/json ' , schema: new OAT \Schema (ref: Product::class))],
27- headers: [
28- new OAT \Header (header: 'X-Rate-Limit ' , description: 'calls per hour allowed by the user ' , schema: new OAT \Schema (type: 'integer ' , format: 'int32 ' )),
29- ]
30- )]
22+ #[OAT \Get(path: '/products/{product_id} ' , operationId: 'getProducts ' , tags: ['products ' ])]
23+ #[OAT \Response(response: 200 , description: 'successful operation ' , headers: [
24+ new OAT \Header (header: 'X-Rate-Limit ' , description: 'calls per hour allowed by the user ' , schema: new OAT \Schema (type: 'integer ' , format: 'int32 ' )),
25+ ], content: [new OAT \MediaType (mediaType: 'application/json ' , schema: new OAT \Schema (ref: Product::class))])]
3126 #[OAT \Response(response: 401 , description: 'oops ' )]
3227 #[OAF \CustomAttachable(value: 'operation ' )]
3328 public function getProduct (
@@ -36,43 +31,39 @@ public function getProduct(
3631 ) {
3732 }
3833
39- #[OAT \Post(path: '/products ' , tags: [ ' products ' ], operationId : 'addProducts ' , summary: ' Add products ' )]
34+ #[OAT \Post(path: '/products ' , operationId: ' addProducts ' , summary : 'Add products ' , tags: [ ' products '] )]
4035 #[OAT \Response(
4136 response: 200 ,
4237 description: 'successful operation ' ,
4338 content: new OAT \JsonContent (ref: Product::class)
4439 )]
45- #[OAT \RequestBody(
46- required: true ,
47- description: 'New product ' ,
48- content: [new OAT \MediaType (
49- mediaType: 'application/json ' ,
50- schema: new OAT \Schema (
51- items: new OAT \Items (type: Product::class)
52- )
53- )]
54- )]
40+ #[OAT \RequestBody(description: 'New product ' , required: true , content: [new OAT \MediaType (
41+ mediaType: 'application/json ' ,
42+ schema: new OAT \Schema (
43+ items: new OAT \Items (type: Product::class)
44+ )
45+ )])]
5546 /**
5647 * Add a product.
5748 */
5849 public function addProduct ()
5950 {
6051 }
6152
62- #[OAT \Get(path: '/products ' , tags: ['products ' , 'catalog ' ], operationId: ' getAll ' )]
53+ #[OAT \Get(path: '/products ' , operationId: ' getAll ' , tags: ['products ' , 'catalog ' ])]
6354 #[OAT \Response(
6455 response: 200 ,
6556 description: 'successful operation ' ,
6657 content: new OAT \JsonContent (
67- type: 'object ' ,
6858 required: ['data ' ],
6959 properties: [
7060 new OAT \Property (
7161 property: 'data ' ,
7262 type: 'array ' ,
7363 items: new OAT \Items (ref: Product::class)
7464 ),
75- ]
65+ ],
66+ type: 'object '
7667 )
7768 )]
7869 /**
0 commit comments