Uploaded image for project: 'Nuxeo Platform'
  1. Nuxeo Platform
  2. NXP-30870

Add complete list of missing required values to constraint violation error

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Open
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: 10.10, 2021.0
    • Fix Version/s: 2021.x
    • Component/s: Rest API

      Description

      Description:

      When a document is missing multiple required values, nuxeo client only returns the first missing value: https://github.com/nuxeo/nuxeo/blob/10.10/nuxeo-core/nuxeo-core-api/src/main/java/org/nuxeo/ecm/core/api/validation/DocumentValidationException.java#L33-L34

      Repro Steps:

      • Drop the attached jar into nxserver/plugins 
      • Run curl command:
        curl -H "Content-Type: application/json" -XPOST -u Administrator:Administrator http://localhost:8080/nuxeo/api/v1/path/ -d '{ "entity-type":"document", "type": "test_required_value", "name":"docOne", "properties": {"dc:title":"docOne"}}'
        

      Outcome:

      {"entity-type":"exception","status":422,"message":"2 constraint violation(s) thrown. First one thrown on property test_required_value:requiredValue[0]: 'Value is required.', call DocumentValidationException.getViolations() to get the others"}
      

       

      Expected outcome:

      The error message should contain the complete list of missing required values

        Attachments

          Activity

            People

            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated: