Property-level behaviors

You can configure schema properties with additional behaviors, such as:

  • Setting the property to read-only
  • Indicating the property is required by the database
  • Making the property sortable or filterable by the corresponding collection
  • Adding additional metadata, such as the first version of the API to include the property

These additional behaviors are typically defined using one or more property attributes.

Where are property attributes defined

Some property attributes are declared directly on the property itself. This includes:

  • Standard JSON properties, such as readOnly
  • Guidewire extension properties declared directly off the attribute, such as x-gw-sinceExtensionVersion

Other property attributes are Guidewire extensions declared in an object named x-gw-extension. This includes:

  • filterable and sortable
  • requiredForCreate
For example, if you had an expirationDate property that was filterable, sortable, and required for creation, the syntax for the declaration of these properties would be as follows:
      "properties": {
        "expirationDate": {
          ...
          "x-gw-extensions": {
            "requiredForCreate": true,
            "filterable": true,
            "sortable": true
          }
        }