Custom subresource path doesn't work
See original GitHub issueAPI Platform version(s) affected: 2.5.6
Description
Following this documentation: https://api-platform.com/docs/core/subresources/#using-custom-paths
I try to override the path (and security, and requirements) of a subresource.
It works for the security, but not for path (and so requirements).
How to reproduce
https://github.com/bastoune/api-platform-issue-1581
Having this route with debug:router
:
api_organizations_users_get_subresource GET ANY ANY /v2/organizations/{id}/users.{_format}
and this annotation :
* subresourceOperations={
* "api_organizations_users_get_subresource"={
* "method"="GET",
* "path"="/BLABLABLA/organizations/{organization_id}/users",
* "requirements"={"organization_id": StringHelper::UUIDv4Regex},
* "security"="is_granted('readOrganization', organization_id)"
* }
* }
I can put this annotation in the User
or the Organization
entity, I have the same result.
The security works but not the rest.
If I remove the security, it doesn’t work anyway.
Issue Analytics
- State:
- Created 3 years ago
- Comments:6
Top Results From Across the Web
API Platform - Custom subresource path doesn't work
I try to override the path (and security, and requirements) of a subresource. It works for the security, but not for path (and...
Read more >PHP Symfony API Platform custom subresource ... - YouTube
In this video I'll be working with Symfony and the API Platform package ... PHP Symfony API Platform custom subresource path by overriding ......
Read more >Subresources - API Platform
A Subresource is another way of declaring a resource that usually involves a more complex URI. In API Platform you can declare as...
Read more >Subresources and Runtime Resource Resolution - The Java ...
A root resource can then implement subresources that can process the remainder of the URI path. A resource class method that is annotated...
Read more >4. Using Custom Resources - Programming Kubernetes [Book]
Pods have a number of subresources, such as /logs, /portforward, /exec, and /status. The corresponding subresource HTTP paths are: /api/v1/namespace/ namespace ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Try with “users_get_subresource” as operation name (instead of “api_organizations_users_get_subresource”). https://github.com/api-platform/docs/issues/1109
This PR was merge https://github.com/api-platform/docs/pull/370 but this commit revert the changes https://github.com/api-platform/docs/commit/b8304bc4a32ac16d6e71997a8b0682187caaa473
Thanks, I won’t use this feature since it seems not to be stable. Maybe the doc shall be changed ?