-
-
Notifications
You must be signed in to change notification settings - Fork 79
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
Enhance the vocabularies serializer to accept a list of tokens #1295
Conversation
@sneridagh thanks for creating this Pull Request and help improve Plone! To ensure that these changes do not break other parts of Plone, the Plone test suite matrix needs to pass. Whenever you feel that the pull request is ready to be tested, either start all jenkins jobs pull requests by yourself, or simply add a comment in this pull request stating:
With this simple comment all the jobs will be started automatically. Happy hacking! |
May I suggest |
I test drive it, and it needs adjustments. Do not merge yet. @tiberiuichim Better not POST for caching, right? Also token and tokens, wouldn't it be far too similar and error prone? |
@jenkins-plone-org please run jobs |
We should make a decision regarding tokens vs token_list and add it to our naming convention: https://github.com/plone/plone.restapi/blob/master/docs/source/conventions.rst I will do some research... |
@jenkins-plone-org please run jobs |
@tisto @tiberiuichim ready. Used |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As far as I understand, we're not gonna be able to have tokens with commas in them, right? I don't know how common this use case is.
@tiberiuichim you have a point, ideally not... but who knows... could be a vector of bugs. The whole "let's decide how we encode lists in parameters" story is also important, I just used what we already have in there. |
Same topic, how to handle list parameters, in search endpoint. |
that list argument conversion is not correct. https://zope.readthedocs.io/en/latest/zdgbook/ObjectPublishing.html#argument-conversion.
It should be |
@ksuess in the search endpoint we are constrained by how Zope Querystring parser search parameters are encoded so the action is taking already care of passing Zope the right way (see the action code) in jsx, when you call the action, just pass a JS array in the action. |
hehe, @tiberiuichim was faster than me :) |
This PR raises a number of REST API design principles questions:
I started to dip my toe into urlencoding arrays and nested structures for the querysting-search endpoint (#1252 (comment)) and I have to admit it is just a horrible mess and there is no standard whatsoever as far as I can see. |
@tisto There's also the option of using Zope's argument parsing, with |
My 2 c., do what we are used to do! Either use:
Notes:
|
I agree with @ale-rt - and I tend to not reinvent the wheel and use Zope list query parameter syntax. |
just my 2c When I design REST API I always use a plural noun when the API client can provide mutliple values. It is more predictive for the user. |
@jenkins-plone-org please run jobs |
@ale-rt a good one! Thanks for weigh in! We already talked about it in today's Volto Team meeting and agreed to go this way. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am good with this PR. ToDo:
- Add the multiple params approach to API design best practices
- Add test and docs to show that you can pass a single param with "tokens" as well
- Deprecate "token" for the future
- Refactor usage of other approaches (e.g. "," in expendables) to support the new "standard", deprecate the old way for the next major release
Given that you are into json you might also be interested in making this happen: zopefoundation/Zope#957 |
…kforp6 * origin/master: (140 commits) Back to development: 8.18.2 Preparing release 8.18.1 Add deprecation msg in docs for tiles endpoint (#1234) Mark 1307 as internal Add internal towncrier classifier Be permissive when testing the schema of the querystring endpoint (#1306) Back to development: 8.18.1 Preparing release 8.18.0 test(leak): Fix unclosed socket leaks test(deprecation): Fix some warnings from our code Expandable params as list and deprecations for list as comma separated (#1301) Improve vocabulary endpoint when asking for a list of tokens adding resilience and deprecation warning (#1299) Do not break if publish recursive folder children that are already published (#1291) Back to development: 8.17.1 Preparing release 8.17.0 Enhance the vocabularies serializer to accept a list of tokens (#1295) Fix typo. Refactor text extraction Add a line break between blocks Move logic of _extract_text function inside the DraftJS indexer ...
We will need this next week.