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

Yaml cant seem to process draft-4/7 schema editing #935

Open
2 tasks
cavanaug opened this issue Nov 13, 2023 · 1 comment
Open
2 tasks

Yaml cant seem to process draft-4/7 schema editing #935

cavanaug opened this issue Nov 13, 2023 · 1 comment

Comments

@cavanaug
Copy link

Describe the bug

Im not sure if this is a bug or if Im just misunderstanding things, but I think its a bug.

If this is an issue with a schema and you have not set a schema yourself then please file the issue on https://github.com/SchemaStore/schemastore.

If you are having an issue with a schema that you have set yourself then please attach the schema as well as the YAML to the bug report.\

yaml-language-server: $schema=http://json-schema.org/draft-04/schema#

$schema: http://json-schema.org/draft-04/schema#

Expected Behavior

So I am basically authoring jsonschemas using yaml. So my schema is the draft-04 available from json-schema.org. I am expecting to be able to use intellisense and have completion of things like type: etc just as I do if I was authoring in json.

Current Behavior

I am getting errors "Schema 'schema.json' is not valid: /properties/multipleOf/exclusiveMinimum : must be number

Steps to Reproduce

  1. Grab any jsonschema that uses draft-4/7, use yq to convert it to yaml
  2. Add the #yaml-language-server reference to draft4/7
  3. Try using either vscode or nvim to edit (with the appropriate lspconfig)
  4. Edit the file and try to get a hint for completion on something like type: which should give you a list of enums from draft4/7 of the appropriate field types

Environment

  • [ X] Windows
  • Mac
  • [ X] Linux
  • other (please specify)
@cavanaug
Copy link
Author

Oh, and I misspoke above regarding draft-4/7, the problem only exists with draf4.

So I have done a bit more investigation on this issue. Its sort of bizarre in that it seems to be forcing the draft4 schema to conform to draft7+ version of jsonschema definition. In the draft7 version exclusiveMinimum and exclusiveMaximum changed from a boolean type to an integer.

The quickfix for this issue from a user perspective is to specify a draft7 for the language server, even if you are editing a draft4 schema. Lame, but it works and is "close" enough...

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