Adding compound datatypes

InsuranceSuite includes several datatypes where multiple values are stored as a unit. This includes the following:

  • Typekey (containing a code and a name)
  • MonetaryAmount and CurrencyAmount (containing a currency and an amount)
  • SpatialPoint (containing a longitude coordinate and a latitude coordinate)
For example, an activity's assignmentStatus property is a typekey. Thus, the response payload for an activity's assignment status has two sub-fields (code and name):
"assignmentStatus": {
  "code": "assigned",
  "name": "Assigned"
}

Use the schema, mapping, and updater extension files to add a compound datatype to a resource.

Filename Guidewire Studio node
<API>_ext-1.​0.​schema.​json integration -> schemas -> ext -> <API>.​v1
<API>_ext-1.​0.​mapping.​json integration -> mappers -> ext -> <API>.​v1
<API>_ext-1.​0.​updater.​json integration -> updaters -> ext -> <API>.​v1

The schema extension file

Each schema extension file for every API contains a definitions section. In the base configuration, this section is typically blank. You can add the name of one or more schemas to the definitions section. In each schema, you can define a properties section, which lists one or more properties defined for the schema.

For compound values, each property must also have a $ref. It specifies an existing definition for the datatype.

For example, the mapping for the Contact data model entity's SpatialPoint field (which is a spatial point) looks like this:
    "properties": {
      "spatialPoint": {
        ... 
        "$ref": "#/definitions/SpatialPoint"
      }
    }

Compound datatype definitions

Set the $ref attribute to a datatype definition from the following table.

Compound datatype $ref value Additional required attributes
Typekey #/definitions/TypeKeyReference A x-gw-extensions attribute with a typelists child attribute that identifies the relevant typelist.
MonetaryAmount #/definitions/MonetaryAmount
CurrencyAmount #/definitions/CurrencyAmount
SpatialPoint #/definitions/SpatialPoint
If you are defining a typekey property, you must also define an x-gw-extensions property with a child typelist property set to the name of the typelist. For example:
    "properties": {
      "assignmentStatus": {
        ... 
        "$ref": "#/definitions/TypeKeyReference",
        "x-gw-extensions": {
          "typelist": "AssignmentStatus"
        }
      }
    }

The mapping extension file

Each mapping extension file for every API contains a mappers section. In the base configuration, this section is typically blank. You can add the name of one or more schemas to the mappers section. In each schema, you can define a properties section, which lists one or more properties defined in the schema.

For each property, you must identify how data is mapped from the Guidewire data model to the property. This is done using the following attributes:

  • path - defines the path to the data model field that stores the data
  • mapper - names a mapper that defines how the compound data type is mapped into its schema

The following table lists the mapper attribute values for the common compound datatypes.

Compound datatype mapper value
Typekey #/mappers/TypeKeyReference
MonetaryAmount #/mappers/MonetaryAmount
CurrencyAmount #/mappers/CurrencyAmount
SpatialPoint #/mappers/SpatialPoint
For example, the mapping for the Activity data model entity's AssignmentStatus field looks like this:
"mappers": {
  "Activity": {
    "properties": {
      "assignmentStatus": {
        "path": "Activity.AssignmentStatus",
        "mapper": "#/mappers/TypeKeyReference"
      }
    }
  }
}

The updater extension file

Each updater extension file for every API contains a updaters section. In the base configuration, this section is typically blank. You can add the name of one or more schemas to the updaters section. In each schema, you can define a properties section, which lists one or more properties defined in the schema.

For each writeable property, you must identify how data is mapped from the Guidewire data model to the property. This is done using the following attributes:

  • path - defines the path to the data model field that stores the data
  • valueResolver - names a mapper that defines how the compound data type is mapped into its schema
The syntax for compound datatype properties is:
"<property>": {
  "path": "<pathValue>",
  "valueResolver": {
    "typeName": "<resolverName>"
  }
}

The following table lists the resolver names for the common compound datatypes.

Compound datatype Mapper value
Typekey TypeKeyValueResolver
MonetaryAmount MonetaryAmountValueResolver
CurrencyAmount CurrencyAmountValueResolver
SpatialPoint SpatialPointValueResolver
For example, the updater for the Activity resource's assignmentStatus property looks like this:
"updaters": {
  "Activity": {
    "properties": {
      "assignmentStatus": {
        "path": "Activity.AssignmentStatus",
        "valueResolver": {
          "typeName": "TypeKeyValueResolver"
        }
      },
      ...