Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  • The superset of all the fields for a JSON structure needs to be known
  • The type definition id needs to be provided for each sub-element within the JSON structure
  • If the type definition id is not provided the type definition generator will behave the same way it currently does. For every provided JSON document the system might potentially generate a new type definition.
  • All clients need to know the registered definitions and id's in order to provide the correct id for any given structure within the JSON document

 

Type Registry Service

Types can be defined in the following manner:

...

  • addTypeDefinitions(List<TypeDefinition>)
  • exportTypeDefinition(long typeDefId) : TypeDefinition
  • exportTypeDefinitons() : List<TypeDefinitions>
  • removeTypeDefinitions(List<TypeDefinition>)
  • lookupTypeDefinition(long typeDefId) : TypeDefinitions
  • lookupTypeIdByTypeDefinition(TypeDefinition) : long

...

Code Block
languagexml
titleType Definition Spec
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema">
  <xs:element name="typeDefinitons" type="typeDefinitonsType"/>
  <xs:complexType name="entryType">
    <xs:simpleContent>annotation>
      <xs:extension base="xs:string">documentation>
        <xs:attributeThe type="xs:long" name="refTypeId" use="optional"/>
        <xs:attribute type= field represents the entry within a List | Set | Array. It can be either a primitive defined by the type attribute
        or referencing a defined type by using the refTypeId attribute.
      </xs:documentation>
    </xs:annotation>
    <xs:simpleContent>
      <xs:extension base="xs:string">
        <xs:attribute type="xs:long" name="refTypeId" use="optional"/>
        <xs:attribute type="xs:string" name="type" use="optional"/>
      </xs:extension>
    </xs:simpleContent>
  </xs:complexType>
  <xs:complexType name="valueType">
    <xs:annotation>
      <xs:documentation>
        The type field represents the value in the key:value for a map or dictionary. It can be either a primitive defined by the type attribute
        or referencing a defined type by using the refTypeId attribute. The name attribute allows for the specification of a named field in the incoming
        document to map to.
      </xs:documentation>
    </xs:annotation>
    <xs:simpleContent>
      <xs:extension base="xs:string">
        <xs:attribute type="xs:long" name="refTypeId" use="optional"/>
        <xs:attribute type="xs:string" name="name" use="optional"/>
        <xs:attribute type="xs:string" name="type" use="optional"/>
      </xs:extension>
    </xs:simpleContent>
  </xs:complexType>
  <xs:complexType name="typeDefinitonsType">
    <xs:sequence>
      <xs:element type="typeDefinitionType" name="typeDefinition" maxOccurs="unbounded" minOccurs="0"/>
    </xs:sequence>
  </xs:complexType>
  <xs:complexType name="typeDefinitionType"><xs:annotation>
    <xs:documentation>
      This field represents the type that is to be defined. The type attribute represents either the class of the object. The typeId represents the externally defined typeId
      for this definition. This typeId will be used in other definitions referring this definition.
    </xs:documentation>
  </xs:annotation>
    <xs:sequence>
      <xs:element type="fieldsType" name="fields"/>
    </xs:sequence>
    <xs:attribute type="xs:string" name="type"/>
    <xs:attribute type="xs:long" name="typeId"/>
  </xs:complexType>
  <xs:complexType name="keyType">
    <xs:annotation>
      <xs:documentation>
        The type field represents the key in the key:value for a map or dictionary. It can be either a primitive defined by the type attribute
        or referencing a defined type by using the refTypeId attribute. The name attribute allows for the specification of a named field in the incoming
        document to map to.
      </xs:documentation>
    </xs:annotation>
    <xs:simpleContent>
      <xs:extension base="xs:string">
        <xs:attribute type="xs:long" name="refTypeId" use="optional"/>
        <xs:attribute type="xs:string" name="name" use="optional"/>
        <xs:attribute type="xs:string" name="type" use="optional"/>
      </xs:extension>
    </xs:simpleContent>
  </xs:complexType>
  <xs:complexType name="valueType">
    <xs:simpleContent>
      <xs:extension base="xs:string">
        <xs:attribute type="xs:string"complexType name="type" use="optional"/fieldType">
    <xs:sequence>
      <xs:attribute type="xs:string"element name="name" use="optional"/>
        <xs:attribute type="xs:long" name="refTypeId" use="optional"/>
      </xs:extension>
    </xs:simpleContent>
