Skip to main content
Version: v5.0

schema-def

SchemaDefinition#

A SchemaDefinition stores all the Schemas in a namespace.

A SchemaDefinition is a first-class resource. It has READ and UPDATE operations with the appropriate permissions.

You can configure a Schema when you create a collection, such as a NamedUserCollection. This schema is either added to the SchemaDefinition or updates an existing schema.

A SchemaDefinition has the following properties:

PropertyTypeDescription
_itemTypesArray of SchemaAn array containing all the namespace's Schemas for RelatedItems
_readingTypesArray of SchemaAn array containing all the namespace's Schemas for readings
_collectionsArray of NamedUserCollectionAn array of NamedUserCollections in the namespace. This is available when withColls=true is a query parameter.

For more context, see the following example:

{  "_readingTypes": [    {      "_typeName": "PressureReading",      "_type": "object",      "_properties": {        "_tsMetadata": {          "_type": "object",          "_properties": {            "_telItemId": {              "_type": "string"            },            "_sourceId": {              "_type": "string"            }          }        },        "pressure": {          "_type": "number"        },        "_ts": {          "_type": "isodate"        }      },      "_description": "This reading captures the pressure measurement of the coolant for the chiller post-compression in PSI"    },    ...    // more reading Schemas  ],  "_itemTypes": [    {      "_readingTypes": [        "TemperatureReading",        "PressureReading"      ],      "_typeName": "SensorDataPoint",      "_type": "object",      "_properties": {        "unit": {            "_type": "string",            "_description": "Unit of measure, e.g. deg Celcius, PSI, etc"        },        "measurementType": {            "_type": "string",            "_description": "The type of measurement e.g. temperature, pressure, humidity, etc"        },        "_sourceId": {            "_type": "string",            "_description": "Id if the sensor data point"        }      },      "_description": "A sensor can have more than one data points. The data points are represented in this collection as TelemetryItems. The sensors in the System Components Collection can have one to many relationships with the SensorDataPoints",      "_relationshipTypes": [        {          "_isInverse": true,          "_userType": "hasSensorDataPoint",          "_ref": {              "_relatedTypeName": "HVACSystemComponent",              "_relatedUserType": "system_component_collection",              "_relatedUserItemId": "systemsensorptscol_BsYCWFBtJG"          },          "_description": "This inverse relationship is between a sensor data point item in this collection with a sensor System Component item in the System Component collection. The semantics of this relationship are defined by the _userType on this relationship"        }      ]    },    ...    // more RelatedItem Schemas  ]}