@@ -56,11 +56,7 @@ function resolveRef (location, ref) {
5656 throw new Error ( `Cannot find reference "${ ref } "` )
5757 }
5858
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 )
6460 if ( schema . $ref !== undefined ) {
6561 return resolveRef ( newLocation , schema . $ref )
6662 }
@@ -137,6 +133,11 @@ function build (schema, options) {
137133 for ( const schemaId of validatorSchemasIds ) {
138134 const schema = refResolver . getSchema ( schemaId )
139135 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+ }
140141 }
141142
142143 const dependenciesName = [ 'validator' , 'serializer' , contextFunctionCode ]
@@ -454,7 +455,6 @@ function mergeAllOfSchema (location, schema, mergedSchema) {
454455}
455456
456457function addIfThenElse ( location , input ) {
457- location . isValidated = true
458458 validatorSchemasIds . add ( location . getSchemaId ( ) )
459459
460460 const schema = merge ( { } , location . schema )
@@ -840,7 +840,6 @@ function buildValue (location, input) {
840840 let code = ''
841841
842842 if ( type === undefined && ( schema . anyOf || schema . oneOf ) ) {
843- location . isValidated = true
844843 validatorSchemasIds . add ( location . getSchemaId ( ) )
845844
846845 const type = schema . anyOf ? 'anyOf' : 'oneOf'
0 commit comments