annotation>
          <xs:documentation>The name of field</xs:documentation>
        </xs:complexType>annotation>
   <xs:complexType name="typeDefinitonsType">
    <xs:sequence>simpleType>
          <xs:elementrestriction type="typeDefinitionType" name="typeDefinition" maxOccurs="unbounded" minOccurs="0"/>
base="xs:string">
        </xs:sequence>
  </xs:complexType>
  <xs:complexTypeenumeration namevalue="typeDefinitionTypeprimitiveTypeField"/>
      <xs:sequence>
      <xs:elementenumeration typevalue="fieldsType" name="fieldsexistingTypeField"/>
        </xs:sequence>
    <xs:attribute type="xs:string" name="type" use="optional:enumeration value="mapTypeField"/>
            <xs:attributeenumeration typevalue="xs:long" name="refTypeId" use="optionallistTypeField"/>
          </xs:complexType>
  <xs:complexTypeenumeration namevalue="keyTypeformattedDateTypeField"/>
     <xs:simpleContent>
       <xs:extensionenumeration basevalue="xs:stringformattedDecimalTypeField"/>
         <xs:attribute type="xs:string" name="type" use="optional"/>
 </xs:restriction>
        </xs:simpleType>
   <xs:attribute type="xs:string" name="name" use="optional"/>
   </xs:element>
      <xs:attributeelement type="xs:longkeyType" name="refTypeIdkey" useminOccurs="optional0"/>
        </xs<xs:extension>annotation>
      </xs:simpleContent>
  </xs:complexType>
  <xs:complexType name="fieldType">
    <xs:sequence>
      <xs:element name="name">documentation>The type of the key within the map. Optional name attribute to define the corresponding field in the incoming document</xs:documentation>
        <xs</xs:simpleType>annotation>
      </xs:element>
      <xs:restriction base="xs:stringelement type="valueType" name="value" minOccurs="0">
            <xs:enumeration value="primitiveTypeField"/>
  annotation>
          <xs:enumeration value="existingTypeField"/>
            <xs:enumeration value="mapTypeField"/>
     documentation>The type of the value within the map.Optional name attribute to define the corresponding field in the incoming document</xs:documentation>
       <xs:enumeration value="listTypeField"/> </xs:annotation>
      </xs:element>
      <xs:enumeration value="formattedDateTypeField"/>
    element type="entryType" name="entry" minOccurs="0">
        <xs:enumeration value="formattedDecimalTypeField"/>annotation>
          </xs:restriction>
        </xs:simpleType>
      </xs:element><xs:documentation>The type of the entry this is stored within the List | Set | Array</xs:documentation>
      <xs:element type="keyType" name="key" minOccurs="0"/> </xs:annotation>
      <xs:element type="valueType" name="value" minOccurs="0"/></xs:element>
      <xs:element type="entryType" name="entryformattingString" minOccurs="0"/>
        <xs:element name="formattingString" minOccurs="0">
annotation>
          <xs:simpleType>
          <xs:restriction base="xs:string"/>documentation>Optional formatting string for the data. This is used for importing/exporting of the field.</xs:documentation>
        </xs:simpleType>annotation>
      </xs:element>
    </xs:sequence>
    <xs:attribute type="xs:string" name="type" use="optional"/>
    <xs:attribute type="xs:long" name="refTypeId" use="optional"/>
  </xs:complexType>
  <xs:complexType name="fieldsType">
    <xs:sequence>
      <xs:element type="fieldType" name="field" maxOccurs="unbounded" minOccurs="0">
        <xs:annotation>
          <xs:documentation>A formatted double | float field definition<documentation>This is the field definition. It can be either a primitive type, an existing definition of a type, a mapType, a listType or a formatted Date/Decimal type</xs:documentation>
        </xs:annotation>
      </xs:element>
    </xs:sequence>
  </xs:complexType>
</xs:schema>

 

In the below example it shows how to define the type definition for a domain object.

...