From 3c89e9d436ed68cbef5ca4969ec2981141aaaba9 Mon Sep 17 00:00:00 2001 From: roadiz-ci Date: Tue, 26 Mar 2024 17:37:49 +0000 Subject: [PATCH] fix: Rewrote all api_resources config files with `resources:` prefix --- config/api_resources/attribute.yml | 6 +- config/api_resources/attribute_value.yml | 26 +-- config/api_resources/common_content.yml | 55 ++--- config/api_resources/custom_form.yml | 202 +++++++++--------- config/api_resources/document.yml | 26 +-- config/api_resources/folder.yml | 26 +-- config/api_resources/node.yml | 16 +- config/api_resources/nodes_sources.yml | 126 +++++------ config/api_resources/realm.yml | 26 +-- config/api_resources/tag.yml | 34 +-- config/api_resources/translation.yml | 30 +-- config/api_resources/web_response.yml | 5 +- src/NodeType/ApiResourceGenerator.php | 57 ++--- tests/expected_api_resources/nssecondtest.yml | 68 +++--- tests/expected_api_resources/nstest.yml | 68 +++--- tests/expected_api_resources/web_response.yml | 63 +++--- .../web_response_multiple.yml | 121 +++++------ 17 files changed, 486 insertions(+), 469 deletions(-) diff --git a/config/api_resources/attribute.yml b/config/api_resources/attribute.yml index 1b48bcc9..ed131e5f 100644 --- a/config/api_resources/attribute.yml +++ b/config/api_resources/attribute.yml @@ -1,4 +1,4 @@ ---- -RZ\Roadiz\CoreBundle\Entity\Attribute: - operations: [] +resources: + RZ\Roadiz\CoreBundle\Entity\Attribute: + operations: [] diff --git a/config/api_resources/attribute_value.yml b/config/api_resources/attribute_value.yml index 23eee57d..cd24bf63 100644 --- a/config/api_resources/attribute_value.yml +++ b/config/api_resources/attribute_value.yml @@ -1,14 +1,14 @@ ---- -RZ\Roadiz\CoreBundle\Entity\AttributeValue: - operations: - ApiPlatform\Metadata\GetCollection: - method: "GET" - normalizationContext: - groups: ["urls", "attribute", "document_display", "attribute_node", "attribute_documents"] - enable_max_depth: true - ApiPlatform\Metadata\Get: - method: 'GET' - normalizationContext: - groups: ["urls", "attribute", "document_display", "attribute_node", "attribute_documents"] - enable_max_depth: true +resources: + RZ\Roadiz\CoreBundle\Entity\AttributeValue: + operations: + ApiPlatform\Metadata\GetCollection: + method: "GET" + normalizationContext: + groups: ["urls", "attribute", "document_display", "attribute_node", "attribute_documents"] + enable_max_depth: true + ApiPlatform\Metadata\Get: + method: 'GET' + normalizationContext: + groups: ["urls", "attribute", "document_display", "attribute_node", "attribute_documents"] + enable_max_depth: true diff --git a/config/api_resources/common_content.yml b/config/api_resources/common_content.yml index cb452fe8..f6e7d26c 100644 --- a/config/api_resources/common_content.yml +++ b/config/api_resources/common_content.yml @@ -1,28 +1,29 @@ -App\Api\Model\CommonContent: - operations: - getCommonContent: - class: ApiPlatform\Metadata\Get - method: 'GET' - uriTemplate: '/common_content' - read: false - controller: App\Controller\GetCommonContentController - pagination_enabled: false - normalizationContext: - enable_max_depth: true +resources: + App\Api\Model\CommonContent: + operations: + getCommonContent: + class: ApiPlatform\Metadata\Get + method: 'GET' + uriTemplate: '/common_content' + read: false + controller: App\Controller\GetCommonContentController pagination_enabled: false - groups: - - get - - common_content - - web_response - - walker - - walker_level - - children - - children_count - - nodes_sources_base - - nodes_sources_default - - urls - - blocks_urls - - tag_base - - translation_base - - document_display - - document_folders + normalizationContext: + enable_max_depth: true + pagination_enabled: false + groups: + - get + - common_content + - web_response + - walker + - walker_level + - children + - children_count + - nodes_sources_base + - nodes_sources_default + - urls + - blocks_urls + - tag_base + - translation_base + - document_display + - document_folders diff --git a/config/api_resources/custom_form.yml b/config/api_resources/custom_form.yml index fbb79c5f..27e15d8b 100644 --- a/config/api_resources/custom_form.yml +++ b/config/api_resources/custom_form.yml @@ -1,110 +1,110 @@ ---- -RZ\Roadiz\CoreBundle\Entity\CustomForm: - operations: - ApiPlatform\Metadata\GetCollection: - method: "GET" - normalizationContext: - enable_max_depth: true +resources: + RZ\Roadiz\CoreBundle\Entity\CustomForm: + operations: + ApiPlatform\Metadata\GetCollection: + method: "GET" + normalizationContext: + enable_max_depth: true - ApiPlatform\Metadata\Get: - method: 'GET' - normalizationContext: - enable_max_depth: true + ApiPlatform\Metadata\Get: + method: 'GET' + normalizationContext: + enable_max_depth: true - api_custom_forms_item_post: - method: 'POST' - class: ApiPlatform\Metadata\Post - routeName: api_custom_forms_item_post - normalizationContext: - enable_max_depth: true - openapiContext: - summary: Post a user custom form - description: | - Post a user custom form - requestBody: - content: - multipart/form-data: - schema: - type: object - properties: - custom_form_slug[email]: - type: string - example: test@test.test - custom_form_slug[first_name]: - type: string - example: John - custom_form_slug[last_name]: - type: string - example: Doe - responses: - 201: ~ - 400: - description: Posted custom form has errors + api_custom_forms_item_post: + method: 'POST' + class: ApiPlatform\Metadata\Post + routeName: api_custom_forms_item_post + normalizationContext: + enable_max_depth: true + openapiContext: + summary: Post a user custom form + description: | + Post a user custom form + requestBody: content: - application/json: + multipart/form-data: schema: type: object properties: - email: - type: object - example: - email: This value is not a valid email address. - 202: - description: Posted custom form was accepted - content: - application/json: - schema: - type: object - properties: { } - - api_custom_forms_item_definition: - method: 'GET' - class: ApiPlatform\Metadata\Get - routeName: api_custom_forms_item_definition - normalizationContext: - enable_max_depth: true - openapiContext: - summary: Get a custom form definition for frontend - description: | - Get a custom form definition for frontend - responses: - 200: - description: Custom form definition object - content: - application/json: - schema: - type: object - properties: - title: + custom_form_slug[email]: + type: string + example: test@test.test + custom_form_slug[first_name]: type: string - description: Form inputs prefix - example: reiciendis_natus_ducimus_nostrum - type: + example: John + custom_form_slug[last_name]: type: string - description: Form definition type - example: object + example: Doe + responses: + 201: ~ + 400: + description: Posted custom form has errors + content: + application/json: + schema: + type: object + properties: + email: + type: object + example: + email: This value is not a valid email address. + 202: + description: Posted custom form was accepted + content: + application/json: + schema: + type: object + properties: { } + + api_custom_forms_item_definition: + method: 'GET' + class: ApiPlatform\Metadata\Get + routeName: api_custom_forms_item_definition + normalizationContext: + enable_max_depth: true + openapiContext: + summary: Get a custom form definition for frontend + description: | + Get a custom form definition for frontend + responses: + 200: + description: Custom form definition object + content: + application/json: + schema: + type: object properties: - type: object - description: Form definition fields - example: - email: - type: string - title: Email - attr: - data-group: null - placeholder: null - widget: email - propertyOrder: 1 - first_name: - type: string - title: Firstname - attr: - data-group: null - placeholder: null - widget: string - propertyOrder: 2 - required: - type: array - description: Required fields names - example: - - 'email' + title: + type: string + description: Form inputs prefix + example: reiciendis_natus_ducimus_nostrum + type: + type: string + description: Form definition type + example: object + properties: + type: object + description: Form definition fields + example: + email: + type: string + title: Email + attr: + data-group: null + placeholder: null + widget: email + propertyOrder: 1 + first_name: + type: string + title: Firstname + attr: + data-group: null + placeholder: null + widget: string + propertyOrder: 2 + required: + type: array + description: Required fields names + example: + - 'email' diff --git a/config/api_resources/document.yml b/config/api_resources/document.yml index d875d9f0..9093e2f9 100644 --- a/config/api_resources/document.yml +++ b/config/api_resources/document.yml @@ -1,15 +1,15 @@ ---- -RZ\Roadiz\CoreBundle\Entity\Document: - operations: - ApiPlatform\Metadata\GetCollection: - method: "GET" - normalizationContext: - groups: ["urls", "document_display", "document_folders", "document_folders_all", "document_display_sources"] - enable_max_depth: true +resources: + RZ\Roadiz\CoreBundle\Entity\Document: + operations: + ApiPlatform\Metadata\GetCollection: + method: "GET" + normalizationContext: + groups: ["urls", "document_display", "document_folders", "document_folders_all", "document_display_sources"] + enable_max_depth: true - ApiPlatform\Metadata\Get: - method: 'GET' - normalizationContext: - groups: ["urls", "document", "document_display", "document_folders", "document_folders_all", "document_display_sources"] - enable_max_depth: true + ApiPlatform\Metadata\Get: + method: 'GET' + normalizationContext: + groups: ["urls", "document", "document_display", "document_folders", "document_folders_all", "document_display_sources"] + enable_max_depth: true diff --git a/config/api_resources/folder.yml b/config/api_resources/folder.yml index 38dafc52..61edc334 100644 --- a/config/api_resources/folder.yml +++ b/config/api_resources/folder.yml @@ -1,13 +1,13 @@ ---- -RZ\Roadiz\CoreBundle\Entity\Folder: - operations: - ApiPlatform\Metadata\GetCollection: - method: "GET" - normalizationContext: - groups: [ "folder" ] - enable_max_depth: true - ApiPlatform\Metadata\Get: - method: "GET" - normalizationContext: - groups: [ "folder" ] - enable_max_depth: true +resources: + RZ\Roadiz\CoreBundle\Entity\Folder: + operations: + ApiPlatform\Metadata\GetCollection: + method: "GET" + normalizationContext: + groups: [ "folder" ] + enable_max_depth: true + ApiPlatform\Metadata\Get: + method: "GET" + normalizationContext: + groups: [ "folder" ] + enable_max_depth: true diff --git a/config/api_resources/node.yml b/config/api_resources/node.yml index 94e6cf1b..2d0aa331 100644 --- a/config/api_resources/node.yml +++ b/config/api_resources/node.yml @@ -1,8 +1,8 @@ ---- -RZ\Roadiz\CoreBundle\Entity\Node: - operations: - ApiPlatform\Metadata\Get: - method: 'GET' - normalizationContext: - groups: ["node", "document_display"] - enable_max_depth: true +resources: + RZ\Roadiz\CoreBundle\Entity\Node: + operations: + ApiPlatform\Metadata\Get: + method: 'GET' + normalizationContext: + groups: ["node", "document_display"] + enable_max_depth: true diff --git a/config/api_resources/nodes_sources.yml b/config/api_resources/nodes_sources.yml index 602794b7..0674f810 100644 --- a/config/api_resources/nodes_sources.yml +++ b/config/api_resources/nodes_sources.yml @@ -1,66 +1,66 @@ ---- -RZ\Roadiz\CoreBundle\Entity\NodesSources: - operations: - ApiPlatform\Metadata\GetCollection: - method: "GET" - normalizationContext: - groups: - - nodes_sources_base - - nodes_sources_default - - user - - urls - - tag_base - - translation_base - - document_display +resources: + RZ\Roadiz\CoreBundle\Entity\NodesSources: + operations: + ApiPlatform\Metadata\GetCollection: + method: "GET" + normalizationContext: + groups: + - nodes_sources_base + - nodes_sources_default + - user + - urls + - tag_base + - translation_base + - document_display - api_nodes_sources_archives: - class: ApiPlatform\Metadata\GetCollection - method: 'GET' - uriTemplate: '/nodes_sources/archives' - pagination_enabled: false - pagination_client_enabled: false - extraProperties: - archive_enabled: true - archive_publication_field_name: publishedAt - normalizationContext: - groups: - - get - - archives - openapiContext: - summary: Get available NodesSources archives - parameters: ~ - description: | - Get available NodesSources archives (years and months) based on their `publishedAt` field + api_nodes_sources_archives: + class: ApiPlatform\Metadata\GetCollection + method: 'GET' + uriTemplate: '/nodes_sources/archives' + pagination_enabled: false + pagination_client_enabled: false + extraProperties: + archive_enabled: true + archive_publication_field_name: publishedAt + normalizationContext: + groups: + - get + - archives + openapiContext: + summary: Get available NodesSources archives + parameters: ~ + description: | + Get available NodesSources archives (years and months) based on their `publishedAt` field - api_nodes_sources_search: - class: ApiPlatform\Metadata\GetCollection - method: 'GET' - uriTemplate: '/nodes_sources/search' - controller: RZ\Roadiz\CoreBundle\Api\Controller\NodesSourcesSearchController - read: false - normalizationContext: - groups: - - get - - nodes_sources_base - - nodes_sources_default - - urls - - tag_base - - translation_base - - document_display - openapiContext: - summary: Search NodesSources resources - description: | - Search all website NodesSources resources using **Solr** full-text search engine - parameters: - - type: string - name: search - in: query - required: true - description: Search pattern - schema: - type: string + api_nodes_sources_search: + class: ApiPlatform\Metadata\GetCollection + method: 'GET' + uriTemplate: '/nodes_sources/search' + controller: RZ\Roadiz\CoreBundle\Api\Controller\NodesSourcesSearchController + read: false + normalizationContext: + groups: + - get + - nodes_sources_base + - nodes_sources_default + - urls + - tag_base + - translation_base + - document_display + openapiContext: + summary: Search NodesSources resources + description: | + Search all website NodesSources resources using **Solr** full-text search engine + parameters: + - type: string + name: search + in: query + required: true + description: Search pattern + schema: + type: string - ApiPlatform\Metadata\Get: - method: 'GET' - normalizationContext: - groups: ["nodes_sources", "urls", "tag_base", "translation_base", "document_display"] + ApiPlatform\Metadata\Get: + method: 'GET' + normalizationContext: + groups: ["nodes_sources", "urls", "tag_base", "translation_base", "document_display"] diff --git a/config/api_resources/realm.yml b/config/api_resources/realm.yml index 50dbdd8b..719d66ac 100644 --- a/config/api_resources/realm.yml +++ b/config/api_resources/realm.yml @@ -1,14 +1,14 @@ ---- -RZ\Roadiz\CoreBundle\Entity\Realm: - operations: - ApiPlatform\Metadata\GetCollection: - method: "GET" - normalizationContext: - groups: [ "realm" ] - enable_max_depth: true +resources: + RZ\Roadiz\CoreBundle\Entity\Realm: + operations: + ApiPlatform\Metadata\GetCollection: + method: "GET" + normalizationContext: + groups: [ "realm" ] + enable_max_depth: true - ApiPlatform\Metadata\Get: - method: "GET" - normalizationContext: - groups: [ "realm" ] - enable_max_depth: true + ApiPlatform\Metadata\Get: + method: "GET" + normalizationContext: + groups: [ "realm" ] + enable_max_depth: true diff --git a/config/api_resources/tag.yml b/config/api_resources/tag.yml index 3f35d12b..51dec445 100644 --- a/config/api_resources/tag.yml +++ b/config/api_resources/tag.yml @@ -1,18 +1,18 @@ ---- -RZ\Roadiz\CoreBundle\Entity\Tag: - operations: - ApiPlatform\Metadata\GetCollection: - method: "GET" - normalizationContext: - enable_max_depth: true - groups: - - tag_base +resources: + RZ\Roadiz\CoreBundle\Entity\Tag: + operations: + ApiPlatform\Metadata\GetCollection: + method: "GET" + normalizationContext: + enable_max_depth: true + groups: + - tag_base - ApiPlatform\Metadata\Get: - method: 'GET' - normalizationContext: - enable_max_depth: true - groups: - - tag - - tag_base - - tag_parent + ApiPlatform\Metadata\Get: + method: 'GET' + normalizationContext: + enable_max_depth: true + groups: + - tag + - tag_base + - tag_parent diff --git a/config/api_resources/translation.yml b/config/api_resources/translation.yml index ad19c01c..20e9fb7b 100644 --- a/config/api_resources/translation.yml +++ b/config/api_resources/translation.yml @@ -1,17 +1,17 @@ ---- -RZ\Roadiz\CoreBundle\Entity\Translation: - operations: - ApiPlatform\Metadata\GetCollection: - method: "GET" - normalizationContext: - enable_max_depth: true - groups: - - translation_base +resources: + RZ\Roadiz\CoreBundle\Entity\Translation: + operations: + ApiPlatform\Metadata\GetCollection: + method: "GET" + normalizationContext: + enable_max_depth: true + groups: + - translation_base - ApiPlatform\Metadata\Get: - method: 'GET' - normalizationContext: - enable_max_depth: true - groups: - - translation_base + ApiPlatform\Metadata\Get: + method: 'GET' + normalizationContext: + enable_max_depth: true + groups: + - translation_base diff --git a/config/api_resources/web_response.yml b/config/api_resources/web_response.yml index 6a903423..4e7d92da 100644 --- a/config/api_resources/web_response.yml +++ b/config/api_resources/web_response.yml @@ -1,2 +1,3 @@ -RZ\Roadiz\CoreBundle\Api\Model\WebResponse: - operations: [] +resources: + RZ\Roadiz\CoreBundle\Api\Model\WebResponse: + operations: [] diff --git a/src/NodeType/ApiResourceGenerator.php b/src/NodeType/ApiResourceGenerator.php index 4ab4ff65..6506c450 100644 --- a/src/NodeType/ApiResourceGenerator.php +++ b/src/NodeType/ApiResourceGenerator.php @@ -51,15 +51,17 @@ public function generate(NodeTypeInterface $nodeType): ?string $filesystem->dumpFile( $webResponseResourcePath, Yaml::dump([ - $this->webResponseClass => [ - 'operations' => [], + 'resources' => [ + $this->webResponseClass => [ + 'operations' => [], + ] ] - ], 6) + ], 7) ); } $filesystem->dumpFile( $webResponseResourcePath, - Yaml::dump($this->addWebResponseResourceOperation($nodeType, $webResponseResourcePath), 6) + Yaml::dump($this->addWebResponseResourceOperation($nodeType, $webResponseResourcePath), 7) ); $this->logger->info('API WebResponse config file has been updated.', [ 'file' => $webResponseResourcePath, @@ -69,7 +71,7 @@ public function generate(NodeTypeInterface $nodeType): ?string if (!$filesystem->exists($resourcePath)) { $filesystem->dumpFile( $resourcePath, - Yaml::dump($this->getApiResourceDefinition($nodeType), 6) + Yaml::dump($this->getApiResourceDefinition($nodeType), 7) ); $this->logger->info('API resource config file has been generated.', [ 'nodeType' => $nodeType->getName(), @@ -96,7 +98,7 @@ public function remove(NodeTypeInterface $nodeType): void if ($filesystem->exists($webResponseResourcePath)) { $filesystem->dumpFile( $webResponseResourcePath, - Yaml::dump($this->removeWebResponseResourceOperation($nodeType, $webResponseResourcePath), 6) + Yaml::dump($this->removeWebResponseResourceOperation($nodeType, $webResponseResourcePath), 7) ); $this->logger->info('API WebResponse config file has been updated.', [ 'file' => $webResponseResourcePath, @@ -148,13 +150,18 @@ protected function getApiResourceDefinition(NodeTypeInterface $nodeType): array ->trimStart('\\') ->toString(); - return [ $fqcn => [ - 'types' => [$nodeType->getName()], - 'operations' => [ - ...$this->getCollectionOperations($nodeType), - ...$this->getItemOperations($nodeType) - ], - ]]; + return [ + 'resources' => [ + $fqcn => [ + 'shortName' => $nodeType->getName(), + 'types' => [$nodeType->getName()], + 'operations' => [ + ...$this->getCollectionOperations($nodeType), + ...$this->getItemOperations($nodeType) + ], + ] + ] + ]; } protected function addWebResponseResourceOperation(NodeTypeInterface $nodeType, string $webResponseResourcePath): array @@ -164,16 +171,18 @@ protected function addWebResponseResourceOperation(NodeTypeInterface $nodeType, ); $webResponseResource = Yaml::parseFile($webResponseResourcePath); - if (!\array_key_exists($this->webResponseClass, $webResponseResource)) { + if (!\array_key_exists($this->webResponseClass, $webResponseResource['resources'])) { $webResponseResource = [ - $this->webResponseClass => [ - 'operations' => [], - ] + 'resources' => [ + $this->webResponseClass => [ + 'operations' => [], + ] + ], ]; } - if (\array_key_exists('operations', $webResponseResource[$this->webResponseClass])) { - $operations = $webResponseResource[$this->webResponseClass]['operations']; + if (\array_key_exists('operations', $webResponseResource['resources'][$this->webResponseClass])) { + $operations = $webResponseResource['resources'][$this->webResponseClass]['operations']; } else { $operations = []; } @@ -226,7 +235,7 @@ protected function addWebResponseResourceOperation(NodeTypeInterface $nodeType, ] ]; - $webResponseResource[$this->webResponseClass]['operations'] = $operations; + $webResponseResource['resources'][$this->webResponseClass]['operations'] = $operations; return $webResponseResource; } @@ -237,11 +246,11 @@ protected function removeWebResponseResourceOperation(NodeTypeInterface $nodeTyp ); $webResponseResource = Yaml::parseFile($webResponseResourcePath); - if (!\array_key_exists($this->webResponseClass, $webResponseResource)) { + if (!\array_key_exists($this->webResponseClass, $webResponseResource['resources'])) { return $webResponseResource; } - if (\array_key_exists('operations', $webResponseResource[$this->webResponseClass])) { - $operations = $webResponseResource[$this->webResponseClass]['operations']; + if (\array_key_exists('operations', $webResponseResource['resources'][$this->webResponseClass])) { + $operations = $webResponseResource['resources'][$this->webResponseClass]['operations']; } else { return $webResponseResource; } @@ -251,7 +260,7 @@ protected function removeWebResponseResourceOperation(NodeTypeInterface $nodeTyp } unset($operations[$getByPathOperationName]); - $webResponseResource[$this->webResponseClass]['operations'] = array_filter($operations); + $webResponseResource['resources'][$this->webResponseClass]['operations'] = array_filter($operations); return $webResponseResource; } diff --git a/tests/expected_api_resources/nssecondtest.yml b/tests/expected_api_resources/nssecondtest.yml index 28427bd6..50af807a 100644 --- a/tests/expected_api_resources/nssecondtest.yml +++ b/tests/expected_api_resources/nssecondtest.yml @@ -1,33 +1,35 @@ -App\GeneratedEntity\NSSecondTest: - types: - - SecondTest - operations: - secondtest_get_collection: - method: GET - class: ApiPlatform\Metadata\GetCollection - shortName: SecondTest - normalizationContext: - enable_max_depth: true - groups: - - nodes_sources_base - - nodes_sources_default - - urls - - tag_base - - translation_base - - document_display - - document_thumbnails - - document_display_sources - secondtest_get: - method: GET - class: ApiPlatform\Metadata\Get - shortName: SecondTest - normalizationContext: - groups: - - nodes_sources - - node_listing - - urls - - tag_base - - translation_base - - document_display - - document_thumbnails - - document_display_sources +resources: + App\GeneratedEntity\NSSecondTest: + shortName: SecondTest + types: + - SecondTest + operations: + secondtest_get_collection: + method: GET + class: ApiPlatform\Metadata\GetCollection + shortName: SecondTest + normalizationContext: + enable_max_depth: true + groups: + - nodes_sources_base + - nodes_sources_default + - urls + - tag_base + - translation_base + - document_display + - document_thumbnails + - document_display_sources + secondtest_get: + method: GET + class: ApiPlatform\Metadata\Get + shortName: SecondTest + normalizationContext: + groups: + - nodes_sources + - node_listing + - urls + - tag_base + - translation_base + - document_display + - document_thumbnails + - document_display_sources diff --git a/tests/expected_api_resources/nstest.yml b/tests/expected_api_resources/nstest.yml index 727aed77..cc8c952f 100644 --- a/tests/expected_api_resources/nstest.yml +++ b/tests/expected_api_resources/nstest.yml @@ -1,33 +1,35 @@ -App\GeneratedEntity\NSTest: - types: - - Test - operations: - test_get_collection: - method: GET - class: ApiPlatform\Metadata\GetCollection - shortName: Test - normalizationContext: - enable_max_depth: true - groups: - - nodes_sources_base - - nodes_sources_default - - urls - - tag_base - - translation_base - - document_display - - document_thumbnails - - document_display_sources - test_get: - method: GET - class: ApiPlatform\Metadata\Get - shortName: Test - normalizationContext: - groups: - - nodes_sources - - node_listing - - urls - - tag_base - - translation_base - - document_display - - document_thumbnails - - document_display_sources +resources: + App\GeneratedEntity\NSTest: + shortName: Test + types: + - Test + operations: + test_get_collection: + method: GET + class: ApiPlatform\Metadata\GetCollection + shortName: Test + normalizationContext: + enable_max_depth: true + groups: + - nodes_sources_base + - nodes_sources_default + - urls + - tag_base + - translation_base + - document_display + - document_thumbnails + - document_display_sources + test_get: + method: GET + class: ApiPlatform\Metadata\Get + shortName: Test + normalizationContext: + groups: + - nodes_sources + - node_listing + - urls + - tag_base + - translation_base + - document_display + - document_thumbnails + - document_display_sources diff --git a/tests/expected_api_resources/web_response.yml b/tests/expected_api_resources/web_response.yml index 1789d94d..176c0a5d 100644 --- a/tests/expected_api_resources/web_response.yml +++ b/tests/expected_api_resources/web_response.yml @@ -1,31 +1,32 @@ -RZ\Roadiz\CoreBundle\Api\Model\WebResponse: - operations: - test_get_by_path: - method: GET - class: ApiPlatform\Metadata\Get - uriTemplate: /web_response_by_path - read: false - controller: RZ\Roadiz\CoreBundle\Api\Controller\GetWebResponseByPathController - normalizationContext: - pagination_enabled: false - enable_max_depth: true - groups: - - test_get_by_path - - nodes_sources - - node_listing - - urls - - tag_base - - translation_base - - document_display - - document_thumbnails - - document_display_sources - - web_response - - walker - - children - openapiContext: - tags: - - WebResponse - summary: 'Get a Test by its path wrapped in a WebResponse object' - description: 'Get a Test by its path wrapped in a WebResponse' - parameters: - - { type: string, name: path, in: query, required: true, description: 'Resource path, or `/` for home page', schema: { type: string } } +resources: + RZ\Roadiz\CoreBundle\Api\Model\WebResponse: + operations: + test_get_by_path: + method: GET + class: ApiPlatform\Metadata\Get + uriTemplate: /web_response_by_path + read: false + controller: RZ\Roadiz\CoreBundle\Api\Controller\GetWebResponseByPathController + normalizationContext: + pagination_enabled: false + enable_max_depth: true + groups: + - test_get_by_path + - nodes_sources + - node_listing + - urls + - tag_base + - translation_base + - document_display + - document_thumbnails + - document_display_sources + - web_response + - walker + - children + openapiContext: + tags: + - WebResponse + summary: 'Get a Test by its path wrapped in a WebResponse object' + description: 'Get a Test by its path wrapped in a WebResponse' + parameters: + - { type: string, name: path, in: query, required: true, description: 'Resource path, or `/` for home page', schema: { type: string } } diff --git a/tests/expected_api_resources/web_response_multiple.yml b/tests/expected_api_resources/web_response_multiple.yml index 34270be0..eff72beb 100644 --- a/tests/expected_api_resources/web_response_multiple.yml +++ b/tests/expected_api_resources/web_response_multiple.yml @@ -1,60 +1,61 @@ -RZ\Roadiz\CoreBundle\Api\Model\WebResponse: - operations: - test_get_by_path: - method: GET - class: ApiPlatform\Metadata\Get - uriTemplate: /web_response_by_path - read: false - controller: RZ\Roadiz\CoreBundle\Api\Controller\GetWebResponseByPathController - normalizationContext: - pagination_enabled: false - enable_max_depth: true - groups: - - test_get_by_path - - nodes_sources - - node_listing - - urls - - tag_base - - translation_base - - document_display - - document_thumbnails - - document_display_sources - - web_response - - walker - - children - openapiContext: - tags: - - WebResponse - summary: 'Get a Test by its path wrapped in a WebResponse object' - description: 'Get a Test by its path wrapped in a WebResponse' - parameters: - - { type: string, name: path, in: query, required: true, description: 'Resource path, or `/` for home page', schema: { type: string } } - secondtest_get_by_path: - method: GET - class: ApiPlatform\Metadata\Get - uriTemplate: /web_response_by_path - read: false - controller: RZ\Roadiz\CoreBundle\Api\Controller\GetWebResponseByPathController - normalizationContext: - pagination_enabled: false - enable_max_depth: true - groups: - - secondtest_get_by_path - - nodes_sources - - node_listing - - urls - - tag_base - - translation_base - - document_display - - document_thumbnails - - document_display_sources - - web_response - - walker - - children - openapiContext: - tags: - - WebResponse - summary: 'Get a SecondTest by its path wrapped in a WebResponse object' - description: 'Get a SecondTest by its path wrapped in a WebResponse' - parameters: - - { type: string, name: path, in: query, required: true, description: 'Resource path, or `/` for home page', schema: { type: string } } +resources: + RZ\Roadiz\CoreBundle\Api\Model\WebResponse: + operations: + test_get_by_path: + method: GET + class: ApiPlatform\Metadata\Get + uriTemplate: /web_response_by_path + read: false + controller: RZ\Roadiz\CoreBundle\Api\Controller\GetWebResponseByPathController + normalizationContext: + pagination_enabled: false + enable_max_depth: true + groups: + - test_get_by_path + - nodes_sources + - node_listing + - urls + - tag_base + - translation_base + - document_display + - document_thumbnails + - document_display_sources + - web_response + - walker + - children + openapiContext: + tags: + - WebResponse + summary: 'Get a Test by its path wrapped in a WebResponse object' + description: 'Get a Test by its path wrapped in a WebResponse' + parameters: + - { type: string, name: path, in: query, required: true, description: 'Resource path, or `/` for home page', schema: { type: string } } + secondtest_get_by_path: + method: GET + class: ApiPlatform\Metadata\Get + uriTemplate: /web_response_by_path + read: false + controller: RZ\Roadiz\CoreBundle\Api\Controller\GetWebResponseByPathController + normalizationContext: + pagination_enabled: false + enable_max_depth: true + groups: + - secondtest_get_by_path + - nodes_sources + - node_listing + - urls + - tag_base + - translation_base + - document_display + - document_thumbnails + - document_display_sources + - web_response + - walker + - children + openapiContext: + tags: + - WebResponse + summary: 'Get a SecondTest by its path wrapped in a WebResponse object' + description: 'Get a SecondTest by its path wrapped in a WebResponse' + parameters: + - { type: string, name: path, in: query, required: true, description: 'Resource path, or `/` for home page', schema: { type: string } }