@@ -42,7 +42,7 @@ private static class ShortcutValidator {
4242 ShortcutValidator (JsonNode schemaNode , JsonSchema parentSchema ,
4343 ValidationContext validationContext , JsonSchema schema ) {
4444 JsonNode refNode = schemaNode .get (ValidatorTypeCode .REF .getValue ());
45- JsonSchema resolvedRefSchema = refNode != null && refNode .isTextual () ? RefValidator .getRefSchema (parentSchema , validationContext ,refNode .textValue ()) : null ;
45+ JsonSchema resolvedRefSchema = refNode != null && refNode .isTextual () ? RefValidator .getRefSchema (parentSchema , validationContext ,refNode .textValue ()). getSchema () : null ;
4646 this .constants = extractConstants (schemaNode , resolvedRefSchema );
4747 this .schema = schema ;
4848 }
@@ -61,13 +61,13 @@ private Map<String, String> extractConstants(JsonNode schemaNode, JsonSchema res
6161 joined .putAll (refMap );
6262 return joined ;
6363 }
64-
64+
6565 private Map <String , String > extractConstants (JsonNode schemaNode ) {
6666 Map <String , String > result = new HashMap <String , String >();
6767 if (!schemaNode .isObject ()) {
6868 return result ;
6969 }
70-
70+
7171 JsonNode propertiesNode = schemaNode .get ("properties" );
7272 if (propertiesNode == null || !propertiesNode .isObject ()) {
7373 return result ;
@@ -81,7 +81,7 @@ private Map<String, String> extractConstants(JsonNode schemaNode) {
8181 result .put (fieldName , constantFieldValue );
8282 }
8383 }
84- return result ;
84+ return result ;
8585 }
8686 private String getConstantFieldValue (JsonNode jsonNode ) {
8787 if (jsonNode == null || !jsonNode .isObject () || !jsonNode .has ("enum" )) {
@@ -100,7 +100,7 @@ private String getConstantFieldValue(JsonNode jsonNode) {
100100 }
101101 return valueNode .textValue ();
102102 }
103-
103+
104104 public boolean allConstantsMatch (JsonNode node ) {
105105 for (Map .Entry <String , String > e : constants .entrySet ()) {
106106 JsonNode valueNode = node .get (e .getKey ());
@@ -130,15 +130,15 @@ public OneOfValidator(String schemaPath, JsonNode schemaNode, JsonSchema parentS
130130
131131 public Set <ValidationMessage > validate (JsonNode node , JsonNode rootNode , String at ) {
132132 debug (logger , node , rootNode , at );
133-
133+
134134 // this validator considers a missing node as an error
135135 // set it here to true, however re-set it to its original value upon finishing the validation
136136 boolean missingNodeAsError = config .isMissingNodeAsError ();
137137 config .setMissingNodeAsError (true );
138-
138+
139139 int numberOfValidSchema = 0 ;
140140 Set <ValidationMessage > errors = new LinkedHashSet <ValidationMessage >();
141-
141+
142142 for (ShortcutValidator validator : schemas ) {
143143 if (!validator .allConstantsMatch (node )) {
144144 // take a shortcut: if there is any constant that does not match,
@@ -164,11 +164,11 @@ public Set<ValidationMessage> validate(JsonNode node, JsonNode rootNode, String
164164 }
165165 }
166166 }
167-
167+
168168 if (numberOfValidSchema == 0 ) {
169169 for (Iterator <ValidationMessage > it = errors .iterator (); it .hasNext ();) {
170170 ValidationMessage msg = it .next ();
171-
171+
172172 if (ValidatorTypeCode .ADDITIONAL_PROPERTIES .getValue ().equals (msg .getType ())) {
173173 it .remove ();
174174 }
@@ -181,10 +181,10 @@ public Set<ValidationMessage> validate(JsonNode node, JsonNode rootNode, String
181181 if (numberOfValidSchema > 1 ) {
182182 errors = Collections .singleton (buildValidationMessage (at , "" ));
183183 }
184-
184+
185185 // reset the flag for error handling
186186 config .setMissingNodeAsError (missingNodeAsError );
187-
187+
188188 return Collections .unmodifiableSet (errors );
189189 }
190190
0 commit comments