File tree Expand file tree Collapse file tree 3 files changed +13
-12
lines changed
core/src/main/java/org/everit/json/schema Expand file tree Collapse file tree 3 files changed +13
-12
lines changed Original file line number Diff line number Diff line change @@ -45,14 +45,8 @@ public Schema getMustNotMatch() {
45
45
return mustNotMatch ;
46
46
}
47
47
48
- @ Override
49
- public void validate (final Object subject ) {
50
- try {
51
- mustNotMatch .validate (subject );
52
- } catch (ValidationException e ) {
53
- return ;
54
- }
55
- throw failure ("subject must not be valid against schema " + mustNotMatch , "not" );
48
+ @ Override void accept (Visitor visitor ) {
49
+ visitor .visitNotSchema (this );
56
50
}
57
51
58
52
@ Override
@@ -69,10 +63,6 @@ public boolean equals(Object o) {
69
63
}
70
64
}
71
65
72
- @ Override void accept (Visitor visitor ) {
73
- throw new UnsupportedOperationException ("not yet implemented" );
74
- }
75
-
76
66
@ Override
77
67
public int hashCode () {
78
68
return Objects .hash (super .hashCode (), mustNotMatch );
Original file line number Diff line number Diff line change @@ -64,6 +64,14 @@ private static boolean isNull(Object obj) {
64
64
failureReporter .failure ("false schema always fails" , "false" );
65
65
}
66
66
67
+ @ Override void visitNotSchema (NotSchema notSchema ) {
68
+ Schema mustNotMatch = notSchema .getMustNotMatch ();
69
+ ValidationException failure = getFailureOfSchema (mustNotMatch , subject );
70
+ if (failure == null ) {
71
+ failureReporter .failure ("subject must not be valid against schema " + mustNotMatch , "not" );
72
+ }
73
+ }
74
+
67
75
ValidationException getFailureOfSchema (Schema schema , Object input ) {
68
76
Object origSubject = this .subject ;
69
77
this .subject = input ;
Original file line number Diff line number Diff line change @@ -99,4 +99,7 @@ void visitEnumSchema(EnumSchema enumSchema) {
99
99
100
100
void visitFalseSchema (FalseSchema falseSchema ) {
101
101
}
102
+
103
+ void visitNotSchema (NotSchema notSchema ) {
104
+ }
102
105
}
You can’t perform that action at this time.
0 commit comments