diff --git a/package.json b/package.json index 5198552a1..88effa2e8 100644 --- a/package.json +++ b/package.json @@ -59,7 +59,7 @@ "runkitExampleFilename": ".runkit_example.js", "dependencies": { "fast-deep-equal": "^3.1.3", - "fast-uri": "^2.4.0", + "fast-uri": "^3.0.1", "json-schema-traverse": "^1.0.0", "require-from-string": "^2.0.2" }, diff --git a/spec/resolve.spec.ts b/spec/resolve.spec.ts index a89cccaf7..032f99ff8 100644 --- a/spec/resolve.spec.ts +++ b/spec/resolve.spec.ts @@ -180,6 +180,41 @@ uriResolvers.forEach((resolver) => { }) }) + describe("URIs with encoded characters (issue #2447)", () => { + it("should resolve the ref", () => { + const schema = { + $ref: "#/definitions/Record%3Cstring%2CPerson%3E", + $schema: "http://json-schema.org/draft-07/schema#", + definitions: { + Person: { + type: "object", + properties: { + firstName: { + type: "string", + description: "The person's first name.", + }, + }, + }, + "Record": { + type: "object", + additionalProperties: { + $ref: "#/definitions/Person", + }, + }, + }, + } + const data = { + joe: { + firstName: "Joe", + }, + } + instances.forEach((ajv) => { + const validate = ajv.compile(schema) + validate(data).should.equal(true) + }) + }) + }) + describe("missing schema error", function () { this.timeout(4000)