Skip to content

Commit 546b416

Browse files
committed
Swagger fix (add prefix, fix auth header name)
1 parent ebecab1 commit 546b416

15 files changed

+217
-212
lines changed

src/Identity/Controller/AdminAttributeDefinitionController.php

Lines changed: 16 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public function __construct(
4242

4343
#[Route('', name: 'create', methods: ['POST'])]
4444
#[OA\Post(
45-
path: '/administrators/attributes',
45+
path: '/api/v2/administrators/attributes',
4646
description: '🚧 **Status: Beta** – This method is under development. Avoid using in production. ' .
4747
'Returns created admin attribute definition.',
4848
summary: 'Create an admin attribute definition.',
@@ -54,8 +54,8 @@ public function __construct(
5454
tags: ['admin-attributes'],
5555
parameters: [
5656
new OA\Parameter(
57-
name: 'session',
58-
description: 'Session ID obtained from authentication',
57+
name: 'php-auth-pw',
58+
description: 'Session key obtained from login',
5959
in: 'header',
6060
required: true,
6161
schema: new OA\Schema(
@@ -96,7 +96,7 @@ public function create(Request $request): JsonResponse
9696

9797
#[Route('/{definitionId}', name: 'update', requirements: ['definitionId' => '\d+'], methods: ['PUT'])]
9898
#[OA\Put(
99-
path: '/administrators/attributes/{definitionId}',
99+
path: '/api/v2/administrators/attributes/{definitionId}',
100100
description: '🚧 **Status: Beta** – This method is under development. Avoid using in production. ' .
101101
'Returns updated admin attribute definition.',
102102
summary: 'Update an admin attribute definition.',
@@ -115,8 +115,8 @@ public function create(Request $request): JsonResponse
115115
schema: new OA\Schema(type: 'string')
116116
),
117117
new OA\Parameter(
118-
name: 'session',
119-
description: 'Session ID obtained from authentication',
118+
name: 'php-auth-pw',
119+
description: 'Session key obtained from login',
120120
in: 'header',
121121
required: true,
122122
schema: new OA\Schema(type: 'string')
@@ -163,15 +163,15 @@ public function update(
163163

164164
#[Route('/{definitionId}', name: 'delete', requirements: ['definitionId' => '\d+'], methods: ['DELETE'])]
165165
#[OA\Delete(
166-
path: '/administrators/attributes/{definitionId}',
166+
path: '/api/v2/administrators/attributes/{definitionId}',
167167
description: '🚧 **Status: Beta** – This method is under development. Avoid using in production. ' .
168168
'Deletes a single admin attribute definition.',
169169
summary: 'Deletes an attribute definition.',
170170
tags: ['admin-attributes'],
171171
parameters: [
172172
new OA\Parameter(
173-
name: 'session',
174-
description: 'Session ID',
173+
name: 'php-auth-pw',
174+
description: 'Session key obtained from login',
175175
in: 'header',
176176
required: true,
177177
schema: new OA\Schema(type: 'string')
@@ -217,20 +217,18 @@ public function delete(
217217

218218
#[Route('', name: 'get_lists', methods: ['GET'])]
219219
#[OA\Get(
220-
path: '/administrators/attributes',
220+
path: '/api/v2/administrators/attributes',
221221
description: '🚧 **Status: Beta** – This method is under development. Avoid using in production. ' .
222222
'Returns a JSON list of all admin attribute definitions.',
223223
summary: 'Gets a list of all admin attribute definitions.',
224224
tags: ['admin-attributes'],
225225
parameters: [
226226
new OA\Parameter(
227-
name: 'session',
228-
description: 'Session ID obtained from authentication',
227+
name: 'php-auth-pw',
228+
description: 'Session key obtained from login',
229229
in: 'header',
230230
required: true,
231-
schema: new OA\Schema(
232-
type: 'string'
233-
)
231+
schema: new OA\Schema(type: 'string')
234232
),
235233
new OA\Parameter(
236234
name: 'after_id',
@@ -286,7 +284,7 @@ public function getPaginated(Request $request): JsonResponse
286284

287285
#[Route('/{definitionId}', name: 'get_one', requirements: ['definitionId' => '\d+'], methods: ['GET'])]
288286
#[OA\Get(
289-
path: '/administrators/attributes/{definitionId}',
287+
path: '/api/v2/administrators/attributes/{definitionId}',
290288
description: '🚧 **Status: Beta** – This method is under development. Avoid using in production. ' .
291289
'Returns a single attribute with specified ID.',
292290
summary: 'Gets attribute with specified ID.',
@@ -300,8 +298,8 @@ public function getPaginated(Request $request): JsonResponse
300298
schema: new OA\Schema(type: 'string')
301299
),
302300
new OA\Parameter(
303-
name: 'session',
304-
description: 'Session ID obtained from authentication',
301+
name: 'php-auth-pw',
302+
description: 'Session key obtained from login',
305303
in: 'header',
306304
required: true,
307305
schema: new OA\Schema(type: 'string')

src/Identity/Controller/AdminAttributeValueController.php

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -42,13 +42,13 @@ public function __construct(
4242
}
4343

4444
#[Route(
45-
path: '/{adminId}/{definitionId}',
45+
path: '/api/v2/{adminId}/{definitionId}',
4646
name: 'create',
4747
requirements: ['adminId' => '\d+', 'definitionId' => '\d+'],
4848
methods: ['POST', 'PUT'],
4949
)]
5050
#[OA\Post(
51-
path: '/administrators/attribute-values/{adminId}/{definitionId}',
51+
path: '/api/v2/administrators/attribute-values/{adminId}/{definitionId}',
5252
description: '🚧 **Status: Beta** – This method is under development. Avoid using in production. ' .
5353
'Returns created/updated admin attribute.',
5454
summary: 'Create/update an admin attribute.',
@@ -64,8 +64,8 @@ public function __construct(
6464
tags: ['admin-attributes'],
6565
parameters: [
6666
new OA\Parameter(
67-
name: 'session',
68-
description: 'Session ID obtained from authentication',
67+
name: 'php-auth-pw',
68+
description: 'Session key obtained from login',
6969
in: 'header',
7070
required: true,
7171
schema: new OA\Schema(type: 'string')
@@ -128,21 +128,21 @@ public function createOrUpdate(
128128
}
129129

130130
#[Route(
131-
path: '/{adminId}/{definitionId}',
131+
path: '/api/v2/{adminId}/{definitionId}',
132132
name: 'delete',
133133
requirements: ['adminId' => '\d+', 'definitionId' => '\d+'],
134134
methods: ['DELETE'],
135135
)]
136136
#[OA\Delete(
137-
path: '/administrators/attribute-values/{adminId}/{definitionId}',
137+
path: '/api/v2/administrators/attribute-values/{adminId}/{definitionId}',
138138
description: '🚧 **Status: Beta** – This method is under development. Avoid using in production. ' .
139139
'Deletes a single admin attribute.',
140140
summary: 'Deletes an attribute.',
141141
tags: ['admin-attributes'],
142142
parameters: [
143143
new OA\Parameter(
144-
name: 'session',
145-
description: 'Session ID',
144+
name: 'php-auth-pw',
145+
description: 'Session key obtained from login',
146146
in: 'header',
147147
required: true,
148148
schema: new OA\Schema(type: 'string')
@@ -199,15 +199,15 @@ public function delete(
199199

200200
#[Route('/{adminId}', name: 'get__list', requirements: ['adminId' => '\d+'], methods: ['GET'])]
201201
#[OA\Get(
202-
path: '/administrators/attribute-values/{adminId}',
202+
path: '/api/v2/administrators/attribute-values/{adminId}',
203203
description: '🚧 **Status: Beta** – This method is under development. Avoid using in production. ' .
204204
'Returns a JSON list of all admin attributes.',
205205
summary: 'Gets a list of all admin attributes.',
206206
tags: ['admin-attributes'],
207207
parameters: [
208208
new OA\Parameter(
209-
name: 'session',
210-
description: 'Session ID obtained from authentication',
209+
name: 'php-auth-pw',
210+
description: 'Session key obtained from login',
211211
in: 'header',
212212
required: true,
213213
schema: new OA\Schema(type: 'string')
@@ -281,7 +281,7 @@ public function getPaginated(
281281

282282
#[Route('/{adminId}/{definitionId}', name: 'get_one', methods: ['GET'])]
283283
#[OA\Get(
284-
path: '/administrators/attribute-values/{adminId}/{definitionId}',
284+
path: '/api/v2/administrators/attribute-values/{adminId}/{definitionId}',
285285
description: '🚧 **Status: Beta** – This method is under development. Avoid using in production. ' .
286286
'Returns a single attribute.',
287287
summary: 'Gets admin attribute.',
@@ -302,8 +302,8 @@ public function getPaginated(
302302
schema: new OA\Schema(type: 'integer')
303303
),
304304
new OA\Parameter(
305-
name: 'session',
306-
description: 'Session ID obtained from authentication',
305+
name: 'php-auth-pw',
306+
description: 'Session key obtained from login',
307307
in: 'header',
308308
required: true,
309309
schema: new OA\Schema(type: 'string')

src/Identity/Controller/AdministratorController.php

Lines changed: 41 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -45,20 +45,18 @@ public function __construct(
4545

4646
#[Route('', name: 'get_list', methods: ['GET'])]
4747
#[OA\Get(
48-
path: '/administrators',
48+
path: '/api/v2/administrators',
4949
description: '🚧 **Status: Beta** – This method is under development. Avoid using in production. ' .
5050
'Get list of administrators.',
5151
summary: 'Get Administrators',
5252
tags: ['administrators'],
5353
parameters: [
5454
new OA\Parameter(
55-
name: 'session',
56-
description: 'Session ID obtained from authentication',
55+
name: 'php-auth-pw',
56+
description: 'Session key obtained from login',
5757
in: 'header',
5858
required: true,
59-
schema: new OA\Schema(
60-
type: 'string'
61-
)
59+
schema: new OA\Schema(type: 'string')
6260
),
6361
new OA\Parameter(
6462
name: 'after_id',
@@ -109,7 +107,7 @@ public function getAdministrators(Request $request): JsonResponse
109107

110108
#[Route('', name: 'create', methods: ['POST'])]
111109
#[OA\Post(
112-
path: '/administrators',
110+
path: '/api/v2/administrators',
113111
description: '🚧 **Status: Beta** – This method is under development. Avoid using in production. ' .
114112
'Create a new administrator.',
115113
summary: 'Create Administrator',
@@ -119,6 +117,15 @@ public function getAdministrators(Request $request): JsonResponse
119117
content: new OA\JsonContent(ref: '#/components/schemas/CreateAdministratorRequest')
120118
),
121119
tags: ['administrators'],
120+
parameters: [
121+
new OA\Parameter(
122+
name: 'php-auth-pw',
123+
description: 'Session key obtained from login',
124+
in: 'header',
125+
required: true,
126+
schema: new OA\Schema(type: 'string')
127+
),
128+
],
122129
responses: [
123130
new OA\Response(
124131
response: 201,
@@ -149,7 +156,7 @@ public function createAdministrator(
149156

150157
#[Route('/{administratorId}', name: 'get_one', requirements: ['administratorId' => '\d+'], methods: ['GET'])]
151158
#[OA\Get(
152-
path: '/administrators/{administratorId}',
159+
path: '/api/v2/administrators/{administratorId}',
153160
description: '🚧 **Status: Beta** – This method is under development. Avoid using in production. ' .
154161
'Get administrator by ID.',
155162
summary: 'Get Administrator',
@@ -161,7 +168,14 @@ public function createAdministrator(
161168
in: 'path',
162169
required: true,
163170
schema: new OA\Schema(type: 'integer')
164-
)
171+
),
172+
new OA\Parameter(
173+
name: 'php-auth-pw',
174+
description: 'Session key obtained from login',
175+
in: 'header',
176+
required: true,
177+
schema: new OA\Schema(type: 'string')
178+
),
165179
],
166180
responses: [
167181
new OA\Response(
@@ -191,7 +205,7 @@ public function getAdministrator(
191205

192206
#[Route('/{administratorId}', name: 'update', requirements: ['administratorId' => '\d+'], methods: ['PUT'])]
193207
#[OA\Put(
194-
path: '/administrators/{administratorId}',
208+
path: '/api/v2/administrators/{administratorId}',
195209
description: '🚧 **Status: Beta** – This method is under development. Avoid using in production. ' .
196210
'Update an administrator.',
197211
summary: 'Update Administrator',
@@ -208,7 +222,14 @@ public function getAdministrator(
208222
in: 'path',
209223
required: true,
210224
schema: new OA\Schema(type: 'integer')
211-
)
225+
),
226+
new OA\Parameter(
227+
name: 'php-auth-pw',
228+
description: 'Session key obtained from login',
229+
in: 'header',
230+
required: true,
231+
schema: new OA\Schema(type: 'string')
232+
),
212233
],
213234
responses: [
214235
new OA\Response(
@@ -239,7 +260,7 @@ public function updateAdministrator(
239260

240261
#[Route('/{administratorId}', name: 'delete', requirements: ['administratorId' => '\d+'], methods: ['DELETE'])]
241262
#[OA\Delete(
242-
path: '/administrators/{administratorId}',
263+
path: '/api/v2/administrators/{administratorId}',
243264
description: '🚧 **Status: Beta** – This method is under development. Avoid using in production. ' .
244265
'Delete an administrator.',
245266
summary: 'Delete Administrator',
@@ -251,7 +272,14 @@ public function updateAdministrator(
251272
in: 'path',
252273
required: true,
253274
schema: new OA\Schema(type: 'integer')
254-
)
275+
),
276+
new OA\Parameter(
277+
name: 'php-auth-pw',
278+
description: 'Session key obtained from login',
279+
in: 'header',
280+
required: true,
281+
schema: new OA\Schema(type: 'string')
282+
),
255283
],
256284
responses: [
257285
new OA\Response(

src/Identity/Controller/SessionController.php

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public function __construct(
4242

4343
#[Route('', name: 'create', methods: ['POST'])]
4444
#[OA\Post(
45-
path: '/sessions',
45+
path: '/api/v2/sessions',
4646
description: '✅ **Status: Stable** – This method is stable and safe for production use. ' .
4747
'Given valid login data, this will generate a login token that will be valid for 1 hour.',
4848
summary: 'Log in or create new session.',
@@ -111,19 +111,26 @@ public function createSession(
111111
*/
112112
#[Route('/{sessionId}', name: 'delete', requirements: ['sessionId' => '\d+'], methods: ['DELETE'])]
113113
#[OA\Delete(
114-
path: '/sessions/{sessionId}',
114+
path: '/api/v2/sessions/{sessionId}',
115115
description: '✅ **Status: Stable** – This method is stable and safe for production use. ' .
116116
'Delete the session passed as a parameter.',
117117
summary: 'Delete a session.',
118118
tags: ['sessions'],
119119
parameters: [
120+
new OA\Parameter(
121+
name: 'php-auth-pw',
122+
description: 'Session key obtained from login',
123+
in: 'header',
124+
required: true,
125+
schema: new OA\Schema(type: 'string')
126+
),
120127
new OA\Parameter(
121128
name: 'sessionId',
122-
description: 'Session ID',
129+
description: 'Session id (not key as for authentication) obtained from login',
123130
in: 'path',
124131
required: true,
125132
schema: new OA\Schema(type: 'string')
126-
)
133+
),
127134
],
128135
responses: [
129136
new OA\Response(

0 commit comments

Comments
 (0)