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

Document creation applies validation on dirty fields only

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 8.10
    • Fix Version/s: 8.10-HF19, 9.3
    • Component/s: Core, Web UI
    • Release Notes Summary:
      Constraint validation applies on all document properties at creation
    • Backlog priority:
      500
    • Upgrade notes:
      Hide

      Nuxeo now validates all document properties during the creation.
      As it, it is no longer possible to create a document with a missing value on a required property.

      Show
      Nuxeo now validates all document properties during the creation. As it, it is no longer possible to create a document with a missing value on a required property.
    • Sprint:
      nxcore 9.3.9
    • Story Points:
      3

      Description

      Currently only the dirty fields are used by the validation service during document creation

      AbstractSession#createDocument
                  DocumentValidationReport report = getValidationService().validate(docModel, true);
      
      DocumentValidationServiceImpl#validate
          @Override
          public DocumentValidationReport validate(DocumentModel document, boolean dirtyOnly) {
              List<ConstraintViolation> violations = new ArrayList<ConstraintViolation>();
              DocumentType docType = document.getDocumentType();
              if (dirtyOnly) {
                  for (DataModel dataModel : document.getDataModels().values()) {
                      Schema schemaDef = getSchemaManager().getSchema(dataModel.getSchema());
                      for (String fieldName : dataModel.getDirtyFields()) {
      

      Because of that, it is not possible to check the constraints on a field which was not set in a WebUI creation form, for example in this case:
      1) A field is declared as required in the schema definition.
      2) In the WebUI creation form, I use an inputText where the field is not required
      3) I submit the form
      4) The document is created without any error

      The expected behavior is that an error in shown in the creation form.

        Attachments

          Issue Links

            Activity

              People

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

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Time Tracking

                  Estimated:
                  Original Estimate - 0 minutes
                  0m
                  Remaining:
                  Remaining Estimate - 0 minutes
                  0m
                  Logged:
                  Time Spent - 1 day, 4 hours
                  1d 4h

                    PagerDuty

                    Error rendering 'com.pagerduty.jira-server-plugin:PagerDuty'. Please contact your Jira administrators.