packages/core/schema/resource.schema.json
{
"$id": "resource.schema.json",
"$schema": "http://json-schema.org/draft-07/schema",
"description": "A resource object",
"type": "object",
"definitions": {
"id": {
"type": ["null", "number", "string"]
},
"relationships": {
"type": "object",
"properties": {
"resource": {
"type": "string"
},
"many": {
"type": "boolean"
},
"cardinality": {
"type": "string",
"enum": ["one-to-one", "one-to-many", "many-to-one" ,"many-to-many"]
}
}
},
"metadata": {
"type": "object",
"properties": {
"loaded": { "type": "boolean" },
"loading": { "type": "boolean" },
"relationships": { "$ref": "#/definitions/relationships" }
},
"required": ["loaded", "loading"]
}
},
"properties": {
"id": {
"$ref": "#/definitions/id"
},
"type": {
"type": "string"
},
"relationships": {
"$ref": "#/definitions/relationships"
},
"data": {
"type": "object"
},
"metadata": {
"$ref": "#/definitions/metadata"
},
"meta": {
"type": "object"
}
},
"required": [ "id", "type", "data", "metadata" ]
}