diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index a0d10777..ee7f70ed 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -5,9 +5,10 @@ micronaut-docs = '2.0.0' micronaut-test = "4.0.0-SNAPSHOT" micronaut-serde = "2.0.0-SNAPSHOT" +micronaut-validation = "4.0.0-SNAPSHOT" -groovy = "4.0.6" -kotlin = '1.7.22' +groovy = "4.0.10" +kotlin = '1.8.10' spock = "2.3-groovy-4.0" managed-zalando-problem="0.27.1" @@ -15,6 +16,7 @@ managed-zalando-problem="0.27.1" [libraries] # micronaut boms micronaut-serde = { module = "io.micronaut.serde:micronaut-serde-bom", version.ref = "micronaut-serde" } +micronaut-validation = { module = "io.micronaut.validation:micronaut-validation-bom", version.ref = "micronaut-validation" } managed-zalando-problem = { module = "org.zalando:problem", version.ref = "managed-zalando-problem" } kotlin-stdlib-jdk8 = { module = "org.jetbrains.kotlin:kotlin-stdlib-jdk8" } diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index f398c33c..bdc9a83b 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.6-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.0.2-bin.zip networkTimeout=10000 zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/problem-json/build.gradle.kts b/problem-json/build.gradle.kts index dc0c6e66..69a078f9 100644 --- a/problem-json/build.gradle.kts +++ b/problem-json/build.gradle.kts @@ -4,12 +4,15 @@ plugins { dependencies { annotationProcessor(mnSerde.micronaut.serde.processor) + annotationProcessor(mnValidation.micronaut.validation.processor) + api(libs.managed.zalando.problem) implementation(mnSerde.micronaut.serde.api) implementation(mnSerde.micronaut.serde.jackson) - implementation(mn.micronaut.validation) + implementation(mnValidation.micronaut.validation) implementation(mn.micronaut.http.server) + testImplementation(mnValidation.micronaut.validation.processor) testImplementation(mn.micronaut.http.server.netty) testImplementation(mn.micronaut.http.client) testAnnotationProcessor(mn.micronaut.inject.java) diff --git a/problem-json/src/main/java/io/micronaut/problem/violations/ProblemConstraintViolationExceptionHandler.java b/problem-json/src/main/java/io/micronaut/problem/violations/ProblemConstraintViolationExceptionHandler.java index ecbb9d0a..00c10d85 100644 --- a/problem-json/src/main/java/io/micronaut/problem/violations/ProblemConstraintViolationExceptionHandler.java +++ b/problem-json/src/main/java/io/micronaut/problem/violations/ProblemConstraintViolationExceptionHandler.java @@ -27,10 +27,10 @@ import io.micronaut.http.server.exceptions.response.ErrorResponseProcessor; import io.micronaut.problem.HttpStatusType; import io.micronaut.validation.exceptions.ConstraintExceptionHandler; - import jakarta.inject.Singleton; -import javax.validation.ConstraintViolation; -import javax.validation.ConstraintViolationException; +import jakarta.validation.ConstraintViolation; +import jakarta.validation.ConstraintViolationException; + import java.util.stream.Collectors; /** diff --git a/problem-json/src/main/java/io/micronaut/problem/violations/Violation.java b/problem-json/src/main/java/io/micronaut/problem/violations/Violation.java index 73a89f09..53f06c9b 100644 --- a/problem-json/src/main/java/io/micronaut/problem/violations/Violation.java +++ b/problem-json/src/main/java/io/micronaut/problem/violations/Violation.java @@ -17,8 +17,7 @@ import io.micronaut.core.annotation.NonNull; import io.micronaut.serde.annotation.Serdeable; - -import javax.validation.constraints.NotBlank; +import jakarta.validation.constraints.NotBlank; /** * Constraint Violation information. diff --git a/problem-json/src/main/java/io/micronaut/problem/violations/package-info.java b/problem-json/src/main/java/io/micronaut/problem/violations/package-info.java index 92bc6570..e02c0208 100644 --- a/problem-json/src/main/java/io/micronaut/problem/violations/package-info.java +++ b/problem-json/src/main/java/io/micronaut/problem/violations/package-info.java @@ -14,7 +14,7 @@ * limitations under the License. */ /** - * Contains classes for rendering {@link javax.validation.ConstraintViolationException} as Problem. + * Contains classes for rendering {@link jakarta.validation.ConstraintViolationException} as Problem. * @author Sergio del Amo * @since 1.0 */ diff --git a/problem-json/src/test/groovy/io/micronaut/problem/ConstraintViolationProblemSpec.groovy b/problem-json/src/test/groovy/io/micronaut/problem/ConstraintViolationProblemSpec.groovy index c9628bfc..0e3c67a0 100644 --- a/problem-json/src/test/groovy/io/micronaut/problem/ConstraintViolationProblemSpec.groovy +++ b/problem-json/src/test/groovy/io/micronaut/problem/ConstraintViolationProblemSpec.groovy @@ -1,7 +1,6 @@ package io.micronaut.problem import io.micronaut.context.annotation.Requires -import io.micronaut.core.annotation.Introspected import io.micronaut.core.annotation.NonNull import io.micronaut.core.annotation.Nullable import io.micronaut.core.type.Argument @@ -13,10 +12,9 @@ import io.micronaut.http.annotation.Post import io.micronaut.http.annotation.Status import io.micronaut.http.client.exceptions.HttpClientResponseException import io.micronaut.serde.annotation.Serdeable - -import javax.validation.Valid -import javax.validation.constraints.NotBlank -import javax.validation.constraints.NotNull +import jakarta.validation.Valid +import jakarta.validation.constraints.NotBlank +import jakarta.validation.constraints.NotNull class ConstraintViolationProblemSpec extends EmbeddedServerSpecification { diff --git a/settings.gradle b/settings.gradle index 575e58c8..e417f95b 100644 --- a/settings.gradle +++ b/settings.gradle @@ -6,15 +6,17 @@ pluginManagement { } plugins { - id("io.micronaut.build.shared.settings") version "6.2.2" + id("io.micronaut.build.shared.settings") version "6.3.5" } enableFeaturePreview("TYPESAFE_PROJECT_ACCESSORS") micronautBuild { addSnapshotRepository() + useStandardizedProjectNames = true importMicronautCatalog() importMicronautCatalog("micronaut-serde") + importMicronautCatalog("micronaut-validation") } rootProject.name = 'problem-json-parent' diff --git a/src/main/docs/guide/breaks.adoc b/src/main/docs/guide/breaks.adoc index d157169a..cdda30c3 100644 --- a/src/main/docs/guide/breaks.adoc +++ b/src/main/docs/guide/breaks.adoc @@ -1,3 +1,9 @@ +=== Micronaut Problem JSON 3.0.0 + +Starting with Micronaut Framework 4.0.0, Micronaut Problem JSON is based on `jakarta.validation` rather than `javax.validation` as in previous versions. + +=== Micronaut Problem JSON 2.2.3 + The default Problem+JSON payload does not include the `detail` field to avoid accidental information disclosure if the exception root cause is not of type `UnsatisfiedRouteException` or `ThrowableProblem` to avoid accidental information disclosure since 2.2.3. -You can <> to include always the detail or for some scenarios. \ No newline at end of file +You can <> to include always the detail or for some scenarios. diff --git a/test-suite-groovy/build.gradle b/test-suite-groovy/build.gradle index d6e23436..0de1c5fc 100644 --- a/test-suite-groovy/build.gradle +++ b/test-suite-groovy/build.gradle @@ -4,10 +4,11 @@ plugins { } dependencies { + testCompileOnly(mnValidation.micronaut.validation.processor) testCompileOnly mn.micronaut.inject.groovy - testImplementation mn.micronaut.validation + testImplementation mnValidation.micronaut.validation testImplementation mnTest.micronaut.test.spock - testImplementation projects.problemJson + testImplementation projects.micronautProblemJson testImplementation mn.micronaut.http.server.netty testImplementation mn.micronaut.http.client } diff --git a/test-suite-kotlin/build.gradle b/test-suite-kotlin/build.gradle index b9900bcd..4079ae6f 100644 --- a/test-suite-kotlin/build.gradle +++ b/test-suite-kotlin/build.gradle @@ -9,16 +9,18 @@ repositories { } dependencies { - testImplementation mn.micronaut.validation + testAnnotationProcessor mnValidation.micronaut.validation.processor + testAnnotationProcessor(mnSerde.micronaut.serde.processor) + + testImplementation mnValidation.micronaut.validation testImplementation libs.junit.api testImplementation mnTest.micronaut.test.junit5 testRuntimeOnly libs.junit.engine testImplementation libs.kotlin.stdlib.jdk8 kaptTest mn.micronaut.inject.java - testImplementation projects.problemJson + testImplementation projects.micronautProblemJson testImplementation mn.micronaut.http.server.netty testImplementation mn.micronaut.http.client - testAnnotationProcessor(mnSerde.micronaut.serde.processor) testImplementation(mnSerde.micronaut.serde.jackson) } diff --git a/test-suite-serde-java/build.gradle b/test-suite-serde-java/build.gradle index 87c56775..0ee1be5b 100644 --- a/test-suite-serde-java/build.gradle +++ b/test-suite-serde-java/build.gradle @@ -5,16 +5,16 @@ plugins { dependencies { testAnnotationProcessor mn.micronaut.inject.java - testAnnotationProcessor mn.micronaut.validation + testAnnotationProcessor mnValidation.micronaut.validation.processor testAnnotationProcessor mnSerde.micronaut.serde.processor - testImplementation mn.micronaut.validation + testImplementation mnValidation.micronaut.validation testImplementation libs.junit.api testImplementation mnTest.micronaut.test.junit5 testRuntimeOnly libs.junit.engine testImplementation mn.micronaut.http.server.netty testImplementation mn.micronaut.http.client - testImplementation projects.problemJson + testImplementation projects.micronautProblemJson testImplementation(mnSerde.micronaut.serde.jackson) } tasks.named('test') { diff --git a/test-suite-serde-java/src/test/java/io/micronaut/problem/ProblemConstraintsTest.java b/test-suite-serde-java/src/test/java/io/micronaut/problem/ProblemConstraintsTest.java index 5e689e07..f947613c 100644 --- a/test-suite-serde-java/src/test/java/io/micronaut/problem/ProblemConstraintsTest.java +++ b/test-suite-serde-java/src/test/java/io/micronaut/problem/ProblemConstraintsTest.java @@ -14,10 +14,10 @@ import io.micronaut.serde.annotation.Serdeable; import io.micronaut.test.extensions.junit5.annotation.MicronautTest; import jakarta.inject.Inject; +import jakarta.validation.Valid; +import jakarta.validation.constraints.NotBlank; import org.junit.jupiter.api.Test; -import javax.validation.Valid; -import javax.validation.constraints.NotBlank; import java.util.Collections; import java.util.Map; diff --git a/test-suite/build.gradle b/test-suite/build.gradle index dd632a30..99eff317 100644 --- a/test-suite/build.gradle +++ b/test-suite/build.gradle @@ -5,15 +5,15 @@ plugins { dependencies { testAnnotationProcessor mn.micronaut.inject.java - testAnnotationProcessor mn.micronaut.validation - testImplementation mn.micronaut.validation + testAnnotationProcessor mnValidation.micronaut.validation.processor + testImplementation mnValidation.micronaut.validation testImplementation mn.logback.classic testImplementation libs.junit.api testImplementation mnTest.micronaut.test.junit5 testRuntimeOnly libs.junit.engine testImplementation mn.micronaut.http.server.netty testImplementation mn.micronaut.http.client - testImplementation projects.problemJson + testImplementation projects.micronautProblemJson testAnnotationProcessor(mnSerde.micronaut.serde.processor) testImplementation(mnSerde.micronaut.serde.jackson) diff --git a/test-suite/src/test/java/io/micronaut/problem/ProblemConstraintsTest.java b/test-suite/src/test/java/io/micronaut/problem/ProblemConstraintsTest.java index 8ca3d35b..58dc1da0 100644 --- a/test-suite/src/test/java/io/micronaut/problem/ProblemConstraintsTest.java +++ b/test-suite/src/test/java/io/micronaut/problem/ProblemConstraintsTest.java @@ -14,11 +14,10 @@ import io.micronaut.http.client.exceptions.HttpClientResponseException; import io.micronaut.test.extensions.junit5.annotation.MicronautTest; import jakarta.inject.Inject; +import jakarta.validation.Valid; +import jakarta.validation.constraints.NotBlank; import org.junit.jupiter.api.Test; -import javax.validation.Valid; -import javax.validation.constraints.NotBlank; - import java.util.Collections; import java.util.Map;