Modifying endpoint behaviors
You can configure schema properties with additional behaviors, such as:
- Setting the property to read-only
- Indicating the property as 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 configurable?
Most attributes are configurable from the schema file. Within the schema file, 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
andsortable
requiredForCreate
expirationDate
property that was
filterable, sortable, and required for creation, the syntax for the declaration of
these properties would be as
follows:Still other properties can only be modified through the use of resource files, such as some custom sorts and filters.
Summary of schema property attributes
The following attributes are direct children of the property
declaration:
Attribute | Description | Example |
---|---|---|
readOnly |
Boolean identifying if the property as read-only. (The default is false.) | "readOnly": true |
x-gw-nullable |
Boolean identifying if the property can be explicitly set to null. (The default is true.) Used to set a property as required by the database. For more information, see Making properties required by the database. | "x-gw-nullable": false |
x-gw-sinceExtensionsVersion |
String identifying the first version of the API to include the extension property | "x-gw-sinceExtensionsVersion": "1.1.0" |
The following attributes are declared in the x-gw-extension
object:
Attribute | Description | Example |
---|---|---|
createOnly |
Boolean identifying if the property can be specified only when the object is created. (The default is false.) | "createOnly": true |
filterable |
Boolean identifying if the filter query
parameter can be used on this property. In other words, collections
can be filtered using this property. (The default is false.) |
"filterable": true |
requiredForCreate |
Boolean identifying if the property must be specified when the object is created. (The default is false.) Used to set a property as required by the database. For more information, see Making properties required by the database. | "requiredForCreate": true |
sortable |
Boolean identifying if the sort query parameter
can be used on this property. In other words, collections can be
sorted using this property. (The default is false.) |
"sortable": true
|