Skip to content

Commit 09ef5de

Browse files
chore: Add controller's response OpenAPI schema
1 parent 1b2bc03 commit 09ef5de

2 files changed

Lines changed: 42 additions & 33 deletions

File tree

‎app/Http/Controllers/Apis/Marketplace/DistributionsApiController.php‎

Lines changed: 1 addition & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -84,39 +84,7 @@ public function __construct(IDistributionRepository $repository, IResourceServer
8484
new OA\Response(
8585
response: 200,
8686
description: 'Success - Returns paginated list of distributions',
87-
content: new OA\JsonContent(
88-
properties: [
89-
'total' => new OA\Property(property: 'total', type: 'integer', example: 20),
90-
'per_page' => new OA\Property(property: 'per_page', type: 'integer', example: 20),
91-
'current_page' => new OA\Property(property: 'current_page', type: 'integer', example: 1),
92-
'last_page' => new OA\Property(property: 'last_page', type: 'integer', example: 1),
93-
'data' => new OA\Property(
94-
property: 'data',
95-
type: 'array',
96-
items: new OA\Items(
97-
properties: [
98-
'id' => new OA\Property(property: 'id', type: 'integer', example: 1),
99-
'class_name' => new OA\Property(property: 'class_name', type: 'string', example: 'Distribution'),
100-
'name' => new OA\Property(property: 'name', type: 'string', example: 'Ubuntu OpenStack'),
101-
'overview' => new OA\Property(property: 'overview', type: 'string', example: 'Ubuntu-based OpenStack distribution'),
102-
'call_2_action_url' => new OA\Property(property: 'call_2_action_url', type: 'string', example: 'https://example.com/download'),
103-
'slug' => new OA\Property(property: 'slug', type: 'string', example: 'ubuntu-openstack'),
104-
'company_id' => new OA\Property(property: 'company_id', type: 'integer', example: 1),
105-
'type_id' => new OA\Property(property: 'type_id', type: 'integer', example: 1),
106-
'is_compatible_with_storage' => new OA\Property(property: 'is_compatible_with_storage', type: 'boolean', example: true),
107-
'is_compatible_with_compute' => new OA\Property(property: 'is_compatible_with_compute', type: 'boolean', example: true),
108-
'is_compatible_with_federated_identity' => new OA\Property(property: 'is_compatible_with_federated_identity', type: 'boolean', example: false),
109-
'is_compatible_with_platform' => new OA\Property(property: 'is_compatible_with_platform', type: 'boolean', example: true),
110-
'is_openstack_powered' => new OA\Property(property: 'is_openstack_powered', type: 'boolean', example: true),
111-
'is_openstack_tested' => new OA\Property(property: 'is_openstack_tested', type: 'boolean', example: true),
112-
'openstack_tested_info' => new OA\Property(property: 'openstack_tested_info', type: 'string', example: 'Tested with OpenStack Zed')
113-
],
114-
type: 'object'
115-
)
116-
)
117-
],
118-
type: 'object'
119-
)
87+
content: new OA\JsonContent(ref: "#/components/schemas/PaginatedMarketplaceDistributionResponseSchema")
12088
),
12189
new OA\Response(response: Response::HTTP_PRECONDITION_FAILED, description: "Validation Error"),
12290
new OA\Response(response: Response::HTTP_INTERNAL_SERVER_ERROR, description: "Server Error")

‎app/Swagger/schemas.php‎

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -376,3 +376,44 @@ class RSVPUpdateRequestSchema_{
376376
]
377377
)]
378378
class RSVPAdminAddRequestSchema {}
379+
380+
#[OA\Schema(
381+
schema: 'MarketplaceDistributionResponseSchema',
382+
type: 'object',
383+
properties: [
384+
'id' => new OA\Property(property: 'id', type: 'integer', example: 1),
385+
'class_name' => new OA\Property(property: 'class_name', type: 'string', example: 'Distribution'),
386+
'name' => new OA\Property(property: 'name', type: 'string', example: 'Ubuntu OpenStack'),
387+
'overview' => new OA\Property(property: 'overview', type: 'string', example: 'Ubuntu-based OpenStack distribution'),
388+
'call_2_action_url' => new OA\Property(property: 'call_2_action_url', type: 'string', example: 'https://example.com/download'),
389+
'slug' => new OA\Property(property: 'slug', type: 'string', example: 'ubuntu-openstack'),
390+
'company_id' => new OA\Property(property: 'company_id', type: 'integer', example: 1),
391+
'type_id' => new OA\Property(property: 'type_id', type: 'integer', example: 1),
392+
'is_compatible_with_storage' => new OA\Property(property: 'is_compatible_with_storage', type: 'boolean', example: true),
393+
'is_compatible_with_compute' => new OA\Property(property: 'is_compatible_with_compute', type: 'boolean', example: true),
394+
'is_compatible_with_federated_identity' => new OA\Property(property: 'is_compatible_with_federated_identity', type: 'boolean', example: false),
395+
'is_compatible_with_platform' => new OA\Property(property: 'is_compatible_with_platform', type: 'boolean', example: true),
396+
'is_openstack_powered' => new OA\Property(property: 'is_openstack_powered', type: 'boolean', example: true),
397+
'is_openstack_tested' => new OA\Property(property: 'is_openstack_tested', type: 'boolean', example: true),
398+
'openstack_tested_info' => new OA\Property(property: 'openstack_tested_info', type: 'string', example: 'Tested with OpenStack Zed')
399+
]
400+
)]
401+
class MarketplaceDistributionResponseSchema {}
402+
403+
#[OA\Schema(
404+
schema: 'PaginatedMarketplaceDistributionResponseSchema',
405+
allOf: [
406+
new OA\Schema(ref: '#/components/schemas/PaginateDataSchemaResponse'),
407+
new OA\Schema(
408+
type: 'object',
409+
properties: [
410+
new OA\Property(
411+
property: 'data',
412+
type: 'array',
413+
items: new OA\Items(ref: '#/components/schemas/MarketplaceDistributionResponseSchema')
414+
)
415+
]
416+
)
417+
]
418+
)]
419+
class PaginatedMarketplaceDistributionResponseSchema {}

0 commit comments

Comments
 (0)