JSON Schema
Validate a map with any tool, and editor support for the files.
Three schemas describe the format, in JSON Schema 2020-12, and a fourth the envelope of every event:
| File | Schema |
|---|---|
cases/map.yaml | https://cases.sypnia.com/schema/v1/map.json |
cases/navigation.yaml | https://cases.sypnia.com/schema/v1/navigation.json |
cases/**/*.case.yaml | https://cases.sypnia.com/schema/v1/case.json |
| an event (What each event carries) | https://cases.sypnia.com/schema/v1/event.json |
They also ship inside the package, for offline use, as exports and as files in its schema/ folder:
import { mapSchema, navigationSchema, caseSchema, eventSchema, parseMap, validateMap } from '@sypnia/cases/spec';
const map = await parseMap('cases');
const result = validateMap(map); // { ok, errors: [{ file, path, line, message, kind }], findings }In your editor
Add the schema line at the top of a file and editors with YAML support complete fields and show errors as you type:
# yaml-language-server: $schema=https://cases.sypnia.com/schema/v1/case.json
id: place-ordernpx @sypnia/cases init adds it for you.