Skip to content

docs: add YAML notation for single property deprecation #1382

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 23, 2021
Merged
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
8 changes: 4 additions & 4 deletions core/default-order.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class Book
```

```yaml
# config/api/resources/Book.yaml
# api/config/api_platform/resources/Book.yaml
App\Entity\Book:
attributes:
order:
Expand Down Expand Up @@ -74,7 +74,7 @@ class Book
```

```yaml
# config/api/resources/Book.yaml
# api/config/api_platform/resources/Book.yaml
App\Entity\Book:
attributes:
order: ['foo', 'bar']
Expand Down Expand Up @@ -110,7 +110,7 @@ class Book
```

```yaml
# config/api/resources/Book.yaml
# api/config/api_platform/resources/Book.yaml
App\Entity\Book:
attributes:
order: ['author.username']
Expand Down Expand Up @@ -144,7 +144,7 @@ class Book
```

```yaml
# config/api/resources/Book.yaml
# api/config/api_platform/resources/Book.yaml
App\Entity\Book:
get: ~
get_desc_custom:
Expand Down
16 changes: 16 additions & 0 deletions core/deprecations.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@ class Parchment

It's also possible to deprecate a single property:

[codeSelector]

```php
<?php
// api/src/Entity/Review.php
Expand All @@ -98,6 +100,20 @@ class Review
}
```

```yaml
# api/config/api_platform/resources/Review.yaml
resources:
# ...
App\Entity\Review:
properties:
# ...
letter:
attributes:
deprecation_reason: 'Use the rating property instead'
```

[/codeSelector]

* With JSON-lD / Hydra, [an `owl:deprecated` annotation property](https://www.w3.org/TR/owl2-syntax/#Annotation_Properties) will be added to the appropriate data structure
* With Swagger / OpenAPI, [a `deprecated` property](https://swagger.io/docs/specification/2-0/paths-and-operations/) will be added
* With GraphQL, the [`isDeprecated` and `deprecationReason` properties](https://facebook.github.io/graphql/June2018/#sec-Deprecation) will be added to the schema
Expand Down
2 changes: 1 addition & 1 deletion core/identifiers.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ final class Person
```

```yaml
# config/api/resources/Person.yaml
# api/config/api_platform/resources/Person.yaml
App\Entity\Person:
properties:
code:
Expand Down
4 changes: 2 additions & 2 deletions core/security.md
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ class Book
```

```yaml
# config/api/resources/Book.yaml
# api/config/api_platform/resources/Book.yaml
App\Entity\Book:
properties:
adminOnlyProperty:
Expand Down Expand Up @@ -213,7 +213,7 @@ class Book
```

```yaml
# config/api/resources/Book.yaml
# api/config/api_platform/resources/Book.yaml
App\Entity\Book:
attributes:
security: 'is_granted("ROLE_USER")'
Expand Down
30 changes: 15 additions & 15 deletions core/serialization.md
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ class Book
```

```yaml
# config/api/resources/Book.yaml
# api/config/api_platform/resources/Book.yaml
App\Entity\Book:
attributes:
normalization_context:
Expand All @@ -210,7 +210,7 @@ App\Entity\Book:
normalization_context:
groups: ['put']

# config/serializer/Book.yaml
# api/config/serializer/Book.yaml
App\Entity\Book:
attributes:
name:
Expand Down Expand Up @@ -305,21 +305,21 @@ class Person
```

```yaml
# config/api/resources/Book.yaml
# api/config/api_platform/resources/Book.yaml
App\Entity\Book:
attributes:
normalization_context:
groups: ['book']

# config/serializer/Book.yaml
# api/config/serializer/Book.yaml
App\Entity\Book:
attributes:
name:
groups: ['book']
author:
groups: ['book']

# config/serializer/Person.yaml
# api/config/serializer/Person.yaml
App\Entity\Person:
attributes:
name:
Expand Down Expand Up @@ -373,7 +373,7 @@ class Book
```

```yaml
# config/api/resources/Book.yaml
# api/config/api_platform/resources/Book.yaml
App\Entity\Book:
attributes:
denormalization_context:
Expand Down Expand Up @@ -432,15 +432,15 @@ class Person
```

```yaml
# config/api/resources/Person.yaml
# api/config/api_platform/resources/Person.yaml
App\Entity\Person:
attributes:
normalization_context:
groups: ['person']
denormalization_context:
groups: ['person']

# config/serializer/Person.yaml
# api/config/serializer/Person.yaml
App\Entity\Person:
attributes:
name:
Expand Down Expand Up @@ -495,7 +495,7 @@ class Person
```

```yaml
# config/api/resources/Person.yaml
# api/config/api_platform/resources/Person.yaml
App\Entity\Person:
attributes:
normalization_context:
Expand All @@ -507,7 +507,7 @@ App\Entity\Person:
readableLink: false
writableLink: false

# config/serializer/Person.yaml
# api/config/serializer/Person.yaml
App\Entity\Person:
attributes:
name:
Expand Down Expand Up @@ -692,14 +692,14 @@ class Greeting
```

```yaml
# config/api/resources/Greeting.yaml
# api/config/api_platform/resources/Greeting.yaml
App\Entity\Greeting:
collectionOperations:
get:
normalization_context:
groups: 'greeting:collection:get'

# config/serializer/Greeting.yaml
# api/config/serializer/Greeting.yaml
App\Entity\Greeting:
attributes:
id:
Expand Down Expand Up @@ -760,15 +760,15 @@ class Book
```

```yaml
# config/api/resources/Book.yaml
# api/config/api_platform/resources/Book.yaml
App\Entity\Book:
attributes:
normalization_context:
groups: ['book:output']
denormalization_context:
groups: ['book:input']

# config/serializer/Book.yaml
# api/config/serializer/Book.yaml
App\Entity\Book:
attributes:
active:
Expand Down Expand Up @@ -1112,7 +1112,7 @@ class Book
```

```yaml
# config/api/resources/Book.yaml
# api/config/api_platform/resources/Book.yaml
App\Entity\Book:
attributes:
normalization_context:
Expand Down