runbook-tutorials/rtut/schema/attribute-set.schema.json

38 lines
1.2 KiB
JSON
Raw Permalink Normal View History

{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://runbook-tutorials.invalid/schema/attribute-set/v0.1",
"title": "Attribute set",
"type": "object",
"required": ["spec", "id", "title", "attributes"],
"additionalProperties": false,
"properties": {
"spec": {"const": "attribute-set/v0.1"},
"id": {"type": "string", "pattern": "^[a-z0-9]+([.-][a-z0-9]+)*$"},
"title": {"type": "string", "minLength": 3},
"extends": {"type": "array", "items": {"type": "string"}, "description": "Composed first; later entries and this set's own attributes override."},
"attributes": {"$ref": "#/$defs/attributes"}
},
"$defs": {
"attributes": {
"type": "object",
"propertyNames": {"pattern": "^[a-z][a-z0-9_]*$"},
"additionalProperties": {"$ref": "#/$defs/attribute"}
},
"attribute": {
"oneOf": [
{"type": ["string", "integer", "boolean"]},
{
"type": "object",
"additionalProperties": false,
"properties": {
"value": {"type": ["string", "integer", "boolean"]},
"requirement": {"enum": ["required", "optional"]},
"note": {"type": "string"}
},
"minProperties": 1
}
]
}
}
}