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

Improve XSD Types support in schema definition

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Resolved
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 5.7.1
    • Component/s: None
    • Impact type:
      API change, API added
    • Upgrade notes:
      Hide

      Added support for more XSD types, see https://jira.nuxeo.com/browse/NXP-10053 for more upgrade notes

      Show
      Added support for more XSD types, see https://jira.nuxeo.com/browse/NXP-10053 for more upgrade notes

      Description

      Problems

      When importing existing XSD schemas definition inside Nuxeo, there are some problems when some XSD types are used :

      org.nuxeo.ecm.core.schema.types.TypeException: Failed to load XSD schema http://XXX.YYY.ZZZ
      	at org.nuxeo.ecm.core.schema.XSDLoader.loadSchema(XSDLoader.java:190)
      	at org.nuxeo.ecm.core.schema.XSDLoader.loadSchema(XSDLoader.java:123)
      ...
      Caused by: java.lang.NullPointerException
      	at org.nuxeo.ecm.core.schema.types.ListTypeImpl.<init>(ListTypeImpl.java:72)
      	at org.nuxeo.ecm.core.schema.XSDLoader.createListType(XSDLoader.java:393)
      	at org.nuxeo.ecm.core.schema.XSDLoader.createComplexType(XSDLoader.java:364)
      	at org.nuxeo.ecm.core.schema.XSDLoader.loadComplexType(XSDLoader.java:266)
      	at org.nuxeo.ecm.core.schema.XSDLoader.loadType(XSDLoader.java:226)
      	at org.nuxeo.ecm.core.schema.XSDLoader.loadSchema(XSDLoader.java:177)
      	... 26 more
      

      Problems are visibles in several cases :

      one of the field is declared with xs:anyType

       <xs:complexType name = "UserObject" abstract = "true">
              <xs:complexContent>
                  <xs:extension base = "xs:anyType"/>
              </xs:complexContent>
          </xs:complexType>
      

      The best option is probably to consider this field as a big String (CLOB).

      one of the field is declared with xs:duration

       <xs:element name = "interval" type = "xs:duration"/>
      

      The best option is probably to consider this field as a String.

      a simple type is declated as enumeration

       <xs:simpleType name = "Gender">
              <xs:restriction base = "xs:string">
                  <xs:enumeration value = "Male"/>
                  <xs:enumeration value = "Female"/>
                  <xs:enumeration value = "Unknown"/>
              </xs:restriction>
          </xs:simpleType>
      

      For now, we have no simple way to support this at Core Level since the values validation is done at Widget level.

      => The best option is probably to consider this field as a String.

      a field type uses xs:choice

              <xs:complexType>
                  <xs:complexContent>
                      <xs:extension base = "types:AbstractExtensibleObject">
                          <xs:sequence>
                              <xs:element name = "header" type = "ApplicationHeader">
                              </xs:element>
                              <xs:choice>
                                  <xs:element name = "error" type = "Error">
                                  </xs:element>
                                  <xs:choice maxOccurs = "unbounded">
                                      <xs:element name = "score" type = "Score"/>
                                      <xs:element name = "decisionResults" type = "DecisionResults"/>
                                  </xs:choice>
                              </xs:choice>
                          </xs:sequence>
                      </xs:extension>
                  </xs:complexContent>
              </xs:complexType>
      

      This could be added to the Core, but this would require significant work, and so far, not sure to see what would be the real use cases ...

      xs:attribute elements with embedded xs:simpleType definitions are not supported

      <xs:attribute name = "Bureau">
              <xs:simpleType>
                  <xs:restriction base = "xs:string">
                      <xs:enumeration value = "EFU"/>
                  </xs:restriction>
              </xs:simpleType>
          </xs:attribute>
      

      Even if workaround is simple, we should try to fix this.

      XSD2JSON and XSDLoader

      The problem were actually reported while playing with XSD2JSON that parses XSD files to generate JSON definition for Nuxeo Studio.

      However, since XSD2JSON uses the XSDLoader of Nuxeo Core the problem reported via XSD2JSON are in fact problems inside Nuxeo Core.

      A simple workaround would be to tweak the XSD at the time XSD2JSON does the loading, this would allow to generate a usable JSON definition inside Studio, but :

      • this JSON definition won't match with the XSD
      • the XSD won't be correctly loaded by Nuxeo Core anyway

      This means that most of the work should be done directly inside the XSDLoader of Nuxeo Core.

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              tdelprat Thierry Delprat
              Participants:
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                PagerDuty

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