Skip to content

enable schema self identification using inline $schema #437

@sooncj

Description

@sooncj

JSON schema allows a JSON file to self identify its schema using the $schema key. This should also be possible with YAML.

without first saving to a file, $schema should enable validation and auto-completion

$schema: https://raw.githubusercontent.com/compose-spec/compose-spec/master/schema/compose-spec.json
version: '3'
services:
  hello:
    image: hello-world

Further, this should enable use of local schema files.
For example, using the product catalog example from https://json-schema.org/learn/getting-started-step-by-step.html
If I were to save the final product catalog JSON schema locally to /usr/shared/productCatalog.json
I can then implement a product catalog with validation and auto-completion:

$schema: /usr/shared/productCatalog.json
productId: 123
productName: "self identify YAML schema"

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions