From dabdbd3cb86dbdbc8273ac0866c30ceaad397e16 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kat=20March=C3=A1n?= Date: Mon, 30 Aug 2021 17:39:42 -0700 Subject: [PATCH] move schema to its own file --- SCHEMA-SPEC.md | 152 +--------------------------------------- examples/kdl-schema.kdl | 147 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 148 insertions(+), 151 deletions(-) create mode 100644 examples/kdl-schema.kdl diff --git a/SCHEMA-SPEC.md b/SCHEMA-SPEC.md index af337c2..d9e100d 100644 --- a/SCHEMA-SPEC.md +++ b/SCHEMA-SPEC.md @@ -1,153 +1,3 @@ # KDL Schema Specification -## Example - -```kdl -document description="KDL Schema KDL schema in KDL" schema-url="https://github.com/zkat/kdl" { - node "document" { - min 1 - max 1 - prop "schema-url" description="URL where you can find this schema. Informational only." { - type "url" - } - prop "description" description="General purpose and description for this document schema." { - type "string" - } - children id="node-children" { - node "node" description="A child node belonging either to `document` or to another `node`. Nodes may be anonymous." { - value description="The name of the node. If a node name is not supplied, the node rules apply to _all_ nodes belonging to the parent." { - type "string" - max 1 - } - prop "description" description="A description of this node's purpose." { - type "string" - } - prop "id" description="globally-unique ID of this node." { - type "string" - } - prop "ref" description="globally unique reference to this node." { - type "string" - } - children { - node "enum" description="An enumeration of possible values" { - max 1 - value description="Enumeration choices" { - min 1 - } - } - node "min" description="minimum number of instances of this node in its parent's children." { - max 1 - value { - min 1 - max 1 - type "number" - } - } - node "max" description="maximum number of instances of this node in its parent's children." { - max 1 - value { - min 1 - max 1 - type "number" - } - } - node "prop" description="A node property key/value pair." { - value description="The property key." { - type "string" - min 1 - max 1 - } - prop "id" description="A globally-unique ID of this property." { - type "string" - } - prop "ref" description="A globally unique reference to another property node." { - type "string" - } - prop "description" description="A description of this property's purpose." { - type "string" - } - children description="Property node children. Only used for validation nodes, for now" { - node "type" description="The type for this prop's value." { - max 1 - value { - min 1 - type "string" - } - } - node "enum" description="An enumeration of possible values" { - max 1 - value description="Enumeration choices" { - min 1 - } - } - node "required" description="Whether this property is required if its parent is present." { - max 1 - value { - min 1 - max 1 - type "boolean" - } - } - } - } - node "value" description="one or more direct node values" { - prop "id" description="A globally-unique ID of this value." { - type "string" - } - prop "ref" description="A globally unique reference to another value node." { - type "string" - } - prop "description" description="A description of this property's purpose." { - type "string" - } - children description="Value node children. Only used for validation nodes, for now" { - node "type" description="The type for this/these value(s)." { - max 1 - value { - min 1 - type "string" - } - } - node "enum" description="An enumeration of possible values" { - max 1 - value description="Enumeration choices" { - min 1 - } - } - node "min" description="minimum number of values for this node." { - max 1 - value { - min 1 - max 1 - type "number" - } - } - node "max" description="maximum number of values for this node." { - max 1 - value { - min 1 - max 1 - type "number" - } - } - } - } - node "children" { - max 1 - prop "id" description="A globally-unique ID of this children node." { - type "string" - } - prop "ref" description="A globally unique reference to another children node." { - type "string" - } - prop "description" description="A description of this these children's purpose." { - type "string" - } - children ref="#node-children" - } - } - } - } - } -} -``` +For the full KDL Schema schema itself, see [examples/kdl-schema.kdl](./examples/kdl-schema.kdl). diff --git a/examples/kdl-schema.kdl b/examples/kdl-schema.kdl new file mode 100644 index 0000000..ed80c82 --- /dev/null +++ b/examples/kdl-schema.kdl @@ -0,0 +1,147 @@ +document description="KDL Schema KDL schema in KDL" schema-url="https://github.com/zkat/kdl" { + node "document" { + min 1 + max 1 + prop "schema-url" description="URL where you can find this schema. Informational only." { + type "url" + } + prop "description" description="General purpose and description for this document schema." { + type "string" + } + children id="node-children" { + node "node" description="A child node belonging either to `document` or to another `node`. Nodes may be anonymous." { + value description="The name of the node. If a node name is not supplied, the node rules apply to _all_ nodes belonging to the parent." { + type "string" + max 1 + } + prop "description" description="A description of this node's purpose." { + type "string" + } + prop "id" description="globally-unique ID of this node." { + type "string" + } + prop "ref" description="globally unique reference to this node." { + type "string" + } + children { + node "enum" description="An enumeration of possible values" { + max 1 + value description="Enumeration choices" { + min 1 + } + } + node "min" description="minimum number of instances of this node in its parent's children." { + max 1 + value { + min 1 + max 1 + type "number" + } + } + node "max" description="maximum number of instances of this node in its parent's children." { + max 1 + value { + min 1 + max 1 + type "number" + } + } + node "prop" description="A node property key/value pair." { + value description="The property key." { + type "string" + min 1 + max 1 + } + prop "id" description="A globally-unique ID of this property." { + type "string" + } + prop "ref" description="A globally unique reference to another property node." { + type "string" + } + prop "description" description="A description of this property's purpose." { + type "string" + } + children description="Property node children. Only used for validation nodes, for now" { + node "type" description="The type for this prop's value." { + max 1 + value { + min 1 + type "string" + } + } + node "enum" description="An enumeration of possible values" { + max 1 + value description="Enumeration choices" { + min 1 + } + } + node "required" description="Whether this property is required if its parent is present." { + max 1 + value { + min 1 + max 1 + type "boolean" + } + } + } + } + node "value" description="one or more direct node values" { + prop "id" description="A globally-unique ID of this value." { + type "string" + } + prop "ref" description="A globally unique reference to another value node." { + type "string" + } + prop "description" description="A description of this property's purpose." { + type "string" + } + children description="Value node children. Only used for validation nodes, for now" { + node "type" description="The type for this/these value(s)." { + max 1 + value { + min 1 + type "string" + } + } + node "enum" description="An enumeration of possible values" { + max 1 + value description="Enumeration choices" { + min 1 + } + } + node "min" description="minimum number of values for this node." { + max 1 + value { + min 1 + max 1 + type "number" + } + } + node "max" description="maximum number of values for this node." { + max 1 + value { + min 1 + max 1 + type "number" + } + } + } + } + node "children" { + max 1 + prop "id" description="A globally-unique ID of this children node." { + type "string" + } + prop "ref" description="A globally unique reference to another children node." { + type "string" + } + prop "description" description="A description of this these children's purpose." { + type "string" + } + children ref="#node-children" + } + } + } + } + } +}