Skip to content

Use of $id in $ref is not working #321

@sunilgunisetty

Description

@sunilgunisetty

I have the following schema in 2 different files.

// ProductDescription.json
{
    "$schema" : "http://json-schema.org/draft-07/schema",
    "$id": "https://some-host.com/ProductDescription.json",
    "type": "object",
    "properties": {.
                   "uuid": {
                       "description": "The internal UUID uniquely identifying this entity",
                       "allOf": [
                           { "$ref": "/Types.json#uuid" }
                        ]
                    },    
       }
}

and

//Types.json
{
    "$schema" : "http://json-schema.org/draft-07/schema",
    "$id": "https://some-host.com/types.json",
    "definitions": {
        "uuid": {
            "$id": "#uuid",
            "type": "string",
            "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
        }
    }
}

When I try to load ProductDescription.json I get exception with a message a JSON pointer should start with '/' or '#/' .

I am using static load method in SchemaLoader class to load the schema.

In my front end I use ajv with the same files and it works without any issue.

Am I missing something / am I using wrong methods. Any suggestions is highly appreciated.

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