Schema design
Models
A schema consists of one or more models. Each model describes a separate entity. Models consist of a set of named properties. Each property is defined with a name, a data type and other parameters like default values and validation rules.
Schema objects
| Object type | Description |
|---|---|
Items are stored in collections, and the model defines the set of properties the items consist of. | |
Data retrieved from external endpoints. | |
A subset of a collection, limited by contained properties and/or a filter. | |
Read-only datasets made by joining multiple collections. |
Designing the schema interactively
You can design the schema interactively in the developer portal
Use the Table view or Map view to design your schema.
Table view:
Map view:
Designing the schema declaratively
You can create the schema by crafting a json file containing the schema definition.
The file must conform to this JSON schema.
Schema definition file for a sample schema with two collections, orders and customers, with a lookup-property in the orders collection referencing customers:
{
"collections": [
{
"name": "orders",
"properties": [
{
"name": "customer",
"typeName": "customers",
"isRequired": true
},
{
"name": "orderDate",
"typeName": "date",
"isRequired": true
},
{
"name": "deliveryDate",
"typeName": "date",
"isRequired": false
}
]
},
{
"name": "customers",
"properties": [
{
"name": "name",
"typeName": "string",
"isRequired": true
},
{
"name": "addressLine1",
"typeName": "string",
"isRequired": true
},
{
"name": "addressLine2",
"typeName": "string",
"isRequired": false
},
{
"name": "zip",
"typeName": "string",
"isUnique": false,
"isRequired": true
},
{
"name": "state",
"typeName": "string",
"isRequired": false
}
]
}
]
}
The schema definition file can be applied to an API instance by pasting the contents into the JSON view of the schema designer in the developer portal or it may be applied using the RestAPI Terminal (RAT).
OpenAPI support
An OpenAPI (Swagger) definition of your API is availible on the following URL:
https://<host-name>/<api-path>/_openapi