api-platform-versioning
Installation
SKILL.md
Api Platform Versioning (Symfony)
Use when
- A field, operation, or resource is being renamed or removed and consumers need time to migrate.
- Announcing a removal date to clients with
SunsetandDeprecationheaders. - Deciding between deprecation and parallel
/v1and/v2surfaces. - A breaking representation change that deprecation and groups cannot express.
Default workflow
- Try deprecation first: set
deprecationReasonon the resource, the operation, or#[ApiProperty]. - Add
sunset:with a date, and on v4 addheaderscarryingDeprecation(RFC 9745) and aLinkwithrel="successor-version". - Before v4, emit those headers from a
KernelEvents::RESPONSElistener. - Only if still breaking, expose parallel
uriTemplatevalues (/v1,/v2) with distinct groups, or output DTOs with one provider per version. - Mark the old operation as deprecated in OpenAPI, document the changes per version, and test every active version.