Skip to content

Commit cec7c02

Browse files
committed
Fix/Enh. OpenAPI
1 parent 922fff9 commit cec7c02

30 files changed

Lines changed: 277 additions & 369 deletions
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"UserGroupRefList": {
3+
"_media-type": "application/vnd.ibexa.api.UserGroupRefList+json",
4+
"_href": "/api/ibexa/v2/user/users/57/groups",
5+
"UserGroup": [
6+
{
7+
"_media-type": "application/vnd.ibexa.api.UserGroup+json",
8+
"_href": "/api/ibexa/v2/user/groups/1/5/13"
9+
}
10+
]
11+
}
12+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<UserGroupRefList media-type="application/vnd.ibexa.api.UserGroupRefList+xml" href="/api/ibexa/v2/user/users/115/groups">
3+
<UserGroup media-type="application/vnd.ibexa.api.UserGroup+xml" href="/api/ibexa/v2/user/groups/1/5/12">
4+
<unassign href="/api/ibexa/v2/user/users/79/groups/12" method="DELETE"/>
5+
</UserGroup>
6+
<UserGroup media-type="application/vnd.ibexa.api.UserGroup+xml" href="/api/ibexa/v2/user/groups/1/5/13">
7+
<unassign href="/api/ibexa/v2/user/users/115/groups/13" method="DELETE"/>
8+
</UserGroup>
9+
</UserGroupRefList>

src/bundle/Resources/api_platform/schemas/user/roles_schemas.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ schemas:
136136
description: A read-only list of IDs or identifiers for which the limitation should be applied. The value of this property must conform to a hash, which means that it may only consist of array and scalar values, but must not contain objects or resources.
137137
type: object
138138
required:
139-
- $ref
139+
- ref
140140
properties:
141141
ref:
142142
type: array

src/contracts/Security/AuthorizationHeaderRESTRequestMatcher.php

Whitespace-only changes.

