@@ -82,8 +82,8 @@ public interface ValidationCriterion {
82
82
*/
83
83
public static final ValidationCriterion ALL_CRITERION = (subschemaCount , matchingCount ) -> {
84
84
if (matchingCount < subschemaCount ) {
85
- throw new ValidationException (String .format ("only %d subschema matches out of %d" ,
86
- matchingCount , subschemaCount ));
85
+ throw new ValidationException (null , String .format ("only %d subschema matches out of %d" ,
86
+ matchingCount , subschemaCount ), "allOf" );
87
87
}
88
88
};
89
89
@@ -92,9 +92,9 @@ public interface ValidationCriterion {
92
92
*/
93
93
public static final ValidationCriterion ANY_CRITERION = (subschemaCount , matchingCount ) -> {
94
94
if (matchingCount == 0 ) {
95
- throw new ValidationException (String .format (
95
+ throw new ValidationException (null , String .format (
96
96
"no subschema matched out of the total %d subschemas" ,
97
- subschemaCount ));
97
+ subschemaCount ), "anyOf" );
98
98
}
99
99
};
100
100
@@ -103,8 +103,8 @@ public interface ValidationCriterion {
103
103
*/
104
104
public static final ValidationCriterion ONE_CRITERION = (subschemaCount , matchingCount ) -> {
105
105
if (matchingCount != 1 ) {
106
- throw new ValidationException (String .format ("%d subschemas matched instead of one" ,
107
- matchingCount ));
106
+ throw new ValidationException (null , String .format ("%d subschemas matched instead of one" ,
107
+ matchingCount ), "oneOf" );
108
108
}
109
109
};
110
110
@@ -171,7 +171,11 @@ public void validate(final Object subject) {
171
171
try {
172
172
criterion .validate (subschemas .size (), matchingCount );
173
173
} catch (ValidationException e ) {
174
- throw new ValidationException (this , e .getMessage (), failures );
174
+ throw new ValidationException (this ,
175
+ new StringBuilder (e .getPointerToViolation ()),
176
+ e .getMessage (),
177
+ failures ,
178
+ e .getKeyword ());
175
179
}
176
180
}
177
181
}
0 commit comments