Skip to content

Not working validator with imports #2

@kamilkazmierczakMtab

Description

@kamilkazmierczakMtab

I am trying to validate my json structure files with json_structure_schema_validator.py available in this repo but I am having issues with imports.

I tried simple example from docs and I can't make it work. I don't know if I am doing something wrong or there is some issue with validator

with Main

{
  "$schema": "https://json-structure.org/meta/core/v0/#",
  "$id": "https://example.com/main.json",
  "name": "Main",
  "type": "object",
  "properties": {
    "person": {
      "type": { "$ref": "#/definitions/People/Person" }
    },
    "shippingAddress": {
      "type": { "$ref": "#/definitions/People/Address" }
    }
  },
  "definitions": {
    "People": {
      "$import": "https://example.com/people.json"
    }
  }
}

and People

{
  "$schema": "https://json-structure.org/meta/core/v0/#",
  "$id": "https://example.com/people.json",
  "name": "Person",
  "type": "object",
  "properties": {
    "firstName": { "type": "string" },
    "lastName": { "type": "string" },
    "address": { "$ref": "#/definitions/Address" }
  },
  "definitions": {
    "Address": {
      "type": "object",
      "properties": {
        "street": { "type": "string" },
        "city": { "type": "string" }
      }
    }
  }
}

Running json_structure_schema_validator.py --allowimport --importmap https://example.com/people.json\=./people.json ./main.json
Results with

Schema is invalid:
 - JSON Pointer segment '/Address' not found. (Location: #/definitions/People/Person/properties/address/$ref, line/column unknown)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions