diff --git a/core/content-negotiation.md b/core/content-negotiation.md index e52c44b86ca..bbc11eb7549 100644 --- a/core/content-negotiation.md +++ b/core/content-negotiation.md @@ -196,6 +196,19 @@ api_platform: myformat: ['application/vnd.myformat'] ``` +You will also need to declare an encoder which supports the new format: + +```yaml +services: + app.api-platform.myformat.encoder: + class: ApiPlatform\Serializer\JsonEncoder + arguments: + $format: 'myformat' + # The following lines are only needed if autoconfigure is disabled + # tags: + # - { name: 'serializer.encoder' } +``` + API Platform will automatically call the serializer with your defined format name as `format` parameter during the deserialization process (`myformat` in the example). It will then return the result to the client with the requested MIME type using its built-in responder. For non-standard formats, [a vendor, vanity or unregistered MIME type should be used](https://en.wikipedia.org/wiki/Media_type#Vendor_tree). diff --git a/core/filters.md b/core/filters.md index 1887fb2ff10..f87f9e2da83 100644 --- a/core/filters.md +++ b/core/filters.md @@ -358,7 +358,7 @@ class SearchFilterParameter ``` ## Doctrine ORM and MongoDB ODM Filters -!> [!WARNING] +> [!WARNING] > Prefer using QueryParameter instead of ApiFilter for more flexibility, this is subject to change in the next major version. ### Basic Knowledge diff --git a/core/openapi.md b/core/openapi.md index 9371a21cff0..c9e961471dc 100644 --- a/core/openapi.md +++ b/core/openapi.md @@ -512,8 +512,11 @@ Manually register the Swagger UI controller: ```yaml # app/config/routes.yaml api_doc: - path: /api_documentation + path: /api_documentation.{_format} controller: api_platform.swagger_ui.action + methods: ['HEAD', 'GET'] + defaults: + _format: html ``` Change `/api_documentation` to the URI you wish Swagger UI to be accessible on. diff --git a/core/serialization.md b/core/serialization.md index fb3235fc5e6..37a0ffea3f0 100644 --- a/core/serialization.md +++ b/core/serialization.md @@ -8,7 +8,7 @@ API Platform embraces and extends the Symfony Serializer Component to transform The main serialization process has two stages: -![Serializer workflow](/docs/core/images/SerializerWorkflow.png) +![Serializer workflow](/images/SerializerWorkflow.png) > As you can see in the picture above, an array is used as a man-in-the-middle. This way, Encoders will only deal with turning specific formats into arrays and vice versa. The same way, Normalizers will deal with turning specific objects into arrays and vice versa. -- [The Symfony documentation](https://symfony.com/doc/current/components/serializer.html)