@@ -26,6 +26,7 @@ public class ValidationMessage {
26
26
private String type ;
27
27
private String code ;
28
28
private String path ;
29
+ private String schemaPath ;
29
30
private String [] arguments ;
30
31
private Map <String , Object > details ;
31
32
private String message ;
@@ -41,6 +42,9 @@ void setCode(String code) {
41
42
this .code = code ;
42
43
}
43
44
45
+ /**
46
+ * @return The path to the input json
47
+ */
44
48
public String getPath () {
45
49
return path ;
46
50
}
@@ -49,6 +53,17 @@ void setPath(String path) {
49
53
this .path = path ;
50
54
}
51
55
56
+ /**
57
+ * @return The path to the schema
58
+ */
59
+ public String getSchemaPath () {
60
+ return schemaPath ;
61
+ }
62
+
63
+ public void setSchemaPath (String schemaPath ) {
64
+ this .schemaPath = schemaPath ;
65
+ }
66
+
52
67
public String [] getArguments () {
53
68
return arguments ;
54
69
}
@@ -88,6 +103,7 @@ public boolean equals(Object o) {
88
103
if (type != null ? !type .equals (that .type ) : that .type != null ) return false ;
89
104
if (code != null ? !code .equals (that .code ) : that .code != null ) return false ;
90
105
if (path != null ? !path .equals (that .path ) : that .path != null ) return false ;
106
+ if (schemaPath != null ? !schemaPath .equals (that .schemaPath ) : that .schemaPath != null ) return false ;
91
107
if (details != null ? !details .equals (that .details ) : that .details != null ) return false ;
92
108
if (!Arrays .equals (arguments , that .arguments )) return false ;
93
109
return !(message != null ? !message .equals (that .message ) : that .message != null );
@@ -99,6 +115,7 @@ public int hashCode() {
99
115
int result = type != null ? type .hashCode () : 0 ;
100
116
result = 31 * result + (code != null ? code .hashCode () : 0 );
101
117
result = 31 * result + (path != null ? path .hashCode () : 0 );
118
+ result = 31 * result + (schemaPath != null ? schemaPath .hashCode () : 0 );
102
119
result = 31 * result + (details != null ? details .hashCode () : 0 );
103
120
result = 31 * result + (arguments != null ? Arrays .hashCode (arguments ) : 0 );
104
121
result = 31 * result + (message != null ? message .hashCode () : 0 );
@@ -113,17 +130,17 @@ public void setType(String type) {
113
130
this .type = type ;
114
131
}
115
132
116
- public static ValidationMessage of (String type , ErrorMessageType errorMessageType , String at , String ... arguments ) {
133
+ public static ValidationMessage of (String type , ErrorMessageType errorMessageType , String at , String schemaPath , String ... arguments ) {
117
134
ValidationMessage .Builder builder = new ValidationMessage .Builder ();
118
- builder .code (errorMessageType .getErrorCode ()).path (at ).arguments (arguments )
135
+ builder .code (errorMessageType .getErrorCode ()).path (at ).schemaPath ( schemaPath ). arguments (arguments )
119
136
.format (errorMessageType .getMessageFormat ()).type (type )
120
137
.customMessage (errorMessageType .getCustomMessage ());
121
138
return builder .build ();
122
139
}
123
140
124
- public static ValidationMessage of (String type , ErrorMessageType errorMessageType , String at , Map <String , Object > details ) {
141
+ public static ValidationMessage of (String type , ErrorMessageType errorMessageType , String at , String schemaPath , Map <String , Object > details ) {
125
142
ValidationMessage .Builder builder = new ValidationMessage .Builder ();
126
- builder .code (errorMessageType .getErrorCode ()).path (at ).details (details )
143
+ builder .code (errorMessageType .getErrorCode ()).path (at ).schemaPath ( schemaPath ). details (details )
127
144
.format (errorMessageType .getMessageFormat ()).type (type );
128
145
return builder .build ();
129
146
}
@@ -132,6 +149,7 @@ public static class Builder {
132
149
private String type ;
133
150
private String code ;
134
151
private String path ;
152
+ private String schemaPath ;
135
153
private String [] arguments ;
136
154
private Map <String , Object > details ;
137
155
private MessageFormat format ;
@@ -152,6 +170,11 @@ public Builder path(String path) {
152
170
return this ;
153
171
}
154
172
173
+ public Builder schemaPath (String schemaPath ) {
174
+ this .schemaPath = schemaPath ;
175
+ return this ;
176
+ }
177
+
155
178
public Builder arguments (String ... arguments ) {
156
179
this .arguments = arguments ;
157
180
return this ;
@@ -177,6 +200,7 @@ public ValidationMessage build() {
177
200
msg .setType (type );
178
201
msg .setCode (code );
179
202
msg .setPath (path );
203
+ msg .setSchemaPath (schemaPath );
180
204
msg .setArguments (arguments );
181
205
msg .setDetails (details );
182
206
0 commit comments