Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace fast-deep-equal to fast-equals #2235

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions lib/compile/resolve.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import type {AnySchema, AnySchemaObject, UriResolver} from "../types"
import type Ajv from "../ajv"
import type {URIComponents} from "uri-js"
import {eachItem} from "./util"
import * as equal from "fast-deep-equal"
import {deepEqual} from "fast-equals"
import * as traverse from "json-schema-traverse"

// the hash of local references inside the schema (created by getSchemaRefs), used for inline resolution
Expand Down Expand Up @@ -140,7 +140,7 @@ export function getSchemaRefs(this: Ajv, schema: AnySchema, baseId: string): Loc
return localRefs

function checkAmbiguosRef(sch1: AnySchema, sch2: AnySchema | undefined, ref: string): void {
if (sch2 !== undefined && !equal(sch1, sch2)) throw ambiguos(ref)
if (sch2 !== undefined && !deepEqual(sch1, sch2)) throw ambiguos(ref)
}

function ambiguos(ref: string): Error {
Expand Down
8 changes: 4 additions & 4 deletions lib/runtime/equal.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// https://github.com/ajv-validator/ajv/issues/889
import * as equal from "fast-deep-equal"
import {deepEqual} from "fast-equals"

type Equal = typeof equal & {code: string}
;(equal as Equal).code = 'require("ajv/dist/runtime/equal").default'
type Equal = typeof deepEqual & {code: string}
;(deepEqual as Equal).code = 'require("ajv/dist/runtime/equal").default'

export default equal as Equal
export default deepEqual as Equal
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
"homepage": "https://ajv.js.org",
"runkitExampleFilename": ".runkit_example.js",
"dependencies": {
"fast-deep-equal": "^3.1.1",
"fast-equals": "^5.0.0",
"json-schema-traverse": "^1.0.0",
"require-from-string": "^2.0.2",
"uri-js": "^4.2.2"
Expand Down