YAML Language Server checks against JSON Schema Draft 7 instead of the defined one
Describe the bug
Expected Behavior
The YAML Language Server respects the $schema property and checks against the meta-schema defined by it.
Current Behavior
The YAML Language Server ignores the $schema property and instead checks against the JSON Schema Draft 7 meta-schema.
Steps to Reproduce
- Open VSCode
- Create a new file called
openapi.yml - Switch the schema to version 3.0 (based on the added feature for #639)
- Type anything
- Observe the error:
Schema 'schema.json' is not valid:
/definitions/Schema/properties/multipleOf/exclusiveMinimum : must be number
The Open API v3.0 schema uses the $schema property like so:
"$schema": "http://json-schema.org/draft-04/schema#",
In Draft 4, exclusiveMinimum MUST be a boolean.
However, in the latest draft (currently 2020-12), exclusiveMinimum MUST be a number. It appears this is the meta-schema the language server is checking against, despite the schema specifically specifying Draft 4.
EDIT: It appears to be checking against Draft 7, which does also say exclusiveMinimum MUST be a number.
EDIT 2: Ok so Draft 4 is REALLY old and is no longer in ajv (the tool used to validate the schema). Not sure if this needs to be actioned, or if one would just need to wait for additional tooling (like Swagger) to finally support v3.1.
Environment
- [ ] Windows
- [x] Mac
- [ ] Linux
- [ ] other (please specify)
check this out: https://github.com/okybr/yaml-language-server/blob/0c344c441be72b7fffc7b2d98a81ef9113aced76/README.md
related issues:
- https://github.com/redhat-developer/yaml-language-server/issues/752
- https://github.com/OAI/OpenAPI-Specification/issues/2969
Is anybody picking this up?
~~you could just merge this commit in order to fix it: https://github.com/okybr/yaml-language-server/commit/455d452f66c700a3101f87b3970f882c3967e986~~
edit: we need a better solution. a solution that makes it possible to choose the draft version.
Okay, I might have something up my sleeve for this.
Any update available on this? I'm looking into creating some schema and it'd be great if I could use the 2020-12 schema.
@gorkem, this is not an enhancement, it's a bug!
@KillDozerX2, have you found time to work on this?
@gorkem, this is not an enhancement, it's a bug!
@KillDozerX2, have you found time to work on this?
Apologies, I haven't looked into this yet.