diff --git a/yaml-schema.yaml b/yaml-schema.yaml new file mode 100644 index 000000000..b792eada8 --- /dev/null +++ b/yaml-schema.yaml @@ -0,0 +1,112 @@ +# YAML Schema Meta-Schema (Draft 2025-11) +# Source: https://github.com/johndoe6345789/yaml-schema +# +# This meta-schema enables IDE validation for YAML files in the MetaBuilder project. +# YAML files should include the following directive at the top: +# # yaml-language-server: $schema=../../yaml-schema.yaml +# +# Used by: +# - packages/*/seed/schema/entities.yaml (database entity definitions) +# - Other YAML configuration files +# +$schema: https://yaml-schema.net/yaml-schema.yaml +$id: https://yaml-schema.net/draft/2025-11/meta-schema +title: YAML Schema meta-schema +description: Meta-schema for YAML Schema, based on JSON Schema meta-schema +type: object +$defs: + valid_types: + description: A list of valid types + type: string + enum: + # Scalars + - boolean + - integer + - number + - string + - "null" + # Complex Types + - array + - enum + - object + # Composition Types + - allOf + - anyOf + - not + - oneOf + schema_type: + description: >- + The type of the schema + oneOf: + - $ref: "#/$defs/valid_types" + - type: array + items: + $ref: "#/$defs/valid_types" + schema: + description: >- + A meta schema for a YAML object schema + type: object + properties: + type: + $ref: "#/$defs/schema_type" + properties: + description: The properties that are defined in the schema + type: object + patternProperties: + "^[a-zA-Z0-9_-]+$": + $ref: "#/$defs/schema" + description: + type: string + enum: + description: An array of accepted values + type: array + const: + description: A scalar value that must match the value + type: + - string + - integer + - number + - boolean + array_of_schemas: + description: >- + An array of schemas + type: array + items: + $ref: "#/$defs/schema" +properties: + $schema: + description: Specifies which draft of the JSON Schema standard the schema adheres to. + type: string + $id: + description: >- + Sets a URI for the schema. You can use this unique URI to refer to elements of the + schema from inside the same document or from external JSON documents. + type: string + $defs: + description: A container for reusable JSON Schema fragments. + type: object + patternProperties: + "^[a-zA-Z0-9_-]+$": + $ref: "#/$defs/schema" + title: + description: >- + The title of the schema + type: string + description: + description: A description of the schema + type: string + type: + description: defines the first constraint on the JSON data. + $ref: "#/$defs/schema_type" + properties: + description: >- + The properties that are defined in the schema + type: object + patternProperties: + "^[a-zA-Z0-9_-]+$": + $ref: "#/$defs/schema" + additionalProperties: + oneOf: + - type: boolean + - $ref: "#/$defs/array_of_schemas" +additionalProperties: false