Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refs #3836 - jakarta namespace artifacts #3881

Merged
merged 2 commits into from
Feb 13, 2021
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
4 changes: 4 additions & 0 deletions CI/post-release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ $CUR/CI/publishRelease.py "$SC_RELEASE_TAG"
./mvnw versions:set -DnewVersion="${SC_NEXT_VERSION}-SNAPSHOT"
./mvnw versions:commit

cd modules/swagger-project-jakarta
../../mvnw versions:set -DnewVersion="${SC_NEXT_VERSION}-SNAPSHOT"
cd ../..

#####################
### update all other versions in files around to the next snapshot or new release, including readme and gradle ###
#####################
Expand Down
5 changes: 5 additions & 0 deletions CI/prepare-release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,11 @@ $CUR/CI/releaseNotes.py "$SC_LAST_RELEASE" "$SC_RELEASE_TITLE" "$SC_RELEASE_TAG"
./mvnw versions:set -DnewVersion=$SC_VERSION
./mvnw versions:commit

cd modules/swagger-project-jakarta
../../mvnw versions:set -DnewVersion=$SC_VERSION
cd ../..


#####################
### update all other versions in files around to the new release, including readme and gradle ###
#####################
Expand Down
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,13 @@

**NOTE:** If you're looking for Swagger Core 1.5.X and OpenAPI 2.0, please refer to [1.5 branch](https://github.com/swagger-api/swagger-core/tree/1.5).

