problem with jsonification of dexterity validation errors
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 109
- Forks
- 107
- Avg merge
- 2d 3h
- Merged PRs (30d)
- 4
Description
in plone.rest we serialize exceptions with a string cast
https://github.com/plone/plone.rest/blob/master/src/plone/rest/errors.py#L37
in plone.restapi, we raise BadRequest with a list of dictionaries as a parameter when we have dexterity fields validation error.
https://github.com/plone/plone.restapi/blob/master/src/plone/restapi/deserializer/dxcontent.py#L114
this results in wrong json (with single quotes, unicode prefixes (u''), classes...)
i'm not sure how to fix this
- we could improve exception message rendering in plone.rest
- we could json.dump the dictionary list in dxcontent code. this is not very clean (two level of jsonification) but would not result in any breaking change
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reading src/plone/rest/errors.py around line 37 and src/plone/restapi/deserializer/dxcontent.py around line 114, then reproduce a Dexterity validation error through the REST API. Compare the current response with valid JSON and determine which serialization boundary should own the fix; done means validation errors are returned as valid JSON without Python repr artifacts.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- api
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100