|
2 | 2 |
|
3 | 3 | namespace Tests\storage\annotations\OpenApi; |
4 | 4 |
|
| 5 | +use OpenApi\Attributes as OA; |
| 6 | + |
5 | 7 | class L5SwaggerAnnotationsExampleProjects |
6 | 8 | { |
7 | 9 | /** |
8 | | - * @OA\Get( |
9 | | - * path="/projects", |
10 | | - * operationId="getProjectsList", |
11 | | - * tags={"Projects"}, |
12 | | - * summary="Get list of projects", |
13 | | - * description="Returns list of projects", |
14 | | - * @OA\Response( |
15 | | - * response=200, |
16 | | - * description="successful operation" |
17 | | - * ), |
18 | | - * @OA\Response(response=400, description="Bad request"), |
19 | | - * security={ |
20 | | - * {"api_key_security_example": {}} |
21 | | - * } |
22 | | - * ) |
23 | | - * |
24 | 10 | * Returns list of projects |
25 | 11 | */ |
| 12 | + #[OA\Get( |
| 13 | + path: "/projects", |
| 14 | + operationId: "getProjectsList", |
| 15 | + tags: ["Projects"], |
| 16 | + summary: "Get list of projects", |
| 17 | + description: "Returns list of projects", |
| 18 | + responses: [ |
| 19 | + new OA\Response( |
| 20 | + response: 200, |
| 21 | + description: "successful operation" |
| 22 | + ), |
| 23 | + new OA\Response(response: 400, description: "Bad request") |
| 24 | + ], |
| 25 | + security: [ |
| 26 | + ["api_key_security_example" => []] |
| 27 | + ] |
| 28 | + )] |
26 | 29 | public function getProjectsList() |
27 | 30 | { |
28 | 31 | } |
29 | 32 |
|
30 | 33 | /** |
31 | | - * @OA\Get( |
32 | | - * path="/projects/{id}", |
33 | | - * operationId="getProjectById", |
34 | | - * tags={"Projects"}, |
35 | | - * summary="Get project information", |
36 | | - * description="Returns project data", |
37 | | - * @OA\Parameter( |
38 | | - * name="id", |
39 | | - * description="Project id", |
40 | | - * required=true, |
41 | | - * in="path", |
42 | | - * @OA\Schema( |
43 | | - * type="integer" |
44 | | - * ) |
45 | | - * ), |
46 | | - * @OA\Response( |
47 | | - * response=200, |
48 | | - * description="successful operation" |
49 | | - * ), |
50 | | - * @OA\Response(response=400, description="Bad request"), |
51 | | - * @OA\Response(response=404, description="Resource Not Found"), |
52 | | - * security={ |
53 | | - * { |
54 | | - * "oauth2_security_example": {"write:projects", "read:projects"} |
55 | | - * } |
56 | | - * }, |
57 | | - * ) |
| 34 | + * Get project information |
58 | 35 | */ |
| 36 | + #[OA\Get( |
| 37 | + path: "/projects/{id}", |
| 38 | + operationId: "getProjectById", |
| 39 | + tags: ["Projects"], |
| 40 | + summary: "Get project information", |
| 41 | + description: "Returns project data", |
| 42 | + parameters: [ |
| 43 | + new OA\Parameter( |
| 44 | + name: "id", |
| 45 | + description: "Project id", |
| 46 | + required: true, |
| 47 | + in: "path", |
| 48 | + schema: new OA\Schema(type: "integer") |
| 49 | + ) |
| 50 | + ], |
| 51 | + responses: [ |
| 52 | + new OA\Response( |
| 53 | + response: 200, |
| 54 | + description: "successful operation" |
| 55 | + ), |
| 56 | + new OA\Response(response: 400, description: "Bad request"), |
| 57 | + new OA\Response(response: 404, description: "Resource Not Found") |
| 58 | + ], |
| 59 | + security: [ |
| 60 | + [ |
| 61 | + "oauth2_security_example" => ["write:projects", "read:projects"] |
| 62 | + ] |
| 63 | + ] |
| 64 | + )] |
59 | 65 | public function getProjectById() |
60 | 66 | { |
61 | 67 | } |
|
0 commit comments