Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions core/design.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# General Design Considerations

Since you only need to describe the structure of the data to expose, API Platform is both
[a "design-first" and "code-first"](https://swagger.io/blog/api-design/design-first-or-code-first-api-development/)
API framework. However, the "design-first" methodology is strongly recommended: first you design the
[a "design-first" and "code-first"](https://swagger.io/blog/code-first-vs-design-first-api/) API
framework. However, the "design-first" methodology is strongly recommended: first you design the
**public shape** of API endpoints.

To do so, you have to write a plain old PHP object (POPO) representing the input and output of your
Expand Down
38 changes: 19 additions & 19 deletions core/serialization.md
Original file line number Diff line number Diff line change
Expand Up @@ -308,22 +308,22 @@ class Book
# api/config/api_platform/resources/Book.yaml
App\ApiResource\Book:
normalizationContext:
groups: ['get']
groups: ["get"]
operations:
ApiPlatform\Metadata\Get: ~
ApiPlatform\Metadata\Get: ~
ApiPlatform\Metadata\Patch:
normalizationContext:
groups: ['patch']
groups: ["patch"]

# The YAML syntax is only supported for Symfony
# api/config/serializer/Book.yaml
App\ApiResource\Book:
attributes:
name:
groups: ['get', 'patch']
groups: ["get", "patch"]
author:
groups: ['get']
groups: ["get"]
```

```xml
Expand Down Expand Up @@ -452,16 +452,16 @@ class Book
# api/config/api_platform/resources/Book.yaml
App\ApiResource\Book:
normalizationContext:
groups: ['book']
groups: ["book"]

# The YAML syntax is only supported for Symfony
# api/config/serializer/Book.yaml
App\ApiResource\Book:
attributes:
name:
groups: ['book']
groups: ["book"]
author:
groups: ['book']
groups: ["book"]
```

</code-selector>
Expand Down Expand Up @@ -597,18 +597,18 @@ class Person
# api/config/api_platform/resources/Person.yaml
App\ApiResource\Person:
normalizationContext:
groups: ['person']
groups: ["person"]
denormalizationContext:
groups: ['person']
groups: ["person"]

# The YAML syntax is only supported for Symfony
# api/config/serializer/Person.yaml
App\ApiResource\Person:
attributes:
name:
groups: ['person']
groups: ["person"]
parent:
groups: ['person']
groups: ["person"]
```

</code-selector>
Expand Down Expand Up @@ -870,18 +870,18 @@ App\Entity\Greeting:
operations:
ApiPlatform\Metadata\GetCollection:
normalizationContext:
groups: 'greeting:collection:get'
groups: "greeting:collection:get"

# The YAML syntax is only supported for Symfony
# api/config/serializer/Greeting.yaml
App\Entity\Greeting:
attributes:
id:
groups: 'greeting:collection:get'
groups: "greeting:collection:get"
name:
groups: 'greeting:collection:get'
groups: "greeting:collection:get"
sum:
groups: 'greeting:collection:get'
groups: "greeting:collection:get"
```

</code-selector>
Expand Down Expand Up @@ -932,18 +932,18 @@ class Book
# api/config/api_platform/resources/Book.yaml
App\ApiResource\Book:
normalizationContext:
groups: ['book:output']
groups: ["book:output"]
denormalizationContext:
groups: ['book:input']
groups: ["book:input"]

# The YAML syntax is only supported for Symfony
# api/config/serializer/Book.yaml
App\ApiResource\Book:
attributes:
active:
groups: ['book:output', 'admin:input']
groups: ["book:output", "admin:input"]
name:
groups: ['book:output', 'book:input']
groups: ["book:output", "book:input"]
```

</code-selector>
Expand Down
6 changes: 3 additions & 3 deletions core/state-providers.md
Original file line number Diff line number Diff line change
Expand Up @@ -435,13 +435,13 @@ use the following snippet:
services:
# ...
App\State\BlogPostProvider:
tags: [ 'api_platform.state_provider' ]
tags: ["api_platform.state_provider"]

# api/config/services.yaml
services:
# ...
App\State\BookRepresentationProvider:
arguments:
$itemProvider: '@api_platform.doctrine.orm.state.item_provider'
tags: [ 'api_platform.state_provider' ]
$itemProvider: "@api_platform.doctrine.orm.state.item_provider"
tags: ["api_platform.state_provider"]
```
Loading