json-yaml-validate icon indicating copy to clipboard operation
json-yaml-validate copied to clipboard

Feature: Support Inline Schemas

Open brianespinosa opened this issue 1 year ago • 1 comments

Feature: Support inline schemas

It is possible to define a path to a schema in both json and yaml files. It would be great if we could pick these schema references up and use them to validate a file.

For yaml, this inline syntax looks to be part of the spec. For json, this is technically not part of the json-schema spec, but is specific to VSCode... though is starting to pick up more broad use. The trick would be to be able to validate a JSON file and understand if the file is itself a schema or if it is referencing a schema draft.

I would be happy to take a shot at adding support for both of these use cases, but if we think this is out of scope for this plugin, please let me know so I can instead implement this separately as a different action that only supports this inline syntax.

Success Criteria:

  • Allows validation of JSON files when they have an inline reference to a $schema file.
  • Allows validation of YAML files when they have an inline reference to a # yaml-language-server: $schema= comment.
  • Both of the above should work with relative, absolute, or url paths.

brianespinosa avatar Sep 26 '23 20:09 brianespinosa

I would be happy to take a shot at adding support for both of these use cases

@brianespinosa Thank you so much! I think this is absolutely in-scope of this Action and other folks may very well appreciate this feature. Give it a go, open a pull request, and I'll take a look when its ready! @ mention me if you need any support :heart:

GrantBirki avatar Sep 26 '23 21:09 GrantBirki