You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: core/deprecations.md
+46Lines changed: 46 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -95,3 +95,49 @@ class Review
95
95
* 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
96
96
* With Swagger / OpenAPI, [a `deprecated` property](https://swagger.io/docs/specification/2-0/paths-and-operations/) will be added
97
97
* With GraphQL, the [`isDeprecated` and `deprecationReason` properties](https://facebook.github.io/graphql/June2018/#sec-Deprecation) will be added to the schema
98
+
99
+
## Setting the `Sunset` HTTP Header to Indicate When a Resource or an Operation Will Be Removed
100
+
101
+
[The `Sunset` HTTP response header](https://tools.ietf.org/html/draft-wilde-sunset-header) indicates that a URI is likely to become unresponsive at a specified point in the future.
102
+
It is especially useful to indicate when a deprecated URL will not be available anymore.
103
+
104
+
Thanks to the `sunset` attribute, API Platform makes it easy to set this header for all URLs related to a resource class:
105
+
106
+
```php
107
+
<?php
108
+
// api/src/Entity/Parchment.php
109
+
110
+
/**
111
+
* @ApiResource(
112
+
* deprecationReason="Create a Book instead",
113
+
* sunset="01/01/2020"
114
+
* )
115
+
*/
116
+
class Parchment
117
+
{
118
+
// ...
119
+
}
120
+
```
121
+
122
+
The value of the `sunset` attribute can be any string compatible with [the `\DateTime` constructor](http://php.net/manual/en/datetime.construct.php).
123
+
It will be automatically converted to a valid HTTP date.
124
+
125
+
It's also possible to set the `Sunset` header only for a specific [operation](operations.md):
0 commit comments