Skip to content

Commit 8990807

Browse files
feat: Add OpenAPI documentation to "getAll" method
1 parent 6e5dc66 commit 8990807

1 file changed

Lines changed: 86 additions & 1 deletion

File tree

app/Http/Controllers/Apis/Marketplace/ConsultantsApiController.php

Lines changed: 86 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,9 @@
1212
* limitations under the License.
1313
**/
1414
use App\Models\Foundation\Marketplace\IConsultantRepository;
15+
use Illuminate\Http\Response;
1516
use models\oauth2\IResourceServerContext;
17+
use OpenApi\Attributes as OA;
1618

1719
/**
1820
* Class ConsultantsApiController
@@ -30,8 +32,91 @@ public function __construct(IConsultantRepository $repository, IResourceServerCo
3032
parent::__construct($repository, $resource_server_context);
3133
}
3234

35+
#[OA\Get(
36+
path: "/api/public/v1/marketplace/consultants",
37+
description: "Get all marketplace consultants and consulting services",
38+
summary: 'Get all consultants',
39+
operationId: 'getAllConsultants',
40+
tags: ['Consultants'],
41+
parameters: [
42+
new OA\Parameter(
43+
name: 'filter[]',
44+
in: 'query',
45+
required: false,
46+
description: 'Filter expressions in the format field<op>value. Available fields: name, company. Operators: =@, ==, @@.',
47+
style: 'form',
48+
explode: true,
49+
schema: new OA\Schema(
50+
type: 'array',
51+
items: new OA\Items(type: 'string', example: 'name@@consulting')
52+
)
53+
),
54+
new OA\Parameter(
55+
name: 'order',
56+
in: 'query',
57+
required: false,
58+
description: 'Order by field(s)',
59+
schema: new OA\Schema(type: 'string', example: 'name,-id')
60+
),
61+
new OA\Parameter(
62+
name: 'expand',
63+
in: 'query',
64+
required: false,
65+
description: 'Comma-separated list of related resources to include. Available relations: company, type, offices, clients, spoken_languages, configuration_management_expertise, expertise_areas, services_offered, supported_regions',
66+
schema: new OA\Schema(type: 'string', example: 'company,offices')
67+
),
68+
new OA\Parameter(
69+
name: 'relations',
70+
in: 'query',
71+
required: false,
72+
description: 'Relations to load eagerly',
73+
schema: new OA\Schema(type: 'string', example: 'company,offices')
74+
),
75+
new OA\Parameter(
76+
name: 'fields',
77+
in: 'query',
78+
required: false,
79+
description: 'Comma-separated list of fields to return',
80+
schema: new OA\Schema(type: 'string', example: 'id,name,company.name')
81+
),
82+
],
83+
responses: [
84+
new OA\Response(
85+
response: 200,
86+
description: 'Success - Returns paginated list of consultants',
87+
content: new OA\JsonContent(
88+
properties: [
89+
'total' => new OA\Property(property: 'total', type: 'integer', example: 15),
90+
'per_page' => new OA\Property(property: 'per_page', type: 'integer', example: 15),
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: 'Consultant'),
100+
'name' => new OA\Property(property: 'name', type: 'string', example: 'OpenStack Consulting Services'),
101+
'overview' => new OA\Property(property: 'overview', type: 'string', example: 'Professional OpenStack consulting and support services'),
102+
'call_2_action_url' => new OA\Property(property: 'call_2_action_url', type: 'string', example: 'https://example.com/contact'),
103+
'slug' => new OA\Property(property: 'slug', type: 'string', example: 'openstack-consulting'),
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+
],
107+
type: 'object'
108+
)
109+
)
110+
],
111+
type: 'object'
112+
)
113+
),
114+
new OA\Response(response: Response::HTTP_PRECONDITION_FAILED, description: "Validation Error"),
115+
new OA\Response(response: Response::HTTP_INTERNAL_SERVER_ERROR, description: "Server Error")
116+
]
117+
)]
33118
public function getAll()
34119
{
35120
return parent::getAll();
36121
}
37-
}
122+
}

0 commit comments

Comments
 (0)