From ef6de63e006b04337c6b114d27a48299d7b8f7f4 Mon Sep 17 00:00:00 2001 From: Vincent Chalamon Date: Mon, 22 Nov 2021 12:27:43 +0100 Subject: [PATCH 1/2] chore: update XML/YAML for 3.0 format --- core/content-negotiation.md | 44 ++++----- core/controllers.md | 122 ++++++++++++------------- core/default-order.md | 21 ++--- core/deprecations.md | 10 +- core/dto.md | 47 ++++------ core/extending-jsonld-context.md | 28 +++--- core/filters.md | 76 ++++++++-------- core/getting-started.md | 18 ++-- core/identifiers.md | 12 +-- core/messenger.md | 7 +- core/openapi.md | 127 +++++++++++++++----------- core/operations.md | 152 +++++++++++++------------------ core/security.md | 70 ++++++-------- core/serialization.md | 80 ++++++++-------- core/url-generation-strategy.md | 13 +-- extra/troubleshooting.md | 2 +- 16 files changed, 387 insertions(+), 442 deletions(-) diff --git a/core/content-negotiation.md b/core/content-negotiation.md index d48b5932b83..cea71698269 100644 --- a/core/content-negotiation.md +++ b/core/content-negotiation.md @@ -146,37 +146,33 @@ class Book ```yaml resources: App\Entity\Book: - attributes: - formats: - 0: 'jsonld' # format already defined in the config - csv: 'text/csv' - itemOperations: - get: + formats: + 0: 'jsonld' # format already defined in the config + csv: 'text/csv' + operations: + ApiPlatform\Metadata\Get: formats: json: ['application/merge-patch+json'] # works also with "application/merge-patch+json" ``` ```xml - + xsi:schemaLocation="https://api-platform.com/schema/metadata/resources + https://api-platform.com/schema/metadata/resources.xsd"> - - jsonld - text/csv - - - - - - - application/merge-patch+json - - - - - + + jsonld + text/csv + + + + + + application/merge-patch+json + + + ``` diff --git a/core/controllers.md b/core/controllers.md index b6668ad6719..42d8ce286db 100644 --- a/core/controllers.md +++ b/core/controllers.md @@ -112,11 +112,12 @@ class Book ```yaml # api/config/api_platform/resources.yaml App\Entity\Book: - itemOperations: - get: ~ + operations: + ApiPlatform\Metadata\Get: ~ post_publication: + class: ApiPlatform\Metadata\Post method: POST - path: /books/{id}/publication + uriTemplate: /books/{id}/publication controller: App\Controller\CreateBookPublication ``` @@ -125,19 +126,16 @@ App\Entity\Book: + xsi:schemaLocation="https://api-platform.com/schema/metadata/resources + https://api-platform.com/schema/metadata/resources.xsd"> - - - - POST - /books/{id}/publication - App\Controller\CreateBookPublication - - + + + + ``` @@ -186,13 +184,13 @@ class Book ```yaml # api/config/api_platform/resources.yaml App\Entity\Book: - itemOperations: - get: ~ + operations: + ApiPlatform\Metadata\Get: ~ post_publication: - method: POST - path: /books/{id}/publication + class: ApiPlatform\Metadata\Get + uriTemplate: /books/{id}/publication controller: App\Controller\CreateBookPublication - normalization_context: + normalizationContext: groups: ['publication'] ``` @@ -200,24 +198,22 @@ App\Entity\Book: - + xsi:schemaLocation="https://api-platform.com/schema/metadata/resources + https://api-platform.com/schema/metadata/resources.xsd"> - - - - POST - /books/{id}/publication - App\Controller\CreateBookPublication - - - publication - - - - + + + + + + publication + + + + ``` @@ -258,11 +254,11 @@ class Book ```yaml # api/config/api_platform/resources.yaml App\Entity\Book: - itemOperations: - get: ~ + operations: + ApiPlatform\Metadata\Get: ~ post_publication: - method: POST - path: /books/{id}/publication + class: ApiPlatform\Metadata\Post + uriTemplate: /books/{id}/publication controller: App\Controller\CreateBookPublication read: false ``` @@ -271,20 +267,16 @@ App\Entity\Book: - + xsi:schemaLocation="https://api-platform.com/schema/metadata/resources + https://api-platform.com/schema/metadata/resources.xsd"> - - - - POST - /books/{id}/publication - App\Controller\CreateBookPublication - false - - + + + + ``` @@ -333,29 +325,29 @@ class Book ```yaml # api/config/api_platform/resources.yaml App\Entity\Book: - itemOperations: - get: ~ + operations: + ApiPlatform\Metadata\Get: ~ post_publication: - route_name: book_post_publication - book_post_discontinuation: ~ + class: ApiPlatform\Metadata\Post + routeName: book_post_publication + book_post_discontinuation: + class: ApiPlatform\Metadata\Post ``` ```xml - + xsi:schemaLocation="https://api-platform.com/schema/metadata/resources + https://api-platform.com/schema/metadata/resources.xsd"> - - - - book_post_publication - - - + + + + + ``` diff --git a/core/default-order.md b/core/default-order.md index bd60389df19..71b41adfb69 100644 --- a/core/default-order.md +++ b/core/default-order.md @@ -31,9 +31,8 @@ class Book ```yaml # api/config/api_platform/resources/Book.yaml App\Entity\Book: - attributes: - order: - foo: ASC + order: + foo: ASC ``` [/codeSelector] @@ -72,8 +71,7 @@ class Book ```yaml # api/config/api_platform/resources/Book.yaml App\Entity\Book: - attributes: - order: ['foo', 'bar'] + order: ['foo', 'bar'] ``` [/codeSelector] @@ -106,8 +104,7 @@ class Book ```yaml # api/config/api_platform/resources/Book.yaml App\Entity\Book: - attributes: - order: ['author.username'] + order: ['author.username'] ``` [/codeSelector] @@ -144,15 +141,15 @@ class Book ```yaml # api/config/api_platform/resources/Book.yaml App\Entity\Book: - get: ~ + ApiPlatform\Metadata\GetCollection: ~ get_desc_custom: - method: get - path: custom_collection_desc_foos + class: ApiPlatform\Metadata\GetCollection + uriTemplate: custom_collection_desc_foos order: name: DESC get_asc_custom: - method: get - path: custom_collection_asc_foos + class: ApiPlatform\Metadata\GetCollection + uriTemplate: custom_collection_asc_foos order: name: ASC ``` diff --git a/core/deprecations.md b/core/deprecations.md index 6dd560cf8d5..c16d2f55f6e 100644 --- a/core/deprecations.md +++ b/core/deprecations.md @@ -91,14 +91,12 @@ class Review ```yaml # api/config/api_platform/resources/Review.yaml -resources: +properties: # ... App\Entity\Review: - properties: - # ... - letter: - attributes: - deprecation_reason: 'Use the rating property instead' + # ... + letter: + deprecationReason: 'Use the rating property instead' ``` [/codeSelector] diff --git a/core/dto.md b/core/dto.md index 2247e2b86dd..3e55ec8a53c 100644 --- a/core/dto.md +++ b/core/dto.md @@ -31,23 +31,19 @@ final class Book # api/config/api_platform/resources.yaml resources: App\Entity\Book: - attributes: - input: App\Dto\BookInput - output: App\Dto\BookOutput + input: App\Dto\BookInput + output: App\Dto\BookOutput ``` ```xml - - - App\Dto\BookInput - App\Dto\BookOutput - + xsi:schemaLocation="https://api-platform.com/schema/metadata/resources + https://api-platform.com/schema/metadata/resources.xsd"> + ``` @@ -382,14 +378,13 @@ final class Book # api/config/api_platform/resources.yaml resources: App\Entity\Book: - collectionOperations: + operations: create: - method: POST + ApiPlatform\Metadata\Post input: App\Dto\CreateBook output: App\Dto\BookOutput - itemOperations: update: - method: PUT + ApiPlatform\Metadata\Put input: App\Dto\UpdateBook output: App\Dto\BookOutput ``` @@ -398,25 +393,15 @@ resources: - + xsi:schemaLocation="https://api-platform.com/schema/metadata/resources + https://api-platform.com/schema/metadata/resources.xsd"> - - - POST - App\Dto\CreateBook - App\Dto\BookOutput - - - - - PUT - App\Dto\UpdateBook - App\Dto\BookOutput - - + + + + ``` diff --git a/core/extending-jsonld-context.md b/core/extending-jsonld-context.md index 74721bb15ce..b23dd6001e8 100644 --- a/core/extending-jsonld-context.md +++ b/core/extending-jsonld-context.md @@ -88,27 +88,29 @@ class Book ```yaml # api/config/api_platform/resources.yaml App\Entity\Book: - itemOperations: - get: - hydra_context: { foo: 'bar' } + operations: + ApiPlatform\Metadata\Get: + hydraContext: { foo: 'bar' } ``` ```xml - + xsi:schemaLocation="https://api-platform.com/schema/metadata/resources + https://api-platform.com/schema/metadata/resources.xsd"> - - - - bar - - - + + + + + bar + + + + ``` diff --git a/core/filters.md b/core/filters.md index fa1568630c7..22569d7d1ea 100644 --- a/core/filters.md +++ b/core/filters.md @@ -61,8 +61,8 @@ to a Resource in two ways: ```yaml # api/config/api_platform/resources.yaml App\Entity\Offer: - collectionOperations: - get: + operations: + ApiPlatform\Metadata\GetCollection: filters: ['offer.date_filter'] # ... ``` @@ -71,19 +71,19 @@ to a Resource in two ways: - + xsi:schemaLocation="https://api-platform.com/schema/metadata/resources + https://api-platform.com/schema/metadata/resources.xsd"> - - - - offer.date_filter - - + + + + offer.date_filter + + - + ``` @@ -178,8 +178,8 @@ services: # config/api/Offer.yaml App\Entity\Offer: # ... - collectionOperations: - get: + operations: + ApiPlatform\Metadata\GetCollection: filters: ['offer.search_filter'] ``` @@ -227,8 +227,8 @@ services: # config/api/Offer.yaml App\Entity\Offer: # ... - collectionOperations: - get: + operations: + ApiPlatform\Metadata\GetCollection: filters: ['offer.search_filter'] ``` @@ -287,8 +287,8 @@ services: # config/api/Offer.yaml App\Entity\Offer: # ... - collectionOperations: - get: + operations: + ApiPlatform\Metadata\GetCollection: filters: ['offer.date_filter'] ``` @@ -348,8 +348,8 @@ services: # config/api/Offer.yaml App\Entity\Offer: # ... - collectionOperations: - get: + operations: + ApiPlatform\Metadata\GetCollection: filters: ['offer.date_filter'] ``` @@ -398,8 +398,8 @@ services: # config/api/Offer.yaml App\Entity\Offer: # ... - collectionOperations: - get: + operations: + ApiPlatform\Metadata\GetCollection: filters: ['offer.boolean_filter'] ``` @@ -452,8 +452,8 @@ services: # config/api/Offer.yaml App\Entity\Offer: # ... - collectionOperations: - get: + operations: + ApiPlatform\Metadata\GetCollection: filters: ['offer.numeric_filter'] ``` @@ -506,8 +506,8 @@ services: # config/api/Offer.yaml App\Entity\Offer: # ... - collectionOperations: - get: + operations: + ApiPlatform\Metadata\GetCollection: filters: ['offer.range_filter'] ``` @@ -565,8 +565,8 @@ services: # config/api/Offer.yaml App\Entity\Offer: # ... - collectionOperations: - get: + operations: + ApiPlatform\Metadata\GetCollection: filters: ['offer.exists_filter'] ``` @@ -633,8 +633,8 @@ services: # config/api/Offer.yaml App\Entity\Offer: # ... - collectionOperations: - get: + operations: + ApiPlatform\Metadata\GetCollection: filters: ['offer.order_filter'] ``` @@ -681,8 +681,8 @@ services: # config/api/Offer.yaml App\Entity\Offer: # ... - collectionOperations: - get: + operations: + ApiPlatform\Metadata\GetCollection: filters: ['offer.order_filter'] ``` @@ -738,8 +738,8 @@ services: # config/api/Offer.yaml App\Entity\Offer: # ... - collectionOperations: - get: + operations: + ApiPlatform\Metadata\GetCollection: filters: ['offer.order_filter'] ``` @@ -817,8 +817,8 @@ services: # config/api/Offer.yaml App\Entity\Offer: # ... - collectionOperations: - get: + operations: + ApiPlatform\Metadata\GetCollection: filters: ['offer.order_filter', 'offer.search_filter'] ``` @@ -868,8 +868,8 @@ services: # config/api/Offer.yaml App\Entity\Offer: # ... - collectionOperations: - get: + operations: + ApiPlatform\Metadata\GetCollection: filters: ['offer.order_filter'] ``` diff --git a/core/getting-started.md b/core/getting-started.md index d0964b7ee34..3e85f3ff7bf 100644 --- a/core/getting-started.md +++ b/core/getting-started.md @@ -189,26 +189,28 @@ resources: App\Entity\Offer: shortName: 'Offer' # optional description: 'An offer from my shop' # optional - iri: 'http://schema.org/Offer' # optional - attributes: # optional - pagination_items_per_page: 25 # optional + types: ['http://schema.org/Offer'] # optional + paginationItemsPerPage: 25 # optional ``` ```xml - + xsi:schemaLocation="https://api-platform.com/schema/metadata/resources + https://api-platform.com/schema/metadata/resources.xsd"> description="An offer from my shop" - iri="http://schema.org/Offer" - /> + > + + http://schema.org/Offer + + ``` diff --git a/core/identifiers.md b/core/identifiers.md index 71bf07171aa..3bbec3c82fa 100644 --- a/core/identifiers.md +++ b/core/identifiers.md @@ -35,18 +35,16 @@ final class Person ```yaml # api/config/api_platform/resources/Person.yaml -App\Entity\Person: - properties: +properties: + App\Entity\Person: code: identifier: true ``` ```xml - - - - - + + + ``` [/codeSelector] diff --git a/core/messenger.md b/core/messenger.md index f9e1588de90..3e358304528 100644 --- a/core/messenger.md +++ b/core/messenger.md @@ -51,13 +51,12 @@ final class Person # api/config/api_platform/resources.yaml resources: App\Entity\Person: - collectionOperations: - post: + operations: + ApiPlatform\Metadata\Post: status: 202 messenger: true output: false - itemOperations: - get: + ApiPlatform\Metadata\Get: status: 404 controller: ApiPlatform\Core\Action\NotFoundAction read: false diff --git a/core/openapi.md b/core/openapi.md index bac057b46b8..c83ae08c67c 100644 --- a/core/openapi.md +++ b/core/openapi.md @@ -185,28 +185,33 @@ resources: ```xml - - - - - type - - one - two - - one - - - - - string - date-time - - - - + xsi:schemaLocation="https://api-platform.com/schema/metadata/properties + https://api-platform.com/schema/metadata/properties.xsd"> + + + + type + + + one + two + + + one + + + + + + + string + date-time + + + + ``` [/codeSelector] @@ -342,12 +347,12 @@ class Rabbit ```yaml resources: App\Entity\Rabbit: - collectionOperations: + operations: create_rabbit: - method: post + class: ApiPlatform\Metadata\Post path: '/rabbit/create' controller: App\Controller\RandomRabbit - openapi_context: + openapiContext: summary: Random rabbit picture description: > # Pop a great rabbit picture by color! @@ -370,39 +375,51 @@ resources: ```xml - + xsi:schemaLocation="https://api-platform.com/schema/metadata/resources + https://api-platform.com/schema/metadata/resources.xsd"> - - - /rabbit/create - post - App\Controller\RandomRabbit - - Create a rabbit picture - # Pop a great rabbit picture by color!! - -![A great rabbit](https://rabbit.org/graphics/fun/netbunnies/jellybean1-brennan1.jpg) - - - - object - - - string - - - string - - - - - - - - + + + + + Create a rabbit picture + # Pop a great rabbit picture by color!! + + ![A great rabbit](https://rabbit.org/graphics/fun/netbunnies/jellybean1-brennan1.jpg) + + + + + + + object + + + + + string + + + + + string + + + + + + + + + + + + + + ``` diff --git a/core/operations.md b/core/operations.md index f31180d548d..6dd3b9bc5f8 100644 --- a/core/operations.md +++ b/core/operations.md @@ -91,27 +91,24 @@ class Book ```yaml # api/config/api_platform/resources.yaml App\Entity\Book: - collectionOperations: - get: ~ # nothing more to add if we want to keep the default controller - itemOperations: - get: ~ + operations: + ApiPlatform\Metadata\GetCollection: ~ # nothing more to add if we want to keep the default controller + ApiPlatform\Metadata\Get: ~ ``` ```xml - + xsi:schemaLocation="https://api-platform.com/schema/metadata/resources + https://api-platform.com/schema/metadata/resources.xsd"> - - - - - - + + + + ``` @@ -143,11 +140,10 @@ class Book ```yaml # api/config/api_platform/resources.yaml App\Entity\Book: - collectionOperations: - get: + operations: + ApiPlatform\Metadata\GetCollection: method: GET - itemOperations: - get: + ApiPlatform\Metadata\Get: method: GET ``` @@ -155,19 +151,15 @@ App\Entity\Book: - + xsi:schemaLocation="https://api-platform.com/schema/metadata/resources + https://api-platform.com/schema/metadata/resources.xsd"> - - - - - - GET - - + + + + ``` @@ -207,10 +199,9 @@ class Book ```yaml # api/config/api_platform/resources.yaml App\Entity\Book: - collectionOperations: - get: ~ - itemOperations: - get: + operations: + ApiPlatform\Metadata\GetCollection: ~ + ApiPlatform\Metadata\Get: controller: ApiPlatform\Core\Action\NotFoundAction read: false output: false @@ -220,21 +211,16 @@ App\Entity\Book: - + xsi:schemaLocation="https://api-platform.com/schema/metadata/resources + https://api-platform.com/schema/metadata/resources.xsd"> - - - - - - ApiPlatform\Core\Action\NotFoundAction - false - false - - + + + + ``` @@ -281,14 +267,12 @@ class Book ```yaml # api/config/api_platform/resources.yaml App\Entity\Book: - collectionOperations: - post: - path: '/grimoire' + operations: + ApiPlatform\Metadata\Post: + uriTemplate: '/grimoire' status: 301 - itemOperations: - get: - method: 'GET' - path: '/grimoire/{id}' + ApiPlatform\Metadata\Get: + uriTemplate: '/grimoire/{id}' requirements: id: '\d+' defaults: @@ -303,35 +287,32 @@ App\Entity\Book: - + xsi:schemaLocation="https://api-platform.com/schema/metadata/resources + https://api-platform.com/schema/metadata/resources.xsd"> - - - /grimoire - 301 - - - - - /grimoire/{id} - - \d+ - - - brown - - {subdomain}.api-platform.com - - https - - - brown - - - + + + + + \d+ + + + + brown + + + + https + + + + brown + + + + ``` @@ -365,21 +346,18 @@ class Book ```yaml # api/config/api_platform/resources.yaml App\Entity\Book: - attributes: - route_prefix: /library + routePrefix: /library ``` ```xml - - - /library - + xsi:schemaLocation="https://api-platform.com/schema/metadata/resources + https://api-platform.com/schema/metadata/resources.xsd"> + ``` diff --git a/core/security.md b/core/security.md index c0bf636a4dc..8fe9e80d86e 100644 --- a/core/security.md +++ b/core/security.md @@ -64,15 +64,13 @@ class Book ```yaml # api/config/api_platform/resources.yaml App\Entity\Book: - attributes: - security: 'is_granted("ROLE_USER")' - collectionOperations: - get: ~ - post: + security: 'is_granted("ROLE_USER")' + operations: + ApiPlatform\Metadata\GetCollection: ~ + ApiPlatform\Metadata\Post: security: 'is_granted("ROLE_ADMIN")' - itemOperations: - get: ~ - put: + ApiPlatform\Metadata\Get: ~ + ApiPlatform\Metadata\Put: security: 'is_granted("ROLE_ADMIN") or object.owner == user' ``` @@ -103,11 +101,10 @@ class Book ```yaml # api/config/api_platform/resources/Book.yaml -App\Entity\Book: - properties: +properties: + App\Entity\Book: adminOnlyProperty: - attributes: - security: 'is_granted("ROLE_ADMIN")' + security: 'is_granted("ROLE_ADMIN")' ``` [/codeSelector] @@ -158,10 +155,10 @@ class Book ```yaml # api/config/api_platform/resources.yaml App\Entity\Book: - itemOperations: - get: ~ - put: - security_post_denormalize: "is_granted('ROLE_ADMIN') or (object.owner == user and previous_object.owner == user)" + operations: + ApiPlatform\Metadata\Get: ~ + ApiPlatform\Metadata\GetCollectionPut: + securityPostDenormalize: "is_granted('ROLE_ADMIN') or (object.owner == user and previous_object.owner == user)" # ... ``` @@ -213,18 +210,16 @@ class Book ```yaml # api/config/api_platform/resources/Book.yaml App\Entity\Book: - attributes: - security: 'is_granted("ROLE_USER")' - collectionOperations: - get: ~ - post: - security_post_denormalize: 'is_granted("BOOK_CREATE", object)' - itemOperations: - get: + security: 'is_granted("ROLE_USER")' + operations: + ApiPlatform\Metadata\GetCollection: ~ + ApiPlatform\Metadata\Post: + securityPostDenormalize: 'is_granted("BOOK_CREATE", object)' + ApiPlatform\Metadata\Get: security: 'is_granted("BOOK_READ", object)' - put: + ApiPlatform\Metadata\Put: security: 'is_granted("BOOK_EDIT", object)' - delete: + ApiPlatform\Metadata\Delete: security: 'is_granted("BOOK_DELETE", object)' ``` @@ -332,22 +327,17 @@ class Book ```yaml # api/config/api_platform/resources.yaml App\Entity\Book: - attributes: - security: 'is_granted("ROLE_USER")' - collectionOperations: - post: - method: 'POST' + security: 'is_granted("ROLE_USER")' + operations: + ApiPlatform\Metadata\Post: security: 'is_granted("ROLE_ADMIN")' - security_message: 'Only admins can add books.' - itemOperations: - get: - method: 'GET' + securityMessage: 'Only admins can add books.' + ApiPlatform\Metadata\Get: security: 'is_granted("ROLE_USER") and object.owner == user' - security_message: 'Sorry, but you are not the book owner.' - put: - method: 'PUT' - security_post_denormalize: "is_granted('ROLE_ADMIN') or (object.owner == user and previous_object.owner == user)" - security_post_denormalize_message: 'Sorry, but you are not the actual book owner.' + securityMessage: 'Sorry, but you are not the book owner.' + ApiPlatform\Metadata\Put: + securityPostDenormalize: "is_granted('ROLE_ADMIN') or (object.owner == user and previous_object.owner == user)" + securityPostDenormalizeMessage: 'Sorry, but you are not the actual book owner.' # ... ``` diff --git a/core/serialization.md b/core/serialization.md index db629d56341..e8b06d2359b 100644 --- a/core/serialization.md +++ b/core/serialization.md @@ -104,11 +104,10 @@ class Book # api/config/api_platform/resources.yaml resources: App\Entity\Book: - attributes: - normalization_context: - groups: ['read'] - denormalization_context: - groups: ['write'] + normalizationContext: + groups: ['read'] + denormalizationContext: + groups: ['write'] # api/config/serialization/Book.yaml App\Entity\Book: @@ -175,13 +174,12 @@ class Book ```yaml # api/config/api_platform/resources/Book.yaml App\Entity\Book: - attributes: - normalization_context: - groups: ['get'] - itemOperations: - get: ~ - put: - normalization_context: + normalizationContext: + groups: ['get'] + operations: + ApiPlatform\Metadata\Get: ~ + ApiPlatform\Metadata\Put: + normalizationContext: groups: ['put'] # api/config/serializer/Book.yaml @@ -255,9 +253,8 @@ class Book ```yaml # api/config/api_platform/resources/Book.yaml App\Entity\Book: - attributes: - normalization_context: - groups: ['book'] + normalizationContext: + groups: ['book'] # api/config/serializer/Book.yaml App\Entity\Book: @@ -346,9 +343,8 @@ class Book ```yaml # api/config/api_platform/resources/Book.yaml App\Entity\Book: - attributes: - denormalization_context: - groups: ['book'] + denormalizationContext: + groups: ['book'] ``` [/codeSelector] @@ -397,11 +393,10 @@ class Person ```yaml # api/config/api_platform/resources/Person.yaml App\Entity\Person: - attributes: - normalization_context: - groups: ['person'] - denormalization_context: - groups: ['person'] + normalizationContext: + groups: ['person'] + denormalizationContext: + groups: ['person'] # api/config/serializer/Person.yaml App\Entity\Person: @@ -452,13 +447,14 @@ class Person ```yaml # api/config/api_platform/resources/Person.yaml -App\Entity\Person: - attributes: - normalization_context: - groups: ['person'] - denormalization_context: - groups: ['person'] - properties: +resources: + App\Entity\Person: + normalizationContext: + groups: ['person'] + denormalizationContext: + groups: ['person'] +properties: + App\Entity\Person: parent: readableLink: false writableLink: false @@ -683,9 +679,9 @@ class Greeting ```yaml # api/config/api_platform/resources/Greeting.yaml App\Entity\Greeting: - collectionOperations: - get: - normalization_context: + operations: + ApiPlatform\Metadata\GetCollection: + normalizationContext: groups: 'greeting:collection:get' # api/config/serializer/Greeting.yaml @@ -748,11 +744,10 @@ class Book ```yaml # api/config/api_platform/resources/Book.yaml App\Entity\Book: - attributes: - normalization_context: - groups: ['book:output'] - denormalization_context: - groups: ['book:input'] + normalizationContext: + groups: ['book:output'] + denormalizationContext: + groups: ['book:input'] # api/config/serializer/Book.yaml App\Entity\Book: @@ -1050,8 +1045,8 @@ You can also use the YAML configuration format: ```yaml # api/config/api_platform/resources.yaml -App\Entity\Book: - properties: +properties: + App\Entity\Book: id: identifier: true ``` @@ -1102,9 +1097,8 @@ class Book ```yaml # api/config/api_platform/resources/Book.yaml App\Entity\Book: - attributes: - normalization_context: - jsonld_embed_context: true + normalizationContext: + jsonldEmbedContext: true ``` [/codeSelector] diff --git a/core/url-generation-strategy.md b/core/url-generation-strategy.md index 09d411549ff..7ca88bf010e 100644 --- a/core/url-generation-strategy.md +++ b/core/url-generation-strategy.md @@ -52,8 +52,7 @@ class Book ```yaml # api/config/api_platform/resources.yaml App\Entity\Book: - attributes: - url_generation_strategy: !php/const ApiPlatform\Core\Api\UrlGeneratorInterface::ABS_URL + urlGenerationStrategy: !php/const ApiPlatform\Core\Api\UrlGeneratorInterface::ABS_URL ``` ```xml @@ -61,13 +60,11 @@ App\Entity\Book: - - ApiPlatform\Core\Api\UrlGeneratorInterface::ABS_URL - + xsi:schemaLocation="https://api-platform.com/schema/metadata/resources + https://api-platform.com/schema/metadata/resources.xsd"> + ``` diff --git a/extra/troubleshooting.md b/extra/troubleshooting.md index 575dffee4ae..49c094e5882 100644 --- a/extra/troubleshooting.md +++ b/extra/troubleshooting.md @@ -37,7 +37,7 @@ In v1 of JMSSerializerBundle, the `serializer` alias is registered for the JMS S ```yaml # api/config/packages/jms_serializer.yaml jms_serializer: -    enable_short_alias: false + enable_short_alias: false ``` The JMS Serializer service is available as `jms_serializer`. From 589e1aca47037b4452f6f14a432cd68bf9f2a45e Mon Sep 17 00:00:00 2001 From: Vincent Chalamon Date: Wed, 29 Dec 2021 14:44:00 +0100 Subject: [PATCH 2/2] Downgrade github/super-linter to v3.17.0 --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 116c42780d8..369f3a4c0a8 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -16,12 +16,12 @@ jobs: fetch-depth: 0 - name: Lint - uses: github/super-linter@v3 + uses: github/super-linter@v3.17.0 env: VALIDATE_ALL_CODEBASE: false VALIDATE_EDITORCONFIG: false VALIDATE_JSCPD: false - DEFAULT_BRANCH: 2.6 + DEFAULT_BRANCH: main GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - uses: actions/cache@v2