|
4 | 4 |
|
5 | 5 | namespace Api\Admin; |
6 | 6 |
|
| 7 | +use Api\Admin\Collection\AdminCollection; |
| 8 | +use Api\Admin\Collection\AdminRoleCollection; |
7 | 9 | use Api\Admin\Entity\Admin; |
8 | 10 | use Api\Admin\Entity\AdminRole; |
9 | 11 | use Api\Admin\Handler\AdminAccountHandler; |
|
192 | 194 | description: 'List of admin accounts', |
193 | 195 | content: new OA\JsonContent(ref: '#/components/schemas/AdminCollection'), |
194 | 196 | ), |
| 197 | + new OA\Response( |
| 198 | + response: StatusCodeInterface::STATUS_BAD_REQUEST, |
| 199 | + description: 'Bad Request', |
| 200 | + content: new OA\JsonContent(ref: '#/components/schemas/ErrorMessage'), |
| 201 | + ), |
195 | 202 | new OA\Response( |
196 | 203 | response: StatusCodeInterface::STATUS_NOT_FOUND, |
197 | 204 | description: 'Not Found', |
|
279 | 286 | content: new OA\JsonContent( |
280 | 287 | required: ['identity', 'password', 'passwordConfirm', 'firstName', 'lastName', 'roles'], |
281 | 288 | properties: [ |
282 | | - new OA\Property(property: 'identity', type: 'string', default: 'password'), |
| 289 | + new OA\Property(property: 'identity', type: 'string'), |
283 | 290 | new OA\Property(property: 'password', type: 'string'), |
284 | 291 | new OA\Property(property: 'passwordConfirm', type: 'string'), |
285 | 292 | new OA\Property(property: 'firstName', type: 'string'), |
|
332 | 339 | description: 'Authenticated (super)admin fetches an admin role identified by its UUID', |
333 | 340 | summary: 'Admin fetches an admin role', |
334 | 341 | security: [['AuthToken' => []]], |
335 | | - tags: ['Admin Role'], |
| 342 | + tags: ['AdminRole'], |
336 | 343 | parameters: [ |
337 | 344 | new OA\Parameter( |
338 | 345 | name: 'uuid', |
|
363 | 370 | description: 'Authenticated (super)admin fetches a list of admin roles', |
364 | 371 | summary: 'Admin lists admin roles', |
365 | 372 | security: [['AuthToken' => []]], |
366 | | - tags: ['Admin Role'], |
| 373 | + tags: ['AdminRole'], |
367 | 374 | parameters: [ |
368 | 375 | new OA\Parameter( |
369 | 376 | name: 'page', |
|
409 | 416 | new OA\Response( |
410 | 417 | response: StatusCodeInterface::STATUS_OK, |
411 | 418 | description: 'List of admin accounts', |
412 | | - content: new OA\JsonContent(ref: '#/components/schemas/AdminCollection'), |
| 419 | + content: new OA\JsonContent(ref: '#/components/schemas/AdminRoleCollection'), |
| 420 | + ), |
| 421 | + new OA\Response( |
| 422 | + response: StatusCodeInterface::STATUS_BAD_REQUEST, |
| 423 | + description: 'Bad Request', |
| 424 | + content: new OA\JsonContent(ref: '#/components/schemas/ErrorMessage'), |
413 | 425 | ), |
414 | 426 | new OA\Response( |
415 | 427 | response: StatusCodeInterface::STATUS_NOT_FOUND, |
|
492 | 504 | type: 'object', |
493 | 505 | )] |
494 | 506 |
|
| 507 | +/** |
| 508 | + * @see AdminCollection |
| 509 | + */ |
495 | 510 | #[OA\Schema( |
496 | 511 | schema: 'AdminCollection', |
497 | 512 | properties: [ |
|
514 | 529 | new OA\Schema(ref: '#/components/schemas/Collection'), |
515 | 530 | ], |
516 | 531 | )] |
| 532 | +/** |
| 533 | + * @see AdminRoleCollection |
| 534 | + */ |
| 535 | +#[OA\Schema( |
| 536 | + schema: 'AdminRoleCollection', |
| 537 | + properties: [ |
| 538 | + new OA\Property( |
| 539 | + property: '_embedded', |
| 540 | + properties: [ |
| 541 | + new OA\Property( |
| 542 | + property: 'roles', |
| 543 | + type: 'array', |
| 544 | + items: new OA\Items( |
| 545 | + ref: '#/components/schemas/AdminRole', |
| 546 | + ), |
| 547 | + ), |
| 548 | + ], |
| 549 | + type: 'object', |
| 550 | + ), |
| 551 | + ], |
| 552 | + type: 'object', |
| 553 | + allOf: [ |
| 554 | + new OA\Schema(ref: '#/components/schemas/Collection'), |
| 555 | + ], |
| 556 | +)] |
517 | 557 |
|
518 | 558 | class OpenAPI |
519 | 559 | { |
|
0 commit comments