diff --git a/.gitignore b/.gitignore index 387d29edc..6eb138889 100644 --- a/.gitignore +++ b/.gitignore @@ -13,3 +13,5 @@ build/ *.Module dependency-reduced-pom.xml .DS_Store +tests/test-sigma/avaje-processors.txt +tests/test-sigma/io.avaje.jsonb.spi.JsonbExtension diff --git a/htmx-nima-jstache/pom.xml b/htmx-nima-jstache/pom.xml index ee44af79d..db268a8b8 100644 --- a/htmx-nima-jstache/pom.xml +++ b/htmx-nima-jstache/pom.xml @@ -39,7 +39,7 @@ io.avaje avaje-inject - 10.5 + 11.0 provided true diff --git a/http-client/pom.xml b/http-client/pom.xml index 971f79362..eec42decd 100644 --- a/http-client/pom.xml +++ b/http-client/pom.xml @@ -43,7 +43,7 @@ io.avaje avaje-inject - 10.5 + 11.0 true @@ -99,7 +99,7 @@ io.avaje avaje-inject-generator - 10.5 + 11.0 diff --git a/http-hibernate-validator/pom.xml b/http-hibernate-validator/pom.xml index 323d53949..82c917cc6 100644 --- a/http-hibernate-validator/pom.xml +++ b/http-hibernate-validator/pom.xml @@ -43,7 +43,7 @@ io.avaje avaje-inject - 10.1 + 11.0 provided diff --git a/http-inject-plugin/pom.xml b/http-inject-plugin/pom.xml index 8262412a3..284aea3ea 100644 --- a/http-inject-plugin/pom.xml +++ b/http-inject-plugin/pom.xml @@ -19,7 +19,7 @@ io.avaje avaje-inject - 10.5 + 11.0 provided true diff --git a/tests/pom.xml b/tests/pom.xml index b4c892a83..8c5631b15 100644 --- a/tests/pom.xml +++ b/tests/pom.xml @@ -16,7 +16,7 @@ 3.26.3 2.18.1 2.5 - 10.5 + 11.0 4.1.4 6.3.0 @@ -43,5 +43,26 @@ + + + + io.avaje + avaje-validator + 2.3 + + + + io.avaje + avaje-validator-constraints + 2.3 + + + + io.avaje + avaje-validator-generator + 2.3 + + + diff --git a/tests/test-javalin-jsonb/pom.xml b/tests/test-javalin-jsonb/pom.xml index ae3a0c81d..a51f92fd3 100644 --- a/tests/test-javalin-jsonb/pom.xml +++ b/tests/test-javalin-jsonb/pom.xml @@ -49,18 +49,12 @@ ${project.version} - - io.avaje - avaje-http-hibernate-validator - 3.5-RC3 - - io.swagger.core.v3 swagger-annotations ${swagger.version} - - + + @@ -89,7 +83,7 @@ 2.3 provided - + io.avaje diff --git a/tests/test-javalin-jsonb/src/main/java/org/example/myapp/web/GetBeanForm.java b/tests/test-javalin-jsonb/src/main/java/org/example/myapp/web/GetBeanForm.java index 70818500d..b264954b5 100644 --- a/tests/test-javalin-jsonb/src/main/java/org/example/myapp/web/GetBeanForm.java +++ b/tests/test-javalin-jsonb/src/main/java/org/example/myapp/web/GetBeanForm.java @@ -7,10 +7,10 @@ import io.avaje.http.api.Ignore; import io.avaje.http.api.QueryParam; import io.avaje.jsonb.Json; -import jakarta.validation.Valid; -import jakarta.validation.constraints.Email; -import jakarta.validation.constraints.NotNull; -import jakarta.validation.constraints.Size; +import io.avaje.validation.constraints.Email; +import io.avaje.validation.constraints.NotNull; +import io.avaje.validation.constraints.Size; +import io.avaje.validation.constraints.Valid; @Json @Valid diff --git a/tests/test-javalin-jsonb/src/main/java/org/example/myapp/web/HelloForm.java b/tests/test-javalin-jsonb/src/main/java/org/example/myapp/web/HelloForm.java index 51dcfb085..c278df5ac 100644 --- a/tests/test-javalin-jsonb/src/main/java/org/example/myapp/web/HelloForm.java +++ b/tests/test-javalin-jsonb/src/main/java/org/example/myapp/web/HelloForm.java @@ -2,14 +2,13 @@ import java.time.LocalDate; -import org.hibernate.validator.constraints.URL; - +import io.avaje.http.api.Valid; import io.avaje.jsonb.Json; -import jakarta.validation.Valid; -import jakarta.validation.constraints.Email; -import jakarta.validation.constraints.Future; -import jakarta.validation.constraints.NotNull; -import jakarta.validation.constraints.Size; +import io.avaje.validation.constraints.Email; +import io.avaje.validation.constraints.Future; +import io.avaje.validation.constraints.NotNull; +import io.avaje.validation.constraints.Size; +import io.avaje.validation.constraints.URI; @Json @Valid @@ -22,10 +21,12 @@ public class HelloForm { @Email @Size(max = 100) String email; -@URL - private String url; -@Future - public LocalDate startDate; + + @URI + private String url; + + @Future + public LocalDate startDate; public HelloForm(String name, String email) { this.name = name; diff --git a/tests/test-javalin-jsonb/src/test/java/org/example/myapp/HelloControllerTest.java b/tests/test-javalin-jsonb/src/test/java/org/example/myapp/HelloControllerTest.java index 80f8619cb..f6296b4d2 100644 --- a/tests/test-javalin-jsonb/src/test/java/org/example/myapp/HelloControllerTest.java +++ b/tests/test-javalin-jsonb/src/test/java/org/example/myapp/HelloControllerTest.java @@ -45,7 +45,7 @@ void hello() { @Test void hello2() { - TypeRef> listDto = new TypeRef>() { }; + TypeRef> listDto = new TypeRef<>() { }; final List beans = given() .get(baseUrl + "/hello") .then() @@ -64,7 +64,7 @@ void hello2() { @Test void helloAsyncRequestHandling() { - TypeRef> listDto = new TypeRef>() { }; + TypeRef> listDto = new TypeRef<>() { }; final List beans = given() .get(baseUrl + "/hello/async") .then() @@ -207,8 +207,6 @@ void postForm_validation_expect_badRequest() { .as(ErrorResponse.class); assertNotNull(res); - assertThat(res.getMessage()).contains("failed validation"); - assertThat(res.get("url")).isEqualTo("must be a valid URL"); assertThat(res.get("name")).isEqualTo("must not be null"); try { @@ -227,7 +225,7 @@ void postForm_validation_expect_badRequest() { assertEquals(422, httpResponse.statusCode()); final ErrorResponse errorResponse = e.bean(ErrorResponse.class); - assertThat(errorResponse.get("url")).isEqualTo("must be a valid URL"); + assertThat(res.get("name")).isEqualTo("must not be null"); assertThat(errorResponse.get("name")).isEqualTo("must not be null"); } } diff --git a/tests/test-javalin/pom.xml b/tests/test-javalin/pom.xml index 2647c2470..cbec16d39 100644 --- a/tests/test-javalin/pom.xml +++ b/tests/test-javalin/pom.xml @@ -56,10 +56,10 @@ io.avaje - avaje-http-hibernate-validator - 3.5-RC3 + avaje-validator + 2.3 - + io.swagger.core.v3 swagger-annotations @@ -82,7 +82,6 @@ provided - io.avaje diff --git a/tests/test-javalin/src/main/java/org/example/myapp/Main.java b/tests/test-javalin/src/main/java/org/example/myapp/Main.java index c08fbd8d9..5a6c402af 100644 --- a/tests/test-javalin/src/main/java/org/example/myapp/Main.java +++ b/tests/test-javalin/src/main/java/org/example/myapp/Main.java @@ -19,7 +19,7 @@ import io.swagger.v3.oas.annotations.OpenAPIDefinition; import io.swagger.v3.oas.annotations.info.Info; -@InjectModule(name = "app", requires = Validator.class) +@InjectModule(name = "app") @OpenAPIDefinition(info = @Info(title = "Example service", description = "Example Javalin controllers with Java and Maven")) public class Main { diff --git a/tests/test-javalin/src/main/java/org/example/myapp/web/GetBeanForm.java b/tests/test-javalin/src/main/java/org/example/myapp/web/GetBeanForm.java index d9337c43d..7fba63af6 100644 --- a/tests/test-javalin/src/main/java/org/example/myapp/web/GetBeanForm.java +++ b/tests/test-javalin/src/main/java/org/example/myapp/web/GetBeanForm.java @@ -1,9 +1,9 @@ package org.example.myapp.web; -import jakarta.validation.Valid; -import jakarta.validation.constraints.Email; -import jakarta.validation.constraints.NotNull; -import jakarta.validation.constraints.Size; +import io.avaje.validation.constraints.Email; +import io.avaje.validation.constraints.NotNull; +import io.avaje.validation.constraints.Size; +import io.avaje.validation.constraints.Valid; @Valid public class GetBeanForm { diff --git a/tests/test-javalin/src/main/java/org/example/myapp/web/HelloController.java b/tests/test-javalin/src/main/java/org/example/myapp/web/HelloController.java index bfad1c72a..0dbc23f18 100644 --- a/tests/test-javalin/src/main/java/org/example/myapp/web/HelloController.java +++ b/tests/test-javalin/src/main/java/org/example/myapp/web/HelloController.java @@ -21,10 +21,10 @@ import io.avaje.http.api.Post; import io.avaje.http.api.Produces; import io.avaje.http.api.QueryParam; +import io.avaje.http.api.Valid; import io.javalin.http.Context; import io.swagger.v3.oas.annotations.Hidden; import jakarta.inject.Inject; -import jakarta.validation.Valid; /** * Hello resource manager. diff --git a/tests/test-javalin/src/main/java/org/example/myapp/web/HelloForm.java b/tests/test-javalin/src/main/java/org/example/myapp/web/HelloForm.java index ea8750600..45eaa5909 100644 --- a/tests/test-javalin/src/main/java/org/example/myapp/web/HelloForm.java +++ b/tests/test-javalin/src/main/java/org/example/myapp/web/HelloForm.java @@ -2,13 +2,12 @@ import java.time.LocalDate; -import org.hibernate.validator.constraints.URL; - -import jakarta.validation.Valid; -import jakarta.validation.constraints.Email; -import jakarta.validation.constraints.Future; -import jakarta.validation.constraints.NotNull; -import jakarta.validation.constraints.Size; +import io.avaje.validation.constraints.Email; +import io.avaje.validation.constraints.Future; +import io.avaje.validation.constraints.NotNull; +import io.avaje.validation.constraints.Size; +import io.avaje.validation.constraints.URI; +import io.avaje.validation.constraints.Valid; @Valid public class HelloForm { @@ -19,7 +18,7 @@ public class HelloForm { @Email @Size(max = 100) String email; - @URL + @URI String url; @Future diff --git a/tests/test-javalin/src/test/java/org/example/myapp/HelloControllerTest.java b/tests/test-javalin/src/test/java/org/example/myapp/HelloControllerTest.java index a1d38a1ea..4686d58ad 100644 --- a/tests/test-javalin/src/test/java/org/example/myapp/HelloControllerTest.java +++ b/tests/test-javalin/src/test/java/org/example/myapp/HelloControllerTest.java @@ -45,7 +45,7 @@ void hello() { @Test void hello2() { - TypeRef> listDto = new TypeRef>() { }; + TypeRef> listDto = new TypeRef<>() { }; final List beans = given() .get(baseUrl + "/hello") .then() @@ -65,7 +65,7 @@ void hello2() { @Test void helloAsyncRequestHandling() { - TypeRef> listDto = new TypeRef>() { }; + TypeRef> listDto = new TypeRef<>() { }; final List beans = given() .get(baseUrl + "/hello/async") .then() @@ -209,9 +209,7 @@ void postForm_validation_expect_badRequest() { .as(ErrorResponse.class); assertNotNull(res); - assertThat(res.getMessage()).contains("failed validation"); - assertThat(res.get("url")).isEqualTo("must be a valid URL"); - assertThat(res.get("name")).isEqualTo("must not be null"); + assertThat(res.getMessage()).contains("must not be null"); try { client.request() @@ -229,7 +227,8 @@ void postForm_validation_expect_badRequest() { assertEquals(422, httpResponse.statusCode()); final ErrorResponse errorResponse = e.bean(ErrorResponse.class); - assertThat(errorResponse.get("url")).isEqualTo("must be a valid URL"); + + assertThat(res.getMessage()).contains("must not be null"); assertThat(errorResponse.get("name")).isEqualTo("must not be null"); } } diff --git a/tests/test-jex/pom.xml b/tests/test-jex/pom.xml index d5889c04b..ab8184eef 100644 --- a/tests/test-jex/pom.xml +++ b/tests/test-jex/pom.xml @@ -54,12 +54,6 @@ ${project.version} - - io.avaje - avaje-http-hibernate-validator - 3.5-RC3 - - io.swagger.core.v3 swagger-annotations diff --git a/tests/test-jex/src/main/java/org/example/Main.java b/tests/test-jex/src/main/java/org/example/Main.java index c1bb6d537..a485c3905 100644 --- a/tests/test-jex/src/main/java/org/example/Main.java +++ b/tests/test-jex/src/main/java/org/example/Main.java @@ -1,16 +1,13 @@ package org.example; import io.avaje.http.api.ValidationException; -import io.avaje.http.api.Validator; import io.avaje.inject.BeanScope; -import io.avaje.inject.InjectModule; import io.avaje.jex.Jex; import io.avaje.jex.Routing; import java.util.LinkedHashMap; import java.util.Map; -@InjectModule(requires = Validator.class) public class Main { public static void main(String[] args) { diff --git a/tests/test-jex/src/main/java/org/example/web/HelloDto.java b/tests/test-jex/src/main/java/org/example/web/HelloDto.java index 721795d78..7f1c00686 100644 --- a/tests/test-jex/src/main/java/org/example/web/HelloDto.java +++ b/tests/test-jex/src/main/java/org/example/web/HelloDto.java @@ -1,7 +1,7 @@ package org.example.web; -import jakarta.validation.Valid; -import jakarta.validation.constraints.NotNull; +import io.avaje.validation.constraints.NotNull; +import io.avaje.validation.constraints.Valid; @Valid public class HelloDto { diff --git a/tests/test-nima-jsonb/.project b/tests/test-nima-jsonb/.project index 14b9f0648..e2e024db0 100644 --- a/tests/test-nima-jsonb/.project +++ b/tests/test-nima-jsonb/.project @@ -1,6 +1,6 @@ - test-nima + test-nima-jsonb diff --git a/tests/test-nima-jsonb/pom.xml b/tests/test-nima-jsonb/pom.xml index 50886cbeb..a2c1587e6 100644 --- a/tests/test-nima-jsonb/pom.xml +++ b/tests/test-nima-jsonb/pom.xml @@ -33,11 +33,6 @@ avaje-jsonb 2.3 - - io.avaje - avaje-http-hibernate-validator - 3.3 - io.helidon.webserver helidon-webserver @@ -92,6 +87,11 @@ avaje-jsonb-generator 2.3 + + io.avaje + avaje-validator-generator + 2.3 + @@ -109,7 +109,7 @@ io.avaje avaje-inject-maven-plugin - 10.5 + 11.0 process-sources diff --git a/tests/test-nima-jsonb/src/test/java/org/example/TestPair.java b/tests/test-nima-jsonb/src/test/java/org/example/TestPair.java index 6ab76b5d9..2260d6088 100644 --- a/tests/test-nima-jsonb/src/test/java/org/example/TestPair.java +++ b/tests/test-nima-jsonb/src/test/java/org/example/TestPair.java @@ -1,10 +1,12 @@ package org.example; -import io.avaje.http.api.Validator; +import java.util.List; +import java.util.Locale; + import io.avaje.http.api.context.ThreadLocalRequestContextResolver; import io.avaje.http.client.HttpClient; -import io.avaje.http.hibernate.validator.BeanValidator; import io.avaje.jsonb.Jsonb; +import io.avaje.validation.http.BeanValidator; import io.helidon.webserver.WebServer; import io.helidon.webserver.http.HttpRouting; @@ -38,7 +40,7 @@ void stop() { private static HttpRouting.Builder routing() { HttpRouting.Builder routing = HttpRouting.builder(); - var beanValidator = new BeanValidator(); + var beanValidator = new BeanValidator(List.of(Locale.getDefault())); Jsonb jsonb = Jsonb.builder().build(); var ec = new ErrorController(); diff --git a/tests/test-sigma/pom.xml b/tests/test-sigma/pom.xml index fd0f01ce7..9efbcce36 100644 --- a/tests/test-sigma/pom.xml +++ b/tests/test-sigma/pom.xml @@ -42,13 +42,7 @@ avaje-http-api ${project.version} - - - io.avaje - avaje-http-hibernate-validator - 3.5-RC3 - - + io.swagger.core.v3 swagger-annotations diff --git a/tests/test-sigma/src/main/java/org/example/myapp/web/GetBeanForm.java b/tests/test-sigma/src/main/java/org/example/myapp/web/GetBeanForm.java index 70818500d..b264954b5 100644 --- a/tests/test-sigma/src/main/java/org/example/myapp/web/GetBeanForm.java +++ b/tests/test-sigma/src/main/java/org/example/myapp/web/GetBeanForm.java @@ -7,10 +7,10 @@ import io.avaje.http.api.Ignore; import io.avaje.http.api.QueryParam; import io.avaje.jsonb.Json; -import jakarta.validation.Valid; -import jakarta.validation.constraints.Email; -import jakarta.validation.constraints.NotNull; -import jakarta.validation.constraints.Size; +import io.avaje.validation.constraints.Email; +import io.avaje.validation.constraints.NotNull; +import io.avaje.validation.constraints.Size; +import io.avaje.validation.constraints.Valid; @Json @Valid diff --git a/tests/test-sigma/src/main/java/org/example/myapp/web/HelloForm.java b/tests/test-sigma/src/main/java/org/example/myapp/web/HelloForm.java index 51dcfb085..1b4331867 100644 --- a/tests/test-sigma/src/main/java/org/example/myapp/web/HelloForm.java +++ b/tests/test-sigma/src/main/java/org/example/myapp/web/HelloForm.java @@ -2,14 +2,13 @@ import java.time.LocalDate; -import org.hibernate.validator.constraints.URL; - import io.avaje.jsonb.Json; -import jakarta.validation.Valid; -import jakarta.validation.constraints.Email; -import jakarta.validation.constraints.Future; -import jakarta.validation.constraints.NotNull; -import jakarta.validation.constraints.Size; +import io.avaje.validation.constraints.Email; +import io.avaje.validation.constraints.Future; +import io.avaje.validation.constraints.NotNull; +import io.avaje.validation.constraints.Size; +import io.avaje.validation.constraints.URI; +import io.avaje.validation.constraints.Valid; @Json @Valid @@ -22,10 +21,11 @@ public class HelloForm { @Email @Size(max = 100) String email; -@URL - private String url; -@Future - public LocalDate startDate; + + @URI + private String url; + @Future + public LocalDate startDate; public HelloForm(String name, String email) { this.name = name;