Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
88 changes: 56 additions & 32 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<parent>
<groupId>com.fasterxml.jackson</groupId>
<artifactId>jackson-base</artifactId>
<version>2.19.2</version>
<version>2.20.0</version>
</parent>
<groupId>org.openapitools</groupId>
<artifactId>jackson-databind-nullable</artifactId>
Expand Down Expand Up @@ -31,8 +31,47 @@
<!-- Generate PackageVersion.java into this directory. -->
<packageVersion.dir>org/openapitools/jackson/nullable</packageVersion.dir>
<packageVersion.package>${project.groupId}.jackson.nullable</packageVersion.package>
<java.version>1.8</java.version>

<!-- region Dependency Versions -->
<!-- Validator 8+ requires Java 11, Validator 9+ requires Java 17. -->
<hibernate-validator.version>7.0.5.Final</hibernate-validator.version>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This likely has to be rolled back to 6.x, since that is the last version that supports the javax namespace.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This and the Jakarta import changes are test only, so I think it’s a safe change to make. The project runtime still allows the consumer to provide whichever (javax or Jakarta) they want to use.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I took a look at the implementation again and you are right. I thought the implementations were more entangled with the namespace.

<jackson-bom.version>2.20.0</jackson-bom.version>
<javax-validation-api.version>2.0.1.Final</javax-validation-api.version>
<jakarta-validation-api.version>3.1.1</jakarta-validation-api.version>
<junit.version>5.13.4</junit.version>
<!-- endregion -->

<!-- region Plugin Versions -->
<central-publishing-maven-plugin.version>0.9.0</central-publishing-maven-plugin.version>
<maven-compiler-plugin.version>3.14.1</maven-compiler-plugin.version>
<maven-gpg-plugin.version>3.2.8</maven-gpg-plugin.version>
<maven-jar-plugin.version>3.4.2</maven-jar-plugin.version>
<maven-javadoc-plugin.version>3.12.0</maven-javadoc-plugin.version>
<maven-replacer-plugin.version>1.5.3</maven-replacer-plugin.version>
<maven-source-plugin.version>3.3.1</maven-source-plugin.version>
<!-- endregion -->
</properties>

<dependencyManagement>
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This section is to aid in the migration away from jackson-base longer term. Instead of relying on the versions provided by the parent, provide the versions ourselves here.

<dependencies>
<dependency>
<groupId>com.fasterxml.jackson</groupId>
<artifactId>jackson-bom</artifactId>
<version>${jackson-bom.version}</version>
<scope>import</scope>
<type>pom</type>
</dependency>
<dependency>
<groupId>org.junit</groupId>
<artifactId>junit-bom</artifactId>
<version>${junit.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>

<dependencies>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
Expand All @@ -41,36 +80,37 @@
<dependency>
<groupId>javax.validation</groupId>
<artifactId>validation-api</artifactId>
<version>2.0.1.Final</version>
<version>${javax-validation-api.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>jakarta.validation</groupId>
<artifactId>jakarta.validation-api</artifactId>
<version>3.1.1</version>
<version>${jakarta-validation-api.version}</version>
<scope>provided</scope>
</dependency>
<!-- test dependencies -->
<!-- cannot update above 6 see: https://stackoverflow.com/questions/36329001/unable-to-create-a-configuration-because-no-bean-validation-provider-could-be-f -->

<!-- region Test Dependencies -->
<dependency>
<groupId>org.hibernate.validator</groupId>
<artifactId>hibernate-validator</artifactId>
<version>6.2.5.Final</version>
<version>${hibernate-validator.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<scope>test</scope>
</dependency>
<!-- endregion -->
</dependencies>

<build>
<plugins>
<plugin>
<groupId>com.google.code.maven-replacer-plugin</groupId>
<artifactId>replacer</artifactId>
<version>1.5.3</version>
<version>${maven-replacer-plugin.version}</version>
<executions>
<execution>
<id>process-packageVersion</id>
Expand All @@ -80,16 +120,16 @@
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.14.0</version>
<version>${maven-compiler-plugin.version}</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
<source>${java.version}</source>
<target>${java.version}</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>3.4.2</version>
<version>${maven-jar-plugin.version}</version>
<configuration>
<archive>
<manifestEntries>
Expand All @@ -101,7 +141,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>3.2.1</version>
<version>${maven-source-plugin.version}</version>
<executions>
<execution>
<id>attach-sources</id>
Expand All @@ -114,7 +154,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>3.11.2</version>
<version>${maven-javadoc-plugin.version}</version>
<executions>
<execution>
<id>attach-javadocs</id>
Expand All @@ -125,7 +165,7 @@
</execution>
</executions>
<configuration>
<source>1.8</source>
<source>${java.version}</source>
<doclint>none</doclint>
<detectJavaApiLink>false</detectJavaApiLink>
<failOnWarnings>false</failOnWarnings>
Expand Down Expand Up @@ -160,7 +200,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId>
<version>1.5</version>
<version>${maven-gpg-plugin.version}</version>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this will update gpg plugin to v3.2.8. let's give it try

if it doesn't work, we will revert the upgrade

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ya I wasn’t really sure how to test it. I’m not familiar with the plugin, but the available options looked the same from what I noticed.

<executions>
<execution>
<id>sign-artifacts</id>
Expand All @@ -177,26 +217,10 @@
</gpgArguments>
</configuration>
</plugin>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>2.4.12</version>
<executions>
<execution>
<id>repackage</id>
<goals>
<goal>repackage</goal>
</goals>
<configuration>
<skip>true</skip>
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because this execution is skipped, I don't see how this plugin would be doing anything. I did a build with and without the plugin enabled and didn't see any changes in files.

</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.sonatype.central</groupId>
<artifactId>central-publishing-maven-plugin</artifactId>
<version>0.8.0</version>
<version>${central-publishing-maven-plugin.version}</version>
<extensions>true</extensions>
<configuration>
<publishingServerId>central</publishingServerId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,14 @@
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.TestInstance;

import javax.validation.*;
import javax.validation.constraints.Max;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import jakarta.validation.ConstraintViolation;
import jakarta.validation.Valid;
import jakarta.validation.Validation;
import jakarta.validation.Validator;
import jakarta.validation.ValidatorFactory;
import jakarta.validation.constraints.Max;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Size;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hibernate Validator changed from javax to jakarta, so the imports needed to be updated.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfortunately, a lot of projects still use the javax namespace. Thats why this project has ValueExtractors for javax and jakarta. We should support javax at least until Jackson 3, since that is based on Java 17, at which point all projects should have migrated to jakarta.

import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
Expand Down Expand Up @@ -58,7 +62,7 @@ void testValidationIsAppliedOnDefinedValue_whenNullValueExtracted() {
Set<ConstraintViolation<UnitIssue3>> violations = validator.validate(unitIssue);
assertEquals(1, violations.size());
}

@Test
void testCollection() {
Car aCar = new Car();
Expand Down Expand Up @@ -164,4 +168,4 @@ public Person(String role) {
}
}

}
}