Skip to content

Local references in external schemas are not resolved. #9

Open
@csdebruin

Description

@csdebruin
    const resolvedSchema = resolver.resolve(
        {
            "$id": "test",
            "title": "Test",
            "type": "object",
            "properties": {
                "TestString": { "$ref": "DefSchema#/$defs/Username" }
            }                      
        }, 
        {
            externalSchemas: [
                {
                    "$id": "DefSchema",
                    "$defs": {
                        "Username": { "$ref": "#/$defs/string:10" },
                        "string:10": {
                            "type": "string",
                            "maxLength": 10
                        }
                    }
                }
            ]
        }
    )

Produces the following incorrect reference:

{
  "$id": "test",
  "definitions": {
     "def-0": {
      "$defs": {
        "Username": { "$ref": "#/$defs/string:10" }
      }
    }
  }
}

As opposed to the expected:

{
  "$id": "test",
  "definitions": {
     "def-0": {
      "$defs": {
        "Username": { "$ref": "#/definitions/def-0/$defs/string:10" }
      }
    }
  }
}

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions