Skip to content

Add schema metadata validation #28

@mindsocket

Description

@mindsocket

We currently embed metadata (hierarchy, aliases, allowSkipLevels, allowSelfRef, rules) in schema ._metadata. This metadata is not validated by JSON Schema and could benefit from explicit validation.

Proposed Options

  1. Extend JSON Schema: Create a schema definition that extends the standard JSON Schema to explicitly validate metadata fields while maintaining compatibility with existing JSON Schema validators.

  2. Separate metadata file: Create a parallel metadata file (e.g., schema-name.metadata.json) that would be validated independently.

Requirements

  • Validate that hierarchy is a non-empty array of strings
  • Validate that aliases is an object mapping string → string
  • Validate that allowSkipLevels is a boolean (default false)
  • Validate that allowSelfRef is an array of strings
  • Validate that rules follows the RulesMetadata structure (validation/coherence/best-practice arrays)
  • Maintain backward compatibility with schemas that don't define all metadata fields

Preference

Per discussion, preference is for Option 1 (extend JSON Schema) to keep metadata and schema in one file, but this requires careful design to avoid breaking JSON Schema validators.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions