Skip to content

Commit 76bdb2e

Browse files
authored
Refactor ValidationResponse detail and remove type
Updated the detail message to reflect the specific exception thrown and removed the type field from the JSON output.
1 parent f31599f commit 76bdb2e

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

http-inject-plugin/src/main/java/io/avaje/http/inject/ValidationResponse.java

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,9 @@
99
import io.avaje.http.api.ValidationException.Violation;
1010

1111
public class ValidationResponse {
12-
13-
private static String type = "tag:io.avaje.http.api.ValidationException";
12+
1413
private static String title = "Request Failed Validation";
15-
private static String detail = "You tried to call this endpoint, but your data failed validation";
14+
private static String detail = "You tried to call this endpoint, but a io.avaje.http.api.ValidationException was thrown";
1615
private final int status;
1716
private final List<Violation> errors;
1817
private final String instance;
@@ -32,8 +31,6 @@ public void toJson(OutputStream os) throws IOException {
3231

3332
private void writeJsonInternal(Writer writer) throws IOException {
3433
writer.write('{');
35-
writeKeyValue("type", type, writer);
36-
writer.write(',');
3734
writeKeyValue("title", title, writer);
3835
writer.write(',');
3936
writeKeyValue("detail", detail, writer);

0 commit comments

Comments
 (0)