From 4fd67ae0a0b2118f8e8ffc348cef99d7f7902f94 Mon Sep 17 00:00:00 2001 From: Adrien Dupuis <61695653+adriendupuis@users.noreply.github.com> Date: Tue, 12 May 2026 11:27:46 +0200 Subject: [PATCH] Fix/Enh. OpenAPI --- .../Bookmark/BookmarkCreateController.php | 17 ++++++-- .../Bookmark/BookmarkDeleteController.php | 10 +++++ .../BookmarkIsBookmarkedController.php | 40 +++++++++++++++++-- .../Bookmark/BookmarkListController.php | 25 ++++-------- .../Language/LanguageListController.php | 25 ++++-------- .../Language/LanguageLoadByIdController.php | 23 ++++------- src/lib/Server/Controller/Root.php | 25 ++++-------- .../Section/SectionCreateController.php | 40 ++++++++----------- .../Section/SectionDeleteController.php | 10 +++++ .../Section/SectionListController.php | 25 +++++------- .../Section/SectionLoadByIdController.php | 25 +++++------- .../Section/SectionUpdateController.php | 39 ++++++++---------- src/lib/Server/Controller/Services.php | 23 ++++------- .../Controller/Trash/TrashEmptyController.php | 10 +++++ .../Trash/TrashItemDeleteController.php | 10 +++++ .../Trash/TrashItemListController.php | 24 ++++------- .../Trash/TrashItemLoadByIdController.php | 23 ++++------- .../URLAlias/URLAliasCreateController.php | 39 ++++++++---------- .../URLAlias/URLAliasDeleteController.php | 10 +++++ .../URLAlias/URLAliasListGlobalController.php | 24 ++++------- .../URLAliasListLocationController.php | 20 +++------- .../URLAlias/URLAliasLoadByIdController.php | 22 ++++------ .../URLWildcardCreateController.php | 39 ++++++++---------- .../URLWildcardDeleteController.php | 10 +++++ .../URLWildcard/URLWildcardListController.php | 24 ++++------- .../URLWildcardLoadByIdController.php | 22 ++++------ 26 files changed, 282 insertions(+), 322 deletions(-) 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/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/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/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 => [