@@ -56,11 +56,7 @@ function resolveRef (location, ref) {
56
56
throw new Error ( `Cannot find reference "${ ref } "` )
57
57
}
58
58
59
- if ( location . isValidated ) {
60
- validatorSchemasIds . add ( schemaId )
61
- }
62
-
63
- const newLocation = new Location ( schema , schemaId , jsonPointer , location . isValidated )
59
+ const newLocation = new Location ( schema , schemaId , jsonPointer )
64
60
if ( schema . $ref !== undefined ) {
65
61
return resolveRef ( newLocation , schema . $ref )
66
62
}
@@ -137,6 +133,11 @@ function build (schema, options) {
137
133
for ( const schemaId of validatorSchemasIds ) {
138
134
const schema = refResolver . getSchema ( schemaId )
139
135
validator . addSchema ( schema , schemaId )
136
+
137
+ const dependencies = refResolver . getSchemaDependencies ( schemaId )
138
+ for ( const [ schemaId , schema ] of Object . entries ( dependencies ) ) {
139
+ validator . addSchema ( schema , schemaId )
140
+ }
140
141
}
141
142
142
143
const dependenciesName = [ 'validator' , 'serializer' , contextFunctionCode ]
@@ -454,7 +455,6 @@ function mergeAllOfSchema (location, schema, mergedSchema) {
454
455
}
455
456
456
457
function addIfThenElse ( location , input ) {
457
- location . isValidated = true
458
458
validatorSchemasIds . add ( location . getSchemaId ( ) )
459
459
460
460
const schema = merge ( { } , location . schema )
@@ -840,7 +840,6 @@ function buildValue (location, input) {
840
840
let code = ''
841
841
842
842
if ( type === undefined && ( schema . anyOf || schema . oneOf ) ) {
843
- location . isValidated = true
844
843
validatorSchemasIds . add ( location . getSchemaId ( ) )
845
844
846
845
const type = schema . anyOf ? 'anyOf' : 'oneOf'
0 commit comments