Skip to content

Commit ef8a843

Browse files
committed
Fix/Enh. OpenAPI
1 parent 09a2626 commit ef8a843

25 files changed

Lines changed: 279 additions & 371 deletions

src/lib/Server/Controller/ContentType/ContentTypeCreateController.php

Lines changed: 15 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -30,26 +30,18 @@
3030
uriTemplate: '/content/typegroups/{contentTypeGroupId}/types',
3131
extraProperties: [OpenApiFactory::OVERRIDE_OPENAPI_RESPONSES => false],
3232
openapi: new Model\Operation(
33+
operationId: 'ibexa.rest.create_content_type',
3334
summary: 'Create content type',
3435
description: 'Creates a new content type draft in the given content type group.',
3536
tags: [
3637
'Type Groups',
3738
],
3839
parameters: [
3940
new Model\Parameter(
40-
name: 'Accept',
41+
name: 'X-CSRF-Token',
4142
in: 'header',
4243
required: true,
43-
description: 'If set, the new content type or draft is returned in XML or JSON format.',
44-
schema: [
45-
'type' => 'string',
46-
],
47-
),
48-
new Model\Parameter(
49-
name: 'Content-Type',
50-
in: 'header',
51-
required: true,
52-
description: 'The content type Create schema encoded in XML or JSON format.',
44+
description: 'The CSRF Token needed on all unsafe HTTP methods with session.',
5345
schema: [
5446
'type' => 'string',
5547
],
@@ -64,35 +56,36 @@
6456
),
6557
],
6658
requestBody: new Model\RequestBody(
59+
description: 'The content type Create schema encoded in XML or JSON format.',
6760
content: new \ArrayObject([
68-
'application/vnd.ibexa.api.ContentTypeCreate+xml' => [
69-
'schema' => [
70-
'$ref' => '#/components/schemas/ContentTypeCreate',
71-
],
72-
'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/content/typegroups/content_type_group_id/types/POST/ContentTypeCreate.xml.example',
73-
],
7461
'application/vnd.ibexa.api.ContentTypeCreate+json' => [
7562
'schema' => [
7663
'$ref' => '#/components/schemas/ContentTypeCreateWrapper',
7764
],
7865
'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/content/typegroups/content_type_group_id/types/POST/ContentTypeCreate.json.example',
7966
],
67+
'application/vnd.ibexa.api.ContentTypeCreate+xml' => [
68+
'schema' => [
69+
'$ref' => '#/components/schemas/ContentTypeCreate',
70+
],
71+
'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/content/typegroups/content_type_group_id/types/POST/ContentTypeCreate.xml.example',
72+
],
8073
]),
8174
),
8275
responses: [
8376
Response::HTTP_CREATED => [
8477
'description' => 'Content type created.',
8578
'content' => [
86-
'application/vnd.ibexa.api.ContentType+xml' => [
79+
'application/vnd.ibexa.api.ContentType+json' => [
8780
'schema' => [
88-
'$ref' => '#/components/schemas/ContentType',
81+
'$ref' => '#/components/schemas/ContentTypeWrapper',
8982
],
90-
'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/content/types/content_type_id/draft/PUBLISH/ContentType.xml.example',
9183
],
92-
'application/vnd.ibexa.api.ContentType+json' => [
84+
'application/vnd.ibexa.api.ContentType+xml' => [
9385
'schema' => [
94-
'$ref' => '#/components/schemas/ContentTypeWrapper',
86+
'$ref' => '#/components/schemas/ContentType',
9587
],
88+
'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/content/typegroups/content_type_group_id/types/POST/ContentType.xml.example',
9689
],
9790
],
9891
],

src/lib/Server/Controller/ContentType/ContentTypeCreateViewController.php

Lines changed: 16 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -22,62 +22,56 @@
2222
uriTemplate: '/content/types/view',
2323
extraProperties: [OpenApiFactory::OVERRIDE_OPENAPI_RESPONSES => false],
2424
openapi: new Model\Operation(
25+
operationId: 'ibexa.rest.content_types.view',
2526
summary: 'Filter content types',
2627
description: 'Executes a query and returns a View including the results. The View input reflects the criteria model of the public PHP API.',
2728
tags: [
2829
'Type',
2930
],
3031
parameters: [
3132
new Model\Parameter(
32-
name: 'Accept',
33+
name: 'X-CSRF-Token',
3334
in: 'header',
3435
required: true,
35-
description: 'The view in XML or JSON format.',
36-
schema: [
37-
'type' => 'string',
38-
],
39-
),
40-
new Model\Parameter(
41-
name: 'Content-Type',
42-
in: 'header',
43-
required: true,
44-
description: 'The view input in XML or JSON format.',
36+
description: 'The CSRF Token needed on all unsafe HTTP methods with session.',
4537
schema: [
4638
'type' => 'string',
4739
],
4840
),
4941
],
5042
requestBody: new Model\RequestBody(
43+
description: 'The view input in XML or JSON format.',
5144
content: new \ArrayObject([
52-
'application/vnd.ibexa.api.ContentTypeViewInput+xml' => [
45+
'application/vnd.ibexa.api.ContentTypeViewInput+json' => [
5346
'schema' => [
54-
'$ref' => '#/components/schemas/ContentTypeViewInput',
47+
'$ref' => '#/components/schemas/ContentTypeViewInputWrapper',
5548
],
56-
'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/content/types/content_type_id/POST/ContentTypeCreateView.xml.example',
49+
'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/content/types/content_type_id/POST/ContentTypeCreateView.json.example',
5750
],
58-
'application/vnd.ibexa.api.ContentTypeViewInput+json' => [
51+
'application/vnd.ibexa.api.ContentTypeViewInput+xml' => [
5952
'schema' => [
60-
'$ref' => '#/components/schemas/ContentTypeViewInputWrapper',
53+
'$ref' => '#/components/schemas/ContentTypeViewInput',
6154
],
6255
'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/content/types/content_type_id/POST/ContentTypeCreateView.xml.example',
6356
],
6457
]),
6558
),
6659
responses: [
6760
Response::HTTP_OK => [
61+
'description' => 'The view in XML or JSON format.',
6862
'content' => [
69-
'application/vnd.ibexa.api.ContentTypeList+xml' => [
70-
'schema' => [
71-
'$ref' => '#/components/schemas/ContentTypeInfoList',
72-
],
73-
'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/content/types/GET/ContentTypeInfoList.xml.example',
74-
],
7563
'application/vnd.ibexa.api.ContentTypeList+json' => [
7664
'schema' => [
7765
'$ref' => '#/components/schemas/ContentTypeInfoListWrapper',
7866
],
7967
'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/content/types/GET/ContentTypeInfoList.json.example',
8068
],
69+
'application/vnd.ibexa.api.ContentTypeList+xml' => [
70+
'schema' => [
71+
'$ref' => '#/components/schemas/ContentTypeInfoList',
72+
],
73+
'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/content/types/GET/ContentTypeInfoList.xml.example',
74+
],
8175
],
8276
],
8377
Response::HTTP_BAD_REQUEST => [

src/lib/Server/Controller/ContentType/ContentTypeDeleteController.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,22 @@
2020
#[Delete(
2121
uriTemplate: '/content/types/{contentTypeId}',
2222
openapi: new Model\Operation(
23+
operationId: 'ibexa.rest.delete_content_type',
2324
summary: 'Delete content type',
2425
description: 'Deletes the provided content type.',
2526
tags: [
2627
'Type',
2728
],
2829
parameters: [
30+
new Model\Parameter(
31+
name: 'X-CSRF-Token',
32+
in: 'header',
33+
required: true,
34+
description: 'The CSRF Token needed on all unsafe HTTP methods with session.',
35+
schema: [
36+
'type' => 'string',
37+
],
38+
),
2939
new Model\Parameter(
3040
name: 'contentTypeId',
3141
in: 'path',

src/lib/Server/Controller/ContentType/ContentTypeDraftCreateController.php

Lines changed: 16 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -26,26 +26,18 @@
2626
uriTemplate: '/content/types/{contentTypeId}',
2727
extraProperties: [OpenApiFactory::OVERRIDE_OPENAPI_RESPONSES => false],
2828
openapi: new Model\Operation(
29+
operationId: 'ibexa.rest.create_content_type_draft',
2930
summary: 'Create Draft',
3031
description: 'Creates a draft and updates it with the given data.',
3132
tags: [
3233
'Type',
3334
],
3435
parameters: [
3536
new Model\Parameter(
36-
name: 'Accept',
37+
name: 'X-CSRF-Token',
3738
in: 'header',
3839
required: true,
39-
description: 'If set, the new content type draft is returned in XML or JSON format.',
40-
schema: [
41-
'type' => 'string',
42-
],
43-
),
44-
new Model\Parameter(
45-
name: 'Content-Type',
46-
in: 'header',
47-
required: true,
48-
description: 'The content type Update schema encoded in XML or JSON format.',
40+
description: 'The CSRF Token needed on all unsafe HTTP methods with session.',
4941
schema: [
5042
'type' => 'string',
5143
],
@@ -60,36 +52,37 @@
6052
),
6153
],
6254
requestBody: new Model\RequestBody(
55+
description: 'The content type Update schema encoded in XML or JSON format.',
6356
content: new \ArrayObject([
64-
'application/vnd.ibexa.api.ContentTypeUpdate+xml' => [
65-
'schema' => [
66-
'$ref' => '#/components/schemas/ContentTypeUpdate',
67-
],
68-
'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/content/types/content_type_id/POST/ContentTypeUpdate.xml.example',
69-
],
7057
'application/vnd.ibexa.api.ContentTypeUpdate+json' => [
7158
'schema' => [
7259
'$ref' => '#/components/schemas/ContentTypeUpdateWrapper',
7360
],
7461
'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/content/types/content_type_id/POST/ContentTypeUpdate.json.example',
7562
],
63+
'application/vnd.ibexa.api.ContentTypeUpdate+xml' => [
64+
'schema' => [
65+
'$ref' => '#/components/schemas/ContentTypeUpdate',
66+
],
67+
'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/content/types/content_type_id/POST/ContentTypeUpdate.xml.example',
68+
],
7669
]),
7770
),
7871
responses: [
7972
Response::HTTP_CREATED => [
8073
'description' => 'Draft created.',
8174
'content' => [
82-
'application/vnd.ibexa.api.ContentTypeInfo+xml' => [
75+
'application/vnd.ibexa.api.ContentTypeInfo+json' => [
8376
'schema' => [
84-
'$ref' => '#/components/schemas/ContentTypeInfo',
77+
'$ref' => '#/components/schemas/ContentTypeInfoWrapper',
8578
],
86-
'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/content/types/content_type_id/draft/PATCH/ContentTypeInfo.xml.example',
79+
'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/content/types/content_type_id/POST/ContentTypeInfo.json.example',
8780
],
88-
'application/vnd.ibexa.api.ContentTypeInfo+json' => [
81+
'application/vnd.ibexa.api.ContentTypeInfo+xml' => [
8982
'schema' => [
90-
'$ref' => '#/components/schemas/ContentTypeInfoWrapper',
83+
'$ref' => '#/components/schemas/ContentTypeInfo',
9184
],
92-
'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/content/types/content_type_id/draft/PATCH/ContentTypeInfo.json.example',
85+
'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/content/types/content_type_id/POST/ContentTypeInfo.xml.example',
9386
],
9487
],
9588
],

src/lib/Server/Controller/ContentType/ContentTypeDraftDeleteController.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,22 @@
1717
#[Delete(
1818
uriTemplate: '/content/types/{contentTypeId}/draft',
1919
openapi: new Model\Operation(
20+
operationId: 'ibexa.rest.delete_content_type_draft',
2021
summary: 'Delete content type draft',
2122
description: 'Deletes the provided content type draft.',
2223
tags: [
2324
'Type',
2425
],
2526
parameters: [
27+
new Model\Parameter(
28+
name: 'X-CSRF-Token',
29+
in: 'header',
30+
required: true,
31+
description: 'The CSRF Token needed on all unsafe HTTP methods with session.',
32+
schema: [
33+
'type' => 'string',
34+
],
35+
),
2636
new Model\Parameter(
2737
name: 'contentTypeId',
2838
in: 'path',

src/lib/Server/Controller/ContentType/ContentTypeDraftFieldDefinitionAddController.php

Lines changed: 15 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -28,26 +28,18 @@
2828
uriTemplate: '/content/types/{contentTypeId}/draft/fieldDefinitions',
2929
extraProperties: [OpenApiFactory::OVERRIDE_OPENAPI_RESPONSES => false],
3030
openapi: new Model\Operation(
31+
operationId: 'ibexa.rest.add_content_type_draft_field_definition',
3132
summary: 'Add content type Draft Field definition',
3233
description: 'Creates a new Field definition for the given content type.',
3334
tags: [
3435
'Type',
3536
],
3637
parameters: [
3738
new Model\Parameter(
38-
name: 'Accept',
39+
name: 'X-CSRF-Token',
3940
in: 'header',
4041
required: true,
41-
description: 'If set, the new Field definition is returned in XML or JSON format.',
42-
schema: [
43-
'type' => 'string',
44-
],
45-
),
46-
new Model\Parameter(
47-
name: 'Content-Type',
48-
in: 'header',
49-
required: true,
50-
description: 'The Field Definition Create schema encoded in XML or JSON format.',
42+
description: 'The CSRF Token needed on all unsafe HTTP methods with session.',
5143
schema: [
5244
'type' => 'string',
5345
],
@@ -62,36 +54,37 @@
6254
),
6355
],
6456
requestBody: new Model\RequestBody(
57+
description: 'The Field Definition Create schema encoded in XML or JSON format.',
6558
content: new \ArrayObject([
66-
'application/vnd.ibexa.api.FieldDefinitionCreate+xml' => [
59+
'application/vnd.ibexa.api.FieldDefinitionCreate+json' => [
6760
'schema' => [
68-
'$ref' => '#/components/schemas/FieldDefinitionCreate',
61+
'$ref' => '#/components/schemas/FieldDefinitionCreateWrapper',
6962
],
70-
'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/content/types/content_type_id/draft/field_definitions/POST/FieldDefinitionCreate.xml.example',
7163
],
72-
'application/vnd.ibexa.api.FieldDefinitionCreate+json' => [
64+
'application/vnd.ibexa.api.FieldDefinitionCreate+xml' => [
7365
'schema' => [
74-
'$ref' => '#/components/schemas/FieldDefinitionCreateWrapper',
66+
'$ref' => '#/components/schemas/FieldDefinitionCreate',
7567
],
68+
'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/content/types/content_type_id/draft/field_definitions/POST/FieldDefinitionCreate.xml.example',
7669
],
7770
]),
7871
),
7972
responses: [
8073
Response::HTTP_CREATED => [
8174
'description' => 'Field definition created.',
8275
'content' => [
83-
'application/vnd.ibexa.api.FieldDefinition+xml' => [
84-
'schema' => [
85-
'$ref' => '#/components/schemas/FieldDefinition',
86-
],
87-
'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/content/types/content_type_id/field_definition_id/GET/FieldDefinition.xml.example',
88-
],
8976
'application/vnd.ibexa.api.FieldDefinition+json' => [
9077
'schema' => [
9178
'$ref' => '#/components/schemas/FieldDefinitionWrapper',
9279
],
9380
'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/content/types/content_type_id/field_definition_id/GET/FieldDefinition.json.example',
9481
],
82+
'application/vnd.ibexa.api.FieldDefinition+xml' => [
83+
'schema' => [
84+
'$ref' => '#/components/schemas/FieldDefinition',
85+
],
86+
'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/content/types/content_type_id/draft/field_definitions/POST/FieldDefinition.xml.example',
87+
],
9588
],
9689
],
9790
Response::HTTP_BAD_REQUEST => [

src/lib/Server/Controller/ContentType/ContentTypeDraftFieldDefinitionDeleteController.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,22 @@
2121
uriTemplate: '/content/types/{contentTypeId}/draft/fieldDefinitions/{fieldDefinitionId}',
2222
extraProperties: [OpenApiFactory::OVERRIDE_OPENAPI_RESPONSES => false],
2323
openapi: new Model\Operation(
24+
operationId: 'ibexa.rest.remove_content_type_draft_field_definition',
2425
summary: 'Delete content type Draft Field definition',
2526
description: 'Deletes the provided Field definition.',
2627
tags: [
2728
'Type',
2829
],
2930
parameters: [
31+
new Model\Parameter(
32+
name: 'X-CSRF-Token',
33+
in: 'header',
34+
required: true,
35+
description: 'The CSRF Token needed on all unsafe HTTP methods with session.',
36+
schema: [
37+
'type' => 'string',
38+
],
39+
),
3040
new Model\Parameter(
3141
name: 'contentTypeId',
3242
in: 'path',

0 commit comments

Comments
 (0)