-
-
Notifications
You must be signed in to change notification settings - Fork 78
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
Choose valid id if id is provided for content creation #1613
Comments
Note: This only happens when I don't think we have consensus on whether it is better to throw an error or normalize the id if the client explicitly requested an id that is not available. It might depend on the use case. There's some related discussion in #1487. |
@davisagli In general, no id should be provided at all. Generating an id is the job of the backend. |
In the long run I think a better solution for that issue would be to give frontend routes a path like |
My own opinion: I think it is best by default for the API to throw an error if the client specifies an |
Great input. |
The problem with my suggestion is that it's not backwards-compatible. So that's why I said "in the long run". But it could happen for Volto 17, now, if the @plone/volto-team is okay with it. Not sure if I'm stirring up some longstanding bikeshed debate... |
This is great idea but it has some limitations - |
No, I don't mean a variable parameter, I mean the literal string |
Another suggestion for this is, It can have two values (of course names can be changed) -
second value will be default value. This value will tell backend that it should consider that This may be not so robust implementation for the use case, various factor can be taken into consideration. Please share your thought on the same. |
By now content creation, or concrete adding created content to its container, fails, if content with this id provided by the api call already exists in its container.
Steps to reprouce:
POST request to /mypage with id "foo", etc
Another POST request to /mypage with id "foo", etc
The reason, the use case, for this is:
In Volto you can create content, that gets an id that clashes with for example routes that only Volto knows, not the backend. Create a page with title "Register". You are redirected after creation to the register form.
So if in Volto the id is explicitly provided, like for example by appending "-1": "register-1", on REST api call, this would solve the problem, nearly. Do it twice, and it fails, cause plone.restapi does not apply INameChooser(container).chooseName for a call WITH id.
The text was updated successfully, but these errors were encountered: