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

Produce addNotNullViolation for '[null]' for multivalued String properties

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2021
    • Fix Version/s: 2021.42, 2023.2
    • Component/s: Core
    • Release Notes Summary:
      You can now make the elements of a multi-valued property non nullable by putting {{nxsv:nillable="false"}} onto the {{xs:list}} xml element.
    • Release Notes Description:
      Hide

      To configure the elements of a multi-valued scalar property non nullable you can do:

      <?xml version="1.0"?>
      <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" 
                 targetNamespace="http://nuxeo.com/schemas/validationSample"
                 xmlns:nxv="http://nuxeo.com/schemas/validationSample"
                 xmlns:nxsv="http://www.nuxeo.org/ecm/schemas/core/validation/">
      
        <xs:element name="arrayOfStrings">
          <xs:simpleType>
            <xs:list nxsv:nillable="false">
              <xs:simpleType>
                <xs:restriction base="xs:string">
                  <xs:pattern value="[a-zA-Z0-9]*"></xs:pattern>
                </xs:restriction>
              </xs:simpleType>
            </xs:list>
          </xs:simpleType>
        </xs:element>
      
      </xs:schema>
      
      Show
      To configure the elements of a multi-valued scalar property non nullable you can do: <?xml version= "1.0" ?> <xs:schema xmlns:xs= "http: //www.w3.org/2001/XMLSchema" targetNamespace= "http: //nuxeo.com/schemas/validationSample" xmlns:nxv= "http: //nuxeo.com/schemas/validationSample" xmlns:nxsv= "http: //www.nuxeo.org/ecm/schemas/core/validation/" > <xs:element name= "arrayOfStrings" > <xs:simpleType> <xs:list nxsv:nillable= " false " > <xs:simpleType> <xs:restriction base= "xs:string" > <xs:pattern value= "[a-zA-Z0-9]*" ></xs:pattern> </xs:restriction> </xs:simpleType> </xs:list> </xs:simpleType> </xs:element> </xs:schema>
    • Backlog priority:
      650
    • Sprint:
      nxplatform #92, nxplatform #93, nxplatform #94
    • Story Points:
      5

      Description

      If a string property is multivalued and required, and the property is being set with a '[null]' value, it should not be valid.

      Ex.
      curl -n localhost:8080/nuxeo/api/v1/path/default-domain/workspaces/ws1 -d '{"entity-type":"document","name":"fil3","type":"File","properties":{"dc:title":"fil3","mysch:str1":[null]}}' -H content-type:application/json
      

      Attached jar file contains an example schema that is added to the File doctype with an override. To reproduce:

      • move hbrown-SANDBOX-20230308-SNAPSHOT.jar to nxserver/plugins and start Nuxeo
      • create a new File document with 'mysch:str1' set to '[null]' (not 'null')

        Attachments

        1. mysch.xsd
          2 kB
          Harlan Brown
        2. screenshot-1.png
          163 kB
          Harlan Brown
        3. screenshot-2.png
          32 kB
          Harlan Brown

          Issue Links

            Activity

              People

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

                Dates

                • Created:
                  Updated:
                  Resolved: