Skip to content

Handle url encoded $ref pointers in subschema expansion#1684

Open
kyum1n wants to merge 1 commit intojson-editor:masterfrom
sprylab:uri_decode_pointers
Open

Handle url encoded $ref pointers in subschema expansion#1684
kyum1n wants to merge 1 commit intojson-editor:masterfrom
sprylab:uri_decode_pointers

Conversation

@kyum1n
Copy link
Copy Markdown

@kyum1n kyum1n commented Jan 20, 2026

Fixes a bug where $refs with percent-encoding were not resolved and resulted in no validation (always passing) and no editor restrictions (can select anything).

Seems like it was already fixed a while ago in the original repo (jdorn/json-editor#402).
As far as I could trace it back, last it worked was in 2.6.1 and broke in 2.7.0 with 615de2d likely being the cause where the path segments were not uri decoded.

In our specific case, we built a schema using ts-json-schema-generator with generics:

export type Foo = {
    foo: Bar<string>
}

export type Bar<T> = {
    bar: T
}

which then generated the following schema:

{
  "$ref": "#/definitions/Foo",
  "$schema": "http://json-schema.org/draft-07/schema#",
  "definitions": {
    "Bar<string>": {
      "additionalProperties": false,
      "properties": {
        "bar": {
          "type": "string"
        }
      },
      "required": [
        "bar"
      ],
      "type": "object"
    },
    "Foo": {
      "additionalProperties": false,
      "properties": {
        "foo": {
          "$ref": "#/definitions/Bar%3Cstring%3E"
        }
      },
      "required": [
        "foo"
      ],
      "type": "object"
    }
  }
}

and resulted in observing this bug.

As far as I can tell, this should be backward-compatible and I also added a minimal test case using <> in a defintion name.

Q A
Is bugfix? ✔️
New feature?
Is backward-compatible? ✔️
Tests pass? ✔️
Fixed issues -
Updated README/docs?
Added CHANGELOG entry? ✔️

@kyum1n kyum1n force-pushed the uri_decode_pointers branch from a4db091 to a00cd2b Compare January 21, 2026 13:56
@kyum1n
Copy link
Copy Markdown
Author

kyum1n commented Jan 22, 2026

I think those errors on the firefox jobs do not seem to be caused by my changes.

Build and Test / end-to-end-test (firefox, build.prod) (pull_request) seems like it went through and failed somewhere in the "after all" hook?

Build and Test / end-to-end-test (firefox, build.nonmin.travis) (pull_request) has two failed tests:
in core: should override error messages if specified in schema options @core @errors-messages exceeded the 30 second timeout. Running this locally with the docker compose setup on my machine already took 20167ms, so I guess it just took too long in CI.
in integer: should update output when (method) setValue is called @integer_range seems just to be flaky, especially looking at 62a27fc, which looks like an attempt to make it less flaky.

The corresponding chrome jobs finished without errors. I would appreciate any feedback how to move this further.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant