Skip to content

Commit 0393eb6

Browse files
committed
Revert "Revert fast-uri change (ajv-validator#2444)"
This reverts commit c8b37f4.
1 parent c8b37f4 commit 0393eb6

File tree

7 files changed

+12
-12
lines changed

7 files changed

+12
-12
lines changed

docs/options.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -344,7 +344,7 @@ Include human-readable messages in errors. `true` by default. `false` can be pas
344344

345345
### uriResolver
346346

347-
By default `uriResolver` is undefined and relies on the embedded uriResolver [uri-js](https://github.com/garycourt/uri-js). Pass an object that satisfies the interface [UriResolver](https://github.com/ajv-validator/ajv/blob/master/lib/types/index.ts) to be used in replacement. One alternative is [fast-uri](https://github.com/fastify/fast-uri).
347+
By default `uriResolver` is undefined and relies on the embedded uriResolver [fast-uri](https://github.com/fastify/fast-uri). Pass an object that satisfies the interface [UriResolver](https://github.com/ajv-validator/ajv/blob/master/lib/types/index.ts) to be used in replacement. One alternative is [uri-js](https://github.com/garycourt/uri-js).
348348

349349
### code <Badge text="v7" />
350350

lib/compile/index.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import N from "./names"
1414
import {LocalRefs, getFullPath, _getFullPath, inlineRef, normalizeId, resolveUrl} from "./resolve"
1515
import {schemaHasRulesButRef, unescapeFragment} from "./util"
1616
import {validateFunctionCode} from "./validate"
17-
import * as URI from "uri-js"
17+
import * as URI from "fast-uri"
1818
import {JSONType} from "./rules"
1919

2020
export type SchemaRefs = {

lib/compile/resolve.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import type {AnySchema, AnySchemaObject, UriResolver} from "../types"
22
import type Ajv from "../ajv"
3-
import type {URIComponents} from "uri-js"
3+
import type {URIComponents} from "fast-uri"
44
import {eachItem} from "./util"
55
import * as equal from "fast-deep-equal"
66
import * as traverse from "json-schema-traverse"

lib/runtime/uri.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import * as uri from "uri-js"
1+
import * as uri from "fast-uri"
22

33
type URI = typeof uri & {code: string}
44
;(uri as URI).code = 'require("ajv/dist/runtime/uri").default'

lib/types/index.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import * as URI from "uri-js"
1+
import * as URI from "fast-uri"
22
import type {CodeGen, Code, Name, ScopeValueSets, ValueScopeName} from "../compile/codegen"
33
import type {SchemaEnv, SchemaCxt, SchemaObjCxt} from "../compile"
44
import type {JSONType} from "../compile/rules"

package.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,9 @@
5959
"runkitExampleFilename": ".runkit_example.js",
6060
"dependencies": {
6161
"fast-deep-equal": "^3.1.3",
62+
"fast-uri": "^2.3.0",
6263
"json-schema-traverse": "^1.0.0",
63-
"require-from-string": "^2.0.2",
64-
"uri-js": "^4.4.1"
64+
"require-from-string": "^2.0.2"
6565
},
6666
"devDependencies": {
6767
"@ajv-validator/config": "^0.5.0",
@@ -83,7 +83,6 @@
8383
"dayjs-plugin-utc": "^0.1.2",
8484
"eslint": "^8.57.0",
8585
"eslint-config-prettier": "^9.1.0",
86-
"fast-uri": "^2.3.0",
8786
"glob": "^10.3.10",
8887
"husky": "^9.0.11",
8988
"if-node-version": "^1.1.1",
@@ -104,6 +103,7 @@
104103
"rollup-plugin-terser": "^7.0.2",
105104
"ts-node": "^10.9.2",
106105
"tsify": "^5.0.4",
106+
"uri-js": "^4.4.1",
107107
"typescript": "5.3.3"
108108
},
109109
"collective": {

spec/resolve.spec.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,17 @@ import _Ajv from "./ajv"
44
import type {AnyValidateFunction} from "../dist/types"
55
import type MissingRefError from "../dist/compile/ref_error"
66
import chai from "./chai"
7-
import * as fastUri from "fast-uri"
7+
import * as uriJs from "uri-js"
88
const should = chai.should()
99

10-
const uriResolvers = [undefined, fastUri]
10+
const uriResolvers = [undefined, uriJs]
1111

1212
uriResolvers.forEach((resolver) => {
1313
let describeTitle: string
1414
if (resolver !== undefined) {
15-
describeTitle = "fast-uri resolver"
16-
} else {
1715
describeTitle = "uri-js resolver"
16+
} else {
17+
describeTitle = "fast-uri resolver"
1818
}
1919
describe(describeTitle, () => {
2020
describe("resolve", () => {

0 commit comments

Comments
 (0)