Comments (9)
Note: This only happens when id
is included in the POST, not when it is being created automatically from the title.
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.
from plone.restapi.
@davisagli In general, no id should be provided at all. Generating an id is the job of the backend.
By now I do not see another solution, than explicitly providing an id to solve issue plone/volto#4486
from plone.restapi.
In the long run I think a better solution for that issue would be to give frontend routes a path like /:register
that cannot collide with content ids. It's a complicated topic. Some names are reserved because they have a special use on the frontend and some are reserved because they have a special use on the backend.
from plone.restapi.
My own opinion: I think it is best by default for the API to throw an error if the client specifies an id
and it is not available exactly as specified. Then the situation is clear. But, I would support adding an option (header or querystring) to tell the API to normalize the id and choose a different one if needed, instead of throwing an error. Then the client has a way to opt in to that if it doesn't care about getting a precise id.
from plone.restapi.
Great input.
Me personnally, for the moment, would opt for your suggestion to prevent name clashes at all by
"give frontend routes a path like /:register that cannot collide with content ids."
from plone.restapi.
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...
from plone.restapi.
In the long run I think a better solution for that issue would be to give frontend routes a path like
/:register
that cannot collide with content ids. It's a complicated topic. Some names are reserved because they have a special use on the frontend and some are reserved because they have a special use on the backend.
This is great idea but it has some limitations -
For route like - /:register
, we consider register
as path param.
example -
'/controlpanel/rules/:id/configure'
in this path id
is parameter.
from plone.restapi.
No, I don't mean a variable parameter, I mean the literal string /:register
from plone.restapi.
Another suggestion for this is,
we can add extra property in POST request, that will decide the behavior of id creation ( object creation ).
It can have two values (of course names can be changed) -
"GEN_ID_FORCEFULLY"
"GEN_ID_SIMPLE"
second value will be default value.
first one will be sent when the generated id will be in routes that clashes with default paths in volto application.
For example - register
This value will tell backend that it should consider that id
generated by default is duplicate, and generate it again.
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.
from plone.restapi.
Related Issues (20)
- Undeprecate comma separated expansion parameters HOT 8
- Undeprecate token parameter from vocabularies endpoint HOT 9
- Code that seems to do nothing HOT 2
- Drop Python 3.7 support HOT 1
- jwt_auth PAS plugin is active without being installed HOT 9
- Global Site tabs should also be customizable with customize_entry HOT 5
- navigation_base_url is not also used here HOT 2
- json_body should not read entire request BODY HOT 5
- debug-exceptions = on in instance part in buildout causes requests that return BadRequest to be returned as html instead of json
- KeyError: 'portal' in tests with Python 3.12.1 HOT 10
- Translate validation error messages
- IBlocks SearchableText indexer bypasses plone.textindexer behavior HOT 2
- relatedItems field returns None in the serializer if the related item is deleted HOT 1
- Site Administrator cannot add user to group
- Add remote_url(getRemoteUrl) to link content-types in navigation HOT 4
- Include release notes in Plone 6 Documentation
- Authentication error messages from PAS Plugins aren't returned by the restapi HOT 1
- restapi double parameter is broking code. HOT 8
- In content that uses the plone.blocks behavior, it is not possible to add fields to SearchableText with "plone.app.dexterity.textindexer" HOT 6
- Community Forum App Icon Not Filling Correctly. HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from plone.restapi.