Skip to content

Commit

Permalink
Revert back to using javax.validation as jakarta.validation is not su…
Browse files Browse the repository at this point in the history
…pported by micronaut (#4476)

Note: Use jakarta.validation-api version 2.0.2 instead of version 3.0.0 to be able to use javax.validation
  • Loading branch information
klustria authored Jul 7, 2022
1 parent 7c23088 commit 9f8aed9
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 24 deletions.
4 changes: 1 addition & 3 deletions config/etcd/src/main/java/module-info.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2017, 2021 Oracle and/or its affiliates.
* Copyright (c) 2017, 2022 Oracle and/or its affiliates.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -31,8 +31,6 @@
requires io.helidon.common;
requires io.helidon.common.media.type;
requires io.grpc;
// TODO 3.0.0-JAKARTA
// used only for compilation of generated classes
requires static java.annotation;

exports io.helidon.config.etcd;
Expand Down
6 changes: 3 additions & 3 deletions dependencies/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -104,9 +104,9 @@
<version.lib.mariadb-java-client>2.6.2</version.lib.mariadb-java-client>
<version.lib.maven-wagon>2.10</version.lib.maven-wagon>
<version.lib.micrometer>1.6.6</version.lib.micrometer>
<version.lib.micronaut>3.1.3</version.lib.micronaut>
<version.lib.micronaut.data>3.1.2</version.lib.micronaut.data>
<version.lib.micronaut.sql>4.0.4</version.lib.micronaut.sql>
<version.lib.micronaut>3.4.3</version.lib.micronaut>
<version.lib.micronaut.data>3.3.0</version.lib.micronaut.data>
<version.lib.micronaut.sql>4.4.0</version.lib.micronaut.sql>
<version.lib.microprofile-config>3.0.1</version.lib.microprofile-config>
<version.lib.microprofile-fault-tolerance-api>4.0</version.lib.microprofile-fault-tolerance-api>
<version.lib.microprofile-graphql>2.0</version.lib.microprofile-graphql>
Expand Down
19 changes: 6 additions & 13 deletions integrations/micronaut/data/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
<dependency>
<groupId>jakarta.validation</groupId>
<artifactId>jakarta.validation-api</artifactId>
<version>2.0.2</version>
<scope>test</scope>
</dependency>
<dependency>
Expand All @@ -67,13 +68,6 @@
<groupId>io.micronaut.data</groupId>
<artifactId>micronaut-data-model</artifactId>
<scope>test</scope>
<exclusions>
<exclusion>
<!-- 3.0.0-JAKARTA -->
<groupId>io.micronaut</groupId>
<artifactId>micronaut-validation</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>io.helidon.microprofile.cdi</groupId>
Expand Down Expand Up @@ -155,12 +149,11 @@
<artifactId>micronaut-inject-java</artifactId>
<version>${version.lib.micronaut}</version>
</path>
<!-- 3.0.0-JAKARTA -->
<!-- <path>-->
<!-- <groupId>io.micronaut</groupId>-->
<!-- <artifactId>micronaut-validation</artifactId>-->
<!-- <version>${version.lib.micronaut}</version>-->
<!-- </path>-->
<path>
<groupId>io.micronaut</groupId>
<artifactId>micronaut-validation</artifactId>
<version>${version.lib.micronaut}</version>
</path>
<path>
<groupId>io.micronaut.data</groupId>
<artifactId>micronaut-data-processor</artifactId>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2020, 2021 Oracle and/or its affiliates.
* Copyright (c) 2020, 2022 Oracle and/or its affiliates.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -27,10 +27,12 @@
import io.helidon.microprofile.tests.junit5.Configuration;
import io.helidon.microprofile.tests.junit5.HelidonTest;

import javax.validation.ConstraintViolationException;
import javax.validation.constraints.Pattern;

import jakarta.enterprise.context.ApplicationScoped;
import jakarta.inject.Inject;
import jakarta.transaction.Transactional;
import jakarta.validation.ConstraintViolationException;
import org.eclipse.microprofile.config.inject.ConfigProperty;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
Expand Down Expand Up @@ -80,7 +82,6 @@ void testTransaction() {
assertThat(myBean.getOwner("Hoppy"), is("Barney"));
}

@Disabled("3.0.0-JAKARTA")
@Test
void testBeanValidation() {
assertThrows(ConstraintViolationException.class, () -> myBean.getOwner("wrong name"), "Name should not contain spaces");
Expand Down Expand Up @@ -108,9 +109,8 @@ public static class MyBean {
@Inject
CdiOnly cdiOnly;

// TODO 3.0.0-JAKARTA - javax.validation used by Micronaut
@Transactional
public String getOwner(/*@Pattern(regexp = "\\w+")*/ String pet) {
public String getOwner(@Pattern(regexp = "\\w+") String pet) {
assertThat(connection, notNullValue());
assertThat(cdiOnly.message(), is("Hello"));
return petRepository.findByName(pet)
Expand Down

0 comments on commit 9f8aed9

Please sign in to comment.