plone / plone/plone.restapi

Error messages from DX field validation could be better (ConstraintNotStatisfied)

Open
#657 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

01 type: bug
Dominant language
Python
Stars
109
Forks
107
Avg merge
2d 3h
Merged PRs (30d)
4

Description

The error messages like

  Module plone.restapi.deserializer.dxcontent, line 129, in __call__
zExceptions.BadRequest: [{'message': 'Constraint not satisfied', 'field': 'gl_date', 'error': ConstraintNotSatisfied('', 'gl_date')}]

are pretty generic and not very helpful for an API consumer. The reason for such an error could be that the related field is either required or the value for the value does not match the vocabulary values of a configured vocabulary.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at plone.restapi.deserializer.dxcontent.call around line 129 and trace how ConstraintNotSatisfied becomes the API response. Compare the required-field and configured-vocabulary validation paths. Done means API consumers receive messages that distinguish missing required values from values outside a vocabulary.

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.