@@ -915,9 +915,6 @@ func (schema *Schema) visitSetOperations(settings *schemaValidationSettings, val
915915 return
916916 }
917917 }
918- if settings .failfast {
919- return errSchema
920- }
921918 return & SchemaError {
922919 Value : value ,
923920 Schema : schema ,
@@ -931,14 +928,8 @@ func (schema *Schema) visitSetOperations(settings *schemaValidationSettings, val
931928 if v == nil {
932929 return foundUnresolvedRef (ref .Ref )
933930 }
934- var oldfailfast bool
935- oldfailfast , settings .failfast = settings .failfast , true
936931 err := v .visitJSON (settings , value )
937- settings .failfast = oldfailfast
938932 if err == nil {
939- if settings .failfast {
940- return errSchema
941- }
942933 return & SchemaError {
943934 Value : value ,
944935 Schema : schema ,
@@ -954,18 +945,12 @@ func (schema *Schema) visitSetOperations(settings *schemaValidationSettings, val
954945 if v == nil {
955946 return foundUnresolvedRef (item .Ref )
956947 }
957- var oldfailfast bool
958- oldfailfast , settings .failfast = settings .failfast , true
959948 err := v .visitJSON (settings , value )
960- settings .failfast = oldfailfast
961949 if err == nil {
962950 ok ++
963951 }
964952 }
965953 if ok != 1 {
966- if settings .failfast {
967- return errSchema
968- }
969954 e := & SchemaError {
970955 Value : value ,
971956 Schema : schema ,
@@ -985,19 +970,13 @@ func (schema *Schema) visitSetOperations(settings *schemaValidationSettings, val
985970 if v == nil {
986971 return foundUnresolvedRef (item .Ref )
987972 }
988- var oldfailfast bool
989- oldfailfast , settings .failfast = settings .failfast , true
990973 err := v .visitJSON (settings , value )
991- settings .failfast = oldfailfast
992974 if err == nil {
993975 ok = true
994976 break
995977 }
996978 }
997979 if ! ok {
998- if settings .failfast {
999- return errSchema
1000- }
1001980 return & SchemaError {
1002981 Value : value ,
1003982 Schema : schema ,
@@ -1011,14 +990,8 @@ func (schema *Schema) visitSetOperations(settings *schemaValidationSettings, val
1011990 if v == nil {
1012991 return foundUnresolvedRef (item .Ref )
1013992 }
1014- var oldfailfast bool
1015- oldfailfast , settings .failfast = settings .failfast , false
1016993 err := v .visitJSON (settings , value )
1017- settings .failfast = oldfailfast
1018994 if err != nil {
1019- if settings .failfast {
1020- return errSchema
1021- }
1022995 return & SchemaError {
1023996 Value : value ,
1024997 Schema : schema ,
@@ -1034,9 +1007,6 @@ func (schema *Schema) visitJSONNull(settings *schemaValidationSettings) (err err
10341007 if schema .Nullable {
10351008 return
10361009 }
1037- if settings .failfast {
1038- return errSchema
1039- }
10401010 return & SchemaError {
10411011 Value : nil ,
10421012 Schema : schema ,
@@ -1067,9 +1037,6 @@ func (schema *Schema) visitJSONNumber(settings *schemaValidationSettings, value
10671037 schemaType := schema .Type
10681038 if schemaType == "integer" {
10691039 if bigFloat := big .NewFloat (value ); ! bigFloat .IsInt () {
1070- if settings .failfast {
1071- return errSchema
1072- }
10731040 err := & SchemaError {
10741041 Value : value ,
10751042 Schema : schema ,
@@ -1087,9 +1054,6 @@ func (schema *Schema) visitJSONNumber(settings *schemaValidationSettings, value
10871054
10881055 // "exclusiveMinimum"
10891056 if v := schema .ExclusiveMin ; v && ! (* schema .Min < value ) {
1090- if settings .failfast {
1091- return errSchema
1092- }
10931057 err := & SchemaError {
10941058 Value : value ,
10951059 Schema : schema ,
@@ -1104,9 +1068,6 @@ func (schema *Schema) visitJSONNumber(settings *schemaValidationSettings, value
11041068
11051069 // "exclusiveMaximum"
11061070 if v := schema .ExclusiveMax ; v && ! (* schema .Max > value ) {
1107- if settings .failfast {
1108- return errSchema
1109- }
11101071 err := & SchemaError {
11111072 Value : value ,
11121073 Schema : schema ,
@@ -1121,9 +1082,6 @@ func (schema *Schema) visitJSONNumber(settings *schemaValidationSettings, value
11211082
11221083 // "minimum"
11231084 if v := schema .Min ; v != nil && ! (* v <= value ) {
1124- if settings .failfast {
1125- return errSchema
1126- }
11271085 err := & SchemaError {
11281086 Value : value ,
11291087 Schema : schema ,
@@ -1138,9 +1096,6 @@ func (schema *Schema) visitJSONNumber(settings *schemaValidationSettings, value
11381096
11391097 // "maximum"
11401098 if v := schema .Max ; v != nil && ! (* v >= value ) {
1141- if settings .failfast {
1142- return errSchema
1143- }
11441099 err := & SchemaError {
11451100 Value : value ,
11461101 Schema : schema ,
@@ -1158,9 +1113,6 @@ func (schema *Schema) visitJSONNumber(settings *schemaValidationSettings, value
11581113 // "A numeric instance is valid only if division by this keyword's
11591114 // value results in an integer."
11601115 if bigFloat := big .NewFloat (value / * v ); ! bigFloat .IsInt () {
1161- if settings .failfast {
1162- return errSchema
1163- }
11641116 err := & SchemaError {
11651117 Value : value ,
11661118 Schema : schema ,
@@ -1206,9 +1158,6 @@ func (schema *Schema) visitJSONString(settings *schemaValidationSettings, value
12061158 }
12071159 }
12081160 if minLength != 0 && length < int64 (minLength ) {
1209- if settings .failfast {
1210- return errSchema
1211- }
12121161 err := & SchemaError {
12131162 Value : value ,
12141163 Schema : schema ,
@@ -1221,9 +1170,6 @@ func (schema *Schema) visitJSONString(settings *schemaValidationSettings, value
12211170 me = append (me , err )
12221171 }
12231172 if maxLength != nil && length > int64 (* maxLength ) {
1224- if settings .failfast {
1225- return errSchema
1226- }
12271173 err := & SchemaError {
12281174 Value : value ,
12291175 Schema : schema ,
@@ -1321,9 +1267,6 @@ func (schema *Schema) visitJSONArray(settings *schemaValidationSettings, value [
13211267
13221268 // "minItems"
13231269 if v := schema .MinItems ; v != 0 && lenValue < int64 (v ) {
1324- if settings .failfast {
1325- return errSchema
1326- }
13271270 err := & SchemaError {
13281271 Value : value ,
13291272 Schema : schema ,
@@ -1338,9 +1281,6 @@ func (schema *Schema) visitJSONArray(settings *schemaValidationSettings, value [
13381281
13391282 // "maxItems"
13401283 if v := schema .MaxItems ; v != nil && lenValue > int64 (* v ) {
1341- if settings .failfast {
1342- return errSchema
1343- }
13441284 err := & SchemaError {
13451285 Value : value ,
13461286 Schema : schema ,
@@ -1358,9 +1298,6 @@ func (schema *Schema) visitJSONArray(settings *schemaValidationSettings, value [
13581298 sliceUniqueItemsChecker = isSliceOfUniqueItems
13591299 }
13601300 if v := schema .UniqueItems ; v && ! sliceUniqueItemsChecker (value ) {
1361- if settings .failfast {
1362- return errSchema
1363- }
13641301 err := & SchemaError {
13651302 Value : value ,
13661303 Schema : schema ,
@@ -1419,9 +1356,6 @@ func (schema *Schema) visitJSONObject(settings *schemaValidationSettings, value
14191356
14201357 // "minProperties"
14211358 if v := schema .MinProps ; v != 0 && lenValue < int64 (v ) {
1422- if settings .failfast {
1423- return errSchema
1424- }
14251359 err := & SchemaError {
14261360 Value : value ,
14271361 Schema : schema ,
@@ -1436,9 +1370,6 @@ func (schema *Schema) visitJSONObject(settings *schemaValidationSettings, value
14361370
14371371 // "maxProperties"
14381372 if v := schema .MaxProps ; v != nil && lenValue > int64 (* v ) {
1439- if settings .failfast {
1440- return errSchema
1441- }
14421373 err := & SchemaError {
14431374 Value : value ,
14441375 Schema : schema ,
@@ -1465,9 +1396,6 @@ func (schema *Schema) visitJSONObject(settings *schemaValidationSettings, value
14651396 return foundUnresolvedRef (propertyRef .Ref )
14661397 }
14671398 if err := p .visitJSON (settings , v ); err != nil {
1468- if settings .failfast {
1469- return errSchema
1470- }
14711399 err = markSchemaErrorKey (err , k )
14721400 if ! settings .multiError {
14731401 return err
@@ -1485,9 +1413,6 @@ func (schema *Schema) visitJSONObject(settings *schemaValidationSettings, value
14851413 if additionalProperties != nil || allowed == nil || (allowed != nil && * allowed ) {
14861414 if additionalProperties != nil {
14871415 if err := additionalProperties .visitJSON (settings , v ); err != nil {
1488- if settings .failfast {
1489- return errSchema
1490- }
14911416 err = markSchemaErrorKey (err , k )
14921417 if ! settings .multiError {
14931418 return err
@@ -1501,9 +1426,6 @@ func (schema *Schema) visitJSONObject(settings *schemaValidationSettings, value
15011426 }
15021427 continue
15031428 }
1504- if settings .failfast {
1505- return errSchema
1506- }
15071429 err := & SchemaError {
15081430 Value : value ,
15091431 Schema : schema ,
@@ -1525,9 +1447,6 @@ func (schema *Schema) visitJSONObject(settings *schemaValidationSettings, value
15251447 if s := schema .Properties [k ]; s != nil && s .Value .WriteOnly && settings .asrep {
15261448 continue
15271449 }
1528- if settings .failfast {
1529- return errSchema
1530- }
15311450 err := markSchemaErrorKey (& SchemaError {
15321451 Value : value ,
15331452 Schema : schema ,
@@ -1549,9 +1468,6 @@ func (schema *Schema) visitJSONObject(settings *schemaValidationSettings, value
15491468}
15501469
15511470func (schema * Schema ) expectedType (settings * schemaValidationSettings , typ string ) error {
1552- if settings .failfast {
1553- return errSchema
1554- }
15551471 return & SchemaError {
15561472 Value : typ ,
15571473 Schema : schema ,
0 commit comments