Skip to content

Schema validation with remote specs #16

Open
@utrack

Description

@utrack

Hi Ferdinand, thanks for maintaining this fork! Looks p awesome :)

Can you clarify how do I actually run the schema validation for me, please?

What I've got:

data JSON (example):

{
    "$schema": "./../json.schema/form.schema.json",
    "form": [
        {
            "type": "string"
        }
    ]
}

../json.schema/form.schema.json JSON:

{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "form.schema.json",
  "title": "Form",
  "description": "A form description",
  "type": "array",
  "minItems": 1,
  "properties": {
    "form": {
      "items": {
        "oneOf": [
          {
            "$ref": "string.schema.json"
          },
          {
            "$ref": "number.schema.json"
          },
          {
            "$ref": "phone.schema.json"
          }
        ]
      }
    }
  }
}

Expected:

jsonlint ./example.json -V
($schema is read automatically, error about form[0] not having "name" property)

Actual:

jsonlint ./example.json -V ../json.schema/form.schema.json                                                                                                                                                                                 
File: form.json
Loading the JSON schema failed: "../json.schema/form.schema.json".
Compiling the JSON schema failed.
no schema with key or ref "https://json-schema.org/draft/2020-12/schema"

I've tried setting the json-schema ref to https://json-schema.org/draft-07/schema but the error for that was the same.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions