11import { Ajv , type AsyncValidateFunction , type ValidateFunction } from "ajv" ;
22import type { ErrorObject , AnySchema } from "ajv" ;
3+ import type { AnyValidateFunction } from "ajv/dist/core.js" ;
34
4- import type { MaybePromise } from '@sjsf/form/lib/types' ;
5- import { deepEqual } from "@sjsf/form/lib/deep-equal" ;
5+ import type { MaybePromise } from "@sjsf/form/lib/types" ;
66import { getValueByPath } from "@sjsf/form/lib/object" ;
77import { weakMemoize } from "@sjsf/form/lib/memoize" ;
88import {
99 ID_KEY ,
1010 prefixSchemaRefs ,
1111 ROOT_SCHEMA_PREFIX ,
12+ isSchemaDeepEqual ,
1213 type Schema ,
1314 type SchemaDefinition ,
1415 type SchemaValue ,
@@ -25,7 +26,6 @@ import {
2526 type UiSchema ,
2627 type UiSchemaRoot ,
2728} from "@sjsf/form" ;
28- import type { AnyValidateFunction } from "ajv/dist/core.js" ;
2929
3030const trueSchema : Schema = { } ;
3131const falseSchema : Schema = {
@@ -58,9 +58,12 @@ export function makeSchemaCompiler<A extends boolean>(ajv: Ajv, _async: A) {
5858 return ( schema : Schema , rootSchema : Schema ) => {
5959 rootSchemaId = rootSchema [ ID_KEY ] ?? ROOT_SCHEMA_PREFIX ;
6060 let ajvSchema = ajv . getSchema ( rootSchemaId ) ?. schema ;
61- // @deprecated
62- // TODO: Replace deep equality comparison with reference equality by default
63- if ( ajvSchema !== undefined && ! deepEqual ( ajvSchema , rootSchema ) ) {
61+ if (
62+ ajvSchema !== undefined &&
63+ // @deprecated
64+ // TODO: Replace deep equality comparison with reference equality by default
65+ ! isSchemaDeepEqual ( ajvSchema as Schema , rootSchema )
66+ ) {
6467 ajv . removeSchema ( rootSchemaId ) ;
6568 validatorsCache . delete ( schema ) ;
6669 ajvSchema = undefined ;
0 commit comments