diff --git a/src/bundle/Resources/api_platform/examples/content/objects/POST/ContentInfo.json.example b/src/bundle/Resources/api_platform/examples/content/objects/POST/ContentInfo.json.example new file mode 100644 index 000000000..a160db9f9 --- /dev/null +++ b/src/bundle/Resources/api_platform/examples/content/objects/POST/ContentInfo.json.example @@ -0,0 +1,43 @@ +{ + "Content": { + "_media-type": "application/vnd.ibexa.api.ContentInfo+json", + "_href": "/api/ibexa/v2/content/objects/77", + "_remoteId": "89e9b86c673b1c1de6781bb94488b18c", + "_id": 77, + "ContentType": { + "_media-type": "application/vnd.ibexa.api.ContentType+json", + "_href": "/api/ibexa/v2/content/types/2" + }, + "Name": "draft article", + "TranslatedName": "draft article", + "Versions": { + "_media-type": "application/vnd.ibexa.api.VersionList+json", + "_href": "/api/ibexa/v2/content/objects/77/versions" + }, + "CurrentVersion": { + "_media-type": "application/vnd.ibexa.api.Version+json", + "_href": "/api/ibexa/v2/content/objects/77/currentversion" + }, + "Section": { + "_media-type": "application/vnd.ibexa.api.Section+json", + "_href": "/api/ibexa/v2/content/sections/1" + }, + "Locations": { + "_media-type": "application/vnd.ibexa.api.LocationList+json", + "_href": "/api/ibexa/v2/content/objects/77/locations" + }, + "Owner": { + "_media-type": "application/vnd.ibexa.api.User+json", + "_href": "/api/ibexa/v2/user/users/14" + }, + "mainLanguageCode": "eng-GB", + "currentVersionNo": 1, + "alwaysAvailable": true, + "isHidden": false, + "status": "DRAFT", + "ObjectStates": { + "_media-type": "application/vnd.ibexa.api.ContentObjectStates+json", + "_href": "/api/ibexa/v2/content/objects/77/objectstates" + } + } +} diff --git a/src/bundle/Resources/api_platform/examples/content/objects/content_id/GET/ContentInfo.xml.example b/src/bundle/Resources/api_platform/examples/content/objects/content_id/GET/ContentInfo.xml.example deleted file mode 100644 index e69de29bb..000000000 diff --git a/src/bundle/Resources/api_platform/examples/user/groups/GET/UserGroupRefList.json.example b/src/bundle/Resources/api_platform/examples/user/groups/GET/UserGroupRefList.json.example new file mode 100644 index 000000000..1d5808dc1 --- /dev/null +++ b/src/bundle/Resources/api_platform/examples/user/groups/GET/UserGroupRefList.json.example @@ -0,0 +1,12 @@ +{ + "UserGroupRefList": { + "_media-type": "application/vnd.ibexa.api.UserGroupRefList+json", + "_href": "/api/ibexa/v2/user/users/57/groups", + "UserGroup": [ + { + "_media-type": "application/vnd.ibexa.api.UserGroup+json", + "_href": "/api/ibexa/v2/user/groups/1/5/13" + } + ] + } +} diff --git a/src/bundle/Resources/api_platform/examples/user/groups/GET/UserGroupRefList.xml.example b/src/bundle/Resources/api_platform/examples/user/groups/GET/UserGroupRefList.xml.example new file mode 100644 index 000000000..ed2ceff01 --- /dev/null +++ b/src/bundle/Resources/api_platform/examples/user/groups/GET/UserGroupRefList.xml.example @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/src/bundle/Resources/api_platform/schemas/user/roles_schemas.yml b/src/bundle/Resources/api_platform/schemas/user/roles_schemas.yml index cbad71f3a..78fe592b2 100644 --- a/src/bundle/Resources/api_platform/schemas/user/roles_schemas.yml +++ b/src/bundle/Resources/api_platform/schemas/user/roles_schemas.yml @@ -136,7 +136,7 @@ schemas: 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. type: object required: - - $ref + - ref properties: ref: type: array diff --git a/src/contracts/Security/AuthorizationHeaderRESTRequestMatcher.php b/src/contracts/Security/AuthorizationHeaderRESTRequestMatcher.php deleted file mode 100644 index e69de29bb..000000000 diff --git a/src/lib/Server/Controller/Bookmark/BookmarkCreateController.php b/src/lib/Server/Controller/Bookmark/BookmarkCreateController.php index def87ee97..47e394e46 100644 --- a/src/lib/Server/Controller/Bookmark/BookmarkCreateController.php +++ b/src/lib/Server/Controller/Bookmark/BookmarkCreateController.php @@ -23,12 +23,22 @@ uriTemplate: '/bookmark/{locationId}', extraProperties: [OpenApiFactory::OVERRIDE_OPENAPI_RESPONSES => false], openapi: new Model\Operation( + operationId: 'ibexa.rest.create_bookmark', summary: 'Create bookmark', description: 'Add given Location to bookmarks of the current user.', tags: [ 'Bookmark', ], parameters: [ + new Model\Parameter( + name: 'X-CSRF-Token', + in: 'header', + required: true, + description: 'The CSRF Token needed on all unsafe HTTP methods with session.', + schema: [ + 'type' => 'string', + ], + ), new Model\Parameter( name: 'locationId', in: 'path', @@ -38,6 +48,10 @@ ], ), ], + requestBody: new Model\RequestBody( + description: 'No payload required', + content: new \ArrayObject(), + ), responses: [ Response::HTTP_CREATED => [ 'description' => 'Created.', @@ -52,9 +66,6 @@ 'description' => 'Error - Location is already bookmarked.', ], ], - requestBody: new Model\RequestBody( - content: new \ArrayObject(), - ), ), )] class BookmarkCreateController extends RestController diff --git a/src/lib/Server/Controller/Bookmark/BookmarkDeleteController.php b/src/lib/Server/Controller/Bookmark/BookmarkDeleteController.php index 68d39f048..a2416f04d 100644 --- a/src/lib/Server/Controller/Bookmark/BookmarkDeleteController.php +++ b/src/lib/Server/Controller/Bookmark/BookmarkDeleteController.php @@ -22,12 +22,22 @@ #[Delete( uriTemplate: '/bookmark/{locationId}', openapi: new Model\Operation( + operationId: 'ibexa.rest.delete_bookmark', summary: 'Delete bookmark', description: 'Deletes the given Location from bookmarks of the current user.', tags: [ 'Bookmark', ], parameters: [ + new Model\Parameter( + name: 'X-CSRF-Token', + in: 'header', + required: true, + description: 'The CSRF Token needed on all unsafe HTTP methods with session.', + schema: [ + 'type' => 'string', + ], + ), new Model\Parameter( name: 'locationId', in: 'path', diff --git a/src/lib/Server/Controller/Bookmark/BookmarkIsBookmarkedController.php b/src/lib/Server/Controller/Bookmark/BookmarkIsBookmarkedController.php index 11ef07b15..7b644ca90 100644 --- a/src/lib/Server/Controller/Bookmark/BookmarkIsBookmarkedController.php +++ b/src/lib/Server/Controller/Bookmark/BookmarkIsBookmarkedController.php @@ -9,6 +9,7 @@ namespace Ibexa\Rest\Server\Controller\Bookmark; use ApiPlatform\OpenApi\Model; +use Ibexa\Bundle\Rest\ApiPlatform\Get; use Ibexa\Bundle\Rest\ApiPlatform\Head; use Ibexa\Contracts\Core\Repository\BookmarkService; use Ibexa\Contracts\Core\Repository\LocationService; @@ -20,6 +21,7 @@ #[Head( uriTemplate: '/bookmark/{locationId}', openapi: new Model\Operation( + operationId: 'ibexa.rest.is_bookmarked.head', summary: 'Check if Location is bookmarked', description: 'Checks if the given Location is bookmarked by the current user.', tags: [ @@ -31,19 +33,51 @@ in: 'path', required: true, schema: [ - 'type' => 'string', + 'type' => 'integer', ], ), ], responses: [ Response::HTTP_OK => [ - 'description' => 'OK - bookmarked.', + 'description' => 'OK - the given Location is bookmarked.', ], Response::HTTP_UNAUTHORIZED => [ 'description' => 'Error - the user is not authorized for the given Location.', ], Response::HTTP_NOT_FOUND => [ - 'description' => 'Error - the given Location does not exist / is not bookmarked.', + 'description' => 'Error - the given Location is not bookmarked or does not exist.', + ], + ], + ), +)] +#[Get( + uriTemplate: '/bookmark/{locationId}', + openapi: new Model\Operation( + operationId: 'ibexa.rest.is_bookmarked.get', + summary: 'Check if Location is bookmarked', + description: 'Checks if the given Location is bookmarked by the current user.', + tags: [ + 'Bookmark', + ], + parameters: [ + new Model\Parameter( + name: 'locationId', + in: 'path', + required: true, + schema: [ + 'type' => 'integer', + ], + ), + ], + responses: [ + Response::HTTP_OK => [ + 'description' => 'OK - the given Location is bookmarked.', + ], + Response::HTTP_UNAUTHORIZED => [ + 'description' => 'Error - the user is not authorized for the given Location.', + ], + Response::HTTP_NOT_FOUND => [ + 'description' => 'Error - the given Location is not bookmarked or does not exist.', ], ], ), diff --git a/src/lib/Server/Controller/Bookmark/BookmarkListController.php b/src/lib/Server/Controller/Bookmark/BookmarkListController.php index ad73fa2db..6ada38452 100644 --- a/src/lib/Server/Controller/Bookmark/BookmarkListController.php +++ b/src/lib/Server/Controller/Bookmark/BookmarkListController.php @@ -23,37 +23,28 @@ uriTemplate: '/bookmark', extraProperties: [OpenApiFactory::OVERRIDE_OPENAPI_RESPONSES => false], openapi: new Model\Operation( + operationId: 'ibexa.rest.load_bookmarks', summary: 'List of bookmarks', description: 'Lists bookmarked Locations for the current user.', tags: [ 'Bookmark', ], - parameters: [ - new Model\Parameter( - name: 'Accept', - in: 'header', - required: true, - description: 'If set, the list is returned in XML or JSON format.', - schema: [ - 'type' => 'string', - ], - ), - ], responses: [ Response::HTTP_OK => [ + 'description' => 'If set, the list is returned in XML or JSON format.', 'content' => [ - 'application/vnd.ibexa.api.BookmarkList+xml' => [ - 'schema' => [ - '$ref' => '#/components/schemas/BookmarkList', - ], - 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/bookmark/GET/BookmarkList.xml.example', - ], 'application/vnd.ibexa.api.BookmarkList+json' => [ 'schema' => [ '$ref' => '#/components/schemas/BookmarkListWrapper', ], 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/bookmark/GET/BookmarkList.json.example', ], + 'application/vnd.ibexa.api.BookmarkList+xml' => [ + 'schema' => [ + '$ref' => '#/components/schemas/BookmarkList', + ], + 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/bookmark/GET/BookmarkList.xml.example', + ], ], ], Response::HTTP_UNAUTHORIZED => [ diff --git a/src/lib/Server/Controller/Content/ContentCreateController.php b/src/lib/Server/Controller/Content/ContentCreateController.php index 8865c7276..caaadc734 100644 --- a/src/lib/Server/Controller/Content/ContentCreateController.php +++ b/src/lib/Server/Controller/Content/ContentCreateController.php @@ -27,6 +27,7 @@ uriTemplate: '/content/objects', extraProperties: [OpenApiFactory::OVERRIDE_OPENAPI_RESPONSES => false], openapi: new Model\Operation( + operationId: 'ibexa.rest.create_content', summary: 'Create content item', description: 'Creates a draft assigned to the authenticated user. If a different user ID is given in the input, the draft is assigned to the given user but this action requires special permissions for the authenticated user (this is useful for content staging where the transfer process does not have to authenticate with the user who created the content item in the source server). The user needs to publish the content item if it should be visible.', tags: [ @@ -34,60 +35,59 @@ ], parameters: [ new Model\Parameter( - name: 'Accept', + name: 'X-CSRF-Token', in: 'header', required: true, - description: 'Content - If set, all information for the content item including the embedded current version is returned in XML or JSON format. ContentInfo - If set, all information for the content item (excluding the current version) is returned in XML or JSON format.', - schema: [ - 'type' => 'string', - ], - ), - new Model\Parameter( - name: 'Content-Type', - in: 'header', - required: true, - description: 'The ContentCreate schema encoded in XML or JSON format.', + description: 'The CSRF Token needed on all unsafe HTTP methods with session.', schema: [ 'type' => 'string', ], ), ], requestBody: new Model\RequestBody( + description: 'The ContentCreate schema encoded in XML or JSON format.', content: new \ArrayObject([ - 'application/vnd.ibexa.api.ContentCreate+xml' => [ - 'schema' => [ - '$ref' => '#/components/schemas/ContentCreate', - ], - 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/content/objects/POST/ContentCreate.xml.example', - ], 'application/vnd.ibexa.api.ContentCreate+json' => [ 'schema' => [ '$ref' => '#/components/schemas/ContentCreateWrapper', ], 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/content/objects/POST/ContentCreate.json.example', ], + 'application/vnd.ibexa.api.ContentCreate+xml' => [ + 'schema' => [ + '$ref' => '#/components/schemas/ContentCreate', + ], + 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/content/objects/POST/ContentCreate.xml.example', + ], ]), ), responses: [ Response::HTTP_CREATED => [ + 'description' => 'Content - If set, all information for the content item including the embedded current version is returned in XML or JSON format. ContentInfo - If set, all information for the content item (excluding the current version) is returned in XML or JSON format.', 'content' => [ + 'application/vnd.ibexa.api.Content+json' => [ + 'schema' => [ + '$ref' => '#/components/schemas/ContentWrapper', + ], + 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/content/objects/POST/Content.json.example', + ], 'application/vnd.ibexa.api.Content+xml' => [ 'schema' => [ '$ref' => '#/components/schemas/Content', ], - 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/content/objects/content_id/GET/Content.xml.example', + 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/content/objects/POST/Content.xml.example', ], - 'application/vnd.ibexa.api.Content+json' => [ + 'application/vnd.ibexa.api.ContentInfo+json' => [ 'schema' => [ - '$ref' => '#/components/schemas/ContentWrapper', + '$ref' => '#/components/schemas/ContentInfoWrapper', ], - 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/content/objects/content_id/GET/Content.json.example', + 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/content/objects/POST/ContentInfo.json.example', ], 'application/vnd.ibexa.api.ContentInfo+xml' => [ 'schema' => [ - '$ref' => '#/components/schemas/ContentInfoWrapper', + '$ref' => '#/components/schemas/ContentInfo', ], - 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/content/objects/content_id/PATCH/ContentInfo.xml.example', + 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/content/objects/POST/ContentInfo.xml.example', ], ], ], diff --git a/src/lib/Server/Controller/Content/ContentCurrentVersionRedirectController.php b/src/lib/Server/Controller/Content/ContentCurrentVersionRedirectController.php index edb607349..47d589a9c 100644 --- a/src/lib/Server/Controller/Content/ContentCurrentVersionRedirectController.php +++ b/src/lib/Server/Controller/Content/ContentCurrentVersionRedirectController.php @@ -16,6 +16,7 @@ #[Get( uriTemplate: '/content/objects/{contentId}/currentversion', openapi: new Model\Operation( + operationId: 'ibexa.rest.redirect_current_version', summary: 'Get current version', description: 'Redirects to the current version of the content item.', tags: [ @@ -33,18 +34,19 @@ ], responses: [ Response::HTTP_OK => [ + 'description' => 'OK - returns the Version in XML or JSON format.', 'content' => [ - 'application/vnd.ibexa.api.Version+xml' => [ + 'application/vnd.ibexa.api.Version+json' => [ 'schema' => [ - '$ref' => '#/components/schemas/Version', + '$ref' => '#/components/schemas/VersionWrapper', ], - 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/content/objects/content_id/versions/version_no/GET/Version.xml.example', + 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/content/objects/content_id/currentversion/GET/Version.json.example', ], - 'application/vnd.ibexa.api.Version+json' => [ + 'application/vnd.ibexa.api.Version+xml' => [ 'schema' => [ - '$ref' => '#/components/schemas/VersionWrapper', + '$ref' => '#/components/schemas/Version', ], - 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/content/objects/content_id/versions/version_no/GET/Version.json.example', + 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/content/objects/content_id/currentversion/GET/Version.xml.example', ], ], ], diff --git a/src/lib/Server/Controller/Content/ContentCurrentVersionRelationsRedirectController.php b/src/lib/Server/Controller/Content/ContentCurrentVersionRelationsRedirectController.php index 2f9455eb7..8392c8f52 100644 --- a/src/lib/Server/Controller/Content/ContentCurrentVersionRelationsRedirectController.php +++ b/src/lib/Server/Controller/Content/ContentCurrentVersionRelationsRedirectController.php @@ -18,6 +18,7 @@ uriTemplate: '/content/objects/{contentId}/relations', extraProperties: [OpenApiFactory::OVERRIDE_OPENAPI_RESPONSES => false], openapi: new Model\Operation( + operationId: 'ibexa.rest.redirect_current_version_relations', summary: 'Load Relations of content item', description: 'Redirects to the Relations of the current version.', tags: [ diff --git a/src/lib/Server/Controller/Content/ContentDeleteController.php b/src/lib/Server/Controller/Content/ContentDeleteController.php index 4a35fafe3..e89bbdc0b 100644 --- a/src/lib/Server/Controller/Content/ContentDeleteController.php +++ b/src/lib/Server/Controller/Content/ContentDeleteController.php @@ -16,12 +16,22 @@ #[Delete( uriTemplate: '/content/objects/{contentId}', openapi: new Model\Operation( + operationId: 'ibexa.rest.delete_content', summary: 'Delete Content', description: 'Deletes content item. If content item has multiple Locations, all of them will be deleted via delete a subtree.', tags: [ 'Objects', ], parameters: [ + new Model\Parameter( + name: 'X-CSRF-Token', + in: 'header', + required: true, + description: 'The CSRF Token needed on all unsafe HTTP methods with session.', + schema: [ + 'type' => 'string', + ], + ), new Model\Parameter( name: 'contentId', in: 'path', diff --git a/src/lib/Server/Controller/Content/ContentDraftCreateFromCurrentVersionController.php b/src/lib/Server/Controller/Content/ContentDraftCreateFromCurrentVersionController.php index e657f3ca8..634c0e0a2 100644 --- a/src/lib/Server/Controller/Content/ContentDraftCreateFromCurrentVersionController.php +++ b/src/lib/Server/Controller/Content/ContentDraftCreateFromCurrentVersionController.php @@ -21,6 +21,7 @@ uriTemplate: '/content/objects/{contentId}/currentversion', extraProperties: [OpenApiFactory::OVERRIDE_OPENAPI_RESPONSES => false], openapi: new Model\Operation( + operationId: 'ibexa.rest.content.create_draft_from_current_version', summary: 'Create a draft from current version', description: 'The system creates a new draft as a copy of the current version. COPY or POST with header X-HTTP-Method-Override COPY.', tags: [ @@ -28,10 +29,10 @@ ], parameters: [ new Model\Parameter( - name: 'Accept', + name: 'X-CSRF-Token', in: 'header', required: true, - description: 'If set, the updated version is returned in XML or JSON format.', + description: 'The CSRF Token needed on all unsafe HTTP methods with session.', schema: [ 'type' => 'string', ], @@ -45,22 +46,26 @@ ], ), ], + requestBody: new Model\RequestBody( + description: 'No payload required', + content: new \ArrayObject(), + ), responses: [ Response::HTTP_CREATED => [ 'description' => 'Created', 'content' => [ - 'application/vnd.ibexa.api.Version+xml' => [ - 'schema' => [ - '$ref' => '#/components/schemas/Version', - ], - 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/content/objects/content_id/versions/version_no/GET/Version.xml.example', - ], 'application/vnd.ibexa.api.Version+json' => [ 'schema' => [ '$ref' => '#/components/schemas/VersionWrapper', ], 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/content/objects/content_id/versions/version_no/GET/Version.json.example', ], + 'application/vnd.ibexa.api.Version+xml' => [ + 'schema' => [ + '$ref' => '#/components/schemas/Version', + ], + 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/content/objects/content_id/versions/version_no/GET/Version.xml.example', + ], ], ], Response::HTTP_UNAUTHORIZED => [ @@ -73,9 +78,6 @@ 'description' => 'Error - the content item was not found.', ], ], - requestBody: new Model\RequestBody( - content: new \ArrayObject(), - ), ), )] class ContentDraftCreateFromCurrentVersionController extends RestController diff --git a/src/lib/Server/Controller/Content/ContentDraftCreateFromVersionController.php b/src/lib/Server/Controller/Content/ContentDraftCreateFromVersionController.php index be03fe7b6..8cb8dd77b 100644 --- a/src/lib/Server/Controller/Content/ContentDraftCreateFromVersionController.php +++ b/src/lib/Server/Controller/Content/ContentDraftCreateFromVersionController.php @@ -19,6 +19,7 @@ uriTemplate: '/content/objects/{contentId}/versions/{versionNo}', extraProperties: [OpenApiFactory::OVERRIDE_OPENAPI_RESPONSES => false], openapi: new Model\Operation( + operationId: 'ibexa.rest.content.create_draft_from_version', summary: 'Create a draft from a version', description: 'The system creates a new draft as a copy of the given version. COPY or POST with header X-HTTP-Method-Override COPY.', tags: [ @@ -26,10 +27,10 @@ ], parameters: [ new Model\Parameter( - name: 'Accept', + name: 'X-CSRF-Token', in: 'header', required: true, - description: 'If set, the updated version is returned in XML or JSON format.', + description: 'The CSRF Token needed on all unsafe HTTP methods with session.', schema: [ 'type' => 'string', ], @@ -51,22 +52,26 @@ ], ), ], + requestBody: new Model\RequestBody( + description: 'No payload required', + content: new \ArrayObject(), + ), responses: [ Response::HTTP_CREATED => [ 'description' => 'Created.', 'content' => [ - 'application/vnd.ibexa.api.Version+xml' => [ - 'schema' => [ - '$ref' => '#/components/schemas/Version', - ], - 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/content/objects/content_id/versions/version_no/GET/Version.xml.example', - ], 'application/vnd.ibexa.api.Version+json' => [ 'schema' => [ '$ref' => '#/components/schemas/VersionWrapper', ], 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/content/objects/content_id/versions/version_no/GET/Version.json.example', ], + 'application/vnd.ibexa.api.Version+xml' => [ + 'schema' => [ + '$ref' => '#/components/schemas/Version', + ], + 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/content/objects/content_id/versions/version_no/GET/Version.xml.example', + ], ], ], Response::HTTP_UNAUTHORIZED => [ @@ -76,9 +81,6 @@ 'description' => 'Error - the content item was not found.', ], ], - requestBody: new Model\RequestBody( - content: new \ArrayObject(), - ), ), )] class ContentDraftCreateFromVersionController extends RestController diff --git a/src/lib/Server/Controller/Content/ContentDraftTranslationDeleteController.php b/src/lib/Server/Controller/Content/ContentDraftTranslationDeleteController.php index 0d71a5b9c..370d0f855 100644 --- a/src/lib/Server/Controller/Content/ContentDraftTranslationDeleteController.php +++ b/src/lib/Server/Controller/Content/ContentDraftTranslationDeleteController.php @@ -17,12 +17,22 @@ #[Delete( uriTemplate: '/content/objects/{contentId}/versions/{versionNo}/translations/{languageCode}', openapi: new Model\Operation( + operationId: 'ibexa.rest.delete_translation_from_draft', summary: 'Delete translation from version draft', description: 'Removes a translation from a version draft.', tags: [ 'Objects', ], parameters: [ + new Model\Parameter( + name: 'X-CSRF-Token', + in: 'header', + required: true, + description: 'The CSRF Token needed on all unsafe HTTP methods with session.', + schema: [ + 'type' => 'string', + ], + ), new Model\Parameter( name: 'contentId', in: 'path', diff --git a/src/lib/Server/Controller/Content/ContentHideController.php b/src/lib/Server/Controller/Content/ContentHideController.php index e9d66f292..765eac9a0 100644 --- a/src/lib/Server/Controller/Content/ContentHideController.php +++ b/src/lib/Server/Controller/Content/ContentHideController.php @@ -18,12 +18,22 @@ uriTemplate: '/content/objects/{contentId}/hide', extraProperties: [OpenApiFactory::OVERRIDE_OPENAPI_RESPONSES => false], openapi: new Model\Operation( + operationId: 'ibexa.rest.hide_content', summary: 'Hide content item', description: 'Makes or keep the content item invisible', tags: [ 'Objects', ], parameters: [ + new Model\Parameter( + name: 'X-CSRF-Token', + in: 'header', + required: true, + description: 'The CSRF Token needed on all unsafe HTTP methods with session.', + schema: [ + 'type' => 'string', + ], + ), new Model\Parameter( name: 'contentId', in: 'path', @@ -33,6 +43,10 @@ ], ), ], + requestBody: new Model\RequestBody( + description: 'No payload required', + content: new \ArrayObject(), + ), responses: [ Response::HTTP_NO_CONTENT => [ 'description' => 'OK - Object item is hidden.', @@ -44,9 +58,6 @@ 'description' => 'Error - The content item was not found.', ], ], - requestBody: new Model\RequestBody( - content: new \ArrayObject(), - ), ), )] class ContentHideController extends RestController diff --git a/src/lib/Server/Controller/Content/ContentInVersionLoadController.php b/src/lib/Server/Controller/Content/ContentInVersionLoadController.php index 018abb2a8..2df4891dd 100644 --- a/src/lib/Server/Controller/Content/ContentInVersionLoadController.php +++ b/src/lib/Server/Controller/Content/ContentInVersionLoadController.php @@ -21,6 +21,7 @@ #[Get( uriTemplate: '/content/objects/{contentId}/versions/{versionNo}', openapi: new Model\Operation( + operationId: 'ibexa.rest.load_content_in_version', summary: 'Load version', description: 'Loads a specific version of a content item. This method returns Fields and relations.', tags: [ @@ -30,21 +31,12 @@ new Model\Parameter( name: 'If-None-Match', in: 'header', - required: true, + required: false, description: 'Only return the version if the given ETag is the not current one, otherwise a 304 is returned.', schema: [ 'type' => 'string', ], ), - new Model\Parameter( - name: 'Accept', - in: 'header', - required: true, - description: 'If set, the version list is returned in XML or JSON format.', - schema: [ - 'type' => 'string', - ], - ), new Model\Parameter( name: 'contentId', in: 'path', @@ -64,23 +56,24 @@ ], responses: [ Response::HTTP_OK => [ + 'description' => 'If set, the version list is returned in XML or JSON format.', 'content' => [ - 'application/vnd.ibexa.api.Version+xml' => [ - 'schema' => [ - '$ref' => '#/components/schemas/Version', - ], - 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/content/objects/content_id/versions/version_no/GET/Version.xml.example', - ], 'application/vnd.ibexa.api.Version+json' => [ 'schema' => [ '$ref' => '#/components/schemas/VersionWrapper', ], 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/content/objects/content_id/versions/version_no/GET/Version.json.example', ], + 'application/vnd.ibexa.api.Version+xml' => [ + 'schema' => [ + '$ref' => '#/components/schemas/Version', + ], + 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/content/objects/content_id/versions/version_no/GET/Version.xml.example', + ], ], ], Response::HTTP_NOT_MODIFIED => [ - 'description' => 'Error - the ETag does not match the current one.', + 'description' => 'Not Modified - the ETag matches the current one.', ], Response::HTTP_UNAUTHORIZED => [ 'description' => 'Error - the user is not authorized to read this content item.', diff --git a/src/lib/Server/Controller/Content/ContentLoadByIdController.php b/src/lib/Server/Controller/Content/ContentLoadByIdController.php index 031609f9a..55d2ff5d2 100644 --- a/src/lib/Server/Controller/Content/ContentLoadByIdController.php +++ b/src/lib/Server/Controller/Content/ContentLoadByIdController.php @@ -19,30 +19,15 @@ #[Get( uriTemplate: '/content/objects/{contentId}', openapi: new Model\Operation( + operationId: 'ibexa.rest.load_content', summary: 'Load content', - description: 'Loads the content item for the given ID. Depending on the Accept header the current version is embedded (i.e. the current published version or if it does not exist, the draft of the authenticated user).', + description: 'Loads the content item for the given ID. Depending on the Accept header the current version is embedded (i.e. the current published version or if it does not exist, the draft of the authenticated user). +* Content - If set, all information for the content item including the embedded current version is returned in XML or JSON format. +* ContentInfo - If set, all information for the content item (excluding the current version) is returned in XML or JSON format.', tags: [ 'Objects', ], parameters: [ - new Model\Parameter( - name: 'Accept', - in: 'header', - required: true, - description: ' -* Content - If set, all information for the content item including the embedded current version is returned in XML or JSON format. -* ContentInfo - If set, all information for the content item (excluding the current version) is returned in XML or JSON format. - ', - schema: [ - 'type' => 'string', - 'enum' => [ - 'application/vnd.ibexa.api.Content+xml', - 'application/vnd.ibexa.api.Content+json', - 'application/vnd.ibexa.api.ContentInfo+xml', - 'application/vnd.ibexa.api.ContentInfo+json', - ], - ], - ), new Model\Parameter( name: 'If-None-Match', in: 'header', @@ -63,29 +48,29 @@ ], responses: [ Response::HTTP_OK => [ + 'description' => 'OK - returns the Content or ContentInfo in XML or JSON format.', 'content' => [ - 'application/vnd.ibexa.api.Content+xml' => [ - 'schema' => [ - '$ref' => '#/components/schemas/Content', - ], - 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/content/objects/content_id/GET/Content.xml.example', - ], 'application/vnd.ibexa.api.Content+json' => [ 'schema' => [ '$ref' => '#/components/schemas/ContentWrapper', ], 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/content/objects/content_id/GET/Content.json.example', ], - 'application/vnd.ibexa.api.ContentInfo+xml' => [ + 'application/vnd.ibexa.api.Content+xml' => [ 'schema' => [ - '$ref' => '#/components/schemas/ContentInfo', + '$ref' => '#/components/schemas/Content', ], + 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/content/objects/content_id/GET/Content.xml.example', ], 'application/vnd.ibexa.api.ContentInfo+json' => [ 'schema' => [ '$ref' => '#/components/schemas/ContentInfoWrapper', ], - 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/content/objects/content_id/PATCH/ContentInfo.xml.example', + ], + 'application/vnd.ibexa.api.ContentInfo+xml' => [ + 'schema' => [ + '$ref' => '#/components/schemas/ContentInfo', + ], ], ], ], diff --git a/src/lib/Server/Controller/Content/ContentMetadataUpdateController.php b/src/lib/Server/Controller/Content/ContentMetadataUpdateController.php index 8f06574f1..38a20a728 100644 --- a/src/lib/Server/Controller/Content/ContentMetadataUpdateController.php +++ b/src/lib/Server/Controller/Content/ContentMetadataUpdateController.php @@ -22,6 +22,7 @@ uriTemplate: '/content/objects/{contentId}', extraProperties: [OpenApiFactory::OVERRIDE_OPENAPI_RESPONSES => false], openapi: new Model\Operation( + operationId: 'ibexa.rest.update_content_metadata', summary: 'Update content', description: 'This method updates the content metadata which is independent from a version. PATCH or POST with header X-HTTP-Method-Override PATCH.', tags: [ @@ -29,10 +30,10 @@ ], parameters: [ new Model\Parameter( - name: 'Accept', + name: 'X-CSRF-Token', in: 'header', required: true, - description: 'If set, all information for the content item (excluding the current version) is returned in XML or JSON format.', + description: 'The CSRF Token needed on all unsafe HTTP methods with session.', schema: [ 'type' => 'string', ], @@ -46,15 +47,6 @@ 'type' => 'string', ], ), - new Model\Parameter( - name: 'Content-Type', - in: 'header', - required: true, - description: 'The ContentUpdate schema encoded in XML or JSON format.', - schema: [ - 'type' => 'string', - ], - ), new Model\Parameter( name: 'contentId', in: 'path', @@ -65,31 +57,33 @@ ), ], requestBody: new Model\RequestBody( + description: 'The ContentUpdate schema encoded in XML or JSON format.', content: new \ArrayObject([ - 'application/vnd.ibexa.api.ContentUpdate+xml' => [ + 'application/vnd.ibexa.api.ContentUpdate+json' => [ 'schema' => [ - '$ref' => '#/components/schemas/ContentInfo', + '$ref' => '#/components/schemas/ContentInfoWrapper', ], ], - 'application/vnd.ibexa.api.ContentUpdate+json' => [ + 'application/vnd.ibexa.api.ContentUpdate+xml' => [ 'schema' => [ - '$ref' => '#/components/schemas/ContentInfoWrapper', + '$ref' => '#/components/schemas/ContentInfo', ], - 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/content/objects/content_id/PATCH/ContentInfo.xml.example', + 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/content/objects/content_id/PATCH/ContentUpdate.xml.example', ], ]), ), responses: [ Response::HTTP_OK => [ + 'description' => 'If set, all information for the content item (excluding the current version) is returned in XML or JSON format.', 'content' => [ - 'application/vnd.ibexa.api.ContentInfo+xml' => [ + 'application/vnd.ibexa.api.ContentInfo+json' => [ 'schema' => [ - '$ref' => '#/components/schemas/ContentInfo', + '$ref' => '#/components/schemas/ContentInfoWrapper', ], ], - 'application/vnd.ibexa.api.ContentInfo+json' => [ + 'application/vnd.ibexa.api.ContentInfo+xml' => [ 'schema' => [ - '$ref' => '#/components/schemas/ContentInfoWrapper', + '$ref' => '#/components/schemas/ContentInfo', ], 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/content/objects/content_id/PATCH/ContentInfo.xml.example', ], diff --git a/src/lib/Server/Controller/Content/ContentRedirectController.php b/src/lib/Server/Controller/Content/ContentRedirectController.php index 43f579249..e5a3ad21d 100644 --- a/src/lib/Server/Controller/Content/ContentRedirectController.php +++ b/src/lib/Server/Controller/Content/ContentRedirectController.php @@ -20,6 +20,7 @@ uriTemplate: '/content/objects', extraProperties: [OpenApiFactory::OVERRIDE_OPENAPI_RESPONSES => false], openapi: new Model\Operation( + operationId: 'ibexa.rest.redirect_content', summary: 'Load content by remote ID', description: 'Loads content item for a given remote ID.', tags: [ diff --git a/src/lib/Server/Controller/Content/ContentRelationCreateController.php b/src/lib/Server/Controller/Content/ContentRelationCreateController.php index 33ee745c8..7d3133f52 100644 --- a/src/lib/Server/Controller/Content/ContentRelationCreateController.php +++ b/src/lib/Server/Controller/Content/ContentRelationCreateController.php @@ -25,6 +25,7 @@ uriTemplate: '/content/objects/{contentId}/versions/{versionNo}/relations', extraProperties: [OpenApiFactory::OVERRIDE_OPENAPI_RESPONSES => false], openapi: new Model\Operation( + operationId: 'ibexa.rest.create_relation', summary: 'Create new Relation', description: 'Creates a new Relation of type COMMON for the given draft.', tags: [ @@ -32,19 +33,10 @@ ], parameters: [ new Model\Parameter( - name: 'Accept', + name: 'X-CSRF-Token', in: 'header', required: true, - description: 'If set, the updated version is returned in XML or JSON format.', - schema: [ - 'type' => 'string', - ], - ), - new Model\Parameter( - name: 'Content-Type', - in: 'header', - required: true, - description: 'The RelationCreate schema encoded in XML or JSON format.', + description: 'The CSRF Token needed on all unsafe HTTP methods with session.', schema: [ 'type' => 'string', ], @@ -67,36 +59,38 @@ ), ], requestBody: new Model\RequestBody( + description: 'The RelationCreate schema encoded in XML or JSON format.', content: new \ArrayObject([ - 'application/vnd.ibexa.api.RelationCreate+xml' => [ - 'schema' => [ - '$ref' => '#/components/schemas/RelationCreate', - ], - 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/content/objects/content_id/versions/version_no/relations/POST/RelationCreate.xml.example', - ], 'application/vnd.ibexa.api.RelationCreate+json' => [ 'schema' => [ '$ref' => '#/components/schemas/RelationCreateWrapper', ], 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/content/objects/content_id/versions/version_no/relations/POST/RelationCreate.json.example', ], + 'application/vnd.ibexa.api.RelationCreate+xml' => [ + 'schema' => [ + '$ref' => '#/components/schemas/RelationCreate', + ], + 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/content/objects/content_id/versions/version_no/relations/POST/RelationCreate.xml.example', + ], ]), ), responses: [ Response::HTTP_CREATED => [ + 'description' => 'If set, the updated version is returned in XML or JSON format.', 'content' => [ - 'application/vnd.ibexa.api.Relation+xml' => [ - 'schema' => [ - '$ref' => '#/components/schemas/Relation', - ], - 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/content/objects/content_id/versions/version_no/relations/relation_id/GET/Relation.xml.example', - ], 'application/vnd.ibexa.api.Relation+json' => [ 'schema' => [ '$ref' => '#/components/schemas/RelationWrapper', ], 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/content/objects/content_id/versions/version_no/relations/POST/Relation.json.example', ], + 'application/vnd.ibexa.api.Relation+xml' => [ + 'schema' => [ + '$ref' => '#/components/schemas/Relation', + ], + 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/content/objects/content_id/versions/version_no/relations/POST/Relation.xml.example', + ], ], ], ], diff --git a/src/lib/Server/Controller/Content/ContentRevealController.php b/src/lib/Server/Controller/Content/ContentRevealController.php index 0aebcc1cc..d48c4d3a8 100644 --- a/src/lib/Server/Controller/Content/ContentRevealController.php +++ b/src/lib/Server/Controller/Content/ContentRevealController.php @@ -18,12 +18,22 @@ uriTemplate: '/content/objects/{contentId}/reveal', extraProperties: [OpenApiFactory::OVERRIDE_OPENAPI_RESPONSES => false], openapi: new Model\Operation( + operationId: 'ibexa.rest.reveal_content', summary: 'Reveal content item', description: 'Makes or keep the content item visible', tags: [ 'Objects', ], parameters: [ + new Model\Parameter( + name: 'X-CSRF-Token', + in: 'header', + required: true, + description: 'The CSRF Token needed on all unsafe HTTP methods with session.', + schema: [ + 'type' => 'string', + ], + ), new Model\Parameter( name: 'contentId', in: 'path', @@ -34,6 +44,7 @@ ), ], requestBody: new Model\RequestBody( + description: 'No payload required', content: new \ArrayObject(), ), responses: [ diff --git a/src/lib/Server/Controller/Content/ContentTranslationDeleteController.php b/src/lib/Server/Controller/Content/ContentTranslationDeleteController.php index 731608e42..dabe44b87 100644 --- a/src/lib/Server/Controller/Content/ContentTranslationDeleteController.php +++ b/src/lib/Server/Controller/Content/ContentTranslationDeleteController.php @@ -16,12 +16,22 @@ #[Delete( uriTemplate: '/content/objects/{contentId}/translations/{languageCode}', openapi: new Model\Operation( + operationId: 'ibexa.rest.delete_content_translation', summary: 'Delete translation (permanently)', description: 'Permanently deletes a translation from all versions of a content item.', tags: [ 'Objects', ], parameters: [ + new Model\Parameter( + name: 'X-CSRF-Token', + in: 'header', + required: true, + description: 'The CSRF Token needed on all unsafe HTTP methods with session.', + schema: [ + 'type' => 'string', + ], + ), new Model\Parameter( name: 'contentId', in: 'path', diff --git a/src/lib/Server/Controller/Content/ContentVersionDeleteController.php b/src/lib/Server/Controller/Content/ContentVersionDeleteController.php index 2a7e0212b..5537b35c6 100644 --- a/src/lib/Server/Controller/Content/ContentVersionDeleteController.php +++ b/src/lib/Server/Controller/Content/ContentVersionDeleteController.php @@ -17,12 +17,22 @@ #[Delete( uriTemplate: '/content/objects/{contentId}/versions/{versionNo}', openapi: new Model\Operation( + operationId: 'ibexa.rest.delete_content_version', summary: 'Delete content version', description: 'Deletes the content version.', tags: [ 'Objects', ], parameters: [ + new Model\Parameter( + name: 'X-CSRF-Token', + in: 'header', + required: true, + description: 'The CSRF Token needed on all unsafe HTTP methods with session.', + schema: [ + 'type' => 'string', + ], + ), new Model\Parameter( name: 'contentId', in: 'path', diff --git a/src/lib/Server/Controller/Content/ContentVersionRelationDeleteController.php b/src/lib/Server/Controller/Content/ContentVersionRelationDeleteController.php index 648c1bd7e..46893849b 100644 --- a/src/lib/Server/Controller/Content/ContentVersionRelationDeleteController.php +++ b/src/lib/Server/Controller/Content/ContentVersionRelationDeleteController.php @@ -22,12 +22,22 @@ #[Delete( uriTemplate: '/content/objects/{contentId}/versions/{versionNo}/relations/{relationId}', openapi: new Model\Operation( + operationId: 'ibexa.rest.remove_relation', summary: 'Delete Relation', description: 'Deletes a Relation of the given draft.', tags: [ 'Objects', ], parameters: [ + new Model\Parameter( + name: 'X-CSRF-Token', + in: 'header', + required: true, + description: 'The CSRF Token needed on all unsafe HTTP methods with session.', + schema: [ + 'type' => 'string', + ], + ), new Model\Parameter( name: 'contentId', in: 'path', diff --git a/src/lib/Server/Controller/Content/ContentVersionRelationLoadByIdController.php b/src/lib/Server/Controller/Content/ContentVersionRelationLoadByIdController.php index d4d44fda3..877ebd67e 100644 --- a/src/lib/Server/Controller/Content/ContentVersionRelationLoadByIdController.php +++ b/src/lib/Server/Controller/Content/ContentVersionRelationLoadByIdController.php @@ -19,21 +19,13 @@ #[Get( uriTemplate: '/content/objects/{contentId}/versions/{versionNo}/relations/{relationId}', openapi: new Model\Operation( + operationId: 'ibexa.rest.load_version_relation', summary: 'Load Relation', description: 'Loads a Relation for the given content item.', tags: [ 'Objects', ], parameters: [ - new Model\Parameter( - name: 'Accept', - in: 'header', - required: true, - description: 'If set, the Relation is returned in XML or JSON format.', - schema: [ - 'type' => 'string', - ], - ), new Model\Parameter( name: 'contentId', in: 'path', @@ -63,18 +55,18 @@ Response::HTTP_OK => [ 'description' => 'OK - loads a Relation for the given content item.', 'content' => [ - 'application/vnd.ibexa.api.Relation+xml' => [ - 'schema' => [ - '$ref' => '#/components/schemas/Relation', - ], - 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/content/objects/content_id/versions/version_no/relations/relation_id/GET/Relation.xml.example', - ], 'application/vnd.ibexa.api.Relation+json' => [ 'schema' => [ '$ref' => '#/components/schemas/RelationWrapper', ], 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/content/objects/content_id/versions/version_no/relations/POST/Relation.json.example', ], + 'application/vnd.ibexa.api.Relation+xml' => [ + 'schema' => [ + '$ref' => '#/components/schemas/Relation', + ], + 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/content/objects/content_id/versions/version_no/relations/relation_id/GET/Relation.xml.example', + ], ], ], Response::HTTP_UNAUTHORIZED => [ diff --git a/src/lib/Server/Controller/Content/ContentVersionUpdateController.php b/src/lib/Server/Controller/Content/ContentVersionUpdateController.php index 814646d00..75ee355ce 100644 --- a/src/lib/Server/Controller/Content/ContentVersionUpdateController.php +++ b/src/lib/Server/Controller/Content/ContentVersionUpdateController.php @@ -26,6 +26,7 @@ uriTemplate: '/content/objects/{contentId}/versions/{versionNo}', extraProperties: [OpenApiFactory::OVERRIDE_OPENAPI_RESPONSES => false], openapi: new Model\Operation( + operationId: 'ibexa.rest.update_version', summary: 'Update version', description: 'A specific draft is updated. PATCH or POST with header X-HTTP-Method-Override PATCH.', tags: [ @@ -33,10 +34,10 @@ ], parameters: [ new Model\Parameter( - name: 'Accept', + name: 'X-CSRF-Token', in: 'header', required: true, - description: 'If set, the updated version is returned in XML or JSON format.', + description: 'The CSRF Token needed on all unsafe HTTP methods with session.', schema: [ 'type' => 'string', ], @@ -50,15 +51,6 @@ 'type' => 'string', ], ), - new Model\Parameter( - name: 'Content-Type', - in: 'header', - required: true, - description: 'The VersionUpdate schema encoded in XML or JSON format.', - schema: [ - 'type' => 'string', - ], - ), new Model\Parameter( name: 'contentId', in: 'path', @@ -77,35 +69,37 @@ ), ], requestBody: new Model\RequestBody( + description: 'The VersionUpdate schema encoded in XML or JSON format.', content: new \ArrayObject([ - 'application/vnd.ibexa.api.VersionUpdate+xml' => [ + 'application/vnd.ibexa.api.VersionUpdate+json' => [ 'schema' => [ - '$ref' => '#/components/schemas/VersionUpdate', + '$ref' => '#/components/schemas/VersionUpdateWrapper', ], - 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/content/objects/content_id/versions/version_no/PATCH/VersionUpdate.xml.example', ], - 'application/vnd.ibexa.api.VersionUpdate+json' => [ + 'application/vnd.ibexa.api.VersionUpdate+xml' => [ 'schema' => [ - '$ref' => '#/components/schemas/VersionUpdateWrapper', + '$ref' => '#/components/schemas/VersionUpdate', ], + 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/content/objects/content_id/versions/version_no/PATCH/VersionUpdate.xml.example', ], ]), ), responses: [ Response::HTTP_OK => [ + 'description' => 'If set, the updated version is returned in XML or JSON format.', 'content' => [ - 'application/vnd.ibexa.api.Version+xml' => [ - 'schema' => [ - '$ref' => '#/components/schemas/Version', - ], - 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/content/objects/content_id/versions/version_no/GET/Version.xml.example', - ], 'application/vnd.ibexa.api.Version+json' => [ 'schema' => [ '$ref' => '#/components/schemas/VersionWrapper', ], 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/content/objects/content_id/versions/version_no/GET/Version.json.example', ], + 'application/vnd.ibexa.api.Version+xml' => [ + 'schema' => [ + '$ref' => '#/components/schemas/Version', + ], + 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/content/objects/content_id/versions/version_no/PATCH/Version.xml.example', + ], ], ], Response::HTTP_BAD_REQUEST => [ diff --git a/src/lib/Server/Controller/Content/ContentVersionsListController.php b/src/lib/Server/Controller/Content/ContentVersionsListController.php index 9e226b9cf..2e39fb92d 100644 --- a/src/lib/Server/Controller/Content/ContentVersionsListController.php +++ b/src/lib/Server/Controller/Content/ContentVersionsListController.php @@ -19,21 +19,13 @@ uriTemplate: '/content/objects/{contentId}/versions', extraProperties: [OpenApiFactory::OVERRIDE_OPENAPI_RESPONSES => false], openapi: new Model\Operation( + operationId: 'ibexa.rest.load_content_versions', summary: 'List versions', description: 'Returns a list of all versions of the content item. This method does not include fields and relations in the version elements of the response.', tags: [ 'Objects', ], parameters: [ - new Model\Parameter( - name: 'Accept', - in: 'header', - required: true, - description: 'If set, the version list is returned in XML or JSON format.', - schema: [ - 'type' => 'string', - ], - ), new Model\Parameter( name: 'contentId', in: 'path', @@ -45,19 +37,20 @@ ], responses: [ Response::HTTP_OK => [ + 'description' => 'If set, the version list is returned in XML or JSON format.', 'content' => [ - 'application/vnd.ibexa.api.VersionList+xml' => [ - 'schema' => [ - '$ref' => '#/components/schemas/VersionList', - ], - 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/content/objects/content_id/versions/GET/VersionList.xml.example', - ], 'application/vnd.ibexa.api.VersionList+json' => [ 'schema' => [ '$ref' => '#/components/schemas/VersionListWrapper', ], 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/content/objects/content_id/versions/GET/VersionList.json.example', ], + 'application/vnd.ibexa.api.VersionList+xml' => [ + 'schema' => [ + '$ref' => '#/components/schemas/VersionList', + ], + 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/content/objects/content_id/versions/GET/VersionList.xml.example', + ], ], ], Response::HTTP_UNAUTHORIZED => [ diff --git a/src/lib/Server/Controller/Content/ContentVersionsRelationsListController.php b/src/lib/Server/Controller/Content/ContentVersionsRelationsListController.php index 5195f8407..b1fb36b3b 100644 --- a/src/lib/Server/Controller/Content/ContentVersionsRelationsListController.php +++ b/src/lib/Server/Controller/Content/ContentVersionsRelationsListController.php @@ -18,21 +18,13 @@ #[Get( uriTemplate: '/content/objects/{contentId}/versions/{versionNo}/relations', openapi: new Model\Operation( + operationId: 'ibexa.rest.load_version_relations', summary: 'Load Relations of content item version', description: 'Loads the Relations of the given version.', tags: [ 'Objects', ], parameters: [ - new Model\Parameter( - name: 'Accept', - in: 'header', - required: true, - description: 'If set, the Relation is returned in XML or JSON format.', - schema: [ - 'type' => 'string', - ], - ), new Model\Parameter( name: 'contentId', in: 'path', @@ -52,19 +44,20 @@ ], responses: [ Response::HTTP_OK => [ + 'description' => 'If set, the Relation is returned in XML or JSON format.', 'content' => [ - 'application/vnd.ibexa.api.RelationList+xml' => [ - 'schema' => [ - '$ref' => '#/components/schemas/RelationList', - ], - 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/content/objects/content_id/versions/version_no/relations/GET/RelationList.xml.example', - ], 'application/vnd.ibexa.api.RelationList+json' => [ 'schema' => [ '$ref' => '#/components/schemas/RelationListWrapper', ], 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/content/objects/content_id/versions/version_no/relations/GET/RelationList.json.example', ], + 'application/vnd.ibexa.api.RelationList+xml' => [ + 'schema' => [ + '$ref' => '#/components/schemas/RelationList', + ], + 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/content/objects/content_id/versions/version_no/relations/GET/RelationList.xml.example', + ], ], ], Response::HTTP_UNAUTHORIZED => [ diff --git a/src/lib/Server/Controller/ContentType/ContentTypeCreateController.php b/src/lib/Server/Controller/ContentType/ContentTypeCreateController.php index a2f82ae07..a417ed07f 100644 --- a/src/lib/Server/Controller/ContentType/ContentTypeCreateController.php +++ b/src/lib/Server/Controller/ContentType/ContentTypeCreateController.php @@ -30,6 +30,7 @@ uriTemplate: '/content/typegroups/{contentTypeGroupId}/types', extraProperties: [OpenApiFactory::OVERRIDE_OPENAPI_RESPONSES => false], openapi: new Model\Operation( + operationId: 'ibexa.rest.create_content_type', summary: 'Create content type', description: 'Creates a new content type draft in the given content type group.', tags: [ @@ -37,19 +38,10 @@ ], parameters: [ new Model\Parameter( - name: 'Accept', + name: 'X-CSRF-Token', in: 'header', required: true, - description: 'If set, the new content type or draft is returned in XML or JSON format.', - schema: [ - 'type' => 'string', - ], - ), - new Model\Parameter( - name: 'Content-Type', - in: 'header', - required: true, - description: 'The content type Create schema encoded in XML or JSON format.', + description: 'The CSRF Token needed on all unsafe HTTP methods with session.', schema: [ 'type' => 'string', ], @@ -64,35 +56,36 @@ ), ], requestBody: new Model\RequestBody( + description: 'The content type Create schema encoded in XML or JSON format.', content: new \ArrayObject([ - 'application/vnd.ibexa.api.ContentTypeCreate+xml' => [ - 'schema' => [ - '$ref' => '#/components/schemas/ContentTypeCreate', - ], - 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/content/typegroups/content_type_group_id/types/POST/ContentTypeCreate.xml.example', - ], 'application/vnd.ibexa.api.ContentTypeCreate+json' => [ 'schema' => [ '$ref' => '#/components/schemas/ContentTypeCreateWrapper', ], 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/content/typegroups/content_type_group_id/types/POST/ContentTypeCreate.json.example', ], + 'application/vnd.ibexa.api.ContentTypeCreate+xml' => [ + 'schema' => [ + '$ref' => '#/components/schemas/ContentTypeCreate', + ], + 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/content/typegroups/content_type_group_id/types/POST/ContentTypeCreate.xml.example', + ], ]), ), responses: [ Response::HTTP_CREATED => [ 'description' => 'Content type created.', 'content' => [ - 'application/vnd.ibexa.api.ContentType+xml' => [ + 'application/vnd.ibexa.api.ContentType+json' => [ 'schema' => [ - '$ref' => '#/components/schemas/ContentType', + '$ref' => '#/components/schemas/ContentTypeWrapper', ], - 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/content/types/content_type_id/draft/PUBLISH/ContentType.xml.example', ], - 'application/vnd.ibexa.api.ContentType+json' => [ + 'application/vnd.ibexa.api.ContentType+xml' => [ 'schema' => [ - '$ref' => '#/components/schemas/ContentTypeWrapper', + '$ref' => '#/components/schemas/ContentType', ], + 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/content/typegroups/content_type_group_id/types/POST/ContentType.xml.example', ], ], ], diff --git a/src/lib/Server/Controller/ContentType/ContentTypeCreateViewController.php b/src/lib/Server/Controller/ContentType/ContentTypeCreateViewController.php index f8f8e697d..8189717f1 100644 --- a/src/lib/Server/Controller/ContentType/ContentTypeCreateViewController.php +++ b/src/lib/Server/Controller/ContentType/ContentTypeCreateViewController.php @@ -22,6 +22,7 @@ uriTemplate: '/content/types/view', extraProperties: [OpenApiFactory::OVERRIDE_OPENAPI_RESPONSES => false], openapi: new Model\Operation( + operationId: 'ibexa.rest.content_types.view', summary: 'Filter content types', description: 'Executes a query and returns a View including the results. The View input reflects the criteria model of the public PHP API.', tags: [ @@ -29,35 +30,27 @@ ], parameters: [ new Model\Parameter( - name: 'Accept', + name: 'X-CSRF-Token', in: 'header', required: true, - description: 'The view in XML or JSON format.', - schema: [ - 'type' => 'string', - ], - ), - new Model\Parameter( - name: 'Content-Type', - in: 'header', - required: true, - description: 'The view input in XML or JSON format.', + description: 'The CSRF Token needed on all unsafe HTTP methods with session.', schema: [ 'type' => 'string', ], ), ], requestBody: new Model\RequestBody( + description: 'The view input in XML or JSON format.', content: new \ArrayObject([ - 'application/vnd.ibexa.api.ContentTypeViewInput+xml' => [ + 'application/vnd.ibexa.api.ContentTypeViewInput+json' => [ 'schema' => [ - '$ref' => '#/components/schemas/ContentTypeViewInput', + '$ref' => '#/components/schemas/ContentTypeViewInputWrapper', ], - 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/content/types/content_type_id/POST/ContentTypeCreateView.xml.example', + 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/content/types/content_type_id/POST/ContentTypeCreateView.json.example', ], - 'application/vnd.ibexa.api.ContentTypeViewInput+json' => [ + 'application/vnd.ibexa.api.ContentTypeViewInput+xml' => [ 'schema' => [ - '$ref' => '#/components/schemas/ContentTypeViewInputWrapper', + '$ref' => '#/components/schemas/ContentTypeViewInput', ], 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/content/types/content_type_id/POST/ContentTypeCreateView.xml.example', ], @@ -65,19 +58,20 @@ ), responses: [ Response::HTTP_OK => [ + 'description' => 'The view in XML or JSON format.', 'content' => [ - 'application/vnd.ibexa.api.ContentTypeList+xml' => [ - 'schema' => [ - '$ref' => '#/components/schemas/ContentTypeInfoList', - ], - 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/content/types/GET/ContentTypeInfoList.xml.example', - ], 'application/vnd.ibexa.api.ContentTypeList+json' => [ 'schema' => [ '$ref' => '#/components/schemas/ContentTypeInfoListWrapper', ], 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/content/types/GET/ContentTypeInfoList.json.example', ], + 'application/vnd.ibexa.api.ContentTypeList+xml' => [ + 'schema' => [ + '$ref' => '#/components/schemas/ContentTypeInfoList', + ], + 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/content/types/GET/ContentTypeInfoList.xml.example', + ], ], ], Response::HTTP_BAD_REQUEST => [ diff --git a/src/lib/Server/Controller/ContentType/ContentTypeDeleteController.php b/src/lib/Server/Controller/ContentType/ContentTypeDeleteController.php index 593ad82c6..6a73c397c 100644 --- a/src/lib/Server/Controller/ContentType/ContentTypeDeleteController.php +++ b/src/lib/Server/Controller/ContentType/ContentTypeDeleteController.php @@ -20,12 +20,22 @@ #[Delete( uriTemplate: '/content/types/{contentTypeId}', openapi: new Model\Operation( + operationId: 'ibexa.rest.delete_content_type', summary: 'Delete content type', description: 'Deletes the provided content type.', tags: [ 'Type', ], parameters: [ + new Model\Parameter( + name: 'X-CSRF-Token', + in: 'header', + required: true, + description: 'The CSRF Token needed on all unsafe HTTP methods with session.', + schema: [ + 'type' => 'string', + ], + ), new Model\Parameter( name: 'contentTypeId', in: 'path', diff --git a/src/lib/Server/Controller/ContentType/ContentTypeDraftCreateController.php b/src/lib/Server/Controller/ContentType/ContentTypeDraftCreateController.php index 14c4defd0..7cc5727d5 100644 --- a/src/lib/Server/Controller/ContentType/ContentTypeDraftCreateController.php +++ b/src/lib/Server/Controller/ContentType/ContentTypeDraftCreateController.php @@ -26,6 +26,7 @@ uriTemplate: '/content/types/{contentTypeId}', extraProperties: [OpenApiFactory::OVERRIDE_OPENAPI_RESPONSES => false], openapi: new Model\Operation( + operationId: 'ibexa.rest.create_content_type_draft', summary: 'Create Draft', description: 'Creates a draft and updates it with the given data.', tags: [ @@ -33,19 +34,10 @@ ], parameters: [ new Model\Parameter( - name: 'Accept', + name: 'X-CSRF-Token', in: 'header', required: true, - description: 'If set, the new content type draft is returned in XML or JSON format.', - schema: [ - 'type' => 'string', - ], - ), - new Model\Parameter( - name: 'Content-Type', - in: 'header', - required: true, - description: 'The content type Update schema encoded in XML or JSON format.', + description: 'The CSRF Token needed on all unsafe HTTP methods with session.', schema: [ 'type' => 'string', ], @@ -60,36 +52,37 @@ ), ], requestBody: new Model\RequestBody( + description: 'The content type Update schema encoded in XML or JSON format.', content: new \ArrayObject([ - 'application/vnd.ibexa.api.ContentTypeUpdate+xml' => [ - 'schema' => [ - '$ref' => '#/components/schemas/ContentTypeUpdate', - ], - 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/content/types/content_type_id/POST/ContentTypeUpdate.xml.example', - ], 'application/vnd.ibexa.api.ContentTypeUpdate+json' => [ 'schema' => [ '$ref' => '#/components/schemas/ContentTypeUpdateWrapper', ], 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/content/types/content_type_id/POST/ContentTypeUpdate.json.example', ], + 'application/vnd.ibexa.api.ContentTypeUpdate+xml' => [ + 'schema' => [ + '$ref' => '#/components/schemas/ContentTypeUpdate', + ], + 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/content/types/content_type_id/POST/ContentTypeUpdate.xml.example', + ], ]), ), responses: [ Response::HTTP_CREATED => [ 'description' => 'Draft created.', 'content' => [ - 'application/vnd.ibexa.api.ContentTypeInfo+xml' => [ + 'application/vnd.ibexa.api.ContentTypeInfo+json' => [ 'schema' => [ - '$ref' => '#/components/schemas/ContentTypeInfo', + '$ref' => '#/components/schemas/ContentTypeInfoWrapper', ], - 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/content/types/content_type_id/draft/PATCH/ContentTypeInfo.xml.example', + 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/content/types/content_type_id/POST/ContentTypeInfo.json.example', ], - 'application/vnd.ibexa.api.ContentTypeInfo+json' => [ + 'application/vnd.ibexa.api.ContentTypeInfo+xml' => [ 'schema' => [ - '$ref' => '#/components/schemas/ContentTypeInfoWrapper', + '$ref' => '#/components/schemas/ContentTypeInfo', ], - 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/content/types/content_type_id/draft/PATCH/ContentTypeInfo.json.example', + 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/content/types/content_type_id/POST/ContentTypeInfo.xml.example', ], ], ], diff --git a/src/lib/Server/Controller/ContentType/ContentTypeDraftDeleteController.php b/src/lib/Server/Controller/ContentType/ContentTypeDraftDeleteController.php index cd9743267..525370069 100644 --- a/src/lib/Server/Controller/ContentType/ContentTypeDraftDeleteController.php +++ b/src/lib/Server/Controller/ContentType/ContentTypeDraftDeleteController.php @@ -17,12 +17,22 @@ #[Delete( uriTemplate: '/content/types/{contentTypeId}/draft', openapi: new Model\Operation( + operationId: 'ibexa.rest.delete_content_type_draft', summary: 'Delete content type draft', description: 'Deletes the provided content type draft.', tags: [ 'Type', ], parameters: [ + new Model\Parameter( + name: 'X-CSRF-Token', + in: 'header', + required: true, + description: 'The CSRF Token needed on all unsafe HTTP methods with session.', + schema: [ + 'type' => 'string', + ], + ), new Model\Parameter( name: 'contentTypeId', in: 'path', diff --git a/src/lib/Server/Controller/ContentType/ContentTypeDraftFieldDefinitionAddController.php b/src/lib/Server/Controller/ContentType/ContentTypeDraftFieldDefinitionAddController.php index c2bc6e2d8..b551934f4 100644 --- a/src/lib/Server/Controller/ContentType/ContentTypeDraftFieldDefinitionAddController.php +++ b/src/lib/Server/Controller/ContentType/ContentTypeDraftFieldDefinitionAddController.php @@ -28,6 +28,7 @@ uriTemplate: '/content/types/{contentTypeId}/draft/fieldDefinitions', extraProperties: [OpenApiFactory::OVERRIDE_OPENAPI_RESPONSES => false], openapi: new Model\Operation( + operationId: 'ibexa.rest.add_content_type_draft_field_definition', summary: 'Add content type Draft Field definition', description: 'Creates a new Field definition for the given content type.', tags: [ @@ -35,19 +36,10 @@ ], parameters: [ new Model\Parameter( - name: 'Accept', + name: 'X-CSRF-Token', in: 'header', required: true, - description: 'If set, the new Field definition is returned in XML or JSON format.', - schema: [ - 'type' => 'string', - ], - ), - new Model\Parameter( - name: 'Content-Type', - in: 'header', - required: true, - description: 'The Field Definition Create schema encoded in XML or JSON format.', + description: 'The CSRF Token needed on all unsafe HTTP methods with session.', schema: [ 'type' => 'string', ], @@ -62,17 +54,18 @@ ), ], requestBody: new Model\RequestBody( + description: 'The Field Definition Create schema encoded in XML or JSON format.', content: new \ArrayObject([ - 'application/vnd.ibexa.api.FieldDefinitionCreate+xml' => [ + 'application/vnd.ibexa.api.FieldDefinitionCreate+json' => [ 'schema' => [ - '$ref' => '#/components/schemas/FieldDefinitionCreate', + '$ref' => '#/components/schemas/FieldDefinitionCreateWrapper', ], - 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/content/types/content_type_id/draft/field_definitions/POST/FieldDefinitionCreate.xml.example', ], - 'application/vnd.ibexa.api.FieldDefinitionCreate+json' => [ + 'application/vnd.ibexa.api.FieldDefinitionCreate+xml' => [ 'schema' => [ - '$ref' => '#/components/schemas/FieldDefinitionCreateWrapper', + '$ref' => '#/components/schemas/FieldDefinitionCreate', ], + 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/content/types/content_type_id/draft/field_definitions/POST/FieldDefinitionCreate.xml.example', ], ]), ), @@ -80,18 +73,18 @@ Response::HTTP_CREATED => [ 'description' => 'Field definition created.', 'content' => [ - 'application/vnd.ibexa.api.FieldDefinition+xml' => [ - 'schema' => [ - '$ref' => '#/components/schemas/FieldDefinition', - ], - 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/content/types/content_type_id/field_definition_id/GET/FieldDefinition.xml.example', - ], 'application/vnd.ibexa.api.FieldDefinition+json' => [ 'schema' => [ '$ref' => '#/components/schemas/FieldDefinitionWrapper', ], 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/content/types/content_type_id/field_definition_id/GET/FieldDefinition.json.example', ], + 'application/vnd.ibexa.api.FieldDefinition+xml' => [ + 'schema' => [ + '$ref' => '#/components/schemas/FieldDefinition', + ], + 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/content/types/content_type_id/draft/field_definitions/POST/FieldDefinition.xml.example', + ], ], ], Response::HTTP_BAD_REQUEST => [ diff --git a/src/lib/Server/Controller/ContentType/ContentTypeDraftFieldDefinitionDeleteController.php b/src/lib/Server/Controller/ContentType/ContentTypeDraftFieldDefinitionDeleteController.php index 124081884..7864b7f6e 100644 --- a/src/lib/Server/Controller/ContentType/ContentTypeDraftFieldDefinitionDeleteController.php +++ b/src/lib/Server/Controller/ContentType/ContentTypeDraftFieldDefinitionDeleteController.php @@ -21,12 +21,22 @@ uriTemplate: '/content/types/{contentTypeId}/draft/fieldDefinitions/{fieldDefinitionId}', extraProperties: [OpenApiFactory::OVERRIDE_OPENAPI_RESPONSES => false], openapi: new Model\Operation( + operationId: 'ibexa.rest.remove_content_type_draft_field_definition', summary: 'Delete content type Draft Field definition', description: 'Deletes the provided Field definition.', tags: [ 'Type', ], parameters: [ + new Model\Parameter( + name: 'X-CSRF-Token', + in: 'header', + required: true, + description: 'The CSRF Token needed on all unsafe HTTP methods with session.', + schema: [ + 'type' => 'string', + ], + ), new Model\Parameter( name: 'contentTypeId', in: 'path', diff --git a/src/lib/Server/Controller/ContentType/ContentTypeDraftFieldDefinitionListController.php b/src/lib/Server/Controller/ContentType/ContentTypeDraftFieldDefinitionListController.php index 80256ae38..a641d32bd 100644 --- a/src/lib/Server/Controller/ContentType/ContentTypeDraftFieldDefinitionListController.php +++ b/src/lib/Server/Controller/ContentType/ContentTypeDraftFieldDefinitionListController.php @@ -17,21 +17,13 @@ #[Get( uriTemplate: '/content/types/{contentTypeId}/draft/fieldDefinitions', openapi: new Model\Operation( + operationId: 'ibexa.rest.load_content_type_draft_field_definition_list', summary: 'Get Draft Field definition list', description: 'Returns all Field definitions of the provided content type Draft.', tags: [ 'Type', ], parameters: [ - new Model\Parameter( - name: 'Accept', - in: 'header', - required: true, - description: 'If set, the Field definitions are returned in XML or JSON format.', - schema: [ - 'type' => 'string', - ], - ), new Model\Parameter( name: 'contentTypeId', in: 'path', @@ -45,14 +37,14 @@ Response::HTTP_OK => [ 'description' => 'OK - return a list of Field definitions.', 'content' => [ - 'application/vnd.ibexa.api.FieldDefinitionList+xml' => [ + 'application/vnd.ibexa.api.FieldDefinitionList+json' => [ 'schema' => [ - '$ref' => '#/components/schemas/FieldDefinitions', + '$ref' => '#/components/schemas/FieldDefinitionsWrapper', ], ], - 'application/vnd.ibexa.api.FieldDefinitionList+json' => [ + 'application/vnd.ibexa.api.FieldDefinitionList+xml' => [ 'schema' => [ - '$ref' => '#/components/schemas/FieldDefinitionsWrapper', + '$ref' => '#/components/schemas/FieldDefinitions', ], ], ], diff --git a/src/lib/Server/Controller/ContentType/ContentTypeDraftFieldDefinitionLoadByIdController.php b/src/lib/Server/Controller/ContentType/ContentTypeDraftFieldDefinitionLoadByIdController.php index b8aefda76..be015b966 100644 --- a/src/lib/Server/Controller/ContentType/ContentTypeDraftFieldDefinitionLoadByIdController.php +++ b/src/lib/Server/Controller/ContentType/ContentTypeDraftFieldDefinitionLoadByIdController.php @@ -19,21 +19,13 @@ #[Get( uriTemplate: '/content/types/{contentTypeId}/draft/fieldDefinitions/{fieldDefinitionId}', openapi: new Model\Operation( + operationId: 'ibexa.rest.load_content_type_draft_field_definition', summary: 'Get content type Draft Field definition', description: 'Returns the Field definition by the given ID.', tags: [ 'Type', ], parameters: [ - new Model\Parameter( - name: 'Accept', - in: 'header', - required: true, - description: 'If set, the Field definition is returned in XML or JSON format.', - schema: [ - 'type' => 'string', - ], - ), new Model\Parameter( name: 'contentTypeId', in: 'path', @@ -55,17 +47,17 @@ Response::HTTP_OK => [ 'description' => 'OK - returns the Field definition.', 'content' => [ - 'application/vnd.ibexa.api.FieldDefinition+xml' => [ + 'application/vnd.ibexa.api.FieldDefinition+json' => [ 'schema' => [ - '$ref' => '#/components/schemas/FieldDefinition', + '$ref' => '#/components/schemas/FieldDefinitionWrapper', ], - 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/content/types/content_type_id/field_definition_id/GET/FieldDefinition.xml.example', + 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/content/types/content_type_id/draft/field_definitions/field_definition_id/GET/FieldDefinition.json.example', ], - 'application/vnd.ibexa.api.FieldDefinition+json' => [ + 'application/vnd.ibexa.api.FieldDefinition+xml' => [ 'schema' => [ - '$ref' => '#/components/schemas/FieldDefinitionWrapper', + '$ref' => '#/components/schemas/FieldDefinition', ], - 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/content/types/content_type_id/field_definition_id/GET/FieldDefinition.json.example', + 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/content/types/content_type_id/draft/field_definitions/field_definition_id/GET/FieldDefinition.xml.example', ], ], ], diff --git a/src/lib/Server/Controller/ContentType/ContentTypeDraftFieldDefinitionUpdateController.php b/src/lib/Server/Controller/ContentType/ContentTypeDraftFieldDefinitionUpdateController.php index 2db208e59..049d65957 100644 --- a/src/lib/Server/Controller/ContentType/ContentTypeDraftFieldDefinitionUpdateController.php +++ b/src/lib/Server/Controller/ContentType/ContentTypeDraftFieldDefinitionUpdateController.php @@ -25,6 +25,7 @@ uriTemplate: '/content/types/{contentTypeId}/draft/fieldDefinitions/{fieldDefinitionId}', extraProperties: [OpenApiFactory::OVERRIDE_OPENAPI_RESPONSES => false], openapi: new Model\Operation( + operationId: 'ibexa.rest.update_content_type_draft_field_definition', summary: 'Update content type Draft Field definition', description: 'Updates the attributes of a Field definition.', tags: [ @@ -32,19 +33,10 @@ ], parameters: [ new Model\Parameter( - name: 'Accept', + name: 'X-CSRF-Token', in: 'header', required: true, - description: 'If set, the updated Field definition is returned in XML or JSON format.', - schema: [ - 'type' => 'string', - ], - ), - new Model\Parameter( - name: 'Content-Type', - in: 'header', - required: true, - description: 'The Field definition update schema encoded in XML or JSON format.', + description: 'The CSRF Token needed on all unsafe HTTP methods with session.', schema: [ 'type' => 'string', ], @@ -67,17 +59,18 @@ ), ], requestBody: new Model\RequestBody( + description: 'The Field definition update schema encoded in XML or JSON format.', content: new \ArrayObject([ - 'application/vnd.ibexa.api.FieldDefinitionUpdate+xml' => [ + 'application/vnd.ibexa.api.FieldDefinitionUpdate+json' => [ 'schema' => [ - '$ref' => '#/components/schemas/FieldDefinitionUpdate', + '$ref' => '#/components/schemas/FieldDefinitionUpdateWrapper', ], - 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/content/types/content_type_id/draft/field_definitions/field_definition_id/PATCH/FieldDefinitionUpdate.xml.example', ], - 'application/vnd.ibexa.api.FieldDefinitionUpdate+json' => [ + 'application/vnd.ibexa.api.FieldDefinitionUpdate+xml' => [ 'schema' => [ - '$ref' => '#/components/schemas/FieldDefinitionUpdateWrapper', + '$ref' => '#/components/schemas/FieldDefinitionUpdate', ], + 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/content/types/content_type_id/draft/field_definitions/field_definition_id/PATCH/FieldDefinitionUpdate.xml.example', ], ]), ), @@ -85,18 +78,18 @@ Response::HTTP_OK => [ 'description' => 'OK - attributes updated.', 'content' => [ - 'application/vnd.ibexa.api.FieldDefinition+xml' => [ - 'schema' => [ - '$ref' => '#/components/schemas/FieldDefinition', - ], - 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/content/types/content_type_id/field_definition_id/GET/FieldDefinition.xml.example', - ], 'application/vnd.ibexa.api.FieldDefinition+json' => [ 'schema' => [ '$ref' => '#/components/schemas/FieldDefinitionWrapper', ], 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/content/types/content_type_id/field_definition_id/GET/FieldDefinition.json.example', ], + 'application/vnd.ibexa.api.FieldDefinition+xml' => [ + 'schema' => [ + '$ref' => '#/components/schemas/FieldDefinition', + ], + 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/content/types/content_type_id/draft/field_definitions/field_definition_id/PATCH/FieldDefinition.xml.example', + ], ], ], Response::HTTP_BAD_REQUEST => [ diff --git a/src/lib/Server/Controller/ContentType/ContentTypeDraftLoadController.php b/src/lib/Server/Controller/ContentType/ContentTypeDraftLoadController.php index 58c913a2a..32790a425 100644 --- a/src/lib/Server/Controller/ContentType/ContentTypeDraftLoadController.php +++ b/src/lib/Server/Controller/ContentType/ContentTypeDraftLoadController.php @@ -17,21 +17,13 @@ #[Get( uriTemplate: '/content/types/{contentTypeId}/draft', openapi: new Model\Operation( + operationId: 'ibexa.rest.load_content_type_draft', summary: 'Get content type draft', description: 'Returns the draft of the content type with the provided ID.', tags: [ 'Type', ], parameters: [ - new Model\Parameter( - name: 'Accept', - in: 'header', - required: true, - description: 'If set, the content type is returned in XML or JSON format.', - schema: [ - 'type' => 'string', - ], - ), new Model\Parameter( name: 'contentTypeId', in: 'path', @@ -45,18 +37,18 @@ Response::HTTP_OK => [ 'description' => 'OK - returns the content type.', 'content' => [ - 'application/vnd.ibexa.api.ContentType+xml' => [ - 'schema' => [ - '$ref' => '#/components/schemas/ContentType', - ], - 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/content/types/content_type_id/draft/PUBLISH/ContentType.xml.example', - ], 'application/vnd.ibexa.api.ContentType+json' => [ 'schema' => [ '$ref' => '#/components/schemas/ContentTypeWrapper', ], 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/content/types/content_type_id/GET/ContentType.json.example', ], + 'application/vnd.ibexa.api.ContentType+xml' => [ + 'schema' => [ + '$ref' => '#/components/schemas/ContentType', + ], + 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/content/types/content_type_id/draft/PUBLISH/ContentType.xml.example', + ], ], ], Response::HTTP_UNAUTHORIZED => [ diff --git a/src/lib/Server/Controller/ContentType/ContentTypeDraftUpdateController.php b/src/lib/Server/Controller/ContentType/ContentTypeDraftUpdateController.php index c5fac48f4..014dadd91 100644 --- a/src/lib/Server/Controller/ContentType/ContentTypeDraftUpdateController.php +++ b/src/lib/Server/Controller/ContentType/ContentTypeDraftUpdateController.php @@ -26,6 +26,7 @@ uriTemplate: '/content/types/{contentTypeId}/draft', extraProperties: [OpenApiFactory::OVERRIDE_OPENAPI_RESPONSES => false], openapi: new Model\Operation( + operationId: 'ibexa.rest.update_content_type_draft', summary: 'Update content type draft', description: 'Updates metadata of a draft. This method does not handle Field definitions. PATCH or POST with header X-HTTP-Method-Override PATCH.', tags: [ @@ -33,19 +34,10 @@ ], parameters: [ new Model\Parameter( - name: 'Accept', + name: 'X-CSRF-Token', in: 'header', required: true, - description: 'If set, the new content type draft is returned in XML or JSON format.', - schema: [ - 'type' => 'string', - ], - ), - new Model\Parameter( - name: 'Content-Type', - in: 'header', - required: true, - description: 'The content type update schema encoded in XML or JSON format.', + description: 'The CSRF Token needed on all unsafe HTTP methods with session.', schema: [ 'type' => 'string', ], @@ -60,18 +52,19 @@ ), ], requestBody: new Model\RequestBody( + description: 'The content type update schema encoded in XML or JSON format.', content: new \ArrayObject([ - 'application/vnd.ibexa.api.ContentTypeUpdate+xml' => [ + 'application/vnd.ibexa.api.ContentTypeUpdate+json' => [ 'schema' => [ - '$ref' => '#/components/schemas/ContentTypeUpdate', + '$ref' => '#/components/schemas/ContentTypeUpdateWrapper', ], - 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/content/types/content_type_id/POST/ContentTypeUpdate.xml.example', + 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/content/types/content_type_id/draft/PATCH/ContentTypeUpdate.json.example', ], - 'application/vnd.ibexa.api.ContentTypeUpdate+json' => [ + 'application/vnd.ibexa.api.ContentTypeUpdate+xml' => [ 'schema' => [ - '$ref' => '#/components/schemas/ContentTypeUpdateWrapper', + '$ref' => '#/components/schemas/ContentTypeUpdate', ], - 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/content/types/content_type_id/POST/ContentTypeUpdate.json.example', + 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/content/types/content_type_id/draft/PATCH/ContentTypeUpdate.xml.example', ], ]), ), @@ -79,18 +72,18 @@ Response::HTTP_OK => [ 'description' => 'Draft metadata updated.', 'content' => [ - 'application/vnd.ibexa.api.ContentTypeInfo+xml' => [ - 'schema' => [ - '$ref' => '#/components/schemas/ContentTypeInfo', - ], - 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/content/types/content_type_id/draft/PATCH/ContentTypeInfo.xml.example', - ], 'application/vnd.ibexa.api.ContentTypeInfo+json' => [ 'schema' => [ '$ref' => '#/components/schemas/ContentTypeInfoWrapper', ], 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/content/types/content_type_id/draft/PATCH/ContentTypeInfo.json.example', ], + 'application/vnd.ibexa.api.ContentTypeInfo+xml' => [ + 'schema' => [ + '$ref' => '#/components/schemas/ContentTypeInfo', + ], + 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/content/types/content_type_id/draft/PATCH/ContentTypeInfo.xml.example', + ], ], ], Response::HTTP_BAD_REQUEST => [ diff --git a/src/lib/Server/Controller/ContentType/ContentTypeFieldDefinitionListController.php b/src/lib/Server/Controller/ContentType/ContentTypeFieldDefinitionListController.php index a91b268c5..30996e574 100644 --- a/src/lib/Server/Controller/ContentType/ContentTypeFieldDefinitionListController.php +++ b/src/lib/Server/Controller/ContentType/ContentTypeFieldDefinitionListController.php @@ -18,21 +18,13 @@ #[Get( uriTemplate: '/content/types/{contentTypeId}/fieldDefinitions', openapi: new Model\Operation( + operationId: 'ibexa.rest.load_content_type_field_definition_list', summary: 'Get Field definition list', description: 'Returns all Field definitions of the provided content type.', tags: [ 'Type', ], parameters: [ - new Model\Parameter( - name: 'Accept', - in: 'header', - required: true, - description: 'If set, the Field definitions are returned in XML or JSON format.', - schema: [ - 'type' => 'string', - ], - ), new Model\Parameter( name: 'contentTypeId', in: 'path', @@ -46,14 +38,14 @@ Response::HTTP_OK => [ 'description' => 'OK - return a list of Field definitions.', 'content' => [ - 'application/vnd.ibexa.api.FieldDefinitionList+xml' => [ + 'application/vnd.ibexa.api.FieldDefinitionList+json' => [ 'schema' => [ - '$ref' => '#/components/schemas/FieldDefinitions', + '$ref' => '#/components/schemas/FieldDefinitionsWrapper', ], ], - 'application/vnd.ibexa.api.FieldDefinitionList+json' => [ + 'application/vnd.ibexa.api.FieldDefinitionList+xml' => [ 'schema' => [ - '$ref' => '#/components/schemas/FieldDefinitionsWrapper', + '$ref' => '#/components/schemas/FieldDefinitions', ], ], ], diff --git a/src/lib/Server/Controller/ContentType/ContentTypeFieldDefinitionLoadByIdController.php b/src/lib/Server/Controller/ContentType/ContentTypeFieldDefinitionLoadByIdController.php index 731fde1d4..716804949 100644 --- a/src/lib/Server/Controller/ContentType/ContentTypeFieldDefinitionLoadByIdController.php +++ b/src/lib/Server/Controller/ContentType/ContentTypeFieldDefinitionLoadByIdController.php @@ -20,21 +20,13 @@ #[Get( uriTemplate: '/content/types/{contentTypeId}/fieldDefinitions/{fieldDefinitionId}', openapi: new Model\Operation( + operationId: 'ibexa.rest.load_content_type_field_definition', summary: 'Get Field definition', description: 'Returns the Field definition by the given ID.', tags: [ 'Type', ], parameters: [ - new Model\Parameter( - name: 'Accept', - in: 'header', - required: true, - description: 'If set, the Field definition is returned in XML or JSON format.', - schema: [ - 'type' => 'string', - ], - ), new Model\Parameter( name: 'contentTypeId', in: 'path', @@ -56,18 +48,18 @@ Response::HTTP_OK => [ 'description' => 'OK - returns the Field definition.', 'content' => [ - 'application/vnd.ibexa.api.FieldDefinition+xml' => [ - 'schema' => [ - '$ref' => '#/components/schemas/FieldDefinition', - ], - 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/content/types/content_type_id/field_definition_id/GET/FieldDefinition.xml.example', - ], 'application/vnd.ibexa.api.FieldDefinition+json' => [ 'schema' => [ '$ref' => '#/components/schemas/FieldDefinitionWrapper', ], 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/content/types/content_type_id/field_definition_id/GET/FieldDefinition.json.example', ], + 'application/vnd.ibexa.api.FieldDefinition+xml' => [ + 'schema' => [ + '$ref' => '#/components/schemas/FieldDefinition', + ], + 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/content/types/content_type_id/field_definition_id/GET/FieldDefinition.xml.example', + ], ], ], Response::HTTP_UNAUTHORIZED => [ diff --git a/src/lib/Server/Controller/ContentType/ContentTypeGroupCreateController.php b/src/lib/Server/Controller/ContentType/ContentTypeGroupCreateController.php index 4aefd9f1f..bfba3e852 100644 --- a/src/lib/Server/Controller/ContentType/ContentTypeGroupCreateController.php +++ b/src/lib/Server/Controller/ContentType/ContentTypeGroupCreateController.php @@ -24,6 +24,7 @@ uriTemplate: '/content/typegroups', extraProperties: [OpenApiFactory::OVERRIDE_OPENAPI_RESPONSES => false], openapi: new Model\Operation( + operationId: 'ibexa.rest.create_content_type_group', summary: 'Create content type group', description: 'Creates a new content type group.', tags: [ @@ -31,55 +32,47 @@ ], parameters: [ new Model\Parameter( - name: 'Accept', + name: 'X-CSRF-Token', in: 'header', required: true, - description: 'If set, the new content type group is returned in XML or JSON format.', - schema: [ - 'type' => 'string', - ], - ), - new Model\Parameter( - name: 'Content-Type', - in: 'header', - required: true, - description: 'The content type group input schema encoded in XML or JSON.', + description: 'The CSRF Token needed on all unsafe HTTP methods with session.', schema: [ 'type' => 'string', ], ), ], requestBody: new Model\RequestBody( + description: 'The content type group input schema encoded in XML or JSON.', content: new \ArrayObject([ - 'application/vnd.ibexa.api.ContentTypeGroupInput+xml' => [ - 'schema' => [ - '$ref' => '#/components/schemas/ContentTypeGroupInput', - ], - 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/content/typegroups/POST/ContentTypeGroupInput.xml.example', - ], 'application/vnd.ibexa.api.ContentTypeGroupInput+json' => [ 'schema' => [ '$ref' => '#/components/schemas/ContentTypeGroupInputWrapper', ], 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/content/typegroups/POST/ContentTypeGroupInput.json.example', ], + 'application/vnd.ibexa.api.ContentTypeGroupInput+xml' => [ + 'schema' => [ + '$ref' => '#/components/schemas/ContentTypeGroupInput', + ], + 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/content/typegroups/POST/ContentTypeGroupInput.xml.example', + ], ]), ), responses: [ Response::HTTP_CREATED => [ 'description' => 'Content type group created.', 'content' => [ - 'application/vnd.ibexa.api.ContentTypeGroup+xml' => [ + 'application/vnd.ibexa.api.ContentTypeGroup+json' => [ 'schema' => [ - '$ref' => '#/components/schemas/ContentTypeGroup', + '$ref' => '#/components/schemas/ContentTypeGroupWrapper', ], - 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/content/typegroups/POST/ContentTypeGroup.xml.example', + 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/content/typegroups/POST/ContentTypeGroup.json.example', ], - 'application/vnd.ibexa.api.ContentTypeGroup+json' => [ + 'application/vnd.ibexa.api.ContentTypeGroup+xml' => [ 'schema' => [ - '$ref' => '#/components/schemas/ContentTypeGroupWrapper', + '$ref' => '#/components/schemas/ContentTypeGroup', ], - 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/content/typegroups/content_type_group_id/PATCH/ContentTypeGroup.json.example', + 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/content/typegroups/POST/ContentTypeGroup.xml.example', ], ], ], diff --git a/src/lib/Server/Controller/ContentType/ContentTypeGroupDeleteController.php b/src/lib/Server/Controller/ContentType/ContentTypeGroupDeleteController.php index 3c0ebfd3f..c96c35f97 100644 --- a/src/lib/Server/Controller/ContentType/ContentTypeGroupDeleteController.php +++ b/src/lib/Server/Controller/ContentType/ContentTypeGroupDeleteController.php @@ -18,12 +18,22 @@ #[Delete( uriTemplate: '/content/typegroups/{contentTypeGroupId}', openapi: new Model\Operation( + operationId: 'ibexa.rest.delete_content_type_group', summary: 'Delete content type group', description: 'Deletes the provided content type group.', tags: [ 'Type Groups', ], parameters: [ + new Model\Parameter( + name: 'X-CSRF-Token', + in: 'header', + required: true, + description: 'The CSRF Token needed on all unsafe HTTP methods with session.', + schema: [ + 'type' => 'string', + ], + ), new Model\Parameter( name: 'contentTypeGroupId', in: 'path', diff --git a/src/lib/Server/Controller/ContentType/ContentTypeGroupListController.php b/src/lib/Server/Controller/ContentType/ContentTypeGroupListController.php index 9cf5fa318..f5dea372b 100644 --- a/src/lib/Server/Controller/ContentType/ContentTypeGroupListController.php +++ b/src/lib/Server/Controller/ContentType/ContentTypeGroupListController.php @@ -18,21 +18,13 @@ #[Get( uriTemplate: '/content/types/{contentTypeId}/groups', openapi: new Model\Operation( + operationId: 'ibexa.rest.load_groups_of_content_type', summary: 'Get groups of content type', description: 'Returns the content type group to which content type belongs to.', tags: [ 'Type', ], parameters: [ - new Model\Parameter( - name: 'Accept', - in: 'header', - required: true, - description: 'If set, the content type group list is returned in XML or JSON format.', - schema: [ - 'type' => 'string', - ], - ), new Model\Parameter( name: 'contentTypeId', in: 'path', @@ -44,18 +36,19 @@ ], responses: [ Response::HTTP_OK => [ + 'description' => 'If set, the content type group list is returned in XML or JSON format.', 'content' => [ - 'application/vnd.ibexa.api.ContentTypeGroupRefList+xml' => [ + 'application/vnd.ibexa.api.ContentTypeGroupRefList+json' => [ 'schema' => [ - '$ref' => '#/components/schemas/ContentTypeGroupRefList', + '$ref' => '#/components/schemas/ContentTypeGroupRefListWrapper', ], - 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/content/types/content_type_id/groups/id/DELETE/ContentTypeGroupRefList.xml.example', + 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/content/types/content_type_id/groups/GET/ContentTypeGroupRefList.json.example', ], - 'application/vnd.ibexa.api.ContentTypeGroupRefList+json' => [ + 'application/vnd.ibexa.api.ContentTypeGroupRefList+xml' => [ 'schema' => [ - '$ref' => '#/components/schemas/ContentTypeGroupRefListWrapper', + '$ref' => '#/components/schemas/ContentTypeGroupRefList', ], - 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/content/types/content_type_id/groups/id/DELETE/ContentTypeGroupRefList.json.example', + 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/content/types/content_type_id/groups/GET/ContentTypeGroupRefList.xml.example', ], ], ], diff --git a/src/lib/Server/Controller/ContentType/ContentTypeGroupLoadByIdController.php b/src/lib/Server/Controller/ContentType/ContentTypeGroupLoadByIdController.php index ba9aefe43..27d6410c0 100644 --- a/src/lib/Server/Controller/ContentType/ContentTypeGroupLoadByIdController.php +++ b/src/lib/Server/Controller/ContentType/ContentTypeGroupLoadByIdController.php @@ -18,25 +18,17 @@ #[Get( uriTemplate: '/content/typegroups/{contentTypeGroupId}', openapi: new Model\Operation( + operationId: 'ibexa.rest.load_content_type_group', summary: 'Get content type group', description: 'Returns the content type group with provided ID.', tags: [ 'Type Groups', ], parameters: [ - new Model\Parameter( - name: 'Accept', - in: 'header', - required: true, - description: 'If set, the content type group is returned in XML or JSON format.', - schema: [ - 'type' => 'string', - ], - ), new Model\Parameter( name: 'If-None-Match', in: 'header', - required: true, + required: false, description: 'ETag', schema: [ 'type' => 'string', @@ -55,17 +47,17 @@ Response::HTTP_OK => [ 'description' => 'OK - returns the content type group.', 'content' => [ - 'application/vnd.ibexa.api.ContentTypeGroup+xml' => [ + 'application/vnd.ibexa.api.ContentTypeGroup+json' => [ 'schema' => [ - '$ref' => '#/components/schemas/ContentTypeList', + '$ref' => '#/components/schemas/ContentTypeListWrapper', ], - 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/content/types/GET/ContentTypeInfoList.xml.example', + 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/content/typegroups/content_type_group_id/GET/ContentTypeGroup.json.example', ], - 'application/vnd.ibexa.api.ContentTypeGroup+json' => [ + 'application/vnd.ibexa.api.ContentTypeGroup+xml' => [ 'schema' => [ - '$ref' => '#/components/schemas/ContentTypeListWrapper', + '$ref' => '#/components/schemas/ContentTypeList', ], - 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/content/types/GET/ContentTypeInfoList.json.example', + 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/content/typegroups/content_type_group_id/GET/ContentTypeGroup.xml.example', ], ], ], diff --git a/src/lib/Server/Controller/ContentType/ContentTypeGroupUpdateController.php b/src/lib/Server/Controller/ContentType/ContentTypeGroupUpdateController.php index 467d64964..bffb892a3 100644 --- a/src/lib/Server/Controller/ContentType/ContentTypeGroupUpdateController.php +++ b/src/lib/Server/Controller/ContentType/ContentTypeGroupUpdateController.php @@ -27,6 +27,7 @@ uriTemplate: '/content/typegroups/{contentTypeGroupId}', extraProperties: [OpenApiFactory::OVERRIDE_OPENAPI_RESPONSES => false], openapi: new Model\Operation( + operationId: 'ibexa.rest.update_content_type_group', summary: 'Update content type group', description: 'Updates a content type group. PATCH or POST with header X-HTTP-Method-Override PATCH.', tags: [ @@ -34,19 +35,10 @@ ], parameters: [ new Model\Parameter( - name: 'Accept', + name: 'X-CSRF-Token', in: 'header', required: true, - description: 'If set, the updated content type group is returned in XML or JSON format.', - schema: [ - 'type' => 'string', - ], - ), - new Model\Parameter( - name: 'Content-Type', - in: 'header', - required: true, - description: 'The content type group input schema encoded in XML or JSON format.', + description: 'The CSRF Token needed on all unsafe HTTP methods with session.', schema: [ 'type' => 'string', ], @@ -70,18 +62,19 @@ ), ], requestBody: new Model\RequestBody( + description: 'The content type group input schema encoded in XML or JSON format.', content: new \ArrayObject([ - 'application/vnd.ibexa.api.ContentTypeGroupInput+xml' => [ + 'application/vnd.ibexa.api.ContentTypeGroupInput+json' => [ 'schema' => [ - '$ref' => '#/components/schemas/ContentTypeGroupInput', + '$ref' => '#/components/schemas/ContentTypeGroupInputWrapper', ], - 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/content/typegroups/POST/ContentTypeGroupInput.xml.example', + 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/content/typegroups/content_type_group_id/PATCH/ContentTypeGroupInput.json.example', ], - 'application/vnd.ibexa.api.ContentTypeGroupInput+json' => [ + 'application/vnd.ibexa.api.ContentTypeGroupInput+xml' => [ 'schema' => [ - '$ref' => '#/components/schemas/ContentTypeGroupInputWrapper', + '$ref' => '#/components/schemas/ContentTypeGroupInput', ], - 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/content/typegroups/POST/ContentTypeGroupInput.json.example', + 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/content/typegroups/content_type_group_id/PATCH/ContentTypeGroupInput.xml.example', ], ]), ), @@ -89,18 +82,18 @@ Response::HTTP_OK => [ 'description' => 'Content type group updated.', 'content' => [ - 'application/vnd.ibexa.api.ContentTypeGroup+xml' => [ - 'schema' => [ - '$ref' => '#/components/schemas/ContentTypeGroup', - ], - 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/content/typegroups/POST/ContentTypeGroup.xml.example', - ], 'application/vnd.ibexa.api.ContentTypeGroup+json' => [ 'schema' => [ '$ref' => '#/components/schemas/ContentTypeGroupWrapper', ], 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/content/typegroups/content_type_group_id/PATCH/ContentTypeGroup.json.example', ], + 'application/vnd.ibexa.api.ContentTypeGroup+xml' => [ + 'schema' => [ + '$ref' => '#/components/schemas/ContentTypeGroup', + ], + 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/content/typegroups/content_type_group_id/PATCH/ContentTypeGroup.xml.example', + ], ], ], Response::HTTP_BAD_REQUEST => [ diff --git a/src/lib/Server/Controller/ContentType/ContentTypeGroupsListController.php b/src/lib/Server/Controller/ContentType/ContentTypeGroupsListController.php index 24b3767da..90a6451a9 100644 --- a/src/lib/Server/Controller/ContentType/ContentTypeGroupsListController.php +++ b/src/lib/Server/Controller/ContentType/ContentTypeGroupsListController.php @@ -19,38 +19,28 @@ #[Get( uriTemplate: '/content/typegroups', openapi: new Model\Operation( + operationId: 'ibexa.rest.load_content_type_group_list', summary: 'Get content type groups', description: 'Returns a list of all content type groups. If an identifier is provided, loads the content type group for this identifier.', tags: [ 'Type Groups', ], - parameters: [ - new Model\Parameter( - name: 'Accept', - in: 'header', - required: true, - description: 'If set, the content type group list is returned in XML or JSON format.', - schema: [ - 'type' => 'string', - ], - ), - ], responses: [ Response::HTTP_OK => [ 'description' => 'OK - returns a list of content type groups.', 'content' => [ - 'application/vnd.ibexa.api.ContentTypeGroupList+xml' => [ - 'schema' => [ - '$ref' => '#/components/schemas/ContentTypeGroupList', - ], - 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/content/typegroups/GET/ContentTypeGroupList.xml.example', - ], 'application/vnd.ibexa.api.ContentTypeGroupList+json' => [ 'schema' => [ '$ref' => '#/components/schemas/ContentTypeGroupListWrapper', ], 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/content/typegroups/GET/ContentTypeGroupList.json.example', ], + 'application/vnd.ibexa.api.ContentTypeGroupList+xml' => [ + 'schema' => [ + '$ref' => '#/components/schemas/ContentTypeGroupList', + ], + 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/content/typegroups/GET/ContentTypeGroupList.xml.example', + ], ], ], Response::HTTP_TEMPORARY_REDIRECT => [ diff --git a/src/lib/Server/Controller/ContentType/ContentTypeLinkToGroupController.php b/src/lib/Server/Controller/ContentType/ContentTypeLinkToGroupController.php index 9342f30a7..33b3c6be6 100644 --- a/src/lib/Server/Controller/ContentType/ContentTypeLinkToGroupController.php +++ b/src/lib/Server/Controller/ContentType/ContentTypeLinkToGroupController.php @@ -23,6 +23,7 @@ uriTemplate: '/content/types/{contentTypeId}/groups', extraProperties: [OpenApiFactory::OVERRIDE_OPENAPI_RESPONSES => false], openapi: new Model\Operation( + operationId: 'ibexa.rest.link_content_type_to_group', summary: 'Link group to content type', description: 'Links a content type group to the content type and returns the updated group list.', tags: [ @@ -30,10 +31,10 @@ ], parameters: [ new Model\Parameter( - name: 'Accept', + name: 'X-CSRF-Token', in: 'header', required: true, - description: 'If set, the updated content type group list is returned in XML or JSON format.', + description: 'The CSRF Token needed on all unsafe HTTP methods with session.', schema: [ 'type' => 'string', ], @@ -46,22 +47,36 @@ 'type' => 'string', ], ), + new Model\Parameter( + name: 'group', + in: 'query', + required: true, + schema: [ + 'type' => 'string', + ], + description: 'Destination content type group URI; for example with content type group 4: `?group=/api/ibexa/v2/content/typegroups/4`', + ), ], + requestBody: new Model\RequestBody( + description: 'No payload required', + content: new \ArrayObject(), + ), responses: [ Response::HTTP_OK => [ + 'description' => 'If set, the updated content type group list is returned in XML or JSON format.', 'content' => [ - 'application/vnd.ibexa.api.ContentTypeGroupRefList+xml' => [ - 'schema' => [ - '$ref' => '#/components/schemas/ContentTypeGroupRefList', - ], - 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/content/types/content_type_id/groups/id/DELETE/ContentTypeGroupRefList.xml.example', - ], 'application/vnd.ibexa.api.ContentTypeGroupRefList+json' => [ 'schema' => [ '$ref' => '#/components/schemas/ContentTypeGroupRefListWrapper', ], 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/content/types/content_type_id/groups/id/DELETE/ContentTypeGroupRefList.json.example', ], + 'application/vnd.ibexa.api.ContentTypeGroupRefList+xml' => [ + 'schema' => [ + '$ref' => '#/components/schemas/ContentTypeGroupRefList', + ], + 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/content/types/content_type_id/groups/POST/ContentTypeGroupRefList.xml.example', + ], ], ], Response::HTTP_BAD_REQUEST => [ @@ -74,9 +89,6 @@ 'description' => 'Error - The content type is already assigned to the group.', ], ], - requestBody: new Model\RequestBody( - content: new \ArrayObject(), - ), ), )] class ContentTypeLinkToGroupController extends RestController diff --git a/src/lib/Server/Controller/ContentType/ContentTypeListController.php b/src/lib/Server/Controller/ContentType/ContentTypeListController.php index bf01e189e..1787067ef 100644 --- a/src/lib/Server/Controller/ContentType/ContentTypeListController.php +++ b/src/lib/Server/Controller/ContentType/ContentTypeListController.php @@ -25,48 +25,38 @@ uriTemplate: '/content/types', extraProperties: [OpenApiFactory::OVERRIDE_OPENAPI_RESPONSES => false], openapi: new Model\Operation( + operationId: 'ibexa.rest.list_content_types', summary: 'List content types', description: 'Returns a list of content types.', tags: [ 'Type', ], - parameters: [ - new Model\Parameter( - name: 'Accept', - in: 'header', - required: true, - description: 'If set, the list of content type info objects or content types (including Field definitions) is returned in XML or JSON format.', - schema: [ - 'type' => 'string', - ], - ), - ], responses: [ Response::HTTP_OK => [ 'description' => 'OK - returns a list of content types.', 'content' => [ - 'application/vnd.ibexa.api.ContentTypeInfoList+xml' => [ - 'schema' => [ - '$ref' => '#/components/schemas/ContentTypeInfoList', - ], - 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/content/types/GET/ContentTypeInfoList.xml.example', - ], 'application/vnd.ibexa.api.ContentTypeInfoList+json' => [ 'schema' => [ '$ref' => '#/components/schemas/ContentTypeInfoListWrapper', ], 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/content/types/GET/ContentTypeInfoList.json.example', ], - 'application/vnd.ibexa.api.ContentTypeList+xml' => [ + 'application/vnd.ibexa.api.ContentTypeInfoList+xml' => [ 'schema' => [ - '$ref' => '#/components/schemas/ContentTypeList', + '$ref' => '#/components/schemas/ContentTypeInfoList', ], + 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/content/types/GET/ContentTypeInfoList.xml.example', ], 'application/vnd.ibexa.api.ContentTypeList+json' => [ 'schema' => [ '$ref' => '#/components/schemas/ContentTypeListWrapper', ], ], + 'application/vnd.ibexa.api.ContentTypeList+xml' => [ + 'schema' => [ + '$ref' => '#/components/schemas/ContentTypeList', + ], + ], ], ], Response::HTTP_UNAUTHORIZED => [ diff --git a/src/lib/Server/Controller/ContentType/ContentTypeListForGroupController.php b/src/lib/Server/Controller/ContentType/ContentTypeListForGroupController.php index 20723377b..0355aaaac 100644 --- a/src/lib/Server/Controller/ContentType/ContentTypeListForGroupController.php +++ b/src/lib/Server/Controller/ContentType/ContentTypeListForGroupController.php @@ -22,21 +22,13 @@ uriTemplate: '/content/typegroups/{contentTypeGroupId}/types', extraProperties: [OpenApiFactory::OVERRIDE_OPENAPI_RESPONSES => false], openapi: new Model\Operation( + operationId: 'ibexa.rest.list_content_types_for_group', summary: 'List content types for group', description: 'Returns a list of content types in the provided group.', tags: [ 'Type Groups', ], parameters: [ - new Model\Parameter( - name: 'Accept', - in: 'header', - required: true, - description: 'If set, the list of content type info objects or content types (including Field definitions) is returned in XML or JSON format.', - schema: [ - 'type' => 'string', - ], - ), new Model\Parameter( name: 'contentTypeGroupId', in: 'path', @@ -50,15 +42,21 @@ Response::HTTP_OK => [ 'description' => 'OK - returns a list on content types.', 'content' => [ + 'application/vnd.ibexa.api.ContentTypeInfoList+json' => [ + 'schema' => [ + '$ref' => '#/components/schemas/ContentTypeInfoListWrapper', + ], + 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/content/typegroups/content_type_group_id/types/GET/ContentTypeInfoList.json.example', + ], 'application/vnd.ibexa.api.ContentTypeInfoList+xml' => [ 'schema' => [ '$ref' => '#/components/schemas/ContentTypeInfoList', ], 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/content/typegroups/content_type_group_id/types/GET/ContentTypeInfoList.xml.example', ], - 'application/vnd.ibexa.api.ContentTypeInfoList+json' => [ + 'application/vnd.ibexa.api.ContentTypeList+json' => [ 'schema' => [ - '$ref' => '#/components/schemas/ContentTypeInfoListWrapper', + '$ref' => '#/components/schemas/ContentTypeListWrapper', ], 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/content/types/GET/ContentTypeInfoList.json.example', ], @@ -66,13 +64,7 @@ 'schema' => [ '$ref' => '#/components/schemas/ContentTypeList', ], - 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/content/types/GET/ContentTypeInfoList.xml.example', - ], - 'application/vnd.ibexa.api.ContentTypeList+json' => [ - 'schema' => [ - '$ref' => '#/components/schemas/ContentTypeListWrapper', - ], - 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/content/types/GET/ContentTypeInfoList.json.example', + 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/content/typegroups/content_type_group_id/types/GET/ContentTypeList.xml.example', ], ], ], diff --git a/src/lib/Server/Controller/ContentType/ContentTypeLoadByIdController.php b/src/lib/Server/Controller/ContentType/ContentTypeLoadByIdController.php index 66544e256..8415612b9 100644 --- a/src/lib/Server/Controller/ContentType/ContentTypeLoadByIdController.php +++ b/src/lib/Server/Controller/ContentType/ContentTypeLoadByIdController.php @@ -18,25 +18,17 @@ #[Get( uriTemplate: '/content/types/{contentTypeId}', openapi: new Model\Operation( + operationId: 'ibexa.rest.load_content_type', summary: 'Get content type', description: 'Returns the content type with the provided ID.', tags: [ 'Type', ], parameters: [ - new Model\Parameter( - name: 'Accept', - in: 'header', - required: true, - description: 'If set, the content type is returned in XML or JSON format.', - schema: [ - 'type' => 'string', - ], - ), new Model\Parameter( name: 'If-None-Match', in: 'header', - required: true, + required: false, description: 'ETag', schema: [ 'type' => 'string', @@ -55,18 +47,18 @@ Response::HTTP_OK => [ 'description' => 'OK - returns the content type.', 'content' => [ - 'application/vnd.ibexa.api.ContentType+xml' => [ - 'schema' => [ - '$ref' => '#/components/schemas/ContentType', - ], - 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/content/types/content_type_id/draft/PUBLISH/ContentType.xml.example', - ], 'application/vnd.ibexa.api.ContentType+json' => [ 'schema' => [ '$ref' => '#/components/schemas/ContentTypeWrapper', ], 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/content/types/content_type_id/GET/ContentType.json.example', ], + 'application/vnd.ibexa.api.ContentType+xml' => [ + 'schema' => [ + '$ref' => '#/components/schemas/ContentType', + ], + 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/content/types/content_type_id/GET/ContentType.xml.example', + ], ], ], Response::HTTP_UNAUTHORIZED => [ diff --git a/src/lib/Server/Controller/ContentType/ContentTypeUnlinkFromGroupController.php b/src/lib/Server/Controller/ContentType/ContentTypeUnlinkFromGroupController.php index fb54162b7..175cfa95d 100644 --- a/src/lib/Server/Controller/ContentType/ContentTypeUnlinkFromGroupController.php +++ b/src/lib/Server/Controller/ContentType/ContentTypeUnlinkFromGroupController.php @@ -19,6 +19,7 @@ #[Delete( uriTemplate: '/content/types/{contentTypeId}/groups/{id}', openapi: new Model\Operation( + operationId: 'ibexa.rest.unlink_content_type_from_group', summary: 'Unlink group from content type', description: 'Removes the given group from the content type and returns the updated group list.', tags: [ @@ -26,10 +27,10 @@ ], parameters: [ new Model\Parameter( - name: 'Accept', + name: 'X-CSRF-Token', in: 'header', required: true, - description: 'If set, the updated content type group list is returned in XML or JSON format.', + description: 'The CSRF Token needed on all unsafe HTTP methods with session.', schema: [ 'type' => 'string', ], @@ -53,19 +54,20 @@ ], responses: [ Response::HTTP_OK => [ + 'description' => 'If set, the updated content type group list is returned in XML or JSON format.', 'content' => [ - 'application/vnd.ibexa.api.ContentTypeGroupRefList+xml' => [ - 'schema' => [ - '$ref' => '#/components/schemas/ContentTypeGroupRefList', - ], - 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/content/types/content_type_id/groups/id/DELETE/ContentTypeGroupRefList.xml.example', - ], 'application/vnd.ibexa.api.ContentTypeGroupRefList+json' => [ 'schema' => [ '$ref' => '#/components/schemas/ContentTypeGroupRefListWrapper', ], 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/content/types/content_type_id/groups/id/DELETE/ContentTypeGroupRefList.json.example', ], + 'application/vnd.ibexa.api.ContentTypeGroupRefList+xml' => [ + 'schema' => [ + '$ref' => '#/components/schemas/ContentTypeGroupRefList', + ], + 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/content/types/content_type_id/groups/id/DELETE/ContentTypeGroupRefList.xml.example', + ], ], ], Response::HTTP_UNAUTHORIZED => [ diff --git a/src/lib/Server/Controller/JWT.php b/src/lib/Server/Controller/JWT.php index 9ad54d68a..4d76e5bd6 100644 --- a/src/lib/Server/Controller/JWT.php +++ b/src/lib/Server/Controller/JWT.php @@ -19,6 +19,7 @@ uriTemplate: '/user/token/jwt', extraProperties: [OpenApiFactory::OVERRIDE_OPENAPI_RESPONSES => false], openapi: new Model\Operation( + operationId: 'ibexa.rest.create_token', summary: 'Create JWT token', description: 'Creates JWT authentication token.', tags: [ diff --git a/src/lib/Server/Controller/Language/LanguageListController.php b/src/lib/Server/Controller/Language/LanguageListController.php index 98526e027..c641ca566 100644 --- a/src/lib/Server/Controller/Language/LanguageListController.php +++ b/src/lib/Server/Controller/Language/LanguageListController.php @@ -21,37 +21,28 @@ uriTemplate: '/languages', extraProperties: [OpenApiFactory::OVERRIDE_OPENAPI_RESPONSES => false], openapi: new Model\Operation( + operationId: 'ibexa.rest.languages.list', summary: 'Language list', description: 'Lists languages', tags: [ 'Language', ], - parameters: [ - new Model\Parameter( - name: 'Accept', - in: 'header', - required: true, - description: 'If set, the list is returned in XML or JSON format.', - schema: [ - 'type' => 'string', - ], - ), - ], responses: [ Response::HTTP_OK => [ + 'description' => 'If set, the list is returned in XML or JSON format.', 'content' => [ - 'application/vnd.ibexa.api.LanguageList+xml' => [ - 'schema' => [ - '$ref' => '#/components/schemas/LanguageList', - ], - 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/languages/GET/LanguageList.xml.example', - ], 'application/vnd.ibexa.api.LanguageList+json' => [ 'schema' => [ '$ref' => '#/components/schemas/LanguageListWrapper', ], 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/languages/GET/LanguageList.json.example', ], + 'application/vnd.ibexa.api.LanguageList+xml' => [ + 'schema' => [ + '$ref' => '#/components/schemas/LanguageList', + ], + 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/languages/GET/LanguageList.xml.example', + ], ], ], ], diff --git a/src/lib/Server/Controller/Language/LanguageLoadByIdController.php b/src/lib/Server/Controller/Language/LanguageLoadByIdController.php index 715960226..ba4b6b2f4 100644 --- a/src/lib/Server/Controller/Language/LanguageLoadByIdController.php +++ b/src/lib/Server/Controller/Language/LanguageLoadByIdController.php @@ -20,20 +20,12 @@ uriTemplate: '/languages/{code}', extraProperties: [OpenApiFactory::OVERRIDE_OPENAPI_RESPONSES => false], openapi: new Model\Operation( + operationId: 'ibexa.rest.languages.view', summary: 'Get language', tags: [ 'Language', ], parameters: [ - new Model\Parameter( - name: 'Accept', - in: 'header', - required: true, - description: 'If set, the language is returned in XML or JSON format.', - schema: [ - 'type' => 'string', - ], - ), new Model\Parameter( name: 'code', in: 'path', @@ -45,19 +37,20 @@ ], responses: [ Response::HTTP_OK => [ + 'description' => 'If set, the language is returned in XML or JSON format.', 'content' => [ - 'application/vnd.ibexa.api.Language+xml' => [ - 'schema' => [ - '$ref' => '#/components/schemas/Language', - ], - 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/languages/code/GET/Language.xml.example', - ], 'application/vnd.ibexa.api.Language+json' => [ 'schema' => [ '$ref' => '#/components/schemas/LanguageWrapper', ], 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/languages/code/GET/Language.json.example', ], + 'application/vnd.ibexa.api.Language+xml' => [ + 'schema' => [ + '$ref' => '#/components/schemas/Language', + ], + 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/languages/code/GET/Language.xml.example', + ], ], ], ], diff --git a/src/lib/Server/Controller/Location/LocationChildrenListController.php b/src/lib/Server/Controller/Location/LocationChildrenListController.php index 2b0d9ba58..a0cb5aa5d 100644 --- a/src/lib/Server/Controller/Location/LocationChildrenListController.php +++ b/src/lib/Server/Controller/Location/LocationChildrenListController.php @@ -16,21 +16,13 @@ #[Get( uriTemplate: '/content/locations/{path}/children', openapi: new Model\Operation( + operationId: 'ibexa.rest.load_location_children', summary: 'Get child Locations.', description: 'Loads all child Locations for the given parent Location.', tags: [ 'Location', ], parameters: [ - new Model\Parameter( - name: 'Accept', - in: 'header', - required: true, - description: 'If set, the new Location list is returned in XML or JSON format.', - schema: [ - 'type' => 'string', - ], - ), new Model\Parameter( name: 'path', in: 'path', @@ -42,17 +34,18 @@ ], responses: [ Response::HTTP_OK => [ + 'description' => 'If set, the new Location list is returned in XML or JSON format.', 'content' => [ - 'application/vnd.ibexa.api.LocationList+xml' => [ + 'application/vnd.ibexa.api.LocationList+json' => [ 'schema' => [ - '$ref' => '#/components/schemas/LocationList', + '$ref' => '#/components/schemas/LocationListWrapper', ], - 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/content/objects/content_id/locations/GET/LocationList.xml.example', ], - 'application/vnd.ibexa.api.LocationList+json' => [ + 'application/vnd.ibexa.api.LocationList+xml' => [ 'schema' => [ - '$ref' => '#/components/schemas/LocationListWrapper', + '$ref' => '#/components/schemas/LocationList', ], + 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/content/locations/path/children/GET/LocationList.xml.example', ], ], ], diff --git a/src/lib/Server/Controller/Location/LocationCreateController.php b/src/lib/Server/Controller/Location/LocationCreateController.php index fb3698274..9128a8ee5 100644 --- a/src/lib/Server/Controller/Location/LocationCreateController.php +++ b/src/lib/Server/Controller/Location/LocationCreateController.php @@ -23,6 +23,7 @@ uriTemplate: '/content/objects/{contentId}/locations', extraProperties: [OpenApiFactory::OVERRIDE_OPENAPI_RESPONSES => false], openapi: new Model\Operation( + operationId: 'ibexa.rest.create_location', summary: 'Create new Location for content item', description: 'Creates a new Location for the given content item.', tags: [ @@ -30,19 +31,10 @@ ], parameters: [ new Model\Parameter( - name: 'Accept', + name: 'X-CSRF-Token', in: 'header', required: true, - description: 'If set, the new Location is returned in XML or JSON format.', - schema: [ - 'type' => 'string', - ], - ), - new Model\Parameter( - name: 'Content-Type', - in: 'header', - required: true, - description: 'The LocationCreate schema encoded in XML or JSON format.', + description: 'The CSRF Token needed on all unsafe HTTP methods with session.', schema: [ 'type' => 'string', ], @@ -57,36 +49,38 @@ ), ], requestBody: new Model\RequestBody( + description: 'The LocationCreate schema encoded in XML or JSON format.', content: new \ArrayObject([ - 'application/vnd.ibexa.api.LocationCreate+xml' => [ - 'schema' => [ - '$ref' => '#/components/schemas/LocationCreate', - ], - 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/content/objects/content_id/locations/POST/LocationCreate.xml.example', - ], 'application/vnd.ibexa.api.LocationCreate+json' => [ 'schema' => [ '$ref' => '#/components/schemas/LocationCreateWrapper', ], 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/content/objects/content_id/locations/POST/LocationCreate.json.example', ], + 'application/vnd.ibexa.api.LocationCreate+xml' => [ + 'schema' => [ + '$ref' => '#/components/schemas/LocationCreate', + ], + 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/content/objects/content_id/locations/POST/LocationCreate.xml.example', + ], ]), ), responses: [ Response::HTTP_CREATED => [ + 'description' => 'If set, the new Location is returned in XML or JSON format.', 'content' => [ - 'application/vnd.ibexa.api.Location+xml' => [ - 'schema' => [ - '$ref' => '#/components/schemas/Location', - ], - 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/content/objects/content_id/locations/POST/Location.xml.example', - ], 'application/vnd.ibexa.api.Location+json' => [ 'schema' => [ '$ref' => '#/components/schemas/LocationWrapper', ], 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/content/objects/content_id/locations/POST/Location.json.example', ], + 'application/vnd.ibexa.api.Location+xml' => [ + 'schema' => [ + '$ref' => '#/components/schemas/Location', + ], + 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/content/objects/content_id/locations/POST/Location.xml.example', + ], ], ], Response::HTTP_BAD_REQUEST => [ diff --git a/src/lib/Server/Controller/Location/LocationForContentListController.php b/src/lib/Server/Controller/Location/LocationForContentListController.php index 7235140cd..e2e23d502 100644 --- a/src/lib/Server/Controller/Location/LocationForContentListController.php +++ b/src/lib/Server/Controller/Location/LocationForContentListController.php @@ -16,25 +16,17 @@ #[Get( uriTemplate: '/content/objects/{contentId}/locations', openapi: new Model\Operation( + operationId: 'ibexa.rest.load_locations_for_content', summary: 'Get Locations for content item', description: 'Loads all Locations for the given content item.', tags: [ 'Objects', ], parameters: [ - new Model\Parameter( - name: 'Accept', - in: 'header', - required: true, - description: 'If set, the Location list is returned in XML or JSON format.', - schema: [ - 'type' => 'string', - ], - ), new Model\Parameter( name: 'If-None-Match', in: 'header', - required: true, + required: false, description: 'ETag', schema: [ 'type' => 'string', @@ -51,19 +43,20 @@ ], responses: [ Response::HTTP_OK => [ + 'description' => 'If set, the Location list is returned in XML or JSON format.', 'content' => [ - 'application/vnd.ibexa.api.LocationList+xml' => [ - 'schema' => [ - '$ref' => '#/components/schemas/LocationList', - ], - 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/content/objects/content_id/locations/GET/LocationList.xml.example', - ], 'application/vnd.ibexa.api.LocationList+json' => [ 'schema' => [ '$ref' => '#/components/schemas/LocationListWrapper', ], 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/content/objects/content_id/locations/GET/LocationList.json.example', ], + 'application/vnd.ibexa.api.LocationList+xml' => [ + 'schema' => [ + '$ref' => '#/components/schemas/LocationList', + ], + 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/content/objects/content_id/locations/GET/LocationList.xml.example', + ], ], ], Response::HTTP_UNAUTHORIZED => [ diff --git a/src/lib/Server/Controller/Location/LocationLoadByPathController.php b/src/lib/Server/Controller/Location/LocationLoadByPathController.php index 1a3b8e47b..d223286c2 100644 --- a/src/lib/Server/Controller/Location/LocationLoadByPathController.php +++ b/src/lib/Server/Controller/Location/LocationLoadByPathController.php @@ -16,25 +16,17 @@ #[Get( uriTemplate: '/content/locations/{path}', openapi: new Model\Operation( + operationId: 'ibexa.rest.load_location', summary: 'Load Location', description: 'Loads the Location for the given path e.g. \'/content/locations/1/2/61\'.', tags: [ 'Location', ], parameters: [ - new Model\Parameter( - name: 'Accept', - in: 'header', - required: true, - description: 'If set, the new Location is returned in XML or JSON format.', - schema: [ - 'type' => 'string', - ], - ), new Model\Parameter( name: 'If-None-Match', in: 'header', - required: true, + required: false, description: 'ETag', schema: [ 'type' => 'string', @@ -51,18 +43,19 @@ ], responses: [ Response::HTTP_OK => [ + 'description' => 'If set, the new Location is returned in XML or JSON format.', 'content' => [ - 'application/vnd.ibexa.api.Location+xml' => [ + 'application/vnd.ibexa.api.Location+json' => [ 'schema' => [ - '$ref' => '#/components/schemas/Location', + '$ref' => '#/components/schemas/LocationWrapper', ], - 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/content/objects/content_id/locations/POST/Location.xml.example', + 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/content/locations/path/GET/Location.json.example', ], - 'application/vnd.ibexa.api.Location+json' => [ + 'application/vnd.ibexa.api.Location+xml' => [ 'schema' => [ - '$ref' => '#/components/schemas/LocationWrapper', + '$ref' => '#/components/schemas/Location', ], - 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/content/objects/content_id/locations/POST/Location.json.example', + 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/content/locations/path/GET/Location.xml.example', ], ], ], diff --git a/src/lib/Server/Controller/Location/LocationRedirectController.php b/src/lib/Server/Controller/Location/LocationRedirectController.php index 2f1baa8f5..14e3fc2a7 100644 --- a/src/lib/Server/Controller/Location/LocationRedirectController.php +++ b/src/lib/Server/Controller/Location/LocationRedirectController.php @@ -17,35 +17,27 @@ #[Get( uriTemplate: '/content/locations', openapi: new Model\Operation( + operationId: 'ibexa.rest.redirect_location', summary: 'Load Locations by id/remoteId/urlAlias', description: 'Loads the Location for a given ID (x), remote ID or URL alias.', tags: [ 'Location', ], - parameters: [ - new Model\Parameter( - name: 'Accept', - in: 'header', - required: true, - schema: [ - 'type' => 'string', - ], - ), - ], responses: [ Response::HTTP_OK => [ + 'description' => 'OK - returns the LocationList in XML or JSON format.', 'content' => [ - 'application/vnd.ibexa.api.LocationList+xml' => [ + 'application/vnd.ibexa.api.LocationList+json' => [ 'schema' => [ - '$ref' => '#/components/schemas/Location', + '$ref' => '#/components/schemas/LocationWrapper', ], - 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/content/objects/content_id/locations/POST/Location.xml.example', + 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/content/locations/GET/LocationList.json.example', ], - 'application/vnd.ibexa.api.LocationList+json' => [ + 'application/vnd.ibexa.api.LocationList+xml' => [ 'schema' => [ - '$ref' => '#/components/schemas/LocationWrapper', + '$ref' => '#/components/schemas/Location', ], - 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/content/objects/content_id/locations/POST/Location.json.example', + 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/content/locations/GET/LocationList.xml.example', ], ], ], diff --git a/src/lib/Server/Controller/Location/LocationSubtreeDeleteController.php b/src/lib/Server/Controller/Location/LocationSubtreeDeleteController.php index 45951a6b3..74d6f783c 100644 --- a/src/lib/Server/Controller/Location/LocationSubtreeDeleteController.php +++ b/src/lib/Server/Controller/Location/LocationSubtreeDeleteController.php @@ -15,12 +15,22 @@ #[Delete( uriTemplate: '/content/locations/{path}', openapi: new Model\Operation( + operationId: 'ibexa.rest.delete_subtree', summary: 'Delete subtree', description: 'Deletes the complete subtree for the given path. Every content item which does not have any other Location is deleted. Otherwise the deleted Location is removed from the content item. The children are recursively deleted.', tags: [ 'Location', ], parameters: [ + new Model\Parameter( + name: 'X-CSRF-Token', + in: 'header', + required: true, + description: 'The CSRF Token needed on all unsafe HTTP methods with session.', + schema: [ + 'type' => 'string', + ], + ), new Model\Parameter( name: 'path', in: 'path', diff --git a/src/lib/Server/Controller/Location/LocationUpdateController.php b/src/lib/Server/Controller/Location/LocationUpdateController.php index 5a91df551..0ade250c3 100644 --- a/src/lib/Server/Controller/Location/LocationUpdateController.php +++ b/src/lib/Server/Controller/Location/LocationUpdateController.php @@ -19,6 +19,7 @@ uriTemplate: '/content/locations/{path}', extraProperties: [OpenApiFactory::OVERRIDE_OPENAPI_RESPONSES => false], openapi: new Model\Operation( + operationId: 'ibexa.rest.update_location', summary: 'Update Location', description: 'Updates the Location. This method can also be used to hide/reveal a Location via the hidden field in the LocationUpdate. PATCH or POST with header X-HTTP-Method-Override PATCH.', tags: [ @@ -26,19 +27,10 @@ ], parameters: [ new Model\Parameter( - name: 'Accept', + name: 'X-CSRF-Token', in: 'header', required: true, - description: 'If set, the Location is returned in XML or JSON format.', - schema: [ - 'type' => 'string', - ], - ), - new Model\Parameter( - name: 'Content-Type', - in: 'header', - required: true, - description: 'The LocationUpdate schema encoded in XML or JSON format.', + description: 'The CSRF Token needed on all unsafe HTTP methods with session.', schema: [ 'type' => 'string', ], @@ -62,35 +54,37 @@ ), ], requestBody: new Model\RequestBody( + description: 'The LocationUpdate schema encoded in XML or JSON format.', content: new \ArrayObject([ - 'application/vnd.ibexa.api.LocationUpdate+xml' => [ - 'schema' => [ - '$ref' => '#/components/schemas/LocationUpdateStruct', - ], - 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/content/locations/location_id/PATCH/LocationUpdate.xml.example', - ], 'application/vnd.ibexa.api.LocationUpdate+json' => [ 'schema' => [ '$ref' => '#/components/schemas/LocationUpdateStructWrapper', ], 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/content/locations/location_id/PATCH/LocationUpdate.json.example', ], + 'application/vnd.ibexa.api.LocationUpdate+xml' => [ + 'schema' => [ + '$ref' => '#/components/schemas/LocationUpdateStruct', + ], + 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/content/locations/location_id/PATCH/LocationUpdate.xml.example', + ], ]), ), responses: [ Response::HTTP_OK => [ + 'description' => 'If set, the Location is returned in XML or JSON format.', 'content' => [ - 'application/vnd.ibexa.api.Location+xml' => [ + 'application/vnd.ibexa.api.Location+json' => [ 'schema' => [ - '$ref' => '#/components/schemas/Location', + '$ref' => '#/components/schemas/LocationWrapper', ], - 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/content/objects/content_id/locations/POST/Location.xml.example', + 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/content/locations/location_id/PATCH/Location.json.example', ], - 'application/vnd.ibexa.api.Location+json' => [ + 'application/vnd.ibexa.api.Location+xml' => [ 'schema' => [ - '$ref' => '#/components/schemas/LocationWrapper', + '$ref' => '#/components/schemas/Location', ], - 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/content/objects/content_id/locations/POST/Location.json.example', + 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/content/locations/location_id/PATCH/Location.xml.example', ], ], ], diff --git a/src/lib/Server/Controller/ObjectState/ObjectStateCreateController.php b/src/lib/Server/Controller/ObjectState/ObjectStateCreateController.php index df5bf4c8e..a2b05d20c 100644 --- a/src/lib/Server/Controller/ObjectState/ObjectStateCreateController.php +++ b/src/lib/Server/Controller/ObjectState/ObjectStateCreateController.php @@ -26,6 +26,7 @@ uriTemplate: '/content/objectstategroups/{objectStateGroupId}/objectstates', extraProperties: [OpenApiFactory::OVERRIDE_OPENAPI_RESPONSES => false], openapi: new Model\Operation( + operationId: 'ibexa.rest.create_object_state', summary: 'Create Object state', description: 'Creates a new Object state.', tags: [ @@ -33,19 +34,10 @@ ], parameters: [ new Model\Parameter( - name: 'Accept', + name: 'X-CSRF-Token', in: 'header', required: true, - description: 'If set, the new Object state is returned in XML or JSON format.', - schema: [ - 'type' => 'string', - ], - ), - new Model\Parameter( - name: 'Content-Type', - in: 'header', - required: true, - description: 'The Object state input schema encoded in XML or JSON format.', + description: 'The CSRF Token needed on all unsafe HTTP methods with session.', schema: [ 'type' => 'string', ], @@ -60,36 +52,37 @@ ), ], requestBody: new Model\RequestBody( + description: 'The Object state input schema encoded in XML or JSON format.', content: new \ArrayObject([ - 'application/vnd.ibexa.api.ObjectStateCreate+xml' => [ - 'schema' => [ - '$ref' => '#/components/schemas/ObjectStateCreate', - ], - 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/content/objectstategroups/object_state_group_id/objectstates/POST/ObjectStateCreate.xml.example', - ], 'application/vnd.ibexa.api.ObjectStateCreate+json' => [ 'schema' => [ '$ref' => '#/components/schemas/ObjectStateCreateWrapper', ], 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/content/objectstategroups/object_state_group_id/objectstates/POST/ObjectStateCreate.json.example', ], + 'application/vnd.ibexa.api.ObjectStateCreate+xml' => [ + 'schema' => [ + '$ref' => '#/components/schemas/ObjectStateCreate', + ], + 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/content/objectstategroups/object_state_group_id/objectstates/POST/ObjectStateCreate.xml.example', + ], ]), ), responses: [ Response::HTTP_CREATED => [ 'description' => 'Object state created.', 'content' => [ - 'application/vnd.ibexa.api.ObjectState+xml' => [ + 'application/vnd.ibexa.api.ObjectState+json' => [ 'schema' => [ - '$ref' => '#/components/schemas/ObjectState', + '$ref' => '#/components/schemas/ObjectStateWrapper', ], - 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/content/objectstategroups/object_state_group_id/objectstates/object_state_id/PATCH/ObjectState.xml.example', + 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/content/objectstategroups/object_state_group_id/objectstates/POST/ObjectState.json.example', ], - 'application/vnd.ibexa.api.ObjectState+json' => [ + 'application/vnd.ibexa.api.ObjectState+xml' => [ 'schema' => [ - '$ref' => '#/components/schemas/ObjectStateWrapper', + '$ref' => '#/components/schemas/ObjectState', ], - 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/content/objectstategroups/object_state_group_id/objectstates/object_state_id/PATCH/ObjectState.json.example', + 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/content/objectstategroups/object_state_group_id/objectstates/POST/ObjectState.xml.example', ], ], ], diff --git a/src/lib/Server/Controller/ObjectState/ObjectStateDeleteController.php b/src/lib/Server/Controller/ObjectState/ObjectStateDeleteController.php index c90d4917f..939948526 100644 --- a/src/lib/Server/Controller/ObjectState/ObjectStateDeleteController.php +++ b/src/lib/Server/Controller/ObjectState/ObjectStateDeleteController.php @@ -18,12 +18,22 @@ #[Delete( uriTemplate: '/content/objectstategroups/{objectStateGroupId}/objectstates/{objectStateId}', openapi: new Model\Operation( + operationId: 'ibexa.rest.delete_object_state', summary: 'Delete Object state', description: 'Deletes provided Object state.', tags: [ 'Object State Groups', ], parameters: [ + new Model\Parameter( + name: 'X-CSRF-Token', + in: 'header', + required: true, + description: 'The CSRF Token needed on all unsafe HTTP methods with session.', + schema: [ + 'type' => 'string', + ], + ), new Model\Parameter( name: 'objectStateGroupId', in: 'path', diff --git a/src/lib/Server/Controller/ObjectState/ObjectStateGroupCreateController.php b/src/lib/Server/Controller/ObjectState/ObjectStateGroupCreateController.php index 71d638157..613585243 100644 --- a/src/lib/Server/Controller/ObjectState/ObjectStateGroupCreateController.php +++ b/src/lib/Server/Controller/ObjectState/ObjectStateGroupCreateController.php @@ -25,6 +25,7 @@ uriTemplate: '/content/objectstategroups', extraProperties: [OpenApiFactory::OVERRIDE_OPENAPI_RESPONSES => false], openapi: new Model\Operation( + operationId: 'ibexa.rest.create_object_state_group', summary: 'Create Object state group', description: 'Creates a new Object state group.', tags: [ @@ -32,55 +33,47 @@ ], parameters: [ new Model\Parameter( - name: 'Accept', + name: 'X-CSRF-Token', in: 'header', required: true, - description: 'If set, the new Object state group is returned in XML or JSON format.', - schema: [ - 'type' => 'string', - ], - ), - new Model\Parameter( - name: 'Content-Type', - in: 'header', - required: true, - description: 'The Object state group input schema encoded in XML or JSON format.', + description: 'The CSRF Token needed on all unsafe HTTP methods with session.', schema: [ 'type' => 'string', ], ), ], requestBody: new Model\RequestBody( + description: 'The Object state group input schema encoded in XML or JSON format.', content: new \ArrayObject([ - 'application/vnd.ibexa.api.ObjectStateGroupCreate+xml' => [ - 'schema' => [ - '$ref' => '#/components/schemas/ObjectStateGroupCreate', - ], - 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/content/objectstategroups/POST/ObjectStateGroupCreate.xml.example', - ], 'application/vnd.ibexa.api.ObjectStateGroupCreate+json' => [ 'schema' => [ '$ref' => '#/components/schemas/ObjectStateGroupCreateWrapper', ], 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/content/objectstategroups/POST/ObjectStateGroupCreate.json.example', ], + 'application/vnd.ibexa.api.ObjectStateGroupCreate+xml' => [ + 'schema' => [ + '$ref' => '#/components/schemas/ObjectStateGroupCreate', + ], + 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/content/objectstategroups/POST/ObjectStateGroupCreate.xml.example', + ], ]), ), responses: [ Response::HTTP_CREATED => [ 'description' => 'Object state group created.', 'content' => [ - 'application/vnd.ibexa.api.ObjectStateGroup+xml' => [ + 'application/vnd.ibexa.api.ObjectStateGroup+json' => [ 'schema' => [ - '$ref' => '#/components/schemas/ObjectStateGroup', + '$ref' => '#/components/schemas/ObjectStateGroupWrapper', ], - 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/content/objectstategroups/object_state_group_id/PATCH/ObjectStateGroup.xml.example', + 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/content/objectstategroups/POST/ObjectStateGroup.json.example', ], - 'application/vnd.ibexa.api.ObjectStateGroup+json' => [ + 'application/vnd.ibexa.api.ObjectStateGroup+xml' => [ 'schema' => [ - '$ref' => '#/components/schemas/ObjectStateGroupWrapper', + '$ref' => '#/components/schemas/ObjectStateGroup', ], - 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/content/objectstategroups/object_state_group_id/PATCH/ObjectStateGroup.json.example', + 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/content/objectstategroups/POST/ObjectStateGroup.xml.example', ], ], ], diff --git a/src/lib/Server/Controller/ObjectState/ObjectStateGroupDeleteController.php b/src/lib/Server/Controller/ObjectState/ObjectStateGroupDeleteController.php index bb4e695b9..714a736a7 100644 --- a/src/lib/Server/Controller/ObjectState/ObjectStateGroupDeleteController.php +++ b/src/lib/Server/Controller/ObjectState/ObjectStateGroupDeleteController.php @@ -18,12 +18,22 @@ #[Delete( uriTemplate: '/content/objectstategroups/{objectStateGroupId}', openapi: new Model\Operation( + operationId: 'ibexa.rest.delete_object_state_group', summary: 'Delete Object state group', description: 'Deletes the given Object state group including Object states.', tags: [ 'Object State Groups', ], parameters: [ + new Model\Parameter( + name: 'X-CSRF-Token', + in: 'header', + required: true, + description: 'The CSRF Token needed on all unsafe HTTP methods with session.', + schema: [ + 'type' => 'string', + ], + ), new Model\Parameter( name: 'objectStateGroupId', in: 'path', diff --git a/src/lib/Server/Controller/ObjectState/ObjectStateGroupListController.php b/src/lib/Server/Controller/ObjectState/ObjectStateGroupListController.php index 2d0a21389..0c790ddeb 100644 --- a/src/lib/Server/Controller/ObjectState/ObjectStateGroupListController.php +++ b/src/lib/Server/Controller/ObjectState/ObjectStateGroupListController.php @@ -21,25 +21,17 @@ uriTemplate: '/content/objectstategroups', extraProperties: [OpenApiFactory::OVERRIDE_OPENAPI_RESPONSES => false], openapi: new Model\Operation( + operationId: 'ibexa.rest.load_object_state_groups', summary: 'List Object state groups', description: 'Returns a list of all Object state groups.', tags: [ 'Object State Groups', ], parameters: [ - new Model\Parameter( - name: 'Accept', - in: 'header', - required: true, - description: 'If set, the Object state group list is returned in XML or JSON format.', - schema: [ - 'type' => 'string', - ], - ), new Model\Parameter( name: 'If-None-Match', in: 'header', - required: true, + required: false, description: 'ETag', schema: [ 'type' => 'string', @@ -50,18 +42,18 @@ Response::HTTP_OK => [ 'description' => 'OK - returns a list of Object state groups.', 'content' => [ - 'application/vnd.ibexa.api.ObjectStateGroupList+xml' => [ - 'schema' => [ - '$ref' => '#/components/schemas/ObjectStateGroupList', - ], - 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/content/objectstategroups/GET/ObjectStateGroupList.xml.example', - ], 'application/vnd.ibexa.api.ObjectStateGroupList+json' => [ 'schema' => [ '$ref' => '#/components/schemas/ObjectStateGroupListWrapper', ], 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/content/objectstategroups/GET/ObjectStateGroupList.json.example', ], + 'application/vnd.ibexa.api.ObjectStateGroupList+xml' => [ + 'schema' => [ + '$ref' => '#/components/schemas/ObjectStateGroupList', + ], + 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/content/objectstategroups/GET/ObjectStateGroupList.xml.example', + ], ], ], Response::HTTP_UNAUTHORIZED => [ diff --git a/src/lib/Server/Controller/ObjectState/ObjectStateGroupLoadByIdController.php b/src/lib/Server/Controller/ObjectState/ObjectStateGroupLoadByIdController.php index 5f8bd351c..8ca06ddf4 100644 --- a/src/lib/Server/Controller/ObjectState/ObjectStateGroupLoadByIdController.php +++ b/src/lib/Server/Controller/ObjectState/ObjectStateGroupLoadByIdController.php @@ -19,25 +19,17 @@ #[Get( uriTemplate: '/content/objectstategroups/{objectStateGroupId}', openapi: new Model\Operation( + operationId: 'ibexa.rest.load_object_state_group', summary: 'Get Object state group', description: 'Returns the Object state group with the provided ID.', tags: [ 'Object State Groups', ], parameters: [ - new Model\Parameter( - name: 'Accept', - in: 'header', - required: true, - description: 'If set, the Object state group is returned in XML or JSON format.', - schema: [ - 'type' => 'string', - ], - ), new Model\Parameter( name: 'If-None-Match', in: 'header', - required: true, + required: false, description: 'ETag', schema: [ 'type' => 'string', @@ -56,17 +48,17 @@ Response::HTTP_OK => [ 'description' => 'OK - returns the Object state group.', 'content' => [ - 'application/vnd.ibexa.api.ObjectStateGroup+xml' => [ + 'application/vnd.ibexa.api.ObjectStateGroup+json' => [ 'schema' => [ - '$ref' => '#/components/schemas/ObjectStateGroup', + '$ref' => '#/components/schemas/ObjectStateGroupWrapper', ], - 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/content/objectstategroups/object_state_group_id/PATCH/ObjectStateGroup.xml.example', + 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/content/objectstategroups/object_state_group_id/GET/ObjectStateGroup.json.example', ], - 'application/vnd.ibexa.api.ObjectStateGroup+json' => [ + 'application/vnd.ibexa.api.ObjectStateGroup+xml' => [ 'schema' => [ - '$ref' => '#/components/schemas/ObjectStateGroupWrapper', + '$ref' => '#/components/schemas/ObjectStateGroup', ], - 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/content/objectstategroups/object_state_group_id/PATCH/ObjectStateGroup.json.example', + 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/content/objectstategroups/object_state_group_id/GET/ObjectStateGroup.xml.example', ], ], ], diff --git a/src/lib/Server/Controller/ObjectState/ObjectStateGroupUpdateController.php b/src/lib/Server/Controller/ObjectState/ObjectStateGroupUpdateController.php index 0519b8873..2879cf67b 100644 --- a/src/lib/Server/Controller/ObjectState/ObjectStateGroupUpdateController.php +++ b/src/lib/Server/Controller/ObjectState/ObjectStateGroupUpdateController.php @@ -24,6 +24,7 @@ uriTemplate: '/content/objectstategroups/{objectStateGroupId}', extraProperties: [OpenApiFactory::OVERRIDE_OPENAPI_RESPONSES => false], openapi: new Model\Operation( + operationId: 'ibexa.rest.update_object_state_group', summary: 'Update Object state group', description: 'Updates an Object state group. PATCH or POST with header X-HTTP-Method-Override PATCH.', tags: [ @@ -31,19 +32,10 @@ ], parameters: [ new Model\Parameter( - name: 'Accept', + name: 'X-CSRF-Token', in: 'header', required: true, - description: 'If set, the updated Object state group is returned in XML or JSON format.', - schema: [ - 'type' => 'string', - ], - ), - new Model\Parameter( - name: 'Content-Type', - in: 'header', - required: true, - description: 'The Object state group input schema encoded in XML or JSON format.', + description: 'The CSRF Token needed on all unsafe HTTP methods with session.', schema: [ 'type' => 'string', ], @@ -67,37 +59,38 @@ ), ], requestBody: new Model\RequestBody( + description: 'The Object state group input schema encoded in XML or JSON format.', content: new \ArrayObject([ - 'application/vnd.ibexa.api.ObjectStateGroupUpdate+xml' => [ - 'schema' => [ - '$ref' => '#/components/schemas/ObjectStateGroupUpdate', - ], - 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/content/objectstategroups/object_state_group_id/PATCH/ObjectStateGroupUpdate.xml.example', - ], 'application/vnd.ibexa.api.ObjectStateGroupUpdate+json' => [ 'schema' => [ '$ref' => '#/components/schemas/ObjectStateGroupUpdateWrapper', ], 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/content/objectstategroups/object_state_group_id/PATCH/ObjectStateGroupUpdate.json.example', ], + 'application/vnd.ibexa.api.ObjectStateGroupUpdate+xml' => [ + 'schema' => [ + '$ref' => '#/components/schemas/ObjectStateGroupUpdate', + ], + 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/content/objectstategroups/object_state_group_id/PATCH/ObjectStateGroupUpdate.xml.example', + ], ]), ), responses: [ Response::HTTP_OK => [ 'description' => 'OK - Object stated group updated.', 'content' => [ - 'application/vnd.ibexa.api.ObjectStateGroup+xml' => [ - 'schema' => [ - '$ref' => '#/components/schemas/ObjectStateGroup', - ], - 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/content/objectstategroups/object_state_group_id/PATCH/ObjectStateGroup.xml.example', - ], 'application/vnd.ibexa.api.ObjectStateGroup+json' => [ 'schema' => [ '$ref' => '#/components/schemas/ObjectStateGroupWrapper', ], 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/content/objectstategroups/object_state_group_id/PATCH/ObjectStateGroup.json.example', ], + 'application/vnd.ibexa.api.ObjectStateGroup+xml' => [ + 'schema' => [ + '$ref' => '#/components/schemas/ObjectStateGroup', + ], + 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/content/objectstategroups/object_state_group_id/PATCH/ObjectStateGroup.xml.example', + ], ], ], Response::HTTP_BAD_REQUEST => [ diff --git a/src/lib/Server/Controller/ObjectState/ObjectStateListController.php b/src/lib/Server/Controller/ObjectState/ObjectStateListController.php index 69938e9c6..7b2f948a0 100644 --- a/src/lib/Server/Controller/ObjectState/ObjectStateListController.php +++ b/src/lib/Server/Controller/ObjectState/ObjectStateListController.php @@ -21,25 +21,17 @@ uriTemplate: '/content/objectstategroups/{objectStateGroupId}/objectstates', extraProperties: [OpenApiFactory::OVERRIDE_OPENAPI_RESPONSES => false], openapi: new Model\Operation( + operationId: 'ibexa.rest.load_object_states', summary: 'List Object states', description: 'Returns a list of all Object states of the given group.', tags: [ 'Object State Groups', ], parameters: [ - new Model\Parameter( - name: 'Accept', - in: 'header', - required: true, - description: 'If set, the Object state list is returned in XML or JSON format.', - schema: [ - 'type' => 'string', - ], - ), new Model\Parameter( name: 'If-None-Match', in: 'header', - required: true, + required: false, description: 'ETag', schema: [ 'type' => 'string', @@ -58,18 +50,18 @@ Response::HTTP_OK => [ 'description' => 'OK - returns a list of Object states.', 'content' => [ - 'application/vnd.ibexa.api.ObjectStateList+xml' => [ - 'schema' => [ - '$ref' => '#/components/schemas/ObjectStateList', - ], - 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/content/objectstategroups/object_state_group_id/objectstates/GET/ObjectStateList.xml.example', - ], 'application/vnd.ibexa.api.ObjectStateList+json' => [ 'schema' => [ '$ref' => '#/components/schemas/ObjectStateListWrapper', ], 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/content/objectstategroups/object_state_group_id/objectstates/GET/ObjectStateList.json.example', ], + 'application/vnd.ibexa.api.ObjectStateList+xml' => [ + 'schema' => [ + '$ref' => '#/components/schemas/ObjectStateList', + ], + 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/content/objectstategroups/object_state_group_id/objectstates/GET/ObjectStateList.xml.example', + ], ], ], Response::HTTP_UNAUTHORIZED => [ diff --git a/src/lib/Server/Controller/ObjectState/ObjectStateLoadByIdController.php b/src/lib/Server/Controller/ObjectState/ObjectStateLoadByIdController.php index 169af848c..9b4785fc5 100644 --- a/src/lib/Server/Controller/ObjectState/ObjectStateLoadByIdController.php +++ b/src/lib/Server/Controller/ObjectState/ObjectStateLoadByIdController.php @@ -19,25 +19,17 @@ #[Get( uriTemplate: '/content/objectstategroups/{objectStateGroupId}/objectstates/{objectStateId}', openapi: new Model\Operation( + operationId: 'ibexa.rest.load_object_state', summary: 'Get Object state', description: 'Returns the Object state.', tags: [ 'Object State Groups', ], parameters: [ - new Model\Parameter( - name: 'Accept', - in: 'header', - required: true, - description: 'If set, the Object State is returned in XML or JSON format.', - schema: [ - 'type' => 'string', - ], - ), new Model\Parameter( name: 'If-None-Match', in: 'header', - required: true, + required: false, description: 'ETag', schema: [ 'type' => 'string', @@ -64,17 +56,17 @@ Response::HTTP_OK => [ 'description' => 'OK - returns the Object state.', 'content' => [ - 'application/vnd.ibexa.api.ObjectState+xml' => [ + 'application/vnd.ibexa.api.ObjectState+json' => [ 'schema' => [ - '$ref' => '#/components/schemas/ObjectState', + '$ref' => '#/components/schemas/ObjectStateWrapper', ], - 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/content/objectstategroups/object_state_group_id/objectstates/object_state_id/PATCH/ObjectState.xml.example', + 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/content/objectstategroups/object_state_group_id/objectstates/object_state_id/GET/ObjectState.json.example', ], - 'application/vnd.ibexa.api.ObjectState+json' => [ + 'application/vnd.ibexa.api.ObjectState+xml' => [ 'schema' => [ - '$ref' => '#/components/schemas/ObjectStateWrapper', + '$ref' => '#/components/schemas/ObjectState', ], - 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/content/objectstategroups/object_state_group_id/objectstates/object_state_id/PATCH/ObjectState.json.example', + 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/content/objectstategroups/object_state_group_id/objectstates/object_state_id/GET/ObjectState.xml.example', ], ], ], diff --git a/src/lib/Server/Controller/ObjectState/ObjectStateUpdateController.php b/src/lib/Server/Controller/ObjectState/ObjectStateUpdateController.php index 3e985a6ea..d15c2bec4 100644 --- a/src/lib/Server/Controller/ObjectState/ObjectStateUpdateController.php +++ b/src/lib/Server/Controller/ObjectState/ObjectStateUpdateController.php @@ -25,6 +25,7 @@ uriTemplate: '/content/objectstategroups/{objectStateGroupId}/objectstates/{objectStateId}', extraProperties: [OpenApiFactory::OVERRIDE_OPENAPI_RESPONSES => false], openapi: new Model\Operation( + operationId: 'ibexa.rest.update_object_state', summary: 'Update Object state', description: 'Updates an Object state. PATCH or POST with header X-HTTP-Method-Override PATCH.', tags: [ @@ -32,19 +33,10 @@ ], parameters: [ new Model\Parameter( - name: 'Accept', + name: 'X-CSRF-Token', in: 'header', required: true, - description: 'If set, the updated Object state is returned in XML or JSON format.', - schema: [ - 'type' => 'string', - ], - ), - new Model\Parameter( - name: 'Content-Type', - in: 'header', - required: true, - description: 'The Object state input schema encoded in XML or JSON format.', + description: 'The CSRF Token needed on all unsafe HTTP methods with session.', schema: [ 'type' => 'string', ], @@ -76,37 +68,38 @@ ), ], requestBody: new Model\RequestBody( + description: 'The Object state input schema encoded in XML or JSON format.', content: new \ArrayObject([ - 'application/vnd.ibexa.api.ObjectStateUpdate+xml' => [ - 'schema' => [ - '$ref' => '#/components/schemas/ObjectStateUpdate', - ], - 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/content/objectstategroups/object_state_group_id/objectstates/object_state_id/PATCH/ObjectStateUpdate.xml.example', - ], 'application/vnd.ibexa.api.ObjectStateUpdate+json' => [ 'schema' => [ '$ref' => '#/components/schemas/ObjectStateUpdateWrapper', ], 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/content/objectstategroups/object_state_group_id/objectstates/object_state_id/PATCH/ObjectStateUpdate.json.example', ], + 'application/vnd.ibexa.api.ObjectStateUpdate+xml' => [ + 'schema' => [ + '$ref' => '#/components/schemas/ObjectStateUpdate', + ], + 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/content/objectstategroups/object_state_group_id/objectstates/object_state_id/PATCH/ObjectStateUpdate.xml.example', + ], ]), ), responses: [ Response::HTTP_OK => [ 'description' => 'OK - Object State updated', 'content' => [ - 'application/vnd.ibexa.api.ObjectState+xml' => [ - 'schema' => [ - '$ref' => '#/components/schemas/ObjectState', - ], - 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/content/objectstategroups/object_state_group_id/objectstates/object_state_id/PATCH/ObjectState.xml.example', - ], 'application/vnd.ibexa.api.ObjectState+json' => [ 'schema' => [ '$ref' => '#/components/schemas/ObjectStateWrapper', ], 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/content/objectstategroups/object_state_group_id/objectstates/object_state_id/PATCH/ObjectState.json.example', ], + 'application/vnd.ibexa.api.ObjectState+xml' => [ + 'schema' => [ + '$ref' => '#/components/schemas/ObjectState', + ], + 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/content/objectstategroups/object_state_group_id/objectstates/object_state_id/PATCH/ObjectState.xml.example', + ], ], ], Response::HTTP_BAD_REQUEST => [ diff --git a/src/lib/Server/Controller/ObjectState/ObjectStatesForContentListController.php b/src/lib/Server/Controller/ObjectState/ObjectStatesForContentListController.php index 4cc2ab36e..ea0f07a66 100644 --- a/src/lib/Server/Controller/ObjectState/ObjectStatesForContentListController.php +++ b/src/lib/Server/Controller/ObjectState/ObjectStatesForContentListController.php @@ -22,25 +22,17 @@ uriTemplate: '/content/objects/{contentId}/objectstates', extraProperties: [OpenApiFactory::OVERRIDE_OPENAPI_RESPONSES => false], openapi: new Model\Operation( + operationId: 'ibexa.rest.get_object_states_for_content', summary: 'Get Object states of content item', description: 'Returns the Object states of a content item', tags: [ 'Objects', ], parameters: [ - new Model\Parameter( - name: 'Accept', - in: 'header', - required: true, - description: 'If set, the Object states are returned in XML or JSON format.', - schema: [ - 'type' => 'string', - ], - ), new Model\Parameter( name: 'If-None-Match', in: 'header', - required: true, + required: false, description: 'ETag', schema: [ 'type' => 'string', @@ -59,15 +51,17 @@ Response::HTTP_OK => [ 'description' => 'OK - returns the Object state.', 'content' => [ - 'application/vnd.ibexa.api.ContentObjectStates+xml' => [ + 'application/vnd.ibexa.api.ContentObjectStates+json' => [ 'schema' => [ '$ref' => '#/components/schemas/ContentObjectStates', ], + 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/content/objects/content_id/objectstates/GET/ContentObjectStates.json.example', ], - 'application/vnd.ibexa.api.ContentObjectStates+json' => [ + 'application/vnd.ibexa.api.ContentObjectStates+xml' => [ 'schema' => [ '$ref' => '#/components/schemas/ContentObjectStates', ], + 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/content/objects/content_id/objectstates/GET/ContentObjectStates.xml.example', ], ], ], diff --git a/src/lib/Server/Controller/ObjectState/ObjectStatesForContentUpdateController.php b/src/lib/Server/Controller/ObjectState/ObjectStatesForContentUpdateController.php index 3666e8dca..23417ea51 100644 --- a/src/lib/Server/Controller/ObjectState/ObjectStatesForContentUpdateController.php +++ b/src/lib/Server/Controller/ObjectState/ObjectStatesForContentUpdateController.php @@ -24,6 +24,7 @@ uriTemplate: '/content/objects/{contentId}/objectstates', extraProperties: [OpenApiFactory::OVERRIDE_OPENAPI_RESPONSES => false], openapi: new Model\Operation( + operationId: 'ibexa.rest.set_object_states_for_content', summary: 'Set Object states of content item', description: 'Updates Object states of a content item. An Object state in the input overrides the state of the Object state group. PATCH or POST with header X-HTTP-Method-Override PATCH.', tags: [ @@ -31,19 +32,10 @@ ], parameters: [ new Model\Parameter( - name: 'Accept', + name: 'X-CSRF-Token', in: 'header', required: true, - description: 'If set, the updated Object state is returned in XML or JSON format.', - schema: [ - 'type' => 'string', - ], - ), - new Model\Parameter( - name: 'Content-Type', - in: 'header', - required: true, - description: 'The content item Object states input schema encoded in XML or JSON format.', + description: 'The CSRF Token needed on all unsafe HTTP methods with session.', schema: [ 'type' => 'string', ], @@ -67,18 +59,19 @@ ), ], requestBody: new Model\RequestBody( + description: 'The content item Object states input schema encoded in XML or JSON format.', content: new \ArrayObject([ - 'application/vnd.ibexa.api.ContentObjectStates+xml' => [ + 'application/vnd.ibexa.api.ContentObjectStates+json' => [ 'schema' => [ - '$ref' => '#/components/schemas/ContentObjectStates', + '$ref' => '#/components/schemas/ContentObjectStatesWrapper', ], - 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/content/objects/content_id/objectstates/PATCH/ContentObjectStates.response.xml.example', + 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/content/objects/content_id/objectstates/PATCH/ContentObjectStates.request.json.example', ], - 'application/vnd.ibexa.api.ContentObjectStates+json' => [ + 'application/vnd.ibexa.api.ContentObjectStates+xml' => [ 'schema' => [ - '$ref' => '#/components/schemas/ContentObjectStatesWrapper', + '$ref' => '#/components/schemas/ContentObjectStates', ], - 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/content/objects/content_id/objectstates/GET/ContentObjectStates.json.example', + 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/content/objects/content_id/objectstates/PATCH/ContentObjectStates.request.xml.example', ], ]), ), @@ -86,17 +79,17 @@ Response::HTTP_NO_CONTENT => [ 'description' => 'OK - Object state updated.', 'content' => [ - 'application/vnd.ibexa.api.ContentObjectStates+xml' => [ + 'application/vnd.ibexa.api.ContentObjectStates+json' => [ 'schema' => [ - '$ref' => '#/components/schemas/ContentObjectStates', + '$ref' => '#/components/schemas/ContentObjectStatesWrapper', ], - 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/content/objects/content_id/objectstates/PATCH/ContentObjectStates.response.xml.example', + 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/content/objects/content_id/objectstates/PATCH/ContentObjectStates.response.json.example', ], - 'application/vnd.ibexa.api.ContentObjectStates+json' => [ + 'application/vnd.ibexa.api.ContentObjectStates+xml' => [ 'schema' => [ - '$ref' => '#/components/schemas/ContentObjectStatesWrapper', + '$ref' => '#/components/schemas/ContentObjectStates', ], - 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/content/objects/content_id/objectstates/GET/ContentObjectStates.json.example', + 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/content/objects/content_id/objectstates/PATCH/ContentObjectStates.response.xml.example', ], ], ], diff --git a/src/lib/Server/Controller/Role/RoleAssignToUserController.php b/src/lib/Server/Controller/Role/RoleAssignToUserController.php index 67d04ea4f..937d236de 100644 --- a/src/lib/Server/Controller/Role/RoleAssignToUserController.php +++ b/src/lib/Server/Controller/Role/RoleAssignToUserController.php @@ -21,6 +21,7 @@ uriTemplate: '/user/users/{userId}/roles', extraProperties: [OpenApiFactory::OVERRIDE_OPENAPI_RESPONSES => false], openapi: new Model\Operation( + operationId: 'ibexa.rest.assign_role_to_user', summary: 'Assign Role to User', description: 'Assigns a Role to a user.', tags: [ @@ -28,19 +29,10 @@ ], parameters: [ new Model\Parameter( - name: 'Accept', + name: 'X-CSRF-Token', in: 'header', required: true, - description: 'If set, the updated Role assignment list is returned in XML or JSON format.', - schema: [ - 'type' => 'string', - ], - ), - new Model\Parameter( - name: 'Content-Type', - in: 'header', - required: true, - description: 'The RoleAssignInput schema encoded in XML or JSON format.', + description: 'The CSRF Token needed on all unsafe HTTP methods with session.', schema: [ 'type' => 'string', ], @@ -55,35 +47,37 @@ ), ], requestBody: new Model\RequestBody( + description: 'The RoleAssignInput schema encoded in XML or JSON format.', content: new \ArrayObject([ - 'application/vnd.ibexa.api.RoleAssignInput+xml' => [ - 'schema' => [ - '$ref' => '#/components/schemas/RoleAssignInput', - ], - 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/user/users/user_id/roles/POST/RoleAssignInput.xml.example', - ], 'application/vnd.ibexa.api.RoleAssignInput+json' => [ 'schema' => [ '$ref' => '#/components/schemas/RoleAssignInputWrapper', ], 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/user/users/user_id/roles/POST/RoleAssignInput.json.example', ], + 'application/vnd.ibexa.api.RoleAssignInput+xml' => [ + 'schema' => [ + '$ref' => '#/components/schemas/RoleAssignInput', + ], + 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/user/users/user_id/roles/POST/RoleAssignInput.xml.example', + ], ]), ), responses: [ Response::HTTP_OK => [ + 'description' => 'If set, the updated Role assignment list is returned in XML or JSON format.', 'content' => [ - 'application/vnd.ibexa.api.RoleAssignmentList+xml' => [ + 'application/vnd.ibexa.api.RoleAssignmentList+json' => [ 'schema' => [ - '$ref' => '#/components/schemas/RoleAssignmentList', + '$ref' => '#/components/schemas/RoleAssignmentListWrapper', ], - 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/user/users/user_id/roles/POST/RoleAssignmentList.xml.example', + 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/user/users/user_id/roles/POST/RoleAssignmentList.json.example', ], - 'application/vnd.ibexa.api.RoleAssignmentList+json' => [ + 'application/vnd.ibexa.api.RoleAssignmentList+xml' => [ 'schema' => [ - '$ref' => '#/components/schemas/RoleAssignmentListWrapper', + '$ref' => '#/components/schemas/RoleAssignmentList', ], - 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/user/users/user_id/roles/role_id/DELETE/RoleAssignmentList.json.example', + 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/user/users/user_id/roles/POST/RoleAssignmentList.xml.example', ], ], ], diff --git a/src/lib/Server/Controller/Role/RoleAssignToUserGroupController.php b/src/lib/Server/Controller/Role/RoleAssignToUserGroupController.php index da43393e7..5aaed075c 100644 --- a/src/lib/Server/Controller/Role/RoleAssignToUserGroupController.php +++ b/src/lib/Server/Controller/Role/RoleAssignToUserGroupController.php @@ -21,6 +21,7 @@ uriTemplate: '/user/groups/{path}/roles', extraProperties: [OpenApiFactory::OVERRIDE_OPENAPI_RESPONSES => false], openapi: new Model\Operation( + operationId: 'ibexa.rest.assign_role_to_user_group', summary: 'Assign Role to User Group', description: 'Assigns a Role to a User Group.', tags: [ @@ -28,19 +29,10 @@ ], parameters: [ new Model\Parameter( - name: 'Accept', + name: 'X-CSRF-Token', in: 'header', required: true, - description: 'If set, the updated Role assignment list is returned in XML or JSON format.', - schema: [ - 'type' => 'string', - ], - ), - new Model\Parameter( - name: 'Content-Type', - in: 'header', - required: true, - description: 'The RoleAssignInput schema encoded in XML or JSON format.', + description: 'The CSRF Token needed on all unsafe HTTP methods with session.', schema: [ 'type' => 'string', ], @@ -55,35 +47,37 @@ ), ], requestBody: new Model\RequestBody( + description: 'The RoleAssignInput schema encoded in XML or JSON format.', content: new \ArrayObject([ - 'application/vnd.ibexa.api.RoleAssignInput+xml' => [ + 'application/vnd.ibexa.api.RoleAssignInput+json' => [ 'schema' => [ - '$ref' => '#/components/schemas/RoleAssignInput', + '$ref' => '#/components/schemas/RoleAssignInputWrapper', ], - 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/user/groups/path/roles/POST/RoleAssignInput.xml.example', + 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/user/groups/path/roles/POST/RoleAssignInput.json.example', ], - 'application/vnd.ibexa.api.RoleAssignInput+json' => [ + 'application/vnd.ibexa.api.RoleAssignInput+xml' => [ 'schema' => [ - '$ref' => '#/components/schemas/RoleAssignInputWrapper', + '$ref' => '#/components/schemas/RoleAssignInput', ], - 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/user/users/user_id/roles/POST/RoleAssignInput.json.example', + 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/user/groups/path/roles/POST/RoleAssignInput.xml.example', ], ]), ), responses: [ Response::HTTP_OK => [ + 'description' => 'If set, the updated Role assignment list is returned in XML or JSON format.', 'content' => [ - 'application/vnd.ibexa.api.RoleAssignmentList+xml' => [ + 'application/vnd.ibexa.api.RoleAssignmentList+json' => [ 'schema' => [ - '$ref' => '#/components/schemas/RoleAssignmentList', + '$ref' => '#/components/schemas/RoleAssignmentListWrapper', ], - 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/user/users/user_id/roles/role_id/GET/RoleAssignment.xml.example', + 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/user/groups/path/roles/POST/RoleAssignmentList.json.example', ], - 'application/vnd.ibexa.api.RoleAssignmentList+json' => [ + 'application/vnd.ibexa.api.RoleAssignmentList+xml' => [ 'schema' => [ - '$ref' => '#/components/schemas/RoleAssignmentListWrapper', + '$ref' => '#/components/schemas/RoleAssignmentList', ], - 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/user/users/user_id/roles/role_id/DELETE/RoleAssignmentList.json.example', + 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/user/groups/path/roles/POST/RoleAssignmentList.xml.example', ], ], ], diff --git a/src/lib/Server/Controller/Role/RoleAssignmentForUserGroupListController.php b/src/lib/Server/Controller/Role/RoleAssignmentForUserGroupListController.php index 4fc803ef1..ab593d2a2 100644 --- a/src/lib/Server/Controller/Role/RoleAssignmentForUserGroupListController.php +++ b/src/lib/Server/Controller/Role/RoleAssignmentForUserGroupListController.php @@ -17,21 +17,13 @@ uriTemplate: '/user/groups/{path}/roles', extraProperties: [OpenApiFactory::OVERRIDE_OPENAPI_RESPONSES => false], openapi: new Model\Operation( + operationId: 'ibexa.rest.load_role_assignments_for_user_group', summary: 'Load Roles for User Group', description: 'Returns a list of all Roles assigned to the given User Group.', tags: [ 'User Group', ], parameters: [ - new Model\Parameter( - name: 'Accept', - in: 'header', - required: true, - description: 'If set, the Role assignment list is returned in XML or JSON format.', - schema: [ - 'type' => 'string', - ], - ), new Model\Parameter( name: 'path', in: 'path', @@ -43,18 +35,19 @@ ], responses: [ Response::HTTP_OK => [ + 'description' => 'If set, the Role assignment list is returned in XML or JSON format.', 'content' => [ - 'application/vnd.ibexa.api.RoleAssignmentList+xml' => [ + 'application/vnd.ibexa.api.RoleAssignmentList+json' => [ 'schema' => [ - '$ref' => '#/components/schemas/RoleAssignmentList', + '$ref' => '#/components/schemas/RoleAssignmentListWrapper', ], - 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/user/users/user_id/roles/role_id/GET/RoleAssignment.xml.example', + 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/user/groups/path/roles/GET/RoleAssigmentList.json.example', ], - 'application/vnd.ibexa.api.RoleAssignmentList+json' => [ + 'application/vnd.ibexa.api.RoleAssignmentList+xml' => [ 'schema' => [ - '$ref' => '#/components/schemas/RoleAssignmentListWrapper', + '$ref' => '#/components/schemas/RoleAssignmentList', ], - 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/user/users/user_id/roles/role_id/DELETE/RoleAssignmentList.json.example', + 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/user/groups/path/roles/GET/RoleAssignmentList.xml.example', ], ], ], diff --git a/src/lib/Server/Controller/Role/RoleAssignmentForUserGroupLoadByIdController.php b/src/lib/Server/Controller/Role/RoleAssignmentForUserGroupLoadByIdController.php index d396b25a0..c1135092e 100644 --- a/src/lib/Server/Controller/Role/RoleAssignmentForUserGroupLoadByIdController.php +++ b/src/lib/Server/Controller/Role/RoleAssignmentForUserGroupLoadByIdController.php @@ -19,21 +19,13 @@ uriTemplate: '/user/groups/{path}/roles/{roleId}', extraProperties: [OpenApiFactory::OVERRIDE_OPENAPI_RESPONSES => false], openapi: new Model\Operation( + operationId: 'ibexa.rest.load_role_assignment_for_user_group', summary: 'Load User Group Role Assignment', description: 'Returns a Role assignment of the given User Group.', tags: [ 'User Group', ], parameters: [ - new Model\Parameter( - name: 'Accept', - in: 'header', - required: true, - description: 'If set, the Role assignment list is returned in XML or JSON format.', - schema: [ - 'type' => 'string', - ], - ), new Model\Parameter( name: 'path', in: 'path', @@ -55,17 +47,17 @@ Response::HTTP_OK => [ 'description' => 'OK - returns a Role assignment of the given User Group.', 'content' => [ - 'application/vnd.ibexa.api.RoleAssignment+xml' => [ + 'application/vnd.ibexa.api.RoleAssignment+json' => [ 'schema' => [ - '$ref' => '#/components/schemas/RoleAssignment', + '$ref' => '#/components/schemas/RoleAssignmentWrapper', ], - 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/user/users/user_id/roles/role_id/GET/RoleAssignment.xml.example', + 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/user/groups/path/roles/role_id/GET/RoleAssignment.json.example', ], - 'application/vnd.ibexa.api.RoleAssignment+json' => [ + 'application/vnd.ibexa.api.RoleAssignment+xml' => [ 'schema' => [ - '$ref' => '#/components/schemas/RoleAssignmentWrapper', + '$ref' => '#/components/schemas/RoleAssignment', ], - 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/user/users/user_id/roles/role_id/GET/RoleAssignment.json.example', + 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/user/groups/path/roles/role_id/GET/RoleAssignment.xml.example', ], ], ], diff --git a/src/lib/Server/Controller/Role/RoleAssignmentForUserListController.php b/src/lib/Server/Controller/Role/RoleAssignmentForUserListController.php index 41ec462e4..7d022c9e1 100644 --- a/src/lib/Server/Controller/Role/RoleAssignmentForUserListController.php +++ b/src/lib/Server/Controller/Role/RoleAssignmentForUserListController.php @@ -17,21 +17,13 @@ uriTemplate: '/user/users/{userId}/roles', extraProperties: [OpenApiFactory::OVERRIDE_OPENAPI_RESPONSES => false], openapi: new Model\Operation( + operationId: 'ibexa.rest.load_role_assignments_for_user', summary: 'Load Roles for User', description: 'Returns a list of all Roles assigned to the given User.', tags: [ 'User', ], parameters: [ - new Model\Parameter( - name: 'Accept', - in: 'header', - required: true, - description: 'If set, the Role assignment list is returned in XML or JSON format.', - schema: [ - 'type' => 'string', - ], - ), new Model\Parameter( name: 'userId', in: 'path', @@ -43,18 +35,19 @@ ], responses: [ Response::HTTP_OK => [ + 'description' => 'If set, the Role assignment list is returned in XML or JSON format.', 'content' => [ - 'application/vnd.ibexa.api.RoleAssignmentList+xml' => [ + 'application/vnd.ibexa.api.RoleAssignmentList+json' => [ 'schema' => [ - '$ref' => '#/components/schemas/RoleAssignmentList', + '$ref' => '#/components/schemas/RoleAssignmentListWrapper', ], - 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/user/users/user_id/roles/POST/RoleAssignmentList.xml.example', + 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/user/users/user_id/roles/GET/RoleAssignmentList.json.example', ], - 'application/vnd.ibexa.api.RoleAssignmentList+json' => [ + 'application/vnd.ibexa.api.RoleAssignmentList+xml' => [ 'schema' => [ - '$ref' => '#/components/schemas/RoleAssignmentListWrapper', + '$ref' => '#/components/schemas/RoleAssignmentList', ], - 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/user/users/user_id/roles/role_id/DELETE/RoleAssignmentList.json.example', + 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/user/users/user_id/roles/GET/RoleAssignmentList.xml.example', ], ], ], diff --git a/src/lib/Server/Controller/Role/RoleAssignmentForUserLoadByIdController.php b/src/lib/Server/Controller/Role/RoleAssignmentForUserLoadByIdController.php index f47a97264..28f3276f5 100644 --- a/src/lib/Server/Controller/Role/RoleAssignmentForUserLoadByIdController.php +++ b/src/lib/Server/Controller/Role/RoleAssignmentForUserLoadByIdController.php @@ -19,21 +19,13 @@ uriTemplate: '/user/users/{userId}/roles/{roleId}', extraProperties: [OpenApiFactory::OVERRIDE_OPENAPI_RESPONSES => false], openapi: new Model\Operation( + operationId: 'ibexa.rest.load_role_assignment_for_user', summary: 'Load User Role Assignment', description: 'Returns a Role assignment to the given User.', tags: [ 'User', ], parameters: [ - new Model\Parameter( - name: 'Accept', - in: 'header', - required: true, - description: 'If set, the Role assignment list is returned in XML or JSON format.', - schema: [ - 'type' => 'string', - ], - ), new Model\Parameter( name: 'userId', in: 'path', @@ -55,18 +47,18 @@ Response::HTTP_OK => [ 'description' => 'OK - Role assignment to the given User Group.', 'content' => [ - 'application/vnd.ibexa.api.RoleAssignment+xml' => [ - 'schema' => [ - '$ref' => '#/components/schemas/RoleAssignment', - ], - 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/user/users/user_id/roles/role_id/GET/RoleAssignment.xml.example', - ], 'application/vnd.ibexa.api.RoleAssignment+json' => [ 'schema' => [ '$ref' => '#/components/schemas/RoleAssignmentWrapper', ], 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/user/users/user_id/roles/role_id/GET/RoleAssignment.json.example', ], + 'application/vnd.ibexa.api.RoleAssignment+xml' => [ + 'schema' => [ + '$ref' => '#/components/schemas/RoleAssignment', + ], + 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/user/users/user_id/roles/role_id/GET/RoleAssignment.xml.example', + ], ], ], Response::HTTP_UNAUTHORIZED => [ diff --git a/src/lib/Server/Controller/Role/RoleCreateController.php b/src/lib/Server/Controller/Role/RoleCreateController.php index fdfd5a650..c6ea1fa90 100644 --- a/src/lib/Server/Controller/Role/RoleCreateController.php +++ b/src/lib/Server/Controller/Role/RoleCreateController.php @@ -28,6 +28,7 @@ uriTemplate: '/user/roles', extraProperties: [OpenApiFactory::OVERRIDE_OPENAPI_RESPONSES => false], openapi: new Model\Operation( + operationId: 'ibexa.rest.create_role', summary: 'Create Role or Role draft', description: 'Creates a new Role or Role draft.', tags: [ @@ -35,54 +36,47 @@ ], parameters: [ new Model\Parameter( - name: 'Accept', + name: 'X-CSRF-Token', in: 'header', required: true, - description: 'If set, the new user is returned in XML or JSON format.', - schema: [ - 'type' => 'string', - ], - ), - new Model\Parameter( - name: 'Content-Type', - in: 'header', - required: true, - description: 'The RoleInput schema encoded in XML or JSON.', + description: 'The CSRF Token needed on all unsafe HTTP methods with session.', schema: [ 'type' => 'string', ], ), ], requestBody: new Model\RequestBody( + description: 'The RoleInput schema encoded in XML or JSON.', content: new \ArrayObject([ - 'application/vnd.ibexa.api.RoleInput+xml' => [ - 'schema' => [ - '$ref' => '#/components/schemas/RoleInput', - ], - 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/user/roles/POST/RoleInput.xml.example', - ], 'application/vnd.ibexa.api.RoleInput+json' => [ 'schema' => [ '$ref' => '#/components/schemas/RoleInputWrapper', ], 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/user/roles/POST/RoleInput.json.example', ], + 'application/vnd.ibexa.api.RoleInput+xml' => [ + 'schema' => [ + '$ref' => '#/components/schemas/RoleInput', + ], + 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/user/roles/POST/RoleInput.xml.example', + ], ]), ), responses: [ Response::HTTP_CREATED => [ + 'description' => 'If set, the new user is returned in XML or JSON format.', 'content' => [ - 'application/vnd.ibexa.api.Role+xml' => [ + 'application/vnd.ibexa.api.Role+json' => [ 'schema' => [ - '$ref' => '#/components/schemas/Role', + '$ref' => '#/components/schemas/RoleWrapper', ], - 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/user/roles/id/draft/PATCH/Role.xml.example', + 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/user/roles/POST/Role.json.example', ], - 'application/vnd.ibexa.api.Role+json' => [ + 'application/vnd.ibexa.api.Role+xml' => [ 'schema' => [ - '$ref' => '#/components/schemas/RoleWrapper', + '$ref' => '#/components/schemas/Role', ], - 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/user/roles/id/draft/PATCH/Role.json.example', + 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/user/roles/POST/Role.xml.example', ], ], ], diff --git a/src/lib/Server/Controller/Role/RoleDeleteController.php b/src/lib/Server/Controller/Role/RoleDeleteController.php index 3982a0a17..09d1eca2d 100644 --- a/src/lib/Server/Controller/Role/RoleDeleteController.php +++ b/src/lib/Server/Controller/Role/RoleDeleteController.php @@ -17,12 +17,22 @@ uriTemplate: '/user/roles/{id}', extraProperties: [OpenApiFactory::OVERRIDE_OPENAPI_RESPONSES => false], openapi: new Model\Operation( + operationId: 'ibexa.rest.delete_role', summary: 'Delete Role', description: 'The given Role and all assignments to Users or User Groups are deleted.', tags: [ 'User Role', ], parameters: [ + new Model\Parameter( + name: 'X-CSRF-Token', + in: 'header', + required: true, + description: 'The CSRF Token needed on all unsafe HTTP methods with session.', + schema: [ + 'type' => 'string', + ], + ), new Model\Parameter( name: 'id', in: 'path', diff --git a/src/lib/Server/Controller/Role/RoleDraftCreateController.php b/src/lib/Server/Controller/Role/RoleDraftCreateController.php index 74227da30..a2a98c696 100644 --- a/src/lib/Server/Controller/Role/RoleDraftCreateController.php +++ b/src/lib/Server/Controller/Role/RoleDraftCreateController.php @@ -23,6 +23,7 @@ uriTemplate: '/user/roles/{id}', extraProperties: [OpenApiFactory::OVERRIDE_OPENAPI_RESPONSES => false], openapi: new Model\Operation( + operationId: 'ibexa.rest.create_role_draft', summary: 'Create Role Draft', description: 'Creates a new Role draft from an existing Role.', tags: [ @@ -30,19 +31,10 @@ ], parameters: [ new Model\Parameter( - name: 'Accept', + name: 'X-CSRF-Token', in: 'header', required: true, - description: 'If set, the new user is returned in XML or JSON format.', - schema: [ - 'type' => 'string', - ], - ), - new Model\Parameter( - name: 'Content-Type', - in: 'header', - required: true, - description: 'The RoleInput schema encoded in XML or JSON.', + description: 'The CSRF Token needed on all unsafe HTTP methods with session.', schema: [ 'type' => 'string', ], @@ -56,20 +48,25 @@ ], ), ], + requestBody: new Model\RequestBody( + description: 'No payload required', + content: new \ArrayObject(), + ), responses: [ Response::HTTP_CREATED => [ + 'description' => 'If set, the new user is returned in XML or JSON format.', 'content' => [ - 'application/vnd.ibexa.api.RoleDraft+xml' => [ + 'application/vnd.ibexa.api.RoleDraft+json' => [ 'schema' => [ - '$ref' => '#/components/schemas/RoleDraft', + '$ref' => '#/components/schemas/RoleDraftWrapper', ], - 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/user/roles/id/POST/RoleDraft.xml.example', + 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/user/roles/id/POST/RoleDraft.json.example', ], - 'application/vnd.ibexa.api.RoleDraft+json' => [ + 'application/vnd.ibexa.api.RoleDraft+xml' => [ 'schema' => [ - '$ref' => '#/components/schemas/RoleDraftWrapper', + '$ref' => '#/components/schemas/RoleDraft', ], - 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/user/roles/id/draft/PATCH/Role.json.example', + 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/user/roles/id/POST/RoleDraft.xml.example', ], ], ], @@ -77,9 +74,6 @@ 'description' => 'Error - the user is not authorized to create a Role or a Role draft', ], ], - requestBody: new Model\RequestBody( - content: new \ArrayObject(), - ), ), )] class RoleDraftCreateController extends RoleBaseController diff --git a/src/lib/Server/Controller/Role/RoleDraftDeleteController.php b/src/lib/Server/Controller/Role/RoleDraftDeleteController.php index da81bd2e6..a128c2aac 100644 --- a/src/lib/Server/Controller/Role/RoleDraftDeleteController.php +++ b/src/lib/Server/Controller/Role/RoleDraftDeleteController.php @@ -17,12 +17,22 @@ uriTemplate: '/user/roles/{id}/draft', extraProperties: [OpenApiFactory::OVERRIDE_OPENAPI_RESPONSES => false], openapi: new Model\Operation( + operationId: 'ibexa.rest.delete_role_draft', summary: 'Delete Role draft', description: 'The given Role draft is deleted.', tags: [ 'User Role', ], parameters: [ + new Model\Parameter( + name: 'X-CSRF-Token', + in: 'header', + required: true, + description: 'The CSRF Token needed on all unsafe HTTP methods with session.', + schema: [ + 'type' => 'string', + ], + ), new Model\Parameter( name: 'id', in: 'path', diff --git a/src/lib/Server/Controller/Role/RoleDraftLoadByRoleIdController.php b/src/lib/Server/Controller/Role/RoleDraftLoadByRoleIdController.php index 12ad7ab47..bb51da8be 100644 --- a/src/lib/Server/Controller/Role/RoleDraftLoadByRoleIdController.php +++ b/src/lib/Server/Controller/Role/RoleDraftLoadByRoleIdController.php @@ -16,25 +16,17 @@ #[Get( uriTemplate: '/user/roles/{id}/draft', openapi: new Model\Operation( + operationId: 'ibexa.rest.load_role_draft', summary: 'Load Role draft', description: 'Loads a Role draft by original Role ID.', tags: [ 'User Role', ], parameters: [ - new Model\Parameter( - name: 'Accept', - in: 'header', - required: true, - description: 'If set, the User list returned in XML or JSON format.', - schema: [ - 'type' => 'string', - ], - ), new Model\Parameter( name: 'If-None-Match', in: 'header', - required: true, + required: false, description: 'ETag', schema: [ 'type' => 'string', @@ -53,17 +45,17 @@ Response::HTTP_OK => [ 'description' => 'OK - Role draft by original Role ID.', 'content' => [ - 'application/vnd.ibexa.api.Role+xml' => [ + 'application/vnd.ibexa.api.Role+json' => [ 'schema' => [ - '$ref' => '#/components/schemas/Role', + '$ref' => '#/components/schemas/RoleWrapper', ], - 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/user/roles/id/draft/PATCH/Role.xml.example', + 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/user/roles/id/draft/GET/Role.json.example', ], - 'application/vnd.ibexa.api.Role+json' => [ + 'application/vnd.ibexa.api.Role+xml' => [ 'schema' => [ - '$ref' => '#/components/schemas/RoleWrapper', + '$ref' => '#/components/schemas/Role', ], - 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/user/roles/id/draft/PATCH/Role.json.example', + 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/user/roles/id/draft/GET/Role.xml.example', ], ], ], diff --git a/src/lib/Server/Controller/Role/RoleDraftUpdateController.php b/src/lib/Server/Controller/Role/RoleDraftUpdateController.php index 6f6272ca8..9cf2006b9 100644 --- a/src/lib/Server/Controller/Role/RoleDraftUpdateController.php +++ b/src/lib/Server/Controller/Role/RoleDraftUpdateController.php @@ -20,6 +20,7 @@ uriTemplate: '/user/roles/{id}/draft', extraProperties: [OpenApiFactory::OVERRIDE_OPENAPI_RESPONSES => false], openapi: new Model\Operation( + operationId: 'ibexa.rest.update_role_draft', summary: 'Update Role draft', description: 'Updates a Role draft. PATCH or POST with header X-HTTP-Method-Override PATCH.', tags: [ @@ -27,19 +28,10 @@ ], parameters: [ new Model\Parameter( - name: 'Accept', + name: 'X-CSRF-Token', in: 'header', required: true, - description: 'If set, the updated Role is returned in XML or JSON format.', - schema: [ - 'type' => 'string', - ], - ), - new Model\Parameter( - name: 'Content-Type', - in: 'header', - required: true, - description: 'The RoleInput schema encoded in XML or JSON format.', + description: 'The CSRF Token needed on all unsafe HTTP methods with session.', schema: [ 'type' => 'string', ], @@ -63,18 +55,19 @@ ), ], requestBody: new Model\RequestBody( + description: 'The RoleInput schema encoded in XML or JSON format.', content: new \ArrayObject([ - 'application/vnd.ibexa.api.RoleInput+xml' => [ + 'application/vnd.ibexa.api.RoleInput+json' => [ 'schema' => [ - '$ref' => '#/components/schemas/RoleInput', + '$ref' => '#/components/schemas/RoleInputWrapper', ], - 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/user/roles/POST/RoleInput.xml.example', + 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/user/roles/id/draft/PATCH/RoleInput.json.example', ], - 'application/vnd.ibexa.api.RoleInput+json' => [ + 'application/vnd.ibexa.api.RoleInput+xml' => [ 'schema' => [ - '$ref' => '#/components/schemas/RoleInputWrapper', + '$ref' => '#/components/schemas/RoleInput', ], - 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/user/roles/POST/RoleInput.json.example', + 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/user/roles/id/draft/PATCH/RoleInput.xml.example', ], ]), ), @@ -82,18 +75,18 @@ Response::HTTP_OK => [ 'description' => 'OK - Role draft updated.', 'content' => [ - 'application/vnd.ibexa.api.Role+xml' => [ - 'schema' => [ - '$ref' => '#/components/schemas/Role', - ], - 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/user/roles/id/draft/PATCH/Role.xml.example', - ], 'application/vnd.ibexa.api.Role+json' => [ 'schema' => [ '$ref' => '#/components/schemas/RoleWrapper', ], 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/user/roles/id/draft/PATCH/Role.json.example', ], + 'application/vnd.ibexa.api.Role+xml' => [ + 'schema' => [ + '$ref' => '#/components/schemas/Role', + ], + 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/user/roles/id/draft/PATCH/Role.xml.example', + ], ], ], Response::HTTP_BAD_REQUEST => [ diff --git a/src/lib/Server/Controller/Role/RoleListController.php b/src/lib/Server/Controller/Role/RoleListController.php index 2730717ac..da7baa936 100644 --- a/src/lib/Server/Controller/Role/RoleListController.php +++ b/src/lib/Server/Controller/Role/RoleListController.php @@ -19,38 +19,28 @@ uriTemplate: '/user/roles', extraProperties: [OpenApiFactory::OVERRIDE_OPENAPI_RESPONSES => false], openapi: new Model\Operation( + operationId: 'ibexa.rest.list_roles', summary: 'Load Roles', description: 'Returns a list of all Roles.', tags: [ 'User Role', ], - parameters: [ - new Model\Parameter( - name: 'Accept', - in: 'header', - required: true, - description: 'If set, the user list returned in XML or JSON format.', - schema: [ - 'type' => 'string', - ], - ), - ], responses: [ Response::HTTP_OK => [ 'description' => 'OK - list of all Roles.', 'content' => [ - 'application/vnd.ibexa.api.RoleList+xml' => [ - 'schema' => [ - '$ref' => '#/components/schemas/RoleList', - ], - 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/user/roles/GET/RoleList.xml.example', - ], 'application/vnd.ibexa.api.RoleList+json' => [ 'schema' => [ '$ref' => '#/components/schemas/RoleListWrapper', ], 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/user/roles/GET/RoleList.json.example', ], + 'application/vnd.ibexa.api.RoleList+xml' => [ + 'schema' => [ + '$ref' => '#/components/schemas/RoleList', + ], + 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/user/roles/GET/RoleList.xml.example', + ], ], ], Response::HTTP_UNAUTHORIZED => [ diff --git a/src/lib/Server/Controller/Role/RoleLoadByIdController.php b/src/lib/Server/Controller/Role/RoleLoadByIdController.php index a691b5cfc..a83c266d8 100644 --- a/src/lib/Server/Controller/Role/RoleLoadByIdController.php +++ b/src/lib/Server/Controller/Role/RoleLoadByIdController.php @@ -15,25 +15,17 @@ #[Get( uriTemplate: '/user/roles/{id}', openapi: new Model\Operation( + operationId: 'ibexa.rest.load_role', summary: 'Load Role', description: 'Loads a Role for the given ID.', tags: [ 'User Role', ], parameters: [ - new Model\Parameter( - name: 'Accept', - in: 'header', - required: true, - description: 'If set, the user list returned in XML or JSON format.', - schema: [ - 'type' => 'string', - ], - ), new Model\Parameter( name: 'If-None-Match', in: 'header', - required: true, + required: false, description: 'ETag', schema: [ 'type' => 'string', @@ -52,17 +44,17 @@ Response::HTTP_OK => [ 'description' => 'OK - Role for the given ID.', 'content' => [ - 'application/vnd.ibexa.api.Role+xml' => [ + 'application/vnd.ibexa.api.Role+json' => [ 'schema' => [ - '$ref' => '#/components/schemas/Role', + '$ref' => '#/components/schemas/RoleWrapper', ], - 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/user/roles/id/draft/PATCH/Role.xml.example', + 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/user/roles/id/GET/Role.json.example', ], - 'application/vnd.ibexa.api.Role+json' => [ + 'application/vnd.ibexa.api.Role+xml' => [ 'schema' => [ - '$ref' => '#/components/schemas/RoleWrapper', + '$ref' => '#/components/schemas/Role', ], - 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/user/roles/id/draft/PATCH/Role.json.example', + 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/user/roles/id/GET/Role.xml.example', ], ], ], diff --git a/src/lib/Server/Controller/Role/RolePoliciesForUserListController.php b/src/lib/Server/Controller/Role/RolePoliciesForUserListController.php index 30694411d..be367c1f4 100644 --- a/src/lib/Server/Controller/Role/RolePoliciesForUserListController.php +++ b/src/lib/Server/Controller/Role/RolePoliciesForUserListController.php @@ -18,37 +18,27 @@ uriTemplate: '/user/policies', extraProperties: [OpenApiFactory::OVERRIDE_OPENAPI_RESPONSES => false], openapi: new Model\Operation( + operationId: 'ibexa.rest.list_policies_for_user', summary: 'List Policies for User', description: 'Search all Policies which are applied to a given User.', tags: [ 'User Policy', ], - parameters: [ - new Model\Parameter( - name: 'Accept', - in: 'header', - required: true, - description: 'If set, the Policy list is returned in XML or JSON format.', - schema: [ - 'type' => 'string', - ], - ), - ], responses: [ Response::HTTP_OK => [ 'description' => 'OK - Policies which are applied to a given User.', 'content' => [ - 'application/vnd.ibexa.api.PolicyList+xml' => [ + 'application/vnd.ibexa.api.PolicyList+json' => [ 'schema' => [ - '$ref' => '#/components/schemas/PolicyList', + '$ref' => '#/components/schemas/PolicyListWrapper', ], - 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/user/roles/id/policies/GET/PolicyList.xml.example', + 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/user/policies/GET/PolicyList.json.example', ], - 'application/vnd.ibexa.api.PolicyList+json' => [ + 'application/vnd.ibexa.api.PolicyList+xml' => [ 'schema' => [ - '$ref' => '#/components/schemas/PolicyListWrapper', + '$ref' => '#/components/schemas/PolicyList', ], - 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/user/roles/id/policies/GET/PolicyList.json.example', + 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/user/policies/GET/PolicyList.xml.example', ], ], ], diff --git a/src/lib/Server/Controller/Role/RolePolicyCreateController.php b/src/lib/Server/Controller/Role/RolePolicyCreateController.php index d3a609bed..6ae3026ad 100644 --- a/src/lib/Server/Controller/Role/RolePolicyCreateController.php +++ b/src/lib/Server/Controller/Role/RolePolicyCreateController.php @@ -22,6 +22,7 @@ uriTemplate: '/user/roles/{id}/policies', extraProperties: [OpenApiFactory::OVERRIDE_OPENAPI_RESPONSES => false], openapi: new Model\Operation( + operationId: 'ibexa.rest.add_policy', summary: 'Create Policy', description: 'Creates a Policy', tags: [ @@ -29,19 +30,10 @@ ], parameters: [ new Model\Parameter( - name: 'Accept', + name: 'X-CSRF-Token', in: 'header', required: true, - description: 'If set, the updated Policy is returned in XML or JSON format.', - schema: [ - 'type' => 'string', - ], - ), - new Model\Parameter( - name: 'Content-Type', - in: 'header', - required: true, - description: 'If set, the updated Policy is returned in XML or JSON format.', + description: 'The CSRF Token needed on all unsafe HTTP methods with session.', schema: [ 'type' => 'string', ], @@ -56,35 +48,37 @@ ), ], requestBody: new Model\RequestBody( + description: 'If set, the updated Policy is returned in XML or JSON format.', content: new \ArrayObject([ - 'application/vnd.ibexa.api.PolicyCreate+xml' => [ + 'application/vnd.ibexa.api.PolicyCreate+json' => [ 'schema' => [ - '$ref' => '#/components/schemas/PolicyCreate', + '$ref' => '#/components/schemas/PolicyCreateWrapper', ], - 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/user/roles/id/policies/POST/PolicyCreate.xml.example', ], - 'application/vnd.ibexa.api.PolicyCreate+json' => [ + 'application/vnd.ibexa.api.PolicyCreate+xml' => [ 'schema' => [ - '$ref' => '#/components/schemas/PolicyCreateWrapper', + '$ref' => '#/components/schemas/PolicyCreate', ], + 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/user/roles/id/policies/POST/PolicyCreate.xml.example', ], ]), ), responses: [ Response::HTTP_CREATED => [ + 'description' => 'If set, the updated Policy is returned in XML or JSON format.', 'content' => [ - 'application/vnd.ibexa.api.Policy+xml' => [ - 'schema' => [ - '$ref' => '#/components/schemas/Policy', - ], - 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/user/roles/id/policies/id/PATCH/Policy.xml.example', - ], 'application/vnd.ibexa.api.Policy+json' => [ 'schema' => [ '$ref' => '#/components/schemas/PolicyWrapper', ], 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/user/roles/id/policies/id/GET/Policy.json.example', ], + 'application/vnd.ibexa.api.Policy+xml' => [ + 'schema' => [ + '$ref' => '#/components/schemas/Policy', + ], + 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/user/roles/id/policies/POST/Policy.xml.example', + ], ], ], Response::HTTP_BAD_REQUEST => [ diff --git a/src/lib/Server/Controller/Role/RolePolicyDeleteAllFromRoleController.php b/src/lib/Server/Controller/Role/RolePolicyDeleteAllFromRoleController.php index b71dad108..37933bf69 100644 --- a/src/lib/Server/Controller/Role/RolePolicyDeleteAllFromRoleController.php +++ b/src/lib/Server/Controller/Role/RolePolicyDeleteAllFromRoleController.php @@ -17,12 +17,22 @@ uriTemplate: '/user/roles/{id}/policies', extraProperties: [OpenApiFactory::OVERRIDE_OPENAPI_RESPONSES => false], openapi: new Model\Operation( + operationId: 'ibexa.rest.delete_policies', summary: 'Delete Policies', description: 'All Policies of the given Role are deleted.', tags: [ 'User Role', ], parameters: [ + new Model\Parameter( + name: 'X-CSRF-Token', + in: 'header', + required: true, + description: 'The CSRF Token needed on all unsafe HTTP methods with session.', + schema: [ + 'type' => 'string', + ], + ), new Model\Parameter( name: 'id', in: 'path', diff --git a/src/lib/Server/Controller/Role/RolePolicyDeleteController.php b/src/lib/Server/Controller/Role/RolePolicyDeleteController.php index 6f4be4d58..f81ca3f3f 100644 --- a/src/lib/Server/Controller/Role/RolePolicyDeleteController.php +++ b/src/lib/Server/Controller/Role/RolePolicyDeleteController.php @@ -19,12 +19,22 @@ #[Delete( uriTemplate: '/user/roles/{roleId}/policies/{policyId}', openapi: new Model\Operation( + operationId: 'ibexa.rest.delete_policy', summary: 'Delete Policy', description: 'Deletes given Policy.', tags: [ 'User Role', ], parameters: [ + new Model\Parameter( + name: 'X-CSRF-Token', + in: 'header', + required: true, + description: 'The CSRF Token needed on all unsafe HTTP methods with session.', + schema: [ + 'type' => 'string', + ], + ), new Model\Parameter( name: 'policyId', in: 'path', diff --git a/src/lib/Server/Controller/Role/RolePolicyListController.php b/src/lib/Server/Controller/Role/RolePolicyListController.php index ba56bad25..5aafbd44d 100644 --- a/src/lib/Server/Controller/Role/RolePolicyListController.php +++ b/src/lib/Server/Controller/Role/RolePolicyListController.php @@ -16,21 +16,13 @@ #[Get( uriTemplate: '/user/roles/{id}/policies', openapi: new Model\Operation( + operationId: 'ibexa.rest.load_policies', summary: 'Load Policies', description: 'Loads Policies for the given Role.', tags: [ 'User Role', ], parameters: [ - new Model\Parameter( - name: 'Accept', - in: 'header', - required: true, - description: 'If set, the Policy list is returned in XML or JSON format.', - schema: [ - 'type' => 'string', - ], - ), new Model\Parameter( name: 'id', in: 'path', @@ -42,19 +34,20 @@ ], responses: [ Response::HTTP_OK => [ + 'description' => 'If set, the Policy list is returned in XML or JSON format.', 'content' => [ - 'application/vnd.ibexa.api.PolicyList+xml' => [ - 'schema' => [ - '$ref' => '#/components/schemas/PolicyList', - ], - 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/user/roles/id/policies/GET/PolicyList.xml.example', - ], 'application/vnd.ibexa.api.PolicyList+json' => [ 'schema' => [ '$ref' => '#/components/schemas/PolicyListWrapper', ], 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/user/roles/id/policies/GET/PolicyList.json.example', ], + 'application/vnd.ibexa.api.PolicyList+xml' => [ + 'schema' => [ + '$ref' => '#/components/schemas/PolicyList', + ], + 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/user/roles/id/policies/GET/PolicyList.xml.example', + ], ], ], Response::HTTP_UNAUTHORIZED => [ diff --git a/src/lib/Server/Controller/Role/RolePolicyLoadByIdController.php b/src/lib/Server/Controller/Role/RolePolicyLoadByIdController.php index b1f4bd7fa..98aee5a7a 100644 --- a/src/lib/Server/Controller/Role/RolePolicyLoadByIdController.php +++ b/src/lib/Server/Controller/Role/RolePolicyLoadByIdController.php @@ -17,25 +17,17 @@ #[Get( uriTemplate: '/user/roles/{roleId}/policies/{policyId}', openapi: new Model\Operation( + operationId: 'ibexa.rest.load_policy', summary: 'Load Policy', description: 'Loads a Policy for the given module and function.', tags: [ 'User Role', ], parameters: [ - new Model\Parameter( - name: 'Accept', - in: 'header', - required: true, - description: 'If set, the Policy is returned in XML or JSON format.', - schema: [ - 'type' => 'string', - ], - ), new Model\Parameter( name: 'If-None-Match', in: 'header', - required: true, + required: false, description: 'ETag', schema: [ 'type' => 'string', @@ -52,19 +44,20 @@ ], responses: [ Response::HTTP_OK => [ + 'description' => 'If set, the Policy is returned in XML or JSON format.', 'content' => [ - 'application/vnd.ibexa.api.Policy+xml' => [ - 'schema' => [ - '$ref' => '#/components/schemas/Policy', - ], - 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/user/roles/id/policies/id/PATCH/Policy.xml.example', - ], 'application/vnd.ibexa.api.Policy+json' => [ 'schema' => [ '$ref' => '#/components/schemas/PolicyWrapper', ], 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/user/roles/id/policies/id/GET/Policy.json.example', ], + 'application/vnd.ibexa.api.Policy+xml' => [ + 'schema' => [ + '$ref' => '#/components/schemas/Policy', + ], + 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/user/roles/id/policies/id/GET/Policy.xml.example', + ], ], ], Response::HTTP_UNAUTHORIZED => [ diff --git a/src/lib/Server/Controller/Role/RolePolicyUpdateController.php b/src/lib/Server/Controller/Role/RolePolicyUpdateController.php index 05ef62cd5..55def0d5a 100644 --- a/src/lib/Server/Controller/Role/RolePolicyUpdateController.php +++ b/src/lib/Server/Controller/Role/RolePolicyUpdateController.php @@ -24,6 +24,7 @@ uriTemplate: '/user/roles/{roleId}/policies/{policyId}', extraProperties: [OpenApiFactory::OVERRIDE_OPENAPI_RESPONSES => false], openapi: new Model\Operation( + operationId: 'ibexa.rest.update_policy', summary: 'Update Policy', description: 'Updates a Policy. PATCH or POST with header X-HTTP-Method-Override PATCH.', tags: [ @@ -31,19 +32,10 @@ ], parameters: [ new Model\Parameter( - name: 'Accept', + name: 'X-CSRF-Token', in: 'header', required: true, - description: 'If set, the updated Policy is returned in XML or JSON format.', - schema: [ - 'type' => 'string', - ], - ), - new Model\Parameter( - name: 'Content-Type', - in: 'header', - required: true, - description: 'If set, the updated Policy is returned in XML or JSON format.', + description: 'The CSRF Token needed on all unsafe HTTP methods with session.', schema: [ 'type' => 'string', ], @@ -67,35 +59,37 @@ ), ], requestBody: new Model\RequestBody( + description: 'If set, the updated Policy is returned in XML or JSON format.', content: new \ArrayObject([ - 'application/vnd.ibexa.api.PolicyUpdate+xml' => [ + 'application/vnd.ibexa.api.PolicyUpdate+json' => [ 'schema' => [ - '$ref' => '#/components/schemas/PolicyUpdate', + '$ref' => '#/components/schemas/PolicyUpdateWrapper', ], - 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/user/roles/id/policies/id/PATCH/PolicyUpdate.xml.example', ], - 'application/vnd.ibexa.api.PolicyUpdate+json' => [ + 'application/vnd.ibexa.api.PolicyUpdate+xml' => [ 'schema' => [ - '$ref' => '#/components/schemas/PolicyUpdateWrapper', + '$ref' => '#/components/schemas/PolicyUpdate', ], + 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/user/roles/id/policies/id/PATCH/PolicyUpdate.xml.example', ], ]), ), responses: [ Response::HTTP_OK => [ + 'description' => 'If set, the updated Policy is returned in XML or JSON format.', 'content' => [ - 'application/vnd.ibexa.api.Policy+xml' => [ - 'schema' => [ - '$ref' => '#/components/schemas/Policy', - ], - 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/user/roles/id/policies/id/PATCH/Policy.xml.example', - ], 'application/vnd.ibexa.api.Policy+json' => [ 'schema' => [ '$ref' => '#/components/schemas/PolicyWrapper', ], 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/user/roles/id/policies/id/GET/Policy.json.example', ], + 'application/vnd.ibexa.api.Policy+xml' => [ + 'schema' => [ + '$ref' => '#/components/schemas/Policy', + ], + 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/user/roles/id/policies/id/PATCH/Policy.xml.example', + ], ], ], Response::HTTP_BAD_REQUEST => [ diff --git a/src/lib/Server/Controller/Role/RoleUnassignFromUserController.php b/src/lib/Server/Controller/Role/RoleUnassignFromUserController.php index ee21b40ba..4c228b481 100644 --- a/src/lib/Server/Controller/Role/RoleUnassignFromUserController.php +++ b/src/lib/Server/Controller/Role/RoleUnassignFromUserController.php @@ -17,6 +17,7 @@ uriTemplate: '/user/users/{userId}/roles/{roleId}', extraProperties: [OpenApiFactory::OVERRIDE_OPENAPI_RESPONSES => false], openapi: new Model\Operation( + operationId: 'ibexa.rest.unassign_role_from_user', summary: 'Unassign Role from User', description: 'The given Role is removed from the user.', tags: [ @@ -24,10 +25,10 @@ ], parameters: [ new Model\Parameter( - name: 'Accept', + name: 'X-CSRF-Token', in: 'header', required: true, - description: 'If set, the updated Role assignment list is returned in XML or JSON format.', + description: 'The CSRF Token needed on all unsafe HTTP methods with session.', schema: [ 'type' => 'string', ], @@ -51,19 +52,20 @@ ], responses: [ Response::HTTP_OK => [ + 'description' => 'If set, the updated Role assignment list is returned in XML or JSON format.', 'content' => [ - 'application/vnd.ibexa.api.RoleAssignmentList+xml' => [ - 'schema' => [ - '$ref' => '#/components/schemas/RoleAssignmentList', - ], - 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/user/users/user_id/roles/POST/RoleAssignmentList.xml.example', - ], 'application/vnd.ibexa.api.RoleAssignmentList+json' => [ 'schema' => [ '$ref' => '#/components/schemas/RoleAssignmentListWrapper', ], 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/user/users/user_id/roles/role_id/DELETE/RoleAssignmentList.json.example', ], + 'application/vnd.ibexa.api.RoleAssignmentList+xml' => [ + 'schema' => [ + '$ref' => '#/components/schemas/RoleAssignmentList', + ], + 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/user/users/user_id/roles/role_id/DELETE/RoleAssignmentList.xml.example', + ], ], ], Response::HTTP_UNAUTHORIZED => [ diff --git a/src/lib/Server/Controller/Role/RoleUnassignFromUserGroupController.php b/src/lib/Server/Controller/Role/RoleUnassignFromUserGroupController.php index 062ac9534..f23594681 100644 --- a/src/lib/Server/Controller/Role/RoleUnassignFromUserGroupController.php +++ b/src/lib/Server/Controller/Role/RoleUnassignFromUserGroupController.php @@ -17,6 +17,7 @@ uriTemplate: '/user/groups/{path}/roles/{roleId}', extraProperties: [OpenApiFactory::OVERRIDE_OPENAPI_RESPONSES => false], openapi: new Model\Operation( + operationId: 'ibexa.rest.unassign_role_from_user_group', summary: 'Unassign Role from User Group', description: 'The given Role is removed from the User or User Group.', tags: [ @@ -24,10 +25,10 @@ ], parameters: [ new Model\Parameter( - name: 'Accept', + name: 'X-CSRF-Token', in: 'header', required: true, - description: 'If set, the updated Role assignment list is returned in XML or JSON format.', + description: 'The CSRF Token needed on all unsafe HTTP methods with session.', schema: [ 'type' => 'string', ], @@ -51,18 +52,19 @@ ], responses: [ Response::HTTP_OK => [ + 'description' => 'If set, the updated Role assignment list is returned in XML or JSON format.', 'content' => [ - 'application/vnd.ibexa.api.RoleAssignmentList+xml' => [ + 'application/vnd.ibexa.api.RoleAssignmentList+json' => [ 'schema' => [ - '$ref' => '#/components/schemas/RoleAssignmentList', + '$ref' => '#/components/schemas/RoleAssignmentListWrapper', ], - 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/user/users/user_id/roles/role_id/GET/RoleAssignment.xml.example', + 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/user/groups/path/roles/role_id/DELETE/RoleAssignmentList.json.example', ], - 'application/vnd.ibexa.api.RoleAssignmentList+json' => [ + 'application/vnd.ibexa.api.RoleAssignmentList+xml' => [ 'schema' => [ - '$ref' => '#/components/schemas/RoleAssignmentListWrapper', + '$ref' => '#/components/schemas/RoleAssignmentList', ], - 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/user/users/user_id/roles/role_id/DELETE/RoleAssignmentList.json.example', + 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/user/groups/path/roles/role_id/DELETE/RoleAssignmentList.xml.example', ], ], ], diff --git a/src/lib/Server/Controller/Role/RoleUpdateController.php b/src/lib/Server/Controller/Role/RoleUpdateController.php index 6e5a66e6d..d315db239 100644 --- a/src/lib/Server/Controller/Role/RoleUpdateController.php +++ b/src/lib/Server/Controller/Role/RoleUpdateController.php @@ -19,6 +19,7 @@ uriTemplate: '/user/roles/{id}', extraProperties: [OpenApiFactory::OVERRIDE_OPENAPI_RESPONSES => false], openapi: new Model\Operation( + operationId: 'ibexa.rest.update_role', summary: 'Update Role', description: 'Updates a Role. PATCH or POST with header X-HTTP-Method-Override PATCH', tags: [ @@ -26,19 +27,10 @@ ], parameters: [ new Model\Parameter( - name: 'Accept', + name: 'X-CSRF-Token', in: 'header', required: true, - description: 'If set, the new user is returned in XML or JSON format.', - schema: [ - 'type' => 'string', - ], - ), - new Model\Parameter( - name: 'Content-Type', - in: 'header', - required: true, - description: 'The RoleInput schema encoded in XML or JSON format.', + description: 'The CSRF Token needed on all unsafe HTTP methods with session.', schema: [ 'type' => 'string', ], @@ -62,18 +54,19 @@ ), ], requestBody: new Model\RequestBody( + description: 'The RoleInput schema encoded in XML or JSON format.', content: new \ArrayObject([ - 'application/vnd.ibexa.api.RoleInput+xml' => [ + 'application/vnd.ibexa.api.RoleInput+json' => [ 'schema' => [ - '$ref' => '#/components/schemas/RoleInput', + '$ref' => '#/components/schemas/RoleInputWrapper', ], - 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/user/roles/POST/RoleInput.xml.example', + 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/user/roles/id/PATCH/RoleInput.json.example', ], - 'application/vnd.ibexa.api.RoleInput+json' => [ + 'application/vnd.ibexa.api.RoleInput+xml' => [ 'schema' => [ - '$ref' => '#/components/schemas/RoleInputWrapper', + '$ref' => '#/components/schemas/RoleInput', ], - 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/user/roles/POST/RoleInput.json.example', + 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/user/roles/id/PATCH/RoleInput.xml.example', ], ]), ), @@ -81,17 +74,17 @@ Response::HTTP_OK => [ 'description' => 'OK - Role updated', 'content' => [ - 'application/vnd.ibexa.api.Role+xml' => [ + 'application/vnd.ibexa.api.Role+json' => [ 'schema' => [ - '$ref' => '#/components/schemas/Role', + '$ref' => '#/components/schemas/RoleWrapper', ], - 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/user/roles/id/draft/PATCH/Role.xml.example', + 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/user/roles/id/PATCH/Role.json.example', ], - 'application/vnd.ibexa.api.Role+json' => [ + 'application/vnd.ibexa.api.Role+xml' => [ 'schema' => [ - '$ref' => '#/components/schemas/RoleWrapper', + '$ref' => '#/components/schemas/Role', ], - 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/user/roles/id/draft/PATCH/Role.json.example', + 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/user/roles/id/PATCH/Role.xml.example', ], ], ], diff --git a/src/lib/Server/Controller/Root.php b/src/lib/Server/Controller/Root.php index 419fde1cc..ae01c564b 100644 --- a/src/lib/Server/Controller/Root.php +++ b/src/lib/Server/Controller/Root.php @@ -18,37 +18,28 @@ #[Get( uriTemplate: '/', openapi: new Model\Operation( + operationId: 'ibexa.rest.load_root_resource', summary: 'List of root resources', description: 'Lists the root resources of the Ibexa Platform installation.', tags: [ 'Root', ], - parameters: [ - new Model\Parameter( - name: 'Accept', - in: 'header', - required: true, - description: 'If set, the list is return in XML or JSON format.', - schema: [ - 'type' => 'string', - ], - ), - ], responses: [ Response::HTTP_OK => [ + 'description' => 'If set, the list is return in XML or JSON format.', 'content' => [ - 'application/vnd.ibexa.api.Root+xml' => [ - 'schema' => [ - '$ref' => '#/components/schemas/Root', - ], - 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/GET/Root.xml.example', - ], 'application/vnd.ibexa.api.Root+json' => [ 'schema' => [ '$ref' => '#/components/schemas/RootWrapper', ], 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/GET/Root.json.example', ], + 'application/vnd.ibexa.api.Root+xml' => [ + 'schema' => [ + '$ref' => '#/components/schemas/Root', + ], + 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/GET/Root.xml.example', + ], ], ], ], diff --git a/src/lib/Server/Controller/Section/SectionCreateController.php b/src/lib/Server/Controller/Section/SectionCreateController.php index 47150bea1..169c7c3e8 100644 --- a/src/lib/Server/Controller/Section/SectionCreateController.php +++ b/src/lib/Server/Controller/Section/SectionCreateController.php @@ -23,6 +23,7 @@ uriTemplate: '/content/sections', extraProperties: [OpenApiFactory::OVERRIDE_OPENAPI_RESPONSES => false], openapi: new Model\Operation( + operationId: 'ibexa.rest.create_section', summary: 'Create new Section', description: 'Creates a new Section.', tags: [ @@ -30,54 +31,47 @@ ], parameters: [ new Model\Parameter( - name: 'Accept', + name: 'X-CSRF-Token', in: 'header', required: true, - description: 'If set, the new Section is returned in XML or JSON format.', - schema: [ - 'type' => 'string', - ], - ), - new Model\Parameter( - name: 'Content-Type', - in: 'header', - required: true, - description: 'The Section input schema encoded in XML or JSON format.', + description: 'The CSRF Token needed on all unsafe HTTP methods with session.', schema: [ 'type' => 'string', ], ), ], requestBody: new Model\RequestBody( + description: 'The Section input schema encoded in XML or JSON format.', content: new \ArrayObject([ - 'application/vnd.ibexa.api.SectionInput+xml' => [ - 'schema' => [ - '$ref' => '#/components/schemas/SectionInput', - ], - 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/content/sections/POST/SectionInput.xml.example', - ], 'application/vnd.ibexa.api.SectionInput+json' => [ 'schema' => [ '$ref' => '#/components/schemas/SectionInputWrapper', ], 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/content/sections/POST/SectionInput.json.example', ], + 'application/vnd.ibexa.api.SectionInput+xml' => [ + 'schema' => [ + '$ref' => '#/components/schemas/SectionInput', + ], + 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/content/sections/POST/SectionInput.xml.example', + ], ]), ), responses: [ Response::HTTP_CREATED => [ + 'description' => 'If set, the new Section is returned in XML or JSON format.', 'content' => [ - 'application/vnd.ibexa.api.Section+xml' => [ + 'application/vnd.ibexa.api.Section+json' => [ 'schema' => [ - '$ref' => '#/components/schemas/Section', + '$ref' => '#/components/schemas/SectionWrapper', ], - 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/content/sections/section_id/PATCH/Section.xml.example', + 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/content/sections/POST/Section.json.example', ], - 'application/vnd.ibexa.api.Section+json' => [ + 'application/vnd.ibexa.api.Section+xml' => [ 'schema' => [ - '$ref' => '#/components/schemas/SectionWrapper', + '$ref' => '#/components/schemas/Section', ], - 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/content/sections/section_id/PATCH/Section.json.example', + 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/content/sections/POST/Section.xml.example', ], ], ], diff --git a/src/lib/Server/Controller/Section/SectionDeleteController.php b/src/lib/Server/Controller/Section/SectionDeleteController.php index 0079bba63..2c2ce2a80 100644 --- a/src/lib/Server/Controller/Section/SectionDeleteController.php +++ b/src/lib/Server/Controller/Section/SectionDeleteController.php @@ -17,12 +17,22 @@ #[Delete( uriTemplate: '/content/sections/{sectionId}', openapi: new Model\Operation( + operationId: 'ibexa.rest.delete_section', summary: 'Delete Section', description: 'The given Section is deleted.', tags: [ 'Section', ], parameters: [ + new Model\Parameter( + name: 'X-CSRF-Token', + in: 'header', + required: true, + description: 'The CSRF Token needed on all unsafe HTTP methods with session.', + schema: [ + 'type' => 'string', + ], + ), new Model\Parameter( name: 'sectionId', in: 'path', diff --git a/src/lib/Server/Controller/Section/SectionListController.php b/src/lib/Server/Controller/Section/SectionListController.php index b6875b6cb..a8bdb24e3 100644 --- a/src/lib/Server/Controller/Section/SectionListController.php +++ b/src/lib/Server/Controller/Section/SectionListController.php @@ -21,25 +21,17 @@ uriTemplate: '/content/sections', extraProperties: [OpenApiFactory::OVERRIDE_OPENAPI_RESPONSES => false], openapi: new Model\Operation( + operationId: 'ibexa.rest.list_sections', summary: 'Get Sections', description: 'Returns a list of all Sections.', tags: [ 'Section', ], parameters: [ - new Model\Parameter( - name: 'Accept', - in: 'header', - required: true, - description: 'If set, the Section list is returned in XML or JSON format.', - schema: [ - 'type' => 'string', - ], - ), new Model\Parameter( name: 'If-None-Match', in: 'header', - required: true, + required: false, description: 'ETag', schema: [ 'type' => 'string', @@ -48,19 +40,20 @@ ], responses: [ Response::HTTP_OK => [ + 'description' => 'If set, the Section list is returned in XML or JSON format.', 'content' => [ - 'application/vnd.ibexa.api.SectionList+xml' => [ - 'schema' => [ - '$ref' => '#/components/schemas/SectionList', - ], - 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/content/sections/GET/SectionList.xml.example', - ], 'application/vnd.ibexa.api.SectionList+json' => [ 'schema' => [ '$ref' => '#/components/schemas/SectionListWrapper', ], 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/content/sections/GET/SectionList.json.example', ], + 'application/vnd.ibexa.api.SectionList+xml' => [ + 'schema' => [ + '$ref' => '#/components/schemas/SectionList', + ], + 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/content/sections/GET/SectionList.xml.example', + ], ], ], //Response::HTTP_NOT_FOUND => [], diff --git a/src/lib/Server/Controller/Section/SectionLoadByIdController.php b/src/lib/Server/Controller/Section/SectionLoadByIdController.php index b39d2d392..a529fa136 100644 --- a/src/lib/Server/Controller/Section/SectionLoadByIdController.php +++ b/src/lib/Server/Controller/Section/SectionLoadByIdController.php @@ -17,25 +17,17 @@ #[Get( uriTemplate: '/content/sections/{sectionId}', openapi: new Model\Operation( + operationId: 'ibexa.rest.load_section', summary: 'Get Section', description: 'Returns the Section by given Section ID.', tags: [ 'Section', ], parameters: [ - new Model\Parameter( - name: 'Accept', - in: 'header', - required: true, - description: 'If set, the Section is returned in XML or JSON format.', - schema: [ - 'type' => 'string', - ], - ), new Model\Parameter( name: 'If-None-match', in: 'header', - required: true, + required: false, description: 'ETag', schema: [ 'type' => 'string', @@ -52,18 +44,19 @@ ], responses: [ Response::HTTP_OK => [ + 'description' => 'If set, the Section is returned in XML or JSON format.', 'content' => [ - 'application/vnd.ibexa.api.Section+xml' => [ + 'application/vnd.ibexa.api.Section+json' => [ 'schema' => [ - '$ref' => '#/components/schemas/Section', + '$ref' => '#/components/schemas/SectionWrapper', ], - 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/content/sections/section_id/PATCH/Section.xml.example', + 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/content/sections/section_id/GET/Section.json.example', ], - 'application/vnd.ibexa.api.Section+json' => [ + 'application/vnd.ibexa.api.Section+xml' => [ 'schema' => [ - '$ref' => '#/components/schemas/SectionWrapper', + '$ref' => '#/components/schemas/Section', ], - 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/content/sections/section_id/PATCH/Section.json.example', + 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/content/sections/section_id/GET/Section.xml.example', ], ], ], diff --git a/src/lib/Server/Controller/Section/SectionUpdateController.php b/src/lib/Server/Controller/Section/SectionUpdateController.php index 23aa20b9e..63815c944 100644 --- a/src/lib/Server/Controller/Section/SectionUpdateController.php +++ b/src/lib/Server/Controller/Section/SectionUpdateController.php @@ -25,6 +25,7 @@ uriTemplate: '/content/sections/{sectionId}', extraProperties: [OpenApiFactory::OVERRIDE_OPENAPI_RESPONSES => false], openapi: new Model\Operation( + operationId: 'ibexa.rest.update_section', summary: 'Update a Section', description: 'Updates a Section. PATCH or POST with header X-HTTP-Method-Override PATCH.', tags: [ @@ -32,19 +33,10 @@ ], parameters: [ new Model\Parameter( - name: 'Accept', + name: 'X-CSRF-Token', in: 'header', required: true, - description: 'If set, the updated Section is returned in XML or JSON format.', - schema: [ - 'type' => 'string', - ], - ), - new Model\Parameter( - name: 'Content-Type', - in: 'header', - required: true, - description: 'The Section input schema encoded in XML or JSON.', + description: 'The CSRF Token needed on all unsafe HTTP methods with session.', schema: [ 'type' => 'string', ], @@ -68,18 +60,19 @@ ), ], requestBody: new Model\RequestBody( + description: 'The Section input schema encoded in XML or JSON.', content: new \ArrayObject([ - 'application/vnd.ibexa.api.SectionInput+xml' => [ + 'application/vnd.ibexa.api.SectionInput+json' => [ 'schema' => [ - '$ref' => '#/components/schemas/SectionInput', + '$ref' => '#/components/schemas/SectionInputWrapper', ], - 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/content/sections/POST/SectionInput.xml.example', + 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/content/sections/section_id/PATCH/SectionInput.json.example', ], - 'application/vnd.ibexa.api.SectionInput+json' => [ + 'application/vnd.ibexa.api.SectionInput+xml' => [ 'schema' => [ - '$ref' => '#/components/schemas/SectionInputWrapper', + '$ref' => '#/components/schemas/SectionInput', ], - 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/content/sections/POST/SectionInput.json.example', + 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/content/sections/section_id/PATCH/SectionInput.xml.example', ], ]), ), @@ -87,18 +80,18 @@ Response::HTTP_OK => [ 'description' => 'OK - Section updated.', 'content' => [ - 'application/vnd.ibexa.api.Section+xml' => [ - 'schema' => [ - '$ref' => '#/components/schemas/Section', - ], - 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/content/sections/section_id/PATCH/Section.xml.example', - ], 'application/vnd.ibexa.api.Section+json' => [ 'schema' => [ '$ref' => '#/components/schemas/SectionWrapper', ], 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/content/sections/section_id/PATCH/Section.json.example', ], + 'application/vnd.ibexa.api.Section+xml' => [ + 'schema' => [ + '$ref' => '#/components/schemas/Section', + ], + 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/content/sections/section_id/PATCH/Section.xml.example', + ], ], ], Response::HTTP_BAD_REQUEST => [ diff --git a/src/lib/Server/Controller/Services.php b/src/lib/Server/Controller/Services.php index b8063a1e7..8a6eab166 100644 --- a/src/lib/Server/Controller/Services.php +++ b/src/lib/Server/Controller/Services.php @@ -17,35 +17,26 @@ #[Get( uriTemplate: '/services/countries', openapi: new Model\Operation( + operationId: 'ibexa.rest.load_country_list', summary: 'Countries list', description: 'Gives access to an ISO-3166 formatted list of world countries. It is useful when presenting a country options list from any application.', tags: [ 'Services', ], - parameters: [ - new Model\Parameter( - name: 'Accept', - in: 'header', - required: true, - description: 'If set, the country list is returned in XML or JSON format.', - schema: [ - 'type' => 'string', - ], - ), - ], responses: [ Response::HTTP_OK => [ + 'description' => 'If set, the country list is returned in XML or JSON format.', 'content' => [ - 'application/vnd.ibexa.api.CountriesList+xml' => [ + 'application/vnd.ibexa.api.CountriesList+json' => [ 'schema' => [ - '$ref' => '#/components/schemas/CountryList', + '$ref' => '#/components/schemas/CountryListWrapper', ], - 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/services/countries/GET/CountriesList.xml.example', ], - 'application/vnd.ibexa.api.CountriesList+json' => [ + 'application/vnd.ibexa.api.CountriesList+xml' => [ 'schema' => [ - '$ref' => '#/components/schemas/CountryListWrapper', + '$ref' => '#/components/schemas/CountryList', ], + 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/services/countries/GET/CountriesList.xml.example', ], ], ], diff --git a/src/lib/Server/Controller/Session/SessionCheckController.php b/src/lib/Server/Controller/Session/SessionCheckController.php index 786e9661e..ed04a60b4 100644 --- a/src/lib/Server/Controller/Session/SessionCheckController.php +++ b/src/lib/Server/Controller/Session/SessionCheckController.php @@ -17,6 +17,7 @@ #[Get( uriTemplate: '/user/sessions/current', openapi: new Model\Operation( + operationId: 'ibexa.rest.check_session', summary: 'Get current session', description: 'Get current user session, if any.', tags: [ @@ -26,38 +27,29 @@ new Model\Parameter( name: 'Cookie', in: 'header', - required: true, + required: false, description: 'Only needed for session\'s checking {sessionName}={sessionID}.', schema: [ 'type' => 'string', ], ), - new Model\Parameter( - name: 'Accept', - in: 'header', - required: true, - description: 'If set, the session is returned in XML or JSON format.', - schema: [ - 'type' => 'string', - ], - ), ], responses: [ Response::HTTP_OK => [ 'description' => 'User is currently logged in and has a valid session.', 'content' => [ - 'application/vnd.ibexa.api.Session+xml' => [ - 'schema' => [ - '$ref' => '#/components/schemas/Session', - ], - 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/user/sessions/POST/Session.xml.example', - ], 'application/vnd.ibexa.api.Session+json' => [ 'schema' => [ '$ref' => '#/components/schemas/SessionWrapper', ], 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/user/sessions/session_id/refresh/POST/Session.json.example', ], + 'application/vnd.ibexa.api.Session+xml' => [ + 'schema' => [ + '$ref' => '#/components/schemas/Session', + ], + 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/user/sessions/POST/Session.xml.example', + ], ], ], Response::HTTP_NOT_FOUND => [ diff --git a/src/lib/Server/Controller/Session/SessionCreateController.php b/src/lib/Server/Controller/Session/SessionCreateController.php index 3ae2ef0be..3d16f3bde 100644 --- a/src/lib/Server/Controller/Session/SessionCreateController.php +++ b/src/lib/Server/Controller/Session/SessionCreateController.php @@ -24,34 +24,17 @@ uriTemplate: '/user/sessions', extraProperties: [OpenApiFactory::OVERRIDE_OPENAPI_RESPONSES => false], openapi: new Model\Operation( + operationId: 'ibexa.rest.create_session', summary: 'Create session (login a User)', 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.', tags: [ 'User Session', ], parameters: [ - new Model\Parameter( - name: 'Accept', - in: 'header', - required: true, - description: 'If set, the session is returned in XML or JSON format.', - schema: [ - 'type' => 'string', - ], - ), - new Model\Parameter( - name: 'Content-Type', - in: 'header', - required: true, - description: 'The SessionInput schema encoded in XML or JSON format.', - schema: [ - 'type' => 'string', - ], - ), new Model\Parameter( name: 'Cookie', in: 'header', - required: true, + required: false, description: 'Only needed for session\'s checking {sessionName}={sessionID}.', schema: [ 'type' => 'string', @@ -60,61 +43,62 @@ new Model\Parameter( name: 'X-CSRF-Token', in: 'header', - required: true, - description: 'Only needed for session\'s checking. The {csrfToken} needed on all unsafe HTTP methods with session.', + required: false, + description: 'Only needed for session\'s checking. The CSRF Token needed on all unsafe HTTP methods with session.', schema: [ 'type' => 'string', ], ), ], requestBody: new Model\RequestBody( + description: 'The session input in XML or JSON format.', content: new \ArrayObject([ - 'application/vnd.ibexa.api.SessionInput+xml' => [ - 'schema' => [ - '$ref' => '#/components/schemas/SessionInput', - ], - 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/user/sessions/POST/SessionInput.xml.example', - ], 'application/vnd.ibexa.api.SessionInput+json' => [ 'schema' => [ '$ref' => '#/components/schemas/SessionInputWrapper', ], 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/user/sessions/POST/SessionInput.json.example', ], + 'application/vnd.ibexa.api.SessionInput+xml' => [ + 'schema' => [ + '$ref' => '#/components/schemas/SessionInput', + ], + 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/user/sessions/POST/SessionInput.xml.example', + ], ]), ), responses: [ Response::HTTP_OK => [ 'description' => 'Session already exists.', 'content' => [ - 'application/vnd.ibexa.api.Session+xml' => [ + 'application/vnd.ibexa.api.Session+json' => [ 'schema' => [ - '$ref' => '#/components/schemas/Session', + '$ref' => '#/components/schemas/SessionWrapper', ], - 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/user/sessions/POST/Session.xml.example', + 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/user/sessions/POST/Session.json.example', ], - 'application/vnd.ibexa.api.Session+json' => [ + 'application/vnd.ibexa.api.Session+xml' => [ 'schema' => [ - '$ref' => '#/components/schemas/SessionWrapper', + '$ref' => '#/components/schemas/Session', ], - 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/user/sessions/session_id/refresh/POST/Session.json.example', + 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/user/sessions/POST/Session.xml.example', ], ], ], Response::HTTP_CREATED => [ 'description' => 'Session is created.', 'content' => [ - 'application/vnd.ibexa.api.Session+xml' => [ + 'application/vnd.ibexa.api.Session+json' => [ 'schema' => [ - '$ref' => '#/components/schemas/Session', + '$ref' => '#/components/schemas/SessionWrapper', ], - 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/user/sessions/POST/Session.xml.example', + 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/user/sessions/POST/Session.json.example', ], - 'application/vnd.ibexa.api.Session+json' => [ + 'application/vnd.ibexa.api.Session+xml' => [ 'schema' => [ - '$ref' => '#/components/schemas/SessionWrapper', + '$ref' => '#/components/schemas/Session', ], - 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/user/sessions/session_id/refresh/POST/Session.json.example', + 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/user/sessions/POST/Session.xml.example', ], ], ], diff --git a/src/lib/Server/Controller/Session/SessionDeleteController.php b/src/lib/Server/Controller/Session/SessionDeleteController.php index 4a646e2e0..510de34e4 100644 --- a/src/lib/Server/Controller/Session/SessionDeleteController.php +++ b/src/lib/Server/Controller/Session/SessionDeleteController.php @@ -17,6 +17,7 @@ #[Delete( uriTemplate: '/user/sessions/{sessionId}', openapi: new Model\Operation( + operationId: 'ibexa.rest.delete_session', summary: 'Delete session (logout a User)', description: 'The user session is removed i.e. the user is logged out.', tags: [ @@ -35,8 +36,8 @@ new Model\Parameter( name: 'X-CSRF-Token', in: 'header', - required: true, - description: 'The {csrfToken} needed on all unsafe HTTP methods with session.', + required: false, + description: 'The CSRF Token needed on all unsafe HTTP methods with session.', schema: [ 'type' => 'string', ], diff --git a/src/lib/Server/Controller/Session/SessionRefreshController.php b/src/lib/Server/Controller/Session/SessionRefreshController.php index f93bf9b6f..b9d22fc41 100644 --- a/src/lib/Server/Controller/Session/SessionRefreshController.php +++ b/src/lib/Server/Controller/Session/SessionRefreshController.php @@ -19,6 +19,7 @@ uriTemplate: '/user/sessions/{sessionId}/refresh', extraProperties: [OpenApiFactory::OVERRIDE_OPENAPI_RESPONSES => false], openapi: new Model\Operation( + operationId: 'ibexa.rest.refresh_session', summary: 'Refresh session (deprecated)', description: 'Get the session\'s User information. Deprecated as of Ibexa DXP 4.6, use GET /user/sessions/current instead.', tags: [ @@ -37,16 +38,8 @@ new Model\Parameter( name: 'X-CSRF-Token', in: 'header', - required: true, - description: 'The {csrfToken} needed on all unsafe HTTP methods with session.', - schema: [ - 'type' => 'string', - ], - ), - new Model\Parameter( - name: 'Accept', - in: 'header', - required: true, + required: false, + description: 'The CSRF Token needed on all unsafe HTTP methods with session.', schema: [ 'type' => 'string', ], @@ -60,30 +53,32 @@ ], ), ], + requestBody: new Model\RequestBody( + description: 'No payload required', + content: new \ArrayObject(), + ), responses: [ Response::HTTP_OK => [ + 'description' => 'OK - returns the Session in XML or JSON format.', 'content' => [ - 'application/vnd.ibexa.api.Session+xml' => [ - 'schema' => [ - '$ref' => '#/components/schemas/Session', - ], - 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/user/sessions/POST/Session.xml.example', - ], 'application/vnd.ibexa.api.Session+json' => [ 'schema' => [ '$ref' => '#/components/schemas/SessionWrapper', ], 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/user/sessions/session_id/refresh/POST/Session.json.example', ], + 'application/vnd.ibexa.api.Session+xml' => [ + 'schema' => [ + '$ref' => '#/components/schemas/Session', + ], + 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/user/sessions/session_id/refresh/POST/Session.xml.example', + ], ], ], Response::HTTP_NOT_FOUND => [ 'description' => 'Error - the session does not exist.', ], ], - requestBody: new Model\RequestBody( - content: new \ArrayObject(), - ), ), )] /** diff --git a/src/lib/Server/Controller/SessionController.php b/src/lib/Server/Controller/SessionController.php deleted file mode 100644 index e69de29bb..000000000 diff --git a/src/lib/Server/Controller/Trash/TrashEmptyController.php b/src/lib/Server/Controller/Trash/TrashEmptyController.php index a328c0f43..5bd692e0e 100644 --- a/src/lib/Server/Controller/Trash/TrashEmptyController.php +++ b/src/lib/Server/Controller/Trash/TrashEmptyController.php @@ -20,12 +20,22 @@ uriTemplate: '/content/trash', extraProperties: [OpenApiFactory::OVERRIDE_OPENAPI_RESPONSES => false], openapi: new Model\Operation( + operationId: 'ibexa.rest.empty_trash', summary: 'Empty Trash', description: 'Empties the Trash.', tags: [ 'Trash', ], parameters: [ + new Model\Parameter( + name: 'X-CSRF-Token', + in: 'header', + required: true, + description: 'The CSRF Token needed on all unsafe HTTP methods with session.', + schema: [ + 'type' => 'string', + ], + ), ], responses: [ Response::HTTP_NO_CONTENT => [ diff --git a/src/lib/Server/Controller/Trash/TrashItemDeleteController.php b/src/lib/Server/Controller/Trash/TrashItemDeleteController.php index a7351bf1a..9f372ddad 100644 --- a/src/lib/Server/Controller/Trash/TrashItemDeleteController.php +++ b/src/lib/Server/Controller/Trash/TrashItemDeleteController.php @@ -18,12 +18,22 @@ #[Delete( uriTemplate: '/content/trash/{trashItemid}', openapi: new Model\Operation( + operationId: 'ibexa.rest.delete_trash_item', summary: 'Delete Trash item', description: 'Deletes the provided item from Trash.', tags: [ 'Trash', ], parameters: [ + new Model\Parameter( + name: 'X-CSRF-Token', + in: 'header', + required: true, + description: 'The CSRF Token needed on all unsafe HTTP methods with session.', + schema: [ + 'type' => 'string', + ], + ), new Model\Parameter( name: 'trashItemid', in: 'path', diff --git a/src/lib/Server/Controller/Trash/TrashItemListController.php b/src/lib/Server/Controller/Trash/TrashItemListController.php index e651f5c3a..2316f7203 100644 --- a/src/lib/Server/Controller/Trash/TrashItemListController.php +++ b/src/lib/Server/Controller/Trash/TrashItemListController.php @@ -23,38 +23,28 @@ uriTemplate: '/content/trash', extraProperties: [OpenApiFactory::OVERRIDE_OPENAPI_RESPONSES => false], openapi: new Model\Operation( + operationId: 'ibexa.rest.load_trash_items', summary: 'List Trash items', description: 'Returns a list of all items in the Trash.', tags: [ 'Trash', ], - parameters: [ - new Model\Parameter( - name: 'Accept', - in: 'header', - required: true, - description: 'If set, the Trash item list is returned in XML or JSON format.', - schema: [ - 'type' => 'string', - ], - ), - ], responses: [ Response::HTTP_OK => [ 'description' => 'OK - returns the list of items in the Trash.', 'content' => [ - 'application/vnd.ibexa.api.Trash+xml' => [ - 'schema' => [ - '$ref' => '#/components/schemas/Trash', - ], - 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/content/trash/GET/Trash.xml.example', - ], 'application/vnd.ibexa.api.Trash+json' => [ 'schema' => [ '$ref' => '#/components/schemas/TrashWrapper', ], 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/content/trash/GET/Trash.json.example', ], + 'application/vnd.ibexa.api.Trash+xml' => [ + 'schema' => [ + '$ref' => '#/components/schemas/Trash', + ], + 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/content/trash/GET/Trash.xml.example', + ], ], ], Response::HTTP_UNAUTHORIZED => [ diff --git a/src/lib/Server/Controller/Trash/TrashItemLoadByIdController.php b/src/lib/Server/Controller/Trash/TrashItemLoadByIdController.php index bdacd6121..a8da394ef 100644 --- a/src/lib/Server/Controller/Trash/TrashItemLoadByIdController.php +++ b/src/lib/Server/Controller/Trash/TrashItemLoadByIdController.php @@ -18,21 +18,13 @@ #[Get( uriTemplate: '/content/trash/{trashItemid}', openapi: new Model\Operation( + operationId: 'ibexa.rest.load_trash_item', summary: 'Get Trash item', description: 'Returns the item in Trash with the provided ID.', tags: [ 'Trash', ], parameters: [ - new Model\Parameter( - name: 'Accept', - in: 'header', - required: true, - description: 'If set, the item in Trash is returned in XML or JSON format.', - schema: [ - 'type' => 'string', - ], - ), new Model\Parameter( name: 'trashItemid', in: 'path', @@ -44,19 +36,20 @@ ], responses: [ Response::HTTP_OK => [ + 'description' => 'If set, the item in Trash is returned in XML or JSON format.', 'content' => [ - 'application/vnd.ibexa.api.TrashItem+xml' => [ - 'schema' => [ - '$ref' => '#/components/schemas/TrashItem', - ], - 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/content/trash/trash_itemid/GET/TrashItem.xml.example', - ], 'application/vnd.ibexa.api.TrashItem+json' => [ 'schema' => [ '$ref' => '#/components/schemas/TrashItemWrapper', ], 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/content/trash/trash_itemid/GET/TrashItem.json.example', ], + 'application/vnd.ibexa.api.TrashItem+xml' => [ + 'schema' => [ + '$ref' => '#/components/schemas/TrashItem', + ], + 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/content/trash/trash_itemid/GET/TrashItem.xml.example', + ], ], ], Response::HTTP_UNAUTHORIZED => [ diff --git a/src/lib/Server/Controller/URLAlias/URLAliasCreateController.php b/src/lib/Server/Controller/URLAlias/URLAliasCreateController.php index aa59079b7..3a67e891b 100644 --- a/src/lib/Server/Controller/URLAlias/URLAliasCreateController.php +++ b/src/lib/Server/Controller/URLAlias/URLAliasCreateController.php @@ -25,6 +25,7 @@ uriTemplate: '/content/urlaliases', extraProperties: [OpenApiFactory::OVERRIDE_OPENAPI_RESPONSES => false], openapi: new Model\Operation( + operationId: 'ibexa.rest.create_url_alias', summary: 'Create URL alias', description: 'Creates a URL alias.', tags: [ @@ -32,55 +33,47 @@ ], parameters: [ new Model\Parameter( - name: 'Accept', + name: 'X-CSRF-Token', in: 'header', required: true, - description: 'If set, the created URL alias is returned in XML or JSON format.', - schema: [ - 'type' => 'string', - ], - ), - new Model\Parameter( - name: 'Content-Type', - in: 'header', - required: true, - description: 'The URL alias input schema encoded in XML or JSON format.', + description: 'The CSRF Token needed on all unsafe HTTP methods with session.', schema: [ 'type' => 'string', ], ), ], requestBody: new Model\RequestBody( + description: 'The URL alias input schema encoded in XML or JSON format.', content: new \ArrayObject([ - 'application/vnd.ibexa.api.UrlAliasCreate+xml' => [ - 'schema' => [ - '$ref' => '#/components/schemas/UrlAliasCreate', - ], - 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/content/urlaliases/POST/UrlAliasCreate.xml.example', - ], 'application/vnd.ibexa.api.UrlAliasCreate+json' => [ 'schema' => [ '$ref' => '#/components/schemas/UrlAliasCreateWrapper', ], 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/content/urlaliases/POST/UrlAliasCreate.json.example', ], + 'application/vnd.ibexa.api.UrlAliasCreate+xml' => [ + 'schema' => [ + '$ref' => '#/components/schemas/UrlAliasCreate', + ], + 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/content/urlaliases/POST/UrlAliasCreate.xml.example', + ], ]), ), responses: [ Response::HTTP_CREATED => [ 'description' => 'URL alias created.', 'content' => [ - 'application/vnd.ibexa.api.UrlAlias+xml' => [ + 'application/vnd.ibexa.api.UrlAlias+json' => [ 'schema' => [ - '$ref' => '#/components/schemas/UrlAlias', + '$ref' => '#/components/schemas/UrlAliasWrapper', ], - 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/content/urlaliases/url_alias_id/GET/UrlAlias.xml.example', + 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/content/urlaliases/POST/UrlAlias.json.example', ], - 'application/vnd.ibexa.api.UrlAlias+json' => [ + 'application/vnd.ibexa.api.UrlAlias+xml' => [ 'schema' => [ - '$ref' => '#/components/schemas/UrlAliasWrapper', + '$ref' => '#/components/schemas/UrlAlias', ], - 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/content/urlaliases/url_alias_id/GET/UrlAlias.json.example', + 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/content/urlaliases/POST/UrlAlias.xml.example', ], ], ], diff --git a/src/lib/Server/Controller/URLAlias/URLAliasDeleteController.php b/src/lib/Server/Controller/URLAlias/URLAliasDeleteController.php index a10612bfe..310ee6eb4 100644 --- a/src/lib/Server/Controller/URLAlias/URLAliasDeleteController.php +++ b/src/lib/Server/Controller/URLAlias/URLAliasDeleteController.php @@ -18,12 +18,22 @@ #[Delete( uriTemplate: '/content/urlaliases/{urlAliasId}', openapi: new Model\Operation( + operationId: 'ibexa.rest.delete_url_alias', summary: 'Delete URL alias', description: 'Deletes the provided URL alias.', tags: [ 'Url Alias', ], parameters: [ + new Model\Parameter( + name: 'X-CSRF-Token', + in: 'header', + required: true, + description: 'The CSRF Token needed on all unsafe HTTP methods with session.', + schema: [ + 'type' => 'string', + ], + ), new Model\Parameter( name: 'urlAliasId', in: 'path', diff --git a/src/lib/Server/Controller/URLAlias/URLAliasListGlobalController.php b/src/lib/Server/Controller/URLAlias/URLAliasListGlobalController.php index 0b635effc..00a5c3cd8 100644 --- a/src/lib/Server/Controller/URLAlias/URLAliasListGlobalController.php +++ b/src/lib/Server/Controller/URLAlias/URLAliasListGlobalController.php @@ -20,38 +20,28 @@ uriTemplate: '/content/urlaliases', extraProperties: [OpenApiFactory::OVERRIDE_OPENAPI_RESPONSES => false], openapi: new Model\Operation( + operationId: 'ibexa.rest.list_global_url_aliases', summary: 'List global URL aliases', description: 'Returns the list of global URL aliases.', tags: [ 'Url Alias', ], - parameters: [ - new Model\Parameter( - name: 'Accept', - in: 'header', - required: true, - description: 'If set, the URL alias list contains only references and is returned in XML or JSON format.', - schema: [ - 'type' => 'string', - ], - ), - ], responses: [ Response::HTTP_OK => [ 'description' => 'OK - returns the list of URL aliases.', 'content' => [ - 'application/vnd.ibexa.api.UrlAliasRefList+xml' => [ - 'schema' => [ - '$ref' => '#/components/schemas/UrlAliasRefList', - ], - 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/content/urlaliases/GET/UrlAliasRefList.xml.example', - ], 'application/vnd.ibexa.api.UrlAliasRefList+json' => [ 'schema' => [ '$ref' => '#/components/schemas/UrlAliasRefListWrapper', ], 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/content/urlaliases/GET/UrlAliasRefList.json.example', ], + 'application/vnd.ibexa.api.UrlAliasRefList+xml' => [ + 'schema' => [ + '$ref' => '#/components/schemas/UrlAliasRefList', + ], + 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/content/urlaliases/GET/UrlAliasRefList.xml.example', + ], ], ], Response::HTTP_UNAUTHORIZED => [ diff --git a/src/lib/Server/Controller/URLAlias/URLAliasListLocationController.php b/src/lib/Server/Controller/URLAlias/URLAliasListLocationController.php index 0eda96b7f..678c60898 100644 --- a/src/lib/Server/Controller/URLAlias/URLAliasListLocationController.php +++ b/src/lib/Server/Controller/URLAlias/URLAliasListLocationController.php @@ -21,21 +21,13 @@ uriTemplate: '/content/locations/{path}/urlaliases', extraProperties: [OpenApiFactory::OVERRIDE_OPENAPI_RESPONSES => false], openapi: new Model\Operation( + operationId: 'ibexa.rest.list_location_url_aliases', summary: 'List URL aliases for Location', description: 'Returns the list of URL aliases for a Location.', tags: [ 'Location', ], parameters: [ - new Model\Parameter( - name: 'Accept', - in: 'header', - required: true, - description: 'If set, the URL alias list contains only references and is returned in XML or JSON format.', - schema: [ - 'type' => 'string', - ], - ), new Model\Parameter( name: 'path', in: 'path', @@ -49,16 +41,16 @@ Response::HTTP_OK => [ 'description' => 'OK - returns the list of URL aliases.', 'content' => [ - 'application/vnd.ibexa.api.UrlAliasRefList+xml' => [ + 'application/vnd.ibexa.api.UrlAliasRefList+json' => [ 'schema' => [ - '$ref' => '#/components/schemas/UrlAliasRefList', + '$ref' => '#/components/schemas/UrlAliasRefListWrapper', ], - 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/content/urlaliases/GET/UrlAliasRefList.xml.example', ], - 'application/vnd.ibexa.api.UrlAliasRefList+json' => [ + 'application/vnd.ibexa.api.UrlAliasRefList+xml' => [ 'schema' => [ - '$ref' => '#/components/schemas/UrlAliasRefListWrapper', + '$ref' => '#/components/schemas/UrlAliasRefList', ], + 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/content/locations/path/urlaliases/GET/UrlAliasRefList.xml.example', ], ], ], diff --git a/src/lib/Server/Controller/URLAlias/URLAliasLoadByIdController.php b/src/lib/Server/Controller/URLAlias/URLAliasLoadByIdController.php index e809a08c9..b0b779a03 100644 --- a/src/lib/Server/Controller/URLAlias/URLAliasLoadByIdController.php +++ b/src/lib/Server/Controller/URLAlias/URLAliasLoadByIdController.php @@ -18,21 +18,13 @@ #[Get( uriTemplate: '/content/urlaliases/{urlAliasId}', openapi: new Model\Operation( + operationId: 'ibexa.rest.load_url_alias', summary: 'Get URL alias', description: 'Returns the URL alias with the given ID.', tags: [ 'Url Alias', ], parameters: [ - new Model\Parameter( - name: 'Accept', - in: 'header', - required: true, - description: 'If set, the URL alias is returned in XML or JSON format.', - schema: [ - 'type' => 'string', - ], - ), new Model\Parameter( name: 'urlAliasId', in: 'path', @@ -46,18 +38,18 @@ Response::HTTP_OK => [ 'description' => 'OK - returns the URL alias.', 'content' => [ - 'application/vnd.ibexa.api.UrlAlias+xml' => [ - 'schema' => [ - '$ref' => '#/components/schemas/UrlAlias', - ], - 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/content/urlaliases/url_alias_id/GET/UrlAlias.xml.example', - ], 'application/vnd.ibexa.api.UrlAlias+json' => [ 'schema' => [ '$ref' => '#/components/schemas/UrlAliasWrapper', ], 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/content/urlaliases/url_alias_id/GET/UrlAlias.json.example', ], + 'application/vnd.ibexa.api.UrlAlias+xml' => [ + 'schema' => [ + '$ref' => '#/components/schemas/UrlAlias', + ], + 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/content/urlaliases/url_alias_id/GET/UrlAlias.xml.example', + ], ], ], Response::HTTP_UNAUTHORIZED => [ diff --git a/src/lib/Server/Controller/URLWildcard/URLWildcardCreateController.php b/src/lib/Server/Controller/URLWildcard/URLWildcardCreateController.php index d0f475112..2f3d58a15 100644 --- a/src/lib/Server/Controller/URLWildcard/URLWildcardCreateController.php +++ b/src/lib/Server/Controller/URLWildcard/URLWildcardCreateController.php @@ -24,6 +24,7 @@ uriTemplate: '/content/urlwildcards', extraProperties: [OpenApiFactory::OVERRIDE_OPENAPI_RESPONSES => false], openapi: new Model\Operation( + operationId: 'ibexa.rest.create_url_wildcard', summary: 'Create URL wildcard', description: 'Creates a new URL wildcard.', tags: [ @@ -31,55 +32,47 @@ ], parameters: [ new Model\Parameter( - name: 'Accept', + name: 'X-CSRF-Token', in: 'header', required: true, - description: 'If set, the new URL wildcard is returned in XML or JSON format.', - schema: [ - 'type' => 'string', - ], - ), - new Model\Parameter( - name: 'Content-Type', - in: 'header', - required: true, - description: 'The URL Wildcard input schema encoded in XML or JSON format.', + description: 'The CSRF Token needed on all unsafe HTTP methods with session.', schema: [ 'type' => 'string', ], ), ], requestBody: new Model\RequestBody( + description: 'The URL Wildcard input schema encoded in XML or JSON format.', content: new \ArrayObject([ - 'application/vnd.ibexa.api.UrlWildcardCreate+xml' => [ - 'schema' => [ - '$ref' => '#/components/schemas/UrlWildcardCreate', - ], - 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/content/urlwildcards/POST/UrlWildcardCreate.xml.example', - ], 'application/vnd.ibexa.api.UrlWildcardCreate+json' => [ 'schema' => [ '$ref' => '#/components/schemas/UrlWildcardCreateWrapper', ], 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/content/urlwildcards/POST/UrlWildcardCreate.json.example', ], + 'application/vnd.ibexa.api.UrlWildcardCreate+xml' => [ + 'schema' => [ + '$ref' => '#/components/schemas/UrlWildcardCreate', + ], + 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/content/urlwildcards/POST/UrlWildcardCreate.xml.example', + ], ]), ), responses: [ Response::HTTP_CREATED => [ 'description' => 'URL wildcard created.', 'content' => [ - 'application/vnd.ibexa.api.UrlWildcard+xml' => [ + 'application/vnd.ibexa.api.UrlWildcard+json' => [ 'schema' => [ - '$ref' => '#/components/schemas/UrlWildcard', + '$ref' => '#/components/schemas/UrlWildcardWrapper', ], - 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/content/urlwildcards/wildcard_id/GET/UrlWildcard.xml.example', + 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/content/urlwildcards/POST/UrlWildcard.json.example', ], - 'application/vnd.ibexa.api.UrlWildcard+json' => [ + 'application/vnd.ibexa.api.UrlWildcard+xml' => [ 'schema' => [ - '$ref' => '#/components/schemas/UrlWildcardWrapper', + '$ref' => '#/components/schemas/UrlWildcard', ], - 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/content/urlwildcards/wildcard_id/GET/UrlWildcard.json.example', + 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/content/urlwildcards/POST/UrlWildcard.xml.example', ], ], ], diff --git a/src/lib/Server/Controller/URLWildcard/URLWildcardDeleteController.php b/src/lib/Server/Controller/URLWildcard/URLWildcardDeleteController.php index 384268779..02442688f 100644 --- a/src/lib/Server/Controller/URLWildcard/URLWildcardDeleteController.php +++ b/src/lib/Server/Controller/URLWildcard/URLWildcardDeleteController.php @@ -17,12 +17,22 @@ #[Delete( uriTemplate: '/content/urlwildcards/{wildcardId}', openapi: new Model\Operation( + operationId: 'ibexa.rest.delete_url_wildcard', summary: 'Delete URL wildcard', description: 'Deletes the given URL wildcard.', tags: [ 'Url Wildcard', ], parameters: [ + new Model\Parameter( + name: 'X-CSRF-Token', + in: 'header', + required: true, + description: 'The CSRF Token needed on all unsafe HTTP methods with session.', + schema: [ + 'type' => 'string', + ], + ), new Model\Parameter( name: 'wildcardId', in: 'path', diff --git a/src/lib/Server/Controller/URLWildcard/URLWildcardListController.php b/src/lib/Server/Controller/URLWildcard/URLWildcardListController.php index 97301d043..191959a60 100644 --- a/src/lib/Server/Controller/URLWildcard/URLWildcardListController.php +++ b/src/lib/Server/Controller/URLWildcard/URLWildcardListController.php @@ -19,38 +19,28 @@ uriTemplate: '/content/urlwildcards', extraProperties: [OpenApiFactory::OVERRIDE_OPENAPI_RESPONSES => false], openapi: new Model\Operation( + operationId: 'ibexa.rest.list_url_wildcards', summary: 'List URL wildcards', description: 'Returns a list of URL wildcards.', tags: [ 'Url Wildcard', ], - parameters: [ - new Model\Parameter( - name: 'Accept', - in: 'header', - required: true, - description: 'If set, the URL wildcard is returned in XML or JSON format.', - schema: [ - 'type' => 'string', - ], - ), - ], responses: [ Response::HTTP_OK => [ 'description' => 'OK - returns a list of URL wildcards.', 'content' => [ - 'application/vnd.ibexa.api.UrlWildcardList+xml' => [ - 'schema' => [ - '$ref' => '#/components/schemas/UrlWildcardList', - ], - 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/content/urlwildcards/GET/UrlWildcardList.xml.example', - ], 'application/vnd.ibexa.api.UrlWildcardList+json' => [ 'schema' => [ '$ref' => '#/components/schemas/UrlWildcardListWrapper', ], 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/content/urlwildcards/GET/UrlWildcardList.json.example', ], + 'application/vnd.ibexa.api.UrlWildcardList+xml' => [ + 'schema' => [ + '$ref' => '#/components/schemas/UrlWildcardList', + ], + 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/content/urlwildcards/GET/UrlWildcardList.xml.example', + ], ], ], Response::HTTP_UNAUTHORIZED => [ diff --git a/src/lib/Server/Controller/URLWildcard/URLWildcardLoadByIdController.php b/src/lib/Server/Controller/URLWildcard/URLWildcardLoadByIdController.php index cfc3a8539..f01060760 100644 --- a/src/lib/Server/Controller/URLWildcard/URLWildcardLoadByIdController.php +++ b/src/lib/Server/Controller/URLWildcard/URLWildcardLoadByIdController.php @@ -17,21 +17,13 @@ #[Get( uriTemplate: '/content/urlwildcards/{wildcardId}', openapi: new Model\Operation( + operationId: 'ibexa.rest.load_url_wildcard', summary: 'Get URL wildcard', description: 'Returns the URL wildcard with the given ID.', tags: [ 'Url Wildcard', ], parameters: [ - new Model\Parameter( - name: 'Accept', - in: 'header', - required: true, - description: 'If set, the URL wildcard is returned in XML or JSON format.', - schema: [ - 'type' => 'string', - ], - ), new Model\Parameter( name: 'wildcardId', in: 'path', @@ -45,18 +37,18 @@ Response::HTTP_OK => [ 'description' => 'OK - returns the URL wildcard.', 'content' => [ - 'application/vnd.ibexa.api.UrlWildcard+xml' => [ - 'schema' => [ - '$ref' => '#/components/schemas/UrlWildcard', - ], - 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/content/urlwildcards/wildcard_id/GET/UrlWildcard.xml.example', - ], 'application/vnd.ibexa.api.UrlWildcard+json' => [ 'schema' => [ '$ref' => '#/components/schemas/UrlWildcardWrapper', ], 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/content/urlwildcards/wildcard_id/GET/UrlWildcard.json.example', ], + 'application/vnd.ibexa.api.UrlWildcard+xml' => [ + 'schema' => [ + '$ref' => '#/components/schemas/UrlWildcard', + ], + 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/content/urlwildcards/wildcard_id/GET/UrlWildcard.xml.example', + ], ], ], Response::HTTP_UNAUTHORIZED => [ diff --git a/src/lib/Server/Controller/User/UserAssignToUserGroupController.php b/src/lib/Server/Controller/User/UserAssignToUserGroupController.php index 6e075d157..ca716657f 100644 --- a/src/lib/Server/Controller/User/UserAssignToUserGroupController.php +++ b/src/lib/Server/Controller/User/UserAssignToUserGroupController.php @@ -22,6 +22,7 @@ uriTemplate: '/user/users/{userId}/groups', extraProperties: [OpenApiFactory::OVERRIDE_OPENAPI_RESPONSES => false], openapi: new Model\Operation( + operationId: 'ibexa.rest.assign_user_to_user_group', summary: 'Assign User Group', description: 'Assigns the User to a User Group.', tags: [ @@ -29,10 +30,10 @@ ], parameters: [ new Model\Parameter( - name: 'Accept', + name: 'X-CSRF-Token', in: 'header', required: true, - description: 'If set, the link list of User Groups is returned in XML or JSON format.', + description: 'The CSRF Token needed on all unsafe HTTP methods with session.', schema: [ 'type' => 'string', ], @@ -46,20 +47,25 @@ ], ), ], + requestBody: new Model\RequestBody( + description: 'No payload required', + content: new \ArrayObject(), + ), responses: [ Response::HTTP_OK => [ + 'description' => 'If set, the link list of User Groups is returned in XML or JSON format.', 'content' => [ - 'application/vnd.ibexa.api.UserGroupRefList+xml' => [ + 'application/vnd.ibexa.api.UserGroupRefList+json' => [ 'schema' => [ - '$ref' => '#/components/schemas/UserGroupRefList', + '$ref' => '#/components/schemas/UserGroupRefListWrapper', ], - 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/user/users/user_id/groups/POST/UserGroupRefList.xml.example', + 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/user/users/user_id/groups/POST/UserGroupRefList.json.example', ], - 'application/vnd.ibexa.api.UserGroupRefList+json' => [ + 'application/vnd.ibexa.api.UserGroupRefList+xml' => [ 'schema' => [ - '$ref' => '#/components/schemas/UserGroupRefListWrapper', + '$ref' => '#/components/schemas/UserGroupRefList', ], - 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/user/users/user_id/groups/group_id/UserGroupRefList.json.example', + 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/user/users/user_id/groups/POST/UserGroupRefList.xml.example', ], ], ], @@ -73,9 +79,6 @@ 'description' => 'Error - the User does not exist.', ], ], - requestBody: new Model\RequestBody( - content: new \ArrayObject(), - ), ), )] final class UserAssignToUserGroupController extends UserBaseController diff --git a/src/lib/Server/Controller/User/UserCreateController.php b/src/lib/Server/Controller/User/UserCreateController.php index d2fc144cb..f48f062c9 100644 --- a/src/lib/Server/Controller/User/UserCreateController.php +++ b/src/lib/Server/Controller/User/UserCreateController.php @@ -24,6 +24,7 @@ uriTemplate: '/user/groups/{path}/users', extraProperties: [OpenApiFactory::OVERRIDE_OPENAPI_RESPONSES => false], openapi: new Model\Operation( + operationId: 'ibexa.rest.create_user', summary: 'Create User', description: 'Creates a new User in the given Group.', tags: [ @@ -31,19 +32,10 @@ ], parameters: [ new Model\Parameter( - name: 'Accept', + name: 'X-CSRF-Token', in: 'header', required: true, - description: 'If set, the new User is returned in XML or JSON format.', - schema: [ - 'type' => 'string', - ], - ), - new Model\Parameter( - name: 'Content-Type', - in: 'header', - required: true, - description: 'The UserCreate schema encoded in XML or JSON format.', + description: 'The CSRF Token needed on all unsafe HTTP methods with session.', schema: [ 'type' => 'string', ], @@ -58,35 +50,37 @@ ), ], requestBody: new Model\RequestBody( + description: 'The UserCreate schema encoded in XML or JSON format.', content: new \ArrayObject([ - 'application/vnd.ibexa.api.UserCreate+xml' => [ - 'schema' => [ - '$ref' => '#/components/schemas/UserCreate', - ], - 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/user/groups/path/users/POST/UserCreate.xml.example', - ], 'application/vnd.ibexa.api.UserCreate+json' => [ 'schema' => [ '$ref' => '#/components/schemas/UserCreateWrapper', ], 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/user/groups/path/users/POST/UserCreate.json.example', ], + 'application/vnd.ibexa.api.UserCreate+xml' => [ + 'schema' => [ + '$ref' => '#/components/schemas/UserCreate', + ], + 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/user/groups/path/users/POST/UserCreate.xml.example', + ], ]), ), responses: [ Response::HTTP_CREATED => [ + 'description' => 'If set, the new User is returned in XML or JSON format.', 'content' => [ - 'application/vnd.ibexa.api.User+xml' => [ + 'application/vnd.ibexa.api.User+json' => [ 'schema' => [ - '$ref' => '#/components/schemas/User', + '$ref' => '#/components/schemas/UserWrapper', ], - 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/user/users/user_id/PATCH/User.xml.example', + 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/user/groups/path/users/POST/User.json.example', ], - 'application/vnd.ibexa.api.User+json' => [ + 'application/vnd.ibexa.api.User+xml' => [ 'schema' => [ - '$ref' => '#/components/schemas/UserWrapper', + '$ref' => '#/components/schemas/User', ], - 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/user/users/user_id/PATCH/User.json.example', + 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/user/groups/path/users/POST/User.xml.example', ], ], ], diff --git a/src/lib/Server/Controller/User/UserDeleteController.php b/src/lib/Server/Controller/User/UserDeleteController.php index 41e87cc70..3ac568ef7 100644 --- a/src/lib/Server/Controller/User/UserDeleteController.php +++ b/src/lib/Server/Controller/User/UserDeleteController.php @@ -17,12 +17,22 @@ #[Delete( uriTemplate: '/user/users/{userId}', openapi: new Model\Operation( + operationId: 'ibexa.rest.delete_user', summary: 'Delete User', description: 'Deletes the given User.', tags: [ 'User', ], parameters: [ + new Model\Parameter( + name: 'X-CSRF-Token', + in: 'header', + required: true, + description: 'The CSRF Token needed on all unsafe HTTP methods with session.', + schema: [ + 'type' => 'string', + ], + ), new Model\Parameter( name: 'userId', in: 'path', diff --git a/src/lib/Server/Controller/User/UserDraftListController.php b/src/lib/Server/Controller/User/UserDraftListController.php index 8ccc95699..7dfc34162 100644 --- a/src/lib/Server/Controller/User/UserDraftListController.php +++ b/src/lib/Server/Controller/User/UserDraftListController.php @@ -21,21 +21,13 @@ uriTemplate: '/user/users/{userId}/drafts', extraProperties: [OpenApiFactory::OVERRIDE_OPENAPI_RESPONSES => false], openapi: new Model\Operation( + operationId: 'ibexa.rest.load_user_drafts', summary: 'Load user drafts', description: 'Loads user\'s drafts', tags: [ 'User', ], parameters: [ - new Model\Parameter( - name: 'Accept', - in: 'header', - required: true, - description: 'If set, the version list is returned in XML or JSON format.', - schema: [ - 'type' => 'string', - ], - ), new Model\Parameter( name: 'userId', in: 'path', @@ -49,14 +41,14 @@ Response::HTTP_OK => [ 'description' => 'OK - List the draft versions', 'content' => [ - 'application/vnd.ibexa.api.VersionList+xml' => [ + 'application/vnd.ibexa.api.VersionList+json' => [ 'schema' => [ - '$ref' => '#/components/schemas/VersionList', + '$ref' => '#/components/schemas/VersionListWrapper', ], ], - 'application/vnd.ibexa.api.VersionList+json' => [ + 'application/vnd.ibexa.api.VersionList+xml' => [ 'schema' => [ - '$ref' => '#/components/schemas/VersionListWrapper', + '$ref' => '#/components/schemas/VersionList', ], ], ], diff --git a/src/lib/Server/Controller/User/UserGroupCreateController.php b/src/lib/Server/Controller/User/UserGroupCreateController.php index c8b6b8752..9f345cd50 100644 --- a/src/lib/Server/Controller/User/UserGroupCreateController.php +++ b/src/lib/Server/Controller/User/UserGroupCreateController.php @@ -21,6 +21,7 @@ uriTemplate: '/user/groups/subgroups', extraProperties: [OpenApiFactory::OVERRIDE_OPENAPI_RESPONSES => false], openapi: new Model\Operation( + operationId: 'ibexa.rest.create_root_user_group', summary: 'Create a top level User Group', description: 'Creates a top level User Group under the root. To create a child group under a parent group use \'/user/groups/{path}/subgroups\'.', tags: [ @@ -28,56 +29,48 @@ ], parameters: [ new Model\Parameter( - name: 'Accept', + name: 'X-CSRF-Token', in: 'header', required: true, - description: 'If set, the new User Group is returned in XML or JSON format.', - schema: [ - 'type' => 'string', - ], - ), - new Model\Parameter( - name: 'Content-Type', - in: 'header', - required: true, - description: 'The UserGroupCreate schema encoded in XML or JSON format.', + description: 'The CSRF Token needed on all unsafe HTTP methods with session.', schema: [ 'type' => 'string', ], ), ], requestBody: new Model\RequestBody( + description: 'The UserGroupCreate schema encoded in XML or JSON format.', content: new \ArrayObject([ - 'application/vnd.ibexa.api.UserGroupCreate+xml' => [ - 'schema' => [ - '$ref' => '#/components/schemas/UserGroupCreate', - ], - 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/user/groups/path/subgroups/POST/UserGroupCreate.xml.example', - ], 'application/vnd.ibexa.api.UserGroupCreate+json' => [ 'schema' => [ '$ref' => '#/components/schemas/UserGroupCreateWrapper', ], 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/user/groups/path/subgroups/POST/UserGroupCreate.json.example', ], + 'application/vnd.ibexa.api.UserGroupCreate+xml' => [ + 'schema' => [ + '$ref' => '#/components/schemas/UserGroupCreate', + ], + 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/user/groups/path/subgroups/POST/UserGroupCreate.xml.example', + ], ]), ), responses: [ Response::HTTP_CREATED => [ 'description' => 'Created - the User Group has been created', 'content' => [ - 'application/vnd.ibexa.api.UserGroup+xml' => [ - 'schema' => [ - '$ref' => '#/components/schemas/UserGroup', - ], - 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/user/groups/path/subgroups/POST/UserGroup.xml.example', - ], 'application/vnd.ibexa.api.UserGroup+json' => [ 'schema' => [ '$ref' => '#/components/schemas/UserGroupWrapper', ], 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/user/groups/path/subgroups/POST/UserGroup.json.example', ], + 'application/vnd.ibexa.api.UserGroup+xml' => [ + 'schema' => [ + '$ref' => '#/components/schemas/UserGroup', + ], + 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/user/groups/path/subgroups/POST/UserGroup.xml.example', + ], ], ], Response::HTTP_BAD_REQUEST => [ @@ -93,6 +86,7 @@ uriTemplate: '/user/groups/{path}/subgroups', extraProperties: [OpenApiFactory::OVERRIDE_OPENAPI_RESPONSES => false], openapi: new Model\Operation( + operationId: 'ibexa.rest.create_user_group', summary: 'Create User Group', description: 'Creates a new User Group under the given parent. To create a top level group use \'/user/groups/subgroups\'.', tags: [ @@ -100,19 +94,10 @@ ], parameters: [ new Model\Parameter( - name: 'Accept', + name: 'X-CSRF-Token', in: 'header', required: true, - description: 'If set, the new User Group is returned in XML or JSON format.', - schema: [ - 'type' => 'string', - ], - ), - new Model\Parameter( - name: 'Content-Type', - in: 'header', - required: true, - description: 'The UserGroupCreate schema encoded in XML or JSON format.', + description: 'The CSRF Token needed on all unsafe HTTP methods with session.', schema: [ 'type' => 'string', ], @@ -127,36 +112,38 @@ ), ], requestBody: new Model\RequestBody( + description: 'The UserGroupCreate schema encoded in XML or JSON format.', content: new \ArrayObject([ - 'application/vnd.ibexa.api.UserGroupCreate+xml' => [ - 'schema' => [ - '$ref' => '#/components/schemas/UserGroupCreate', - ], - 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/user/groups/path/subgroups/POST/UserGroupCreate.xml.example', - ], 'application/vnd.ibexa.api.UserGroupCreate+json' => [ 'schema' => [ '$ref' => '#/components/schemas/UserGroupCreateWrapper', ], 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/user/groups/path/subgroups/POST/UserGroupCreate.json.example', ], + 'application/vnd.ibexa.api.UserGroupCreate+xml' => [ + 'schema' => [ + '$ref' => '#/components/schemas/UserGroupCreate', + ], + 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/user/groups/path/subgroups/POST/UserGroupCreate.xml.example', + ], ]), ), responses: [ Response::HTTP_CREATED => [ + 'description' => 'If set, the new User Group is returned in XML or JSON format.', 'content' => [ - 'application/vnd.ibexa.api.UserGroup+xml' => [ - 'schema' => [ - '$ref' => '#/components/schemas/UserGroup', - ], - 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/user/groups/path/subgroups/POST/UserGroup.xml.example', - ], 'application/vnd.ibexa.api.UserGroup+json' => [ 'schema' => [ '$ref' => '#/components/schemas/UserGroupWrapper', ], 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/user/groups/path/subgroups/POST/UserGroup.json.example', ], + 'application/vnd.ibexa.api.UserGroup+xml' => [ + 'schema' => [ + '$ref' => '#/components/schemas/UserGroup', + ], + 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/user/groups/path/subgroups/POST/UserGroup.xml.example', + ], ], ], Response::HTTP_BAD_REQUEST => [ diff --git a/src/lib/Server/Controller/User/UserGroupDeleteController.php b/src/lib/Server/Controller/User/UserGroupDeleteController.php index b0800ae7a..cfc1eccfe 100644 --- a/src/lib/Server/Controller/User/UserGroupDeleteController.php +++ b/src/lib/Server/Controller/User/UserGroupDeleteController.php @@ -19,12 +19,22 @@ uriTemplate: '/user/groups/{path}', extraProperties: [OpenApiFactory::OVERRIDE_OPENAPI_RESPONSES => false], openapi: new Model\Operation( + operationId: 'ibexa.rest.delete_user_group', summary: 'Delete User Group', description: 'The given User Group is deleted.', tags: [ 'User Group', ], parameters: [ + new Model\Parameter( + name: 'X-CSRF-Token', + in: 'header', + required: true, + description: 'The CSRF Token needed on all unsafe HTTP methods with session.', + schema: [ + 'type' => 'string', + ], + ), new Model\Parameter( name: 'path', in: 'path', diff --git a/src/lib/Server/Controller/User/UserGroupListController.php b/src/lib/Server/Controller/User/UserGroupListController.php index f31376483..90086c5c4 100644 --- a/src/lib/Server/Controller/User/UserGroupListController.php +++ b/src/lib/Server/Controller/User/UserGroupListController.php @@ -23,48 +23,39 @@ uriTemplate: '/user/groups', extraProperties: [OpenApiFactory::OVERRIDE_OPENAPI_RESPONSES => false], openapi: new Model\Operation( + operationId: 'ibexa.rest.load_user_groups', summary: 'Load User Groups', description: 'Loads User Groups for either an an ID or a remote ID or a Role.', tags: [ 'User Group', ], - parameters: [ - new Model\Parameter( - name: 'Accept', - in: 'header', - required: true, - description: 'UserGroupList - If set, the User Group List is returned in XML or JSON format. UserGroupRefList - If set, the link list of User Group is returned in XML or JSON format.', - schema: [ - 'type' => 'string', - ], - ), - ], responses: [ Response::HTTP_OK => [ + 'description' => 'UserGroupList - If set, the User Group List is returned in XML or JSON format. UserGroupRefList - If set, the link list of User Group is returned in XML or JSON format.', 'content' => [ - 'application/vnd.ibexa.api.UserGroupList+xml' => [ - 'schema' => [ - '$ref' => '#/components/schemas/UserGroupList', - ], - 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/user/groups/GET/UserGroupList.xml.example', - ], 'application/vnd.ibexa.api.UserGroupList+json' => [ 'schema' => [ '$ref' => '#/components/schemas/UserGroupListWrapper', ], 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/user/groups/GET/UserGroupList.json.example', ], - 'application/vnd.ibexa.api.UserGroupRefList+xml' => [ + 'application/vnd.ibexa.api.UserGroupList+xml' => [ 'schema' => [ - '$ref' => '#/components/schemas/UserGroupRefList', + '$ref' => '#/components/schemas/UserGroupList', ], - 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/user/users/user_id/groups/POST/UserGroupRefList.xml.example', + 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/user/groups/GET/UserGroupList.xml.example', ], 'application/vnd.ibexa.api.UserGroupRefList+json' => [ 'schema' => [ '$ref' => '#/components/schemas/UserGroupRefListWrapper', ], - 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/user/users/user_id/groups/group_id/UserGroupRefList.json.example', + 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/user/groups/GET/UserGroupRefList.json.example', + ], + 'application/vnd.ibexa.api.UserGroupRefList+xml' => [ + 'schema' => [ + '$ref' => '#/components/schemas/UserGroupRefList', + ], + 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/user/groups/GET/UserGroupRefList.xml.example', ], ], ], diff --git a/src/lib/Server/Controller/User/UserGroupLoadByPathController.php b/src/lib/Server/Controller/User/UserGroupLoadByPathController.php index a46b13595..6cb7a50d4 100644 --- a/src/lib/Server/Controller/User/UserGroupLoadByPathController.php +++ b/src/lib/Server/Controller/User/UserGroupLoadByPathController.php @@ -19,25 +19,17 @@ #[Get( uriTemplate: '/user/groups/{path}', openapi: new Model\Operation( + operationId: 'ibexa.rest.load_user_group', summary: 'Load User Group', description: 'Loads User Groups for the given {path}.', tags: [ 'User Group', ], parameters: [ - new Model\Parameter( - name: 'Accept', - in: 'header', - required: true, - description: 'If set, the new User Group is returned in XML or JSON format.', - schema: [ - 'type' => 'string', - ], - ), new Model\Parameter( name: 'If-None-Match', in: 'header', - required: true, + required: false, description: 'ETag', schema: [ 'type' => 'string', @@ -56,17 +48,17 @@ Response::HTTP_OK => [ 'description' => 'OK - loads User Groups.', 'content' => [ - 'application/vnd.ibexa.api.UserGroup+xml' => [ + 'application/vnd.ibexa.api.UserGroup+json' => [ 'schema' => [ - '$ref' => '#/components/schemas/UserGroup', + '$ref' => '#/components/schemas/UserGroupWrapper', ], - 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/user/groups/path/subgroups/POST/UserGroup.xml.example', + 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/user/groups/path/GET/UserGroup.json.example', ], - 'application/vnd.ibexa.api.UserGroup+json' => [ + 'application/vnd.ibexa.api.UserGroup+xml' => [ 'schema' => [ - '$ref' => '#/components/schemas/UserGroupWrapper', + '$ref' => '#/components/schemas/UserGroup', ], - 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/user/groups/path/subgroups/POST/UserGroup.json.example', + 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/user/groups/path/GET/UserGroup.xml.example', ], ], ], diff --git a/src/lib/Server/Controller/User/UserGroupOfRootLoadController.php b/src/lib/Server/Controller/User/UserGroupOfRootLoadController.php index de115c55c..4adcca257 100644 --- a/src/lib/Server/Controller/User/UserGroupOfRootLoadController.php +++ b/src/lib/Server/Controller/User/UserGroupOfRootLoadController.php @@ -18,13 +18,12 @@ uriTemplate: '/user/groups/root', extraProperties: [OpenApiFactory::OVERRIDE_OPENAPI_RESPONSES => false], openapi: new Model\Operation( + operationId: 'ibexa.rest.load_root_user_group', summary: 'Get root User Group', description: 'Redirects to the root User Group.', tags: [ 'User Group', ], - parameters: [ - ], responses: [ Response::HTTP_MOVED_PERMANENTLY => [ 'description' => 'Moved permanently.', diff --git a/src/lib/Server/Controller/User/UserGroupUpdateController.php b/src/lib/Server/Controller/User/UserGroupUpdateController.php index 378eb05ee..4cd20154d 100644 --- a/src/lib/Server/Controller/User/UserGroupUpdateController.php +++ b/src/lib/Server/Controller/User/UserGroupUpdateController.php @@ -20,6 +20,7 @@ uriTemplate: '/user/groups/{path}', extraProperties: [OpenApiFactory::OVERRIDE_OPENAPI_RESPONSES => false], openapi: new Model\Operation( + operationId: 'ibexa.rest.update_user_group', summary: 'Update User Group', description: 'Updates a User Group. PATCH or POST with header X-HTTP-Method-Override PATCH.', tags: [ @@ -27,19 +28,10 @@ ], parameters: [ new Model\Parameter( - name: 'Accept', + name: 'X-CSRF-Token', in: 'header', required: true, - description: 'If set, the new User Group is returned in XML or JSON format.', - schema: [ - 'type' => 'string', - ], - ), - new Model\Parameter( - name: 'Content-Type', - in: 'header', - required: true, - description: 'The UserGroupUpdate schema encoded in XML or JSON format.', + description: 'The CSRF Token needed on all unsafe HTTP methods with session.', schema: [ 'type' => 'string', ], @@ -63,36 +55,37 @@ ), ], requestBody: new Model\RequestBody( + description: 'The UserGroupUpdate schema encoded in XML or JSON format.', content: new \ArrayObject([ - 'application/vnd.ibexa.api.UserGroupUpdate+xml' => [ - 'schema' => [ - '$ref' => '#/components/schemas/UserGroupUpdate', - ], - 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/user/groups/path/PATCH/UserGroupUpdate.xml.example', - ], 'application/vnd.ibexa.api.UserGroupUpdate+json' => [ 'schema' => [ '$ref' => '#/components/schemas/UserGroupUpdateWrapper', ], 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/user/groups/path/PATCH/UserGroupUpdate.json.example', ], + 'application/vnd.ibexa.api.UserGroupUpdate+xml' => [ + 'schema' => [ + '$ref' => '#/components/schemas/UserGroupUpdate', + ], + 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/user/groups/path/PATCH/UserGroupUpdate.xml.example', + ], ]), ), responses: [ Response::HTTP_OK => [ 'description' => 'OK - updated User Group.', 'content' => [ - 'application/vnd.ibexa.api.UserGroup+xml' => [ + 'application/vnd.ibexa.api.UserGroup+json' => [ 'schema' => [ - '$ref' => '#/components/schemas/UserGroup', + '$ref' => '#/components/schemas/UserGroupWrapper', ], - 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/user/groups/path/subgroups/POST/UserGroup.xml.example', + 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/user/groups/path/PATCH/UserGroup.json.example', ], - 'application/vnd.ibexa.api.UserGroup+json' => [ + 'application/vnd.ibexa.api.UserGroup+xml' => [ 'schema' => [ - '$ref' => '#/components/schemas/UserGroupWrapper', + '$ref' => '#/components/schemas/UserGroup', ], - 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/user/groups/path/subgroups/POST/UserGroup.json.example', + 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/user/groups/path/PATCH/UserGroup.xml.example', ], ], ], diff --git a/src/lib/Server/Controller/User/UserGroupUsersListController.php b/src/lib/Server/Controller/User/UserGroupUsersListController.php index 59a84b123..a110e3265 100644 --- a/src/lib/Server/Controller/User/UserGroupUsersListController.php +++ b/src/lib/Server/Controller/User/UserGroupUsersListController.php @@ -20,21 +20,13 @@ #[Get( uriTemplate: '/user/groups/{path}/users', openapi: new Model\Operation( + operationId: 'ibexa.rest.load_users_from_group', summary: 'Load Users of Group', description: 'Loads the Users of the Group with the given ID.', tags: [ 'User Group', ], parameters: [ - new Model\Parameter( - name: 'Accept', - in: 'header', - required: true, - description: 'UserList - If set, the User list returned in XML or JSON format. UserRefList - If set, the link list of Users returned in XML or JSON format.', - schema: [ - 'type' => 'string', - ], - ), new Model\Parameter( name: 'path', in: 'path', @@ -48,21 +40,15 @@ Response::HTTP_OK => [ 'description' => 'OK - the Users of the Group with the given ID.', 'content' => [ - 'application/vnd.ibexa.api.UserList+xml' => [ - 'schema' => [ - '$ref' => '#/components/schemas/UserList', - ], - ], 'application/vnd.ibexa.api.UserList+json' => [ 'schema' => [ '$ref' => '#/components/schemas/UserList', ], ], - 'application/vnd.ibexa.api.UserRefList+xml' => [ + 'application/vnd.ibexa.api.UserList+xml' => [ 'schema' => [ - '$ref' => '#/components/schemas/UserRefList', + '$ref' => '#/components/schemas/UserList', ], - 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/user/users/GET/UserRefList.xml.example', ], 'application/vnd.ibexa.api.UserRefList+json' => [ 'schema' => [ @@ -70,6 +56,12 @@ ], 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/user/groups/id/users/GET/UserRefList.json.example', ], + 'application/vnd.ibexa.api.UserRefList+xml' => [ + 'schema' => [ + '$ref' => '#/components/schemas/UserRefList', + ], + 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/user/groups/id/users/GET/UserRefList.xml.example', + ], ], ], Response::HTTP_UNAUTHORIZED => [ diff --git a/src/lib/Server/Controller/User/UserGroupsOfUserListController.php b/src/lib/Server/Controller/User/UserGroupsOfUserListController.php index 66dc5112d..347f8ed59 100644 --- a/src/lib/Server/Controller/User/UserGroupsOfUserListController.php +++ b/src/lib/Server/Controller/User/UserGroupsOfUserListController.php @@ -20,21 +20,13 @@ #[Get( uriTemplate: '/user/users/{userId}/groups', openapi: new Model\Operation( + operationId: 'ibexa.rest.load_user_groups_of_user', summary: 'Load Groups of User', description: 'Returns a list of User Groups the User belongs to. The returned list includes the resources for unassigning a User Group if the User is in multiple groups.', tags: [ 'User', ], parameters: [ - new Model\Parameter( - name: 'Accept', - in: 'header', - required: true, - description: 'If set, the link list of User Groups is returned in XML or JSON format.', - schema: [ - 'type' => 'string', - ], - ), new Model\Parameter( name: 'userId', in: 'path', @@ -46,19 +38,20 @@ ], responses: [ Response::HTTP_OK => [ + 'description' => 'If set, the link list of User Groups is returned in XML or JSON format.', 'content' => [ - 'application/vnd.ibexa.api.UserGroupRefList+xml' => [ - 'schema' => [ - '$ref' => '#/components/schemas/UserGroupRefList', - ], - 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/user/users/user_id/groups/POST/UserGroupRefList.xml.example', - ], 'application/vnd.ibexa.api.UserGroupRefList+json' => [ 'schema' => [ '$ref' => '#/components/schemas/UserGroupRefListWrapper', ], 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/user/users/user_id/groups/group_id/UserGroupRefList.json.example', ], + 'application/vnd.ibexa.api.UserGroupRefList+xml' => [ + 'schema' => [ + '$ref' => '#/components/schemas/UserGroupRefList', + ], + 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/user/users/user_id/groups/GET/UserGroupRefList.xml.example', + ], ], ], Response::HTTP_UNAUTHORIZED => [ diff --git a/src/lib/Server/Controller/User/UserListController.php b/src/lib/Server/Controller/User/UserListController.php index c926568ab..2e1ec4c4e 100644 --- a/src/lib/Server/Controller/User/UserListController.php +++ b/src/lib/Server/Controller/User/UserListController.php @@ -15,37 +15,32 @@ #[Get( uriTemplate: '/user/users', openapi: new Model\Operation( + operationId: 'ibexa.rest.load_users', summary: 'List Users', description: 'Load Users either for a given remote ID or Role.', tags: [ 'User', ], - parameters: [ - new Model\Parameter( - name: 'Accept', - in: 'header', - required: true, - description: 'UserList - If set, the User list is returned in XML or JSON format. UserRefList - If set, the link list of Users is returned in XML or JSON format.', - schema: [ - 'type' => 'string', - ], - ), - ], responses: [ Response::HTTP_OK => [ 'description' => 'OK - Loads Users either for a given remote ID or Role.', 'content' => [ + 'application/vnd.ibexa.api.UserList+json' => [ + 'schema' => [ + '$ref' => '#/components/schemas/UserListWrapper', + ], + 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/user/users/GET/UserList.json.example', + ], 'application/vnd.ibexa.api.UserList+xml' => [ 'schema' => [ '$ref' => '#/components/schemas/UserList', ], - 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/user/users/user_id/GET/User.xml.example', + 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/user/users/GET/UserList.xml.example', ], - 'application/vnd.ibexa.api.UserList+json' => [ + 'application/vnd.ibexa.api.UserRefList+json' => [ 'schema' => [ - '$ref' => '#/components/schemas/UserListWrapper', + '$ref' => '#/components/schemas/UserRefListWrapper', ], - 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/user/users/user_id/GET/User.json.example', ], 'application/vnd.ibexa.api.UserRefList+xml' => [ 'schema' => [ @@ -53,11 +48,6 @@ ], 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/user/users/GET/UserRefList.xml.example', ], - 'application/vnd.ibexa.api.UserRefList+json' => [ - 'schema' => [ - '$ref' => '#/components/schemas/UserRefListWrapper', - ], - ], ], ], Response::HTTP_NOT_FOUND => [ diff --git a/src/lib/Server/Controller/User/UserLoadByIdController.php b/src/lib/Server/Controller/User/UserLoadByIdController.php index 3b07f02a1..de5b4c53a 100644 --- a/src/lib/Server/Controller/User/UserLoadByIdController.php +++ b/src/lib/Server/Controller/User/UserLoadByIdController.php @@ -20,25 +20,17 @@ #[Get( uriTemplate: '/user/users/{userId}', openapi: new Model\Operation( + operationId: 'ibexa.rest.load_user', summary: 'Load User', description: 'Loads User with the given ID.', tags: [ 'User', ], parameters: [ - new Model\Parameter( - name: 'Accept', - in: 'header', - required: true, - description: 'If set, the User is returned in XML or JSON format.', - schema: [ - 'type' => 'string', - ], - ), new Model\Parameter( name: 'If-None-Match', in: 'header', - required: true, + required: false, description: 'ETag', schema: [ 'type' => 'string', @@ -57,18 +49,18 @@ Response::HTTP_OK => [ 'description' => 'OK - the User with the given ID.', 'content' => [ - 'application/vnd.ibexa.api.User+xml' => [ - 'schema' => [ - '$ref' => '#/components/schemas/UserList', - ], - 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/user/users/user_id/GET/User.xml.example', - ], 'application/vnd.ibexa.api.User+json' => [ 'schema' => [ '$ref' => '#/components/schemas/UserListWrapper', ], 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/user/users/user_id/GET/User.json.example', ], + 'application/vnd.ibexa.api.User+xml' => [ + 'schema' => [ + '$ref' => '#/components/schemas/UserList', + ], + 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/user/users/user_id/GET/User.xml.example', + ], ], ], Response::HTTP_UNAUTHORIZED => [ diff --git a/src/lib/Server/Controller/User/UserRedirectToCurrentUserController.php b/src/lib/Server/Controller/User/UserRedirectToCurrentUserController.php index 893ee44c8..83acec668 100644 --- a/src/lib/Server/Controller/User/UserRedirectToCurrentUserController.php +++ b/src/lib/Server/Controller/User/UserRedirectToCurrentUserController.php @@ -20,38 +20,28 @@ uriTemplate: '/user/current', extraProperties: [OpenApiFactory::OVERRIDE_OPENAPI_RESPONSES => false], openapi: new Model\Operation( + operationId: 'ibexa.rest.current_user', summary: 'Load current User', description: 'Loads the current user.', tags: [ 'User', ], - parameters: [ - new Model\Parameter( - name: 'Accept', - in: 'header', - required: true, - description: 'If set, the User is returned in XML or JSON format.', - schema: [ - 'type' => 'string', - ], - ), - ], responses: [ Response::HTTP_OK => [ 'description' => 'OK - the User with the given ID.', 'content' => [ - 'application/vnd.ibexa.api.User+xml' => [ - 'schema' => [ - '$ref' => '#/components/schemas/UserList', - ], - 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/user/users/user_id/GET/User.xml.example', - ], 'application/vnd.ibexa.api.User+json' => [ 'schema' => [ '$ref' => '#/components/schemas/UserListWrapper', ], 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/user/users/user_id/GET/User.json.example', ], + 'application/vnd.ibexa.api.User+xml' => [ + 'schema' => [ + '$ref' => '#/components/schemas/UserList', + ], + 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/user/users/user_id/GET/User.xml.example', + ], ], ], Response::HTTP_UNAUTHORIZED => [ diff --git a/src/lib/Server/Controller/User/UserSubGroupListController.php b/src/lib/Server/Controller/User/UserSubGroupListController.php index d8c9b1275..4bbcc2046 100644 --- a/src/lib/Server/Controller/User/UserSubGroupListController.php +++ b/src/lib/Server/Controller/User/UserSubGroupListController.php @@ -20,21 +20,13 @@ #[Get( uriTemplate: '/user/groups/{path}/subgroups', openapi: new Model\Operation( + operationId: 'ibexa.rest.load_sub_user_groups', summary: 'Load subgroups', description: 'Returns a list of the subgroups.', tags: [ 'User Group', ], parameters: [ - new Model\Parameter( - name: 'Accept', - in: 'header', - required: true, - description: 'UserGroupList - If set, the User Group list is returned in XML or JSON format. UserGroupRefList - If set, the link list of User Groups is returned in XML or JSON format.', - schema: [ - 'type' => 'string', - ], - ), new Model\Parameter( name: 'path', in: 'path', @@ -48,29 +40,29 @@ Response::HTTP_OK => [ 'description' => 'OK - list of the subgroups.', 'content' => [ - 'application/vnd.ibexa.api.UserGroupList+xml' => [ - 'schema' => [ - '$ref' => '#/components/schemas/UserGroupList', - ], - 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/user/groups/GET/UserGroupList.xml.example', - ], 'application/vnd.ibexa.api.UserGroupList+json' => [ 'schema' => [ '$ref' => '#/components/schemas/UserGroupListWrapper', ], 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/user/groups/GET/UserGroupList.json.example', ], - 'application/vnd.ibexa.api.UserGroupRefList+xml' => [ + 'application/vnd.ibexa.api.UserGroupList+xml' => [ 'schema' => [ - '$ref' => '#/components/schemas/UserGroupRefList', + '$ref' => '#/components/schemas/UserGroupList', ], - 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/user/users/user_id/groups/POST/UserGroupRefList.xml.example', + 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/user/groups/GET/UserGroupList.xml.example', ], 'application/vnd.ibexa.api.UserGroupRefList+json' => [ 'schema' => [ '$ref' => '#/components/schemas/UserGroupRefListWrapper', ], - 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/user/users/user_id/groups/group_id/UserGroupRefList.json.example', + 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/user/groups/id/subgroups/GET/UserGroupRefList.json.example', + ], + 'application/vnd.ibexa.api.UserGroupRefList+xml' => [ + 'schema' => [ + '$ref' => '#/components/schemas/UserGroupRefList', + ], + 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/user/groups/id/subgroups/GET/UserGroupRefList.xml.example', ], ], ], diff --git a/src/lib/Server/Controller/User/UserUnassignFromUserGroupController.php b/src/lib/Server/Controller/User/UserUnassignFromUserGroupController.php index 330a49850..705f0b154 100644 --- a/src/lib/Server/Controller/User/UserUnassignFromUserGroupController.php +++ b/src/lib/Server/Controller/User/UserUnassignFromUserGroupController.php @@ -19,6 +19,7 @@ #[Delete( uriTemplate: '/user/users/{userId}/groups/{groupId}', openapi: new Model\Operation( + operationId: 'ibexa.rest.unassign_user_from_user_group', summary: 'Unassign User Group', description: 'Unassigns the User from a User Group.', tags: [ @@ -26,10 +27,10 @@ ], parameters: [ new Model\Parameter( - name: 'Accept', + name: 'X-CSRF-Token', in: 'header', required: true, - description: 'If set, the link list of User Groups is returned in XML or JSON format.', + description: 'The CSRF Token needed on all unsafe HTTP methods with session.', schema: [ 'type' => 'string', ], @@ -53,19 +54,20 @@ ], responses: [ Response::HTTP_OK => [ + 'description' => 'If set, the link list of User Groups is returned in XML or JSON format.', 'content' => [ - 'application/vnd.ibexa.api.UserGroupRefList+xml' => [ - 'schema' => [ - '$ref' => '#/components/schemas/UserGroupRefList', - ], - 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/user/users/user_id/groups/POST/UserGroupRefList.xml.example', - ], 'application/vnd.ibexa.api.UserGroupRefList+json' => [ 'schema' => [ '$ref' => '#/components/schemas/UserGroupRefListWrapper', ], 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/user/users/user_id/groups/group_id/UserGroupRefList.json.example', ], + 'application/vnd.ibexa.api.UserGroupRefList+xml' => [ + 'schema' => [ + '$ref' => '#/components/schemas/UserGroupRefList', + ], + 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/user/users/user_id/groups/group_id/DELETE/UserGroupRefList.xml.example', + ], ], ], Response::HTTP_UNAUTHORIZED => [ diff --git a/src/lib/Server/Controller/User/UserUpdateController.php b/src/lib/Server/Controller/User/UserUpdateController.php index 80941b7d6..d38bac4d0 100644 --- a/src/lib/Server/Controller/User/UserUpdateController.php +++ b/src/lib/Server/Controller/User/UserUpdateController.php @@ -21,6 +21,7 @@ uriTemplate: '/user/users/{userId}', extraProperties: [OpenApiFactory::OVERRIDE_OPENAPI_RESPONSES => false], openapi: new Model\Operation( + operationId: 'ibexa.rest.update_user', summary: 'Update User', description: 'Updates a User.', tags: [ @@ -28,19 +29,10 @@ ], parameters: [ new Model\Parameter( - name: 'Accept', + name: 'X-CSRF-Token', in: 'header', required: true, - description: 'If set, the updated User is returned in XML or JSON format.', - schema: [ - 'type' => 'string', - ], - ), - new Model\Parameter( - name: 'Content-Type', - in: 'header', - required: true, - description: 'The UserUpdate schema encoded in XML or JSON format.', + description: 'The CSRF Token needed on all unsafe HTTP methods with session.', schema: [ 'type' => 'string', ], @@ -64,37 +56,38 @@ ), ], requestBody: new Model\RequestBody( + description: 'The UserUpdate schema encoded in XML or JSON format.', content: new \ArrayObject([ - 'application/vnd.ibexa.api.UserUpdate+xml' => [ - 'schema' => [ - '$ref' => '#/components/schemas/UserUpdate', - ], - 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/user/users/user_id/PATCH/UserUpdate.xml.example', - ], 'application/vnd.ibexa.api.UserUpdate+json' => [ 'schema' => [ '$ref' => '#/components/schemas/UserUpdateWrapper', ], 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/user/users/user_id/PATCH/UserUpdate.json.example', ], + 'application/vnd.ibexa.api.UserUpdate+xml' => [ + 'schema' => [ + '$ref' => '#/components/schemas/UserUpdate', + ], + 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/user/users/user_id/PATCH/UserUpdate.xml.example', + ], ]), ), responses: [ Response::HTTP_OK => [ 'description' => 'OK - User updated.', 'content' => [ - 'application/vnd.ibexa.api.User+xml' => [ - 'schema' => [ - '$ref' => '#/components/schemas/User', - ], - 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/user/users/user_id/PATCH/User.xml.example', - ], 'application/vnd.ibexa.api.User+json' => [ 'schema' => [ '$ref' => '#/components/schemas/UserWrapper', ], 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/user/users/user_id/PATCH/User.json.example', ], + 'application/vnd.ibexa.api.User+xml' => [ + 'schema' => [ + '$ref' => '#/components/schemas/User', + ], + 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/user/users/user_id/PATCH/User.xml.example', + ], ], ], Response::HTTP_BAD_REQUEST => [ diff --git a/src/lib/Server/Controller/User/UserVerifyController.php b/src/lib/Server/Controller/User/UserVerifyController.php index 1ef4c8637..e9b913861 100644 --- a/src/lib/Server/Controller/User/UserVerifyController.php +++ b/src/lib/Server/Controller/User/UserVerifyController.php @@ -18,13 +18,12 @@ #[Head( uriTemplate: '/user/users', openapi: new Model\Operation( + operationId: 'ibexa.rest.verify_users', summary: 'Verify Users', description: 'Verifies if there are Users matching given filter.', tags: [ 'User', ], - parameters: [ - ], responses: [ Response::HTTP_OK => [ 'description' => 'OK - verifies if there are Users matching the given filter.', diff --git a/src/lib/Server/Controller/Views.php b/src/lib/Server/Controller/Views.php index 5c78cc3d4..9f96422fb 100644 --- a/src/lib/Server/Controller/Views.php +++ b/src/lib/Server/Controller/Views.php @@ -25,6 +25,7 @@ uriTemplate: '/views', extraProperties: [OpenApiFactory::OVERRIDE_OPENAPI_RESPONSES => false], openapi: new Model\Operation( + operationId: 'ibexa.rest.views.create', summary: 'Search content', description: 'Executes a query and returns a View including the results. View input reflects the criteria model of the public PHP API. @@ -34,42 +35,35 @@ ], parameters: [ new Model\Parameter( - name: 'Accept', + name: 'X-CSRF-Token', in: 'header', required: true, - description: 'The view in XML or JSON format.', - schema: [ - 'type' => 'string', - ], - ), - new Model\Parameter( - name: 'Content-Type', - in: 'header', - required: true, - description: 'The view input in XML or JSON format.', + description: 'The CSRF Token needed on all unsafe HTTP methods with session.', schema: [ 'type' => 'string', ], ), ], requestBody: new Model\RequestBody( + description: 'The view input in XML or JSON format.', content: new \ArrayObject([ - 'application/vnd.ibexa.api.ViewInput+xml' => [ - 'schema' => [ - '$ref' => '#/components/schemas/ViewInput', - ], - 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/views/POST/ViewInput.xml.example', - ], 'application/vnd.ibexa.api.ViewInput+json' => [ 'schema' => [ '$ref' => '#/components/schemas/ViewInputWrapper', ], 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/views/POST/ViewInput.json.example', ], + 'application/vnd.ibexa.api.ViewInput+xml' => [ + 'schema' => [ + '$ref' => '#/components/schemas/ViewInput', + ], + 'x-ibexa-example-file' => '@IbexaRestBundle/Resources/api_platform/examples/views/POST/ViewInput.xml.example', + ], ]), ), responses: [ Response::HTTP_OK => [ + 'description' => 'The view in XML or JSON format.', 'content' => [ 'application/vnd.ibexa.api.View+xml; version=1.1' => [ 'schema' => [ diff --git a/src/lib/Server/Security/RestAuthenticator.php b/src/lib/Server/Security/RestAuthenticator.php deleted file mode 100644 index e69de29bb..000000000