-
-
Notifications
You must be signed in to change notification settings - Fork 878
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
No item route associated when itemOperations is set but empty #3501
Comments
Indeed the safe way to diable item operations is to do:
As documented at the end of this section. |
@soyuka thanks for your answer. |
you can remove it by swagger decorator https://api-platform.com/docs/core/swagger/#overriding-the-openapi-specification |
You can also manually set the IRI used by the normalization context, such that it won't try to generate one: App\Entity\Book:
itemOperations: {}
collectionOperations: { get: { normalization_context: { iri: "" } } } |
API Platform version(s) affected: 2.5.4
Description
When the
itemOperations
is empty, andcollectionOperations
is set, there is an error when fetching the collection like[GET] /api/books
How to reproduce
Create an entity with the api mapping
Possible Solution
in RouteNameResolver.php line 50, the value returned in the sprintf for
$operationType
should be collection, but its item instead.Then the route default value
_api_item_operation_name
does not exists so no route is not found.When I replace by
_api_collection_operation_name
it works.Occurences
itemOperations: []
tooThe text was updated successfully, but these errors were encountered: