diff --git a/format/seat-definition.schema.json b/format/seat-definition.schema.json new file mode 100644 index 0000000..965beeb --- /dev/null +++ b/format/seat-definition.schema.json @@ -0,0 +1,419 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "https://git.novox.be/novox/mesh-contracts/format/seat-definition.schema.json", + "title": "A seat's definition (novox/hq ADR 0608 \u00a71, design 26), format 1", + "description": "One file per seat, seats//seat.json. A whole definition (grain whole) gives every verb's input and answer, every message's body and where its events are kept; one at the seat list's grain (seat-list) holds what mesh-sdk's compiled seat list held (ADR 0613 \u00a72). At most 256 KiB. Read strictly: a field not named here is refused.", + "type": "object", + "additionalProperties": false, + "required": [ + "format", + "seat", + "scope", + "grain", + "decision" + ], + "properties": { + "format": { + "const": 1 + }, + "seat": { + "type": "string", + "pattern": "^[a-z][a-z0-9-]*[a-z0-9]$" + }, + "scope": { + "enum": [ + "mesh", + "node" + ] + }, + "grain": { + "enum": [ + "whole", + "seat-list" + ] + }, + "decision": { + "type": "string", + "minLength": 1 + }, + "description": { + "type": "string" + }, + "holder-declares": { + "type": "boolean", + "description": "the seat is not in the compiled seat list; its holder's manifest declares it" + }, + "delivers": { + "type": "string" + }, + "replicated": { + "type": "boolean" + }, + "pulled-by-kind": { + "type": "boolean" + }, + "yields": { + "type": "boolean" + }, + "held-by-the-engine": { + "type": "boolean" + }, + "includes": { + "type": "array", + "items": { + "type": "string", + "pattern": "^[a-z][a-z0-9-]*$" + }, + "description": "parts/.json taken in whole" + }, + "verbs": { + "type": "array", + "items": { + "$ref": "#/$defs/verb" + } + }, + "accepts": { + "type": "array", + "items": { + "$ref": "#/$defs/message" + } + }, + "events": { + "type": "array", + "items": { + "$ref": "#/$defs/message" + }, + "description": "published on mesh.seat..event." + }, + "family": { + "type": "object", + "additionalProperties": false, + "required": [ + "name", + "max-age-days" + ], + "properties": { + "name": { + "type": "string" + }, + "max-age-days": { + "type": "integer", + "minimum": 1 + }, + "max-mib": { + "type": "integer", + "minimum": 1 + } + } + }, + "holder-events": { + "type": "array", + "items": { + "type": "object", + "additionalProperties": false, + "required": [ + "name", + "subject" + ], + "properties": { + "name": { + "type": "string", + "pattern": "^[a-z][a-z0-9-]*$" + }, + "subject": { + "type": "string" + }, + "family": { + "type": "string" + }, + "body": { + "type": "object", + "description": "a JSON Schema" + } + } + }, + "description": "the holder's own events listed beside the seat, keeping the holder's subjects (ADR 0620 \u00a72)" + }, + "records": { + "type": "array", + "items": { + "type": "object", + "additionalProperties": false, + "required": [ + "name" + ], + "properties": { + "name": { + "type": "string", + "pattern": "^[a-z][a-z0-9-]*$" + }, + "key": { + "type": "string" + }, + "value": { + "type": "object", + "description": "a JSON Schema" + } + } + } + }, + "provisions": { + "type": "array", + "items": { + "type": "object", + "additionalProperties": false, + "required": [ + "name", + "form" + ], + "properties": { + "name": { + "type": "string" + }, + "form": { + "type": "object", + "description": "a JSON Schema" + } + } + } + }, + "receives": { + "type": "array", + "items": { + "type": "object", + "additionalProperties": false, + "required": [ + "kind" + ], + "properties": { + "kind": { + "type": "string" + }, + "comment": { + "type": "string" + }, + "dirs": { + "type": "boolean" + }, + "offered": { + "type": "boolean" + }, + "shape": { + "type": "object", + "additionalProperties": false, + "properties": { + "places": { + "type": "array", + "items": { + "type": "object", + "additionalProperties": false, + "required": [ + "field" + ], + "properties": { + "field": { + "type": "string" + }, + "values": { + "type": "array", + "items": { + "type": "string" + } + } + } + } + }, + "order": { + "type": "string" + }, + "examples": { + "type": "array", + "items": { + "type": "object" + } + }, + "text": { + "type": "boolean" + } + } + } + } + } + }, + "paths": { + "type": "array", + "items": { + "type": "object", + "additionalProperties": false, + "required": [ + "path" + ], + "properties": { + "path": { + "type": "string", + "pattern": "^/" + }, + "steps-back-for": { + "type": "string" + } + } + } + }, + "defs": { + "type": "object", + "additionalProperties": { + "type": "object", + "description": "a JSON Schema" + } + } + }, + "$defs": { + "verb": { + "type": "object", + "additionalProperties": false, + "required": [ + "name" + ], + "properties": { + "name": { + "type": "string", + "pattern": "^[a-z][a-z0-9-]*$" + }, + "description": { + "type": "string" + }, + "optional": { + "type": "boolean" + }, + "replaces": { + "type": "array", + "items": { + "type": "string" + } + }, + "input": { + "type": "object", + "description": "a JSON Schema" + }, + "answer": { + "type": "object", + "description": "a JSON Schema" + }, + "callers": { + "type": "string" + } + } + }, + "message": { + "type": "object", + "additionalProperties": false, + "required": [ + "name" + ], + "properties": { + "name": { + "type": "string", + "pattern": "^[a-z][a-z0-9-]*$" + }, + "body": { + "type": "object", + "description": "a JSON Schema" + }, + "by-caller": { + "type": "boolean" + } + } + }, + "part": { + "description": "parts/.json", + "type": "object", + "additionalProperties": false, + "required": [ + "format", + "part" + ], + "properties": { + "format": { + "const": 1 + }, + "part": { + "type": "string", + "pattern": "^[a-z][a-z0-9-]*$" + }, + "description": { + "type": "string" + }, + "verbs": { + "type": "array", + "items": { + "$ref": "#/$defs/verb" + } + }, + "events": { + "type": "array", + "items": { + "$ref": "#/$defs/message" + } + }, + "defs": { + "type": "object", + "additionalProperties": { + "type": "object", + "description": "a JSON Schema" + } + } + } + }, + "fixtures": { + "description": "seats//fixtures/*.json: data, never functions", + "type": "array", + "items": { + "type": "object", + "additionalProperties": false, + "required": [ + "name", + "of", + "given" + ], + "properties": { + "name": { + "type": "string" + }, + "of": { + "type": "string", + "pattern": "^(verb:[a-z][a-z0-9-]*\\.(input|answer)|accept:[a-z][a-z0-9-]*|event:[a-z][a-z0-9-]*|holder-event:[a-z][a-z0-9-]*)$" + }, + "subject": { + "type": "string" + }, + "given": {}, + "wire": {}, + "why": { + "type": "string" + } + } + } + }, + "index": { + "description": "seats/index.json: the seat list's reading order", + "type": "object", + "additionalProperties": false, + "required": [ + "format", + "seats" + ], + "properties": { + "format": { + "const": 1 + }, + "seats": { + "type": "array", + "items": { + "type": "string" + }, + "uniqueItems": true + } + } + } + } +}