From 7eca7fda75d9126bcb6a0b8783fc30529ad75717 Mon Sep 17 00:00:00 2001 From: "robin.bygrave" Date: Tue, 8 Aug 2023 14:24:10 +1200 Subject: [PATCH] Inline generated code for validation language --- .../main/java/io/avaje/http/generator/core/ElementReader.java | 4 +--- .../avaje/http/generator/helidon/nima/ControllerWriter.java | 2 +- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/http-generator-core/src/main/java/io/avaje/http/generator/core/ElementReader.java b/http-generator-core/src/main/java/io/avaje/http/generator/core/ElementReader.java index eda7dd5e..d9545eda 100644 --- a/http-generator-core/src/main/java/io/avaje/http/generator/core/ElementReader.java +++ b/http-generator-core/src/main/java/io/avaje/http/generator/core/ElementReader.java @@ -283,10 +283,8 @@ void writeValidate(Append writer) { if (!contextType && typeHandler == null) { final var indent = platform().indent(); if (useValidation) { - writer.append("%s var validLanguage = ", indent); + writer.append("%s validator.validate(%s, ", indent, varName); platform().writeAcceptLanguage(writer); - writer.append(";").eol(); - writer.append("%s validator.validate(%s, validLanguage", indent, varName); validationGroups.forEach(g -> writer.append(", %s", Util.shortName(g))); writer.append(");").eol(); } else { diff --git a/http-generator-helidon/src/main/java/io/avaje/http/generator/helidon/nima/ControllerWriter.java b/http-generator-helidon/src/main/java/io/avaje/http/generator/helidon/nima/ControllerWriter.java index 432e3d43..f7479617 100644 --- a/http-generator-helidon/src/main/java/io/avaje/http/generator/helidon/nima/ControllerWriter.java +++ b/http-generator-helidon/src/main/java/io/avaje/http/generator/helidon/nima/ControllerWriter.java @@ -21,7 +21,7 @@ */ class ControllerWriter extends BaseControllerWriter { - private static final String AT_GENERATED = "@Generated(\"avaje-helidon-nima-generator\")"; + private static final String AT_GENERATED = "@Generated(\"avaje-helidon-generator\")"; private final boolean useJsonB; private final Map jsonTypes;