**NOTE:** Since version 2.1.7 Swagger Core supports also Jakarta namespace, with a parallel set of artifacts with `-jakarta` suffix, providing the same functionality as the "standard" `javax` namespace ones.
Please check [Wiki](https://github.com/swagger-api/swagger-core/wiki/Swagger-2.X---Getting-started) for more details

![Build Test Deploy](https://github.com/swagger-api/swagger-core/workflows/Build%20Test%20Deploy%20master/badge.svg?branch=master)
[![Maven Central](https://maven-badges.herokuapp.com/maven-central/io.swagger.core.v3/swagger-project/badge.svg?style=plastic)](https://maven-badges.herokuapp.com/maven-central/io.swagger.core.v3/swagger-project)

Swagger Core is a Java implementation of the OpenAPI Specification. Current version supports *JAX-RS2*.
Swagger Core is a Java implementation of the OpenAPI Specification. Current version supports *JAX-RS2* (`javax` and `jakarta` namespaces).

## Get started with Swagger Core!
See the guide on [getting started with Swagger Core](https://github.com/swagger-api/swagger-core/wiki/Swagger-2.X---Getting-started) to get started with adding Swagger to your API.
Expand Down
7 changes: 4 additions & 3 deletions modules/swagger-core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -141,9 +141,9 @@
<artifactId>commons-io</artifactId>
</dependency>
<dependency>
<groupId>javax.ws.rs</groupId>
<artifactId>jsr311-api</artifactId>
<version>1.1.1</version>
<groupId>jakarta.ws.rs</groupId>
<artifactId>jakarta.ws.rs-api</artifactId>
<version>${jakarta-ws-rs-api-version}</version>
<scope>test</scope>
</dependency>
<dependency>
Expand All @@ -156,6 +156,7 @@
<properties>
<!-- TODO increase coverage -->
<validation-api-version>2.0.2</validation-api-version>
<jakarta-ws-rs-api-version>2.1.6</jakarta-ws-rs-api-version>
<coverage.complexity.minimum>0.60</coverage.complexity.minimum>
<coverage.line.minimum>0.0</coverage.line.minimum>
<coverage.missed.classes>3</coverage.missed.classes>
Expand Down
19 changes: 19 additions & 0 deletions modules/swagger-gradle-plugin/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,26 @@

**`swagger-gradle-plugin` supports gradle 3.2 and higher.**

## Jakarta namespace support

Since version 2.1.7 Swagger Core supports also Jakarta namespace, with a parallel set of artifacts with `-jakarta` suffix, providing the same functionality as the "standard" `javax` namespace ones.
Please check [Wiki](https://github.com/swagger-api/swagger-core/wiki/Swagger-2.X---Getting-started) for more details

To have gradle plugin use the `jakarta` namespace artifacts, you need to provide a value to parameter `buildClasspath`
In many cases it is sufficient to set it to the `classpath` value, like:

`buildClasspath = classpath`

Alternatively provide as value a classpath with the following dependencies (replacing the provided [`javax` ones](https://github.com/swagger-api/swagger-core/blob/master/modules/swagger-gradle-plugin/src/main/java/io/swagger/v3/plugins/gradle/SwaggerPlugin.java#L16-L25)):

* org.apache.commons:commons-lang3:3.7
* io.swagger.core.v3:swagger-jaxrs2-jakarta:2.1.7
* jakarta.ws.rs:jakarta.ws.rs-api:3.0.0
* jakarta.servlet:jakarta.servlet-api:5.0.0

## Installation


### Gradle 3.2 and higher

```
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
import org.gradle.api.tasks.Classpath;
import org.gradle.api.tasks.Input;
import org.gradle.api.tasks.InputFile;
import org.gradle.api.tasks.Internal;
import org.gradle.api.tasks.Optional;
import org.gradle.api.tasks.OutputDirectory;
import org.gradle.api.tasks.PathSensitive;
Expand Down
2 changes: 1 addition & 1 deletion modules/swagger-jaxrs2/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@
<dependency>
<groupId>org.javassist</groupId>
<artifactId>javassist</artifactId>
<version>3.22.0-GA</version>
<version>3.25.0-GA</version>
</dependency>
<dependency>
<groupId>commons-io</groupId>
Expand Down
98 changes: 94 additions & 4 deletions modules/swagger-maven-plugin/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,16 @@
All parameters except `outputFileName`, `outputFormat`, `skip`, `encoding` and `outputPath` correspond
to `swagger` [configuration property](https://github.com/swagger-api/swagger-core/wiki/Swagger-2.X---Integration-and-Configuration#configuration-properties) with same name.

## Jakarta namespace support

Since version 2.1.7 Swagger Core supports also Jakarta namespace, with a parallel set of artifacts with `-jakarta` suffix, providing the same functionality as the "standard" `javax` namespace ones.
Please check [Wiki](https://github.com/swagger-api/swagger-core/wiki/Swagger-2.X---Getting-started) for more details

Both `javax` and `jakarta` examples are provided below

## Configuration example

### `javax` namespace

```xml
<project>
Expand All @@ -14,7 +22,7 @@ to `swagger` [configuration property](https://github.com/swagger-api/swagger-cor
<plugin>
<groupId>io.swagger.core.v3</groupId>
<artifactId>swagger-maven-plugin</artifactId>
<version>2.1.1</version>
<version>2.1.7</version>
<configuration>
<outputFileName>openapi</outputFileName>
<outputPath>${project.build.directory}/generatedtest</outputPath>
Expand All @@ -39,7 +47,7 @@ to `swagger` [configuration property](https://github.com/swagger-api/swagger-cor
<dependency>
<groupId>io.swagger.core.v3</groupId>
<artifactId>swagger-jaxrs2</artifactId>
<version>2.1.1</version>
<version>2.1.7</version>
</dependency>

<dependency>
Expand All @@ -56,7 +64,60 @@ to `swagger` [configuration property](https://github.com/swagger-api/swagger-cor
</project>
```

### Configuration example with provided Swagger configuration file
### `jakarta` namespace

```xml
<project>
<build>
<plugins>
<plugin>
<groupId>io.swagger.core.v3</groupId>
<artifactId>swagger-maven-plugin-jakarta</artifactId>
<version>2.1.7</version>
<configuration>
<outputFileName>openapi</outputFileName>
<outputPath>${project.build.directory}/generatedtest</outputPath>
<outputFormat>JSONANDYAML</outputFormat>
<resourcePackages>
<package>test.petstore</package>
</resourcePackages>
<prettyPrint>TRUE</prettyPrint>
</configuration>
<executions>
<execution>
<phase>compile</phase>
<goals>
<goal>resolve</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>io.swagger.core.v3</groupId>
<artifactId>swagger-jaxrs2-jakarta</artifactId>
<version>2.1.7</version>
</dependency>

<dependency>
<groupId>jakarta.ws.rs</groupId>
<artifactId>jakarta.ws.rs-api</artifactId>
<version>3.0.0</version>
</dependency>
<dependency>
<groupId>jakarta.servlet</groupId>
<artifactId>jakarta.servlet-api</artifactId>
<version>5.0.0</version>
</dependency>
</dependencies>
</project>
```

## Configuration example with provided Swagger configuration file

### `javax` namespace

```xml
<project>
Expand All @@ -65,7 +126,36 @@ to `swagger` [configuration property](https://github.com/swagger-api/swagger-cor
<plugin>
<groupId>io.swagger.core.v3</groupId>
<artifactId>swagger-maven-plugin</artifactId>
<version>2.1.1</version>
<version>2.1.7</version>
<configuration>
<outputFileName>openapi</outputFileName>
<outputPath>${project.build.directory}/generatedtest</outputPath>
<configurationFilePath>${project.basedir}/src/main/resources/configurationFile.yaml</configurationFilePath>
</configuration>
<executions>
<execution>
<phase>compile</phase>
<goals>
<goal>resolve</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
...
```

### `jakarta` namespace

```xml
<project>
<build>
<plugins>
<plugin>
<groupId>io.swagger.core.v3</groupId>
<artifactId>swagger-maven-plugin-jakarta</artifactId>
<version>2.1.7</version>
<configuration>
<outputFileName>openapi</outputFileName>
<outputPath>${project.build.directory}/generatedtest</outputPath>
Expand Down
18 changes: 18 additions & 0 deletions modules/swagger-project-jakarta/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
build/
lib/*.jar
target
.idea
.idea_modules
.settings
.project
.classpath
.cache
atlassian-ide-plugin.xml
*.iml
.java-version
sonar-project.properties
test-output/
*.pyc
**/transformed/*.jar
**/transformed/*.test-jar
**/transformed/*.maven-plugin
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://maven.apache.org/POM/4.0.0"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<parent>
<groupId>io.swagger.core.v3</groupId>
<artifactId>swagger-project-jakarta</artifactId>
<version>2.1.7-SNAPSHOT</version>
<relativePath>../..</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>swagger-annotations-jakarta</artifactId>
<name>swagger-annotations-jakarta</name>
<description>swagger-annotations-jakarta</description>

<build></build>

<dependencies></dependencies>

<properties></properties>
</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#### Don't delete

Target directory for eclipse transformer plugin; Jakarta EE 9+ artifacts are generated in this directory
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://maven.apache.org/POM/4.0.0"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<parent>
<groupId>io.swagger.core.v3</groupId>
<artifactId>swagger-project-jakarta</artifactId>
<version>2.1.7-SNAPSHOT</version>
<relativePath>../..</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>swagger-core-jakarta</artifactId>
<name>swagger-core-jakarta</name>
<description>swagger-core-jakarta</description>

<build></build>

<dependencies>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-core</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
</dependency>


<dependency>
<groupId>io.swagger.core.v3</groupId>
<artifactId>swagger-annotations-jakarta</artifactId>
<version>${project.parent.version}</version>
</dependency>
<dependency>
<groupId>io.swagger.core.v3</groupId>
<artifactId>swagger-models-jakarta</artifactId>
<version>${project.parent.version}</version>
</dependency>

<dependency>
<groupId>jakarta.xml.bind</groupId>
<artifactId>jakarta.xml.bind-api</artifactId>
</dependency>
<dependency>
<groupId>jakarta.validation</groupId>
<artifactId>jakarta.validation-api</artifactId>
</dependency>


<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-annotations</artifactId>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.dataformat</groupId>
<artifactId>jackson-dataformat-yaml</artifactId>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.datatype</groupId>
<artifactId>jackson-datatype-jsr310</artifactId>
</dependency>
</dependencies>

<properties></properties>
</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#### Don't delete

Target directory for eclipse transformer plugin; Jakarta EE 9+ artifacts are generated in this directory
Loading