Skip to content

Commit

Permalink
feat: add test for encoded refs and bump fast-uri (#2449)
Browse files Browse the repository at this point in the history
* test: add encoded ref test

* bump fast-uri

* remove .only
  • Loading branch information
jasoniangreen committed Jul 7, 2024
1 parent a18641e commit 595fe58
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 1 deletion.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
},
Expand Down
35 changes: 35 additions & 0 deletions spec/resolve.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<string,Person>": {
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)

Expand Down

0 comments on commit 595fe58

Please sign in to comment.