Skip to content

Commit 2b25133

Browse files
committed
docs: fixes to Content Negotiation / Serialization
1 parent 74df760 commit 2b25133

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

core/content-negotiation.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
The API system has built-in [content negotiation](https://en.wikipedia.org/wiki/Content_negotiation) capabilities.
44

5-
By default, only the [JSON-LD](https://json-ld.org) format is enabled. However API Platform Core supports many more formats and can be extended.
5+
By default, only the [JSON-LD](https://json-ld.org) and JSON formats are enabled. However API Platform Core supports many more formats and can be extended.
66

77
The framework natively supports JSON-LD (and Hydra), GraphQL, JSON:API, HAL, YAML, CSV, HTML (API docs), raw JSON and raw XML.
88
Using the raw JSON or raw XML formats is discouraged, prefer using JSON-LD instead, which provides more feature and is as easy to use.
@@ -52,6 +52,7 @@ api_platform:
5252
yaml: ['application/x-yaml']
5353
csv: ['text/csv']
5454
html: ['text/html']
55+
myformat: ['application/vnd.myformat']
5556
```
5657
5758
To enable GraphQL support, [read the dedicated chapter](graphql.md).

core/serialization.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -694,7 +694,9 @@ services:
694694
Note: this normalizer will work only for JSON-LD format, if you want to process JSON data too, you have to decorate another service:
695695

696696
```yaml
697-
App\Serializer\ApiNormalizer:
697+
# Need a different name to avoid duplicate YAML key
698+
'App\Serializer\ApiNormalizer.json':
699+
class: 'App\Serializer\ApiNormalizer'
698700
decorates: 'api_platform.serializer.normalizer.item'
699701
```
700702

0 commit comments

Comments
 (0)