Skip to content

Commit 316a415

Browse files
jasoniangreenAlbinaBlazhko17
authored andcommitted
Revert fast-uri change (ajv-validator#2444)
* Revert "Replace `uri-js` with `fast-uri` (ajv-validator#2415)" This reverts commit fa1b5d5. * bump version to 8.16.0
1 parent aa74a5e commit 316a415

File tree

7 files changed

+12
-12
lines changed

7 files changed

+12
-12
lines changed

docs/options.md

Lines changed: 1 addition & 1 deletion
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 [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).
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).
348348

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

lib/compile/index.ts

Lines changed: 1 addition & 1 deletion
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 "fast-uri"
17+
import * as URI from "uri-js"
1818
import {JSONType} from "./rules"
1919

2020
export type SchemaRefs = {

lib/compile/resolve.ts

Lines changed: 1 addition & 1 deletion
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 "fast-uri"
3+
import type {URIComponents} from "uri-js"
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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import * as uri from "fast-uri"
1+
import * as uri from "uri-js"
22

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

lib/types/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import * as URI from "fast-uri"
1+
import * as URI from "uri-js"
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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,9 +61,9 @@
6161
"runkitExampleFilename": ".runkit_example.js",
6262
"dependencies": {
6363
"fast-deep-equal": "^3.1.3",
64-
"fast-uri": "^2.3.0",
6564
"json-schema-traverse": "^1.0.0",
66-
"require-from-string": "^2.0.2"
65+
"require-from-string": "^2.0.2",
66+
"uri-js": "^4.4.1"
6767
},
6868
"devDependencies": {
6969
"@ajv-validator/config": "^0.5.0",
@@ -85,6 +85,7 @@
8585
"dayjs-plugin-utc": "^0.1.2",
8686
"eslint": "^8.57.0",
8787
"eslint-config-prettier": "^9.1.0",
88+
"fast-uri": "^2.3.0",
8889
"glob": "^10.3.10",
8990
"husky": "^9.0.11",
9091
"if-node-version": "^1.1.1",
@@ -105,7 +106,6 @@
105106
"rollup-plugin-terser": "^7.0.2",
106107
"ts-node": "^10.9.2",
107108
"tsify": "^5.0.4",
108-
"uri-js": "^4.4.1",
109109
"typescript": "5.3.3"
110110
},
111111
"collective": {

spec/resolve.spec.ts

Lines changed: 4 additions & 4 deletions
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 uriJs from "uri-js"
7+
import * as fastUri from "fast-uri"
88
const should = chai.should()
99

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

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

0 commit comments

Comments
 (0)