-
-
Notifications
You must be signed in to change notification settings - Fork 848
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
Identifier should be optional when using only a POST operation #4037
Comments
Here you described why identifier is needed. Could you please explain why it was decided to allow resources without identifiers again, to understand the whole picture? Probably, it will answer the question where we should use custom controllers and where we should use api-platform resources with no identifiers. During upgrading from 2.5 to 2.6, we had to replace all DTOs marked with |
@maks-rafalko I discussed this privately with @soyuka and I think that it's a regression. The POST verb explicitly allows this kind of RPC-like operations, and so API Platform should too. Also, it's a BC break (I'm very sorry for the inconvenience) that I noticed lately. It breaks some of our internal projects too. We refrain from introducing BC breaks in minor versions (we patched most of them on 2.6.2). |
@dunglas I am really interested in the discussion and the arguments of you and @soyuka. Maybe you can publish them? In the HTTP-RFC it says among other things.
which sounds plausible to me. Not always a created resource can or must be represented by a URI (or IRI). E.g. if the developer or the use case does not want that. I'm really not deep in the philosphy of REST (https://www.ics.uci.edu/~fielding/pubs/dissertation/rest_arch_style.htm), but I would say in summary myself that the request always has the full state, so the server can process the request stateless. In the example of a message that is posted and created in the backend service, but not represented as URL/URI /GET, this may happen. Since the request represents the full state. I wonder if content is returned, this must contain an ID in any case? Or does REST only say, if you want to link to a resource, how this linking has to be done?! |
On one hand we say that a Resource MUST have a corresponding IRI (hence the disabling of operations must still have a GET /cars/1, even if its status is 404). This, to respect JSON-LD specification. I'd really suggest a new annotation like
Indeed, to me if it has a representation, it should have an identifier. The JSON-LD format is really good for that as it enforces the use of |
* Fix #4037 allow POST operations without identifiers * Better * remove line * Update features/main/overridden_operation.feature Co-authored-by: Alan Poulain <contact@alanpoulain.eu> * fix review * Fix mongodb Co-authored-by: Alan Poulain <contact@alanpoulain.eu>
Could anyone try the 2.6 branch see if it resolves the issue? |
It does for us @soyuka |
thanks! |
API Platform version(s) affected: 2.6.2
Description
POST should allow not having any identifiers #3975
The text was updated successfully, but these errors were encountered: