Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support ref pointers in url with schema.json#$RefName #988

Open
airtonix opened this issue Aug 31, 2024 · 0 comments
Open

Support ref pointers in url with schema.json#$RefName #988

airtonix opened this issue Aug 31, 2024 · 0 comments

Comments

@airtonix
Copy link

airtonix commented Aug 31, 2024

Is your enhancement related to a problem? Please describe.

my schema.json:

{
  "$defs": {

    "IncludeAThing": {
      "properties": {
        "include": {
          "type": "string"
        }
      },
      "required": [
        "include"
      ],
      "title": "IncludeAThing",
      "type": "object"
    },

    "ABigThing": {
      "properties": {
        "thing": {
          "$ref": "#/$defs/AThing"
        }
      },
      "required": [
        "thing"
      ],
      "title": "ABigThing",
      "type": "object"
    },

    "AListOfThings": {
      "items": {
        "anyOf": [
          {
            "$ref": "#/$defs/AThing"
          },
          {
            "$ref": "#/$defs/IncludeAThing"
          },
          {
            "$ref": "#/$defs/ABigThing"
          }
        ]
      },
      "title": "AListOfThings",
      "type": "array"
    },

    "AThing": {
      "properties": {
        "name": {
          "type": "string"
        },
      },
      "required": [
        "name"
      ],
      "title": "AThing",
      "type": "object"
    },
  },
  "properties": {
    "things": {
        "$ref": "AListOfThings"
    }
  },
  "required": [
    "things",
  ],
  "title": "ASchemaOfThings",
  "type": "object"
}

so i might have :

config.yml

# yaml-language-server: $schema=./schema.json

things: 
  - include: "./some-include.yml"
  - thing:
      name: "The Thing!"
  - name: "Moar things!"

./some-include.yml

- name: "All"
- name: "The"
- name: "Things"
- thing: 
    name: "Foo"
- include: "./moar-things.yml"

I want to be able to do :

./some-include.yml

# yaml-language-server: $schema=./schema.json#$AListOfThings

- name: "All"
- name: "The"
- name: "Things"
- thing: 
    name: "Foo"
- include: "./moar-things.yml"

Describe the solution you would like

allow me to specify that a yaml file be validated by a ref pointer of an existing schema.

Describe alternatives you have considered

Giving up software and becoming a farmer.

Additional context

n/a

@airtonix airtonix changed the title Support def pointers in url with schema.json#ref=RefName Support ref pointers in url with schema.json#ref=RefName Aug 31, 2024
@airtonix airtonix changed the title Support ref pointers in url with schema.json#ref=RefName Support ref pointers in url with schema.json#$RefName Aug 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant