File tree Expand file tree Collapse file tree 1 file changed +30
-0
lines changed
Expand file tree Collapse file tree 1 file changed +30
-0
lines changed Original file line number Diff line number Diff line change @@ -152,3 +152,33 @@ class Parchment
152152 // ...
153153}
154154` ` `
155+
156+ # # Path versioning
157+
158+ > [!NOTE]
159+ > REST and GraphQL architectures recommend to use deprecations instead of path versioning.
160+
161+ You can prefix your URI Templates and change the representation using serialization groups :
162+
163+ ` ` ` php
164+ <?php
165+ // api/src/Entity/Parchment.php
166+ namespace App\M odel;
167+
168+ use ApiPlatform\M etadata\G et;
169+ use Symfony\C omponent\S erializer\A ttrbute\G roups;
170+
171+ #[Get(uriTemplate: '/v1/books/{id}', normalizationContext: ['groups' => ['v1']])]
172+ #[Get(uriTemplate: '/v2/books/{id}', normalizationContext: ['groups' => ['v2']])]
173+ class Parchment
174+ {
175+ #[Groups(['v1'])]
176+ public $name;
177+
178+ #[Groups(['v2'])]
179+ public $title;
180+ }
181+ ` ` `
182+
183+ > [!NOTE]
184+ > It's also possible to use the configuration `route_prefix` to prefix all your operations.
You can’t perform that action at this time.
0 commit comments