Skip to content

YAML Language Server checks against JSON Schema Draft 7 instead of the defined one #780

Closed
@ngregory-rbi

Description

@ngregory-rbi

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

  1. Open VSCode
  2. Create a new file called openapi.yml
  3. Switch the schema to version 3.0 (based on the added feature for Support versions from schemastore #639)
  4. Type anything
  5. 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
  • Mac
  • Linux
  • other (please specify)

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