src/lib/Server/Controller/JWT.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
uriTemplate: '/user/token/jwt',
2020
extraProperties: [OpenApiFactory::OVERRIDE_OPENAPI_RESPONSES => false],
2121
openapi: new Model\Operation(
22+
operationId: 'ibexa.rest.create_token',
2223
summary: 'Create JWT token',
2324
description: 'Creates JWT authentication token.',
2425
tags: [

src/lib/Server/Controller/Session/SessionCheckController.php

Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
#[Get(
1818
uriTemplate: '/user/sessions/current',
1919
openapi: new Model\Operation(
20+
operationId: 'ibexa.rest.check_session',
2021
summary: 'Get current session',
2122
description: 'Get current user session, if any.',
2223
tags: [
@@ -26,38 +27,29 @@
2627
new Model\Parameter(
2728
name: 'Cookie',
2829
in: 'header',
29-
required: true,
30+
required: false,
3031
description: 'Only needed for session\'s checking {sessionName}={sessionID}.',
3132
schema: [
3233
'type' => 'string',
3334
],
3435
),
35-
new Model\Parameter(
36-
name: 'Accept',
37-
in: 'header',
38-
required: true,
39-
description: 'If set, the session is returned in XML or JSON format.',
40-
schema: [
41-
'type' => 'string',
42-
],
43-
),
4436
],
4537
responses: [
4638
Response::HTTP_OK => [
4739
'description' => 'User is currently logged in and has a valid session.',
4840
'content' => [
49-
'application/vnd.ibexa.api.Session+xml' => [
50-
'schema' => [
51-
'$ref' => '#/components/schemas/Session',
52-
],
53-
'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/user/sessions/POST/Session.xml.example',
54-
],
5541
'application/vnd.ibexa.api.Session+json' => [
5642
'schema' => [
5743
'$ref' => '#/components/schemas/SessionWrapper',
5844
],
5945
'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/user/sessions/session_id/refresh/POST/Session.json.example',
6046
],
47+
'application/vnd.ibexa.api.Session+xml' => [
48+
'schema' => [
49+
'$ref' => '#/components/schemas/Session',
50+
],
51+
'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/user/sessions/POST/Session.xml.example',
52+
],
6153
],
6254
],
6355
Response::HTTP_NOT_FOUND => [

src/lib/Server/Controller/Session/SessionCreateController.php

Lines changed: 23 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -24,34 +24,17 @@
2424
uriTemplate: '/user/sessions',
2525
extraProperties: [OpenApiFactory::OVERRIDE_OPENAPI_RESPONSES => false],
2626
openapi: new Model\Operation(
27+
operationId: 'ibexa.rest.create_session',
2728
summary: 'Create session (login a User)',
2829
description: 'Performs a login for the user or checks if session exists and returns the session and session cookie. The client will need to remember both session name/ID and CSRF token as this is for security reasons not exposed via GET.',
2930
tags: [
3031
'User Session',
3132
],
3233
parameters: [
33-
new Model\Parameter(
34-
name: 'Accept',
35-
in: 'header',
36-
required: true,
37-
description: 'If set, the session is returned in XML or JSON format.',
38-
schema: [
39-
'type' => 'string',
40-
],
41-
),
42-
new Model\Parameter(
43-
name: 'Content-Type',
44-
in: 'header',
45-
required: true,
46-
description: 'The SessionInput schema encoded in XML or JSON format.',
47-
schema: [
48-
'type' => 'string',
49-
],
50-
),
5134
new Model\Parameter(
5235
name: 'Cookie',
5336
in: 'header',
54-
required: true,
37+
required: false,
5538
description: 'Only needed for session\'s checking {sessionName}={sessionID}.',
5639
schema: [
5740
'type' => 'string',
@@ -60,61 +43,62 @@
6043
new Model\Parameter(
6144
name: 'X-CSRF-Token',
6245
in: 'header',
63-
required: true,
64-
description: 'Only needed for session\'s checking. The {csrfToken} needed on all unsafe HTTP methods with session.',
46+
required: false,
47+
description: 'Only needed for session\'s checking. The CSRF Token needed on all unsafe HTTP methods with session.',
6548
schema: [
6649
'type' => 'string',
6750
],
6851
),
6952
],
7053
requestBody: new Model\RequestBody(
54+
description: 'The session input in XML or JSON format.',
7155
content: new \ArrayObject([
72-
'application/vnd.ibexa.api.SessionInput+xml' => [
73-
'schema' => [
74-
'$ref' => '#/components/schemas/SessionInput',
75-
],
76-
'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/user/sessions/POST/SessionInput.xml.example',
77-
],
7856
'application/vnd.ibexa.api.SessionInput+json' => [
7957
'schema' => [
8058
'$ref' => '#/components/schemas/SessionInputWrapper',
8159
],
8260
'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/user/sessions/POST/SessionInput.json.example',
8361
],
62+
'application/vnd.ibexa.api.SessionInput+xml' => [
63+
'schema' => [
64+
'$ref' => '#/components/schemas/SessionInput',
65+
],
66+
'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/user/sessions/POST/SessionInput.xml.example',
67+
],
8468
]),
8569
),
8670
responses: [
8771
Response::HTTP_OK => [
8872
'description' => 'Session already exists.',
8973
'content' => [
90-
'application/vnd.ibexa.api.Session+xml' => [
74+
'application/vnd.ibexa.api.Session+json' => [
9175
'schema' => [
92-
'$ref' => '#/components/schemas/Session',
76+
'$ref' => '#/components/schemas/SessionWrapper',
9377
],
94-
'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/user/sessions/POST/Session.xml.example',
78+
'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/user/sessions/POST/Session.json.example',
9579
],
96-
'application/vnd.ibexa.api.Session+json' => [
80+
'application/vnd.ibexa.api.Session+xml' => [
9781
'schema' => [
98-
'$ref' => '#/components/schemas/SessionWrapper',
82+
'$ref' => '#/components/schemas/Session',
9983
],
100-
'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/user/sessions/session_id/refresh/POST/Session.json.example',
84+
'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/user/sessions/POST/Session.xml.example',
10185
],
10286
],
10387
],
10488
Response::HTTP_CREATED => [
10589
'description' => 'Session is created.',
10690
'content' => [
107-
'application/vnd.ibexa.api.Session+xml' => [
91+
'application/vnd.ibexa.api.Session+json' => [
10892
'schema' => [
109-
'$ref' => '#/components/schemas/Session',
93+
'$ref' => '#/components/schemas/SessionWrapper',
11094
],
111-
'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/user/sessions/POST/Session.xml.example',
95+
'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/user/sessions/POST/Session.json.example',
11296
],
113-
'application/vnd.ibexa.api.Session+json' => [
97+
'application/vnd.ibexa.api.Session+xml' => [
11498
'schema' => [
115-
'$ref' => '#/components/schemas/SessionWrapper',
99+
'$ref' => '#/components/schemas/Session',
116100
],
117-
'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/user/sessions/session_id/refresh/POST/Session.json.example',
101+
'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/user/sessions/POST/Session.xml.example',
118102
],
119103
],
120104
],

src/lib/Server/Controller/Session/SessionDeleteController.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
#[Delete(
1818
uriTemplate: '/user/sessions/{sessionId}',
1919
openapi: new Model\Operation(
20+
operationId: 'ibexa.rest.delete_session',
2021
summary: 'Delete session (logout a User)',
2122
description: 'The user session is removed i.e. the user is logged out.',
2223
tags: [
@@ -35,8 +36,8 @@
3536
new Model\Parameter(
3637
name: 'X-CSRF-Token',
3738
in: 'header',
38-
required: true,
39-
description: 'The {csrfToken} needed on all unsafe HTTP methods with session.',
39+
required: false,
40+
description: 'The CSRF Token needed on all unsafe HTTP methods with session.',
4041
schema: [
4142
'type' => 'string',
4243
],

src/lib/Server/Controller/Session/SessionRefreshController.php

Lines changed: 14 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
uriTemplate: '/user/sessions/{sessionId}/refresh',
2020
extraProperties: [OpenApiFactory::OVERRIDE_OPENAPI_RESPONSES => false],
2121
openapi: new Model\Operation(
22+
operationId: 'ibexa.rest.refresh_session',
2223
summary: 'Refresh session (deprecated)',
2324
description: 'Get the session\'s User information. Deprecated as of Ibexa DXP 4.6, use GET /user/sessions/current instead.',
2425
tags: [
@@ -37,16 +38,8 @@
3738
new Model\Parameter(
3839
name: 'X-CSRF-Token',
3940
in: 'header',
40-
required: true,
41-
description: 'The {csrfToken} needed on all unsafe HTTP methods with session.',
42-
schema: [
43-
'type' => 'string',
44-
],
45-
),
46-
new Model\Parameter(
47-
name: 'Accept',
48-
in: 'header',
49-
required: true,
41+
required: false,
42+
description: 'The CSRF Token needed on all unsafe HTTP methods with session.',
5043
schema: [
5144
'type' => 'string',
5245
],
@@ -60,30 +53,32 @@
6053
],
6154
),
6255
],
56+
requestBody: new Model\RequestBody(
57+
description: 'No payload required',
58+
content: new \ArrayObject(),
59+
),
6360
responses: [
6461
Response::HTTP_OK => [
62+
'description' => 'OK - returns the Session in XML or JSON format.',
6563
'content' => [
66-
'application/vnd.ibexa.api.Session+xml' => [
67-
'schema' => [
68-
'$ref' => '#/components/schemas/Session',
69-
],
70-
'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/user/sessions/POST/Session.xml.example',
71-
],
7264
'application/vnd.ibexa.api.Session+json' => [
7365
'schema' => [
7466
'$ref' => '#/components/schemas/SessionWrapper',
7567
],
7668
'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/user/sessions/session_id/refresh/POST/Session.json.example',
7769
],
70+
'application/vnd.ibexa.api.Session+xml' => [
71+
'schema' => [
72+
'$ref' => '#/components/schemas/Session',
73+
],
74+
'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/user/sessions/session_id/refresh/POST/Session.xml.example',
75+
],
7876
],
7977
],
8078
Response::HTTP_NOT_FOUND => [
8179
'description' => 'Error - the session does not exist.',
8280
],
8381
],
84-
requestBody: new Model\RequestBody(
85-
content: new \ArrayObject(),
86-
),
8782
),
8883
)]
8984
/**

src/lib/Server/Controller/SessionController.php

Whitespace-only changes.

0 commit comments

Comments
 (0)