OptimumCode/json-schema-validator

Bug: id with absolute uri-reference results in incorrect reference resolution

Closed this issue · 0 comments

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

When the root id is https://example.com/schemas/unevaluated-items-are-disallowed the inner id /schemas/unevaluated-items-are-allowed results in https://example.com/schemas//schemas/unevaluated-items-are-allowed

Expected Behavior

When the root id is https://example.com/schemas/unevaluated-items-are-disallowed the inner id /schemas/unevaluated-items-are-allowed results in https://example.com/schemas/unevaluated-items-are-allowed

JSON schema

{
  "$schema": "https://json-schema.org/draft/2019-09/schema",
  "$id": "https://example.com/schemas/unevaluated-items-are-disallowed",
  "$ref": "/schemas/unevaluated-items-are-allowed",
  "$recursiveAnchor": true,
  "unevaluatedItems": false,
  "$defs": {
    "/schemas/unevaluated-items-are-allowed": {
      "$schema": "https://json-schema.org/draft/2019-09/schema",
      "$id": "/schemas/unevaluated-items-are-allowed",
      "$recursiveAnchor": true,
      "type": "array",
      "items": [
        {
          "type": "string"
        },
        {
          "$ref": "#"
        }
      ]
    }
  }
}

Library version

0.0.13

Anything else?

Found with the help of bowtie report because json-schema-org/JSON-Schema-Test-Suite#731 was added