Skip to content

Add schema metadata validation #28

Closed

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.

Activity

  1. mindsocket commented on Mar 9, 2026

    @mindsocket
    OwnerAuthor

    This issue depends on #33 (Support full cross-schema resolution of refs) - to validate schema metadata, we need to be able to resolve all references to ensure metadata is complete and consistent.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions