-
-
Notifications
You must be signed in to change notification settings - Fork 6.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make sure jaxrs-spec works with Jakarta (#14654)
- Loading branch information
Showing
64 changed files
with
12,694 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
generatorName: jaxrs-spec | ||
outputDir: samples/server/petstore/jaxrs-spec-jakarta | ||
inputSpec: modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml | ||
templateDir: modules/openapi-generator/src/main/resources/JavaJaxRS/spec | ||
additionalProperties: | ||
artifactId: jaxrs-spec-petstore-server-jakarta | ||
serializableModel: "true" | ||
hideGenerationTimestamp: "true" | ||
implicitHeadersRegex: (api_key|enum_header_string) | ||
generateBuilders: "true" | ||
useJakartaEe: "true" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
samples/server/petstore/jaxrs-spec-jakarta/.openapi-generator-ignore
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# OpenAPI Generator Ignore | ||
# Generated by openapi-generator https://github.com/openapitools/openapi-generator | ||
|
||
# Use this file to prevent files from being overwritten by the generator. | ||
# The patterns follow closely to .gitignore or .dockerignore. | ||
|
||
# As an example, the C# client generator defines ApiClient.cs. | ||
# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line: | ||
#ApiClient.cs | ||
|
||
# You can match any string of characters against a directory, file or extension with a single asterisk (*): | ||
#foo/*/qux | ||
# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux | ||
|
||
# You can recursively match patterns against a directory, file or extension with a double asterisk (**): | ||
#foo/**/qux | ||
# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux | ||
|
||
# You can also negate patterns with an exclamation (!). | ||
# For example, you can ignore all files in a docs folder with the file extension .md: | ||
#docs/*.md | ||
# Then explicitly reverse the ignore rule for a single file: | ||
#!docs/README.md |
59 changes: 59 additions & 0 deletions
59
samples/server/petstore/jaxrs-spec-jakarta/.openapi-generator/FILES
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
README.md | ||
pom.xml | ||
src/gen/java/org/openapitools/api/AnotherFakeApi.java | ||
src/gen/java/org/openapitools/api/FakeApi.java | ||
src/gen/java/org/openapitools/api/FakeClassnameTestApi.java | ||
src/gen/java/org/openapitools/api/PetApi.java | ||
src/gen/java/org/openapitools/api/RestApplication.java | ||
src/gen/java/org/openapitools/api/RestResourceRoot.java | ||
src/gen/java/org/openapitools/api/StoreApi.java | ||
src/gen/java/org/openapitools/api/UserApi.java | ||
src/gen/java/org/openapitools/model/AdditionalPropertiesAnyType.java | ||
src/gen/java/org/openapitools/model/AdditionalPropertiesArray.java | ||
src/gen/java/org/openapitools/model/AdditionalPropertiesBoolean.java | ||
src/gen/java/org/openapitools/model/AdditionalPropertiesClass.java | ||
src/gen/java/org/openapitools/model/AdditionalPropertiesInteger.java | ||
src/gen/java/org/openapitools/model/AdditionalPropertiesNumber.java | ||
src/gen/java/org/openapitools/model/AdditionalPropertiesObject.java | ||
src/gen/java/org/openapitools/model/AdditionalPropertiesString.java | ||
src/gen/java/org/openapitools/model/Animal.java | ||
src/gen/java/org/openapitools/model/ArrayOfArrayOfNumberOnly.java | ||
src/gen/java/org/openapitools/model/ArrayOfNumberOnly.java | ||
src/gen/java/org/openapitools/model/ArrayTest.java | ||
src/gen/java/org/openapitools/model/BigCat.java | ||
src/gen/java/org/openapitools/model/BigCatAllOf.java | ||
src/gen/java/org/openapitools/model/Capitalization.java | ||
src/gen/java/org/openapitools/model/Cat.java | ||
src/gen/java/org/openapitools/model/CatAllOf.java | ||
src/gen/java/org/openapitools/model/Category.java | ||
src/gen/java/org/openapitools/model/ClassModel.java | ||
src/gen/java/org/openapitools/model/Client.java | ||
src/gen/java/org/openapitools/model/Dog.java | ||
src/gen/java/org/openapitools/model/DogAllOf.java | ||
src/gen/java/org/openapitools/model/EnumArrays.java | ||
src/gen/java/org/openapitools/model/EnumClass.java | ||
src/gen/java/org/openapitools/model/EnumTest.java | ||
src/gen/java/org/openapitools/model/FileSchemaTestClass.java | ||
src/gen/java/org/openapitools/model/FormatTest.java | ||
src/gen/java/org/openapitools/model/HasOnlyReadOnly.java | ||
src/gen/java/org/openapitools/model/MapTest.java | ||
src/gen/java/org/openapitools/model/MixedPropertiesAndAdditionalPropertiesClass.java | ||
src/gen/java/org/openapitools/model/Model200Response.java | ||
src/gen/java/org/openapitools/model/ModelApiResponse.java | ||
src/gen/java/org/openapitools/model/ModelFile.java | ||
src/gen/java/org/openapitools/model/ModelList.java | ||
src/gen/java/org/openapitools/model/ModelReturn.java | ||
src/gen/java/org/openapitools/model/Name.java | ||
src/gen/java/org/openapitools/model/NumberOnly.java | ||
src/gen/java/org/openapitools/model/Order.java | ||
src/gen/java/org/openapitools/model/OuterComposite.java | ||
src/gen/java/org/openapitools/model/OuterEnum.java | ||
src/gen/java/org/openapitools/model/Pet.java | ||
src/gen/java/org/openapitools/model/ReadOnlyFirst.java | ||
src/gen/java/org/openapitools/model/SpecialModelName.java | ||
src/gen/java/org/openapitools/model/Tag.java | ||
src/gen/java/org/openapitools/model/TypeHolderDefault.java | ||
src/gen/java/org/openapitools/model/TypeHolderExample.java | ||
src/gen/java/org/openapitools/model/User.java | ||
src/gen/java/org/openapitools/model/XmlItem.java | ||
src/main/openapi/openapi.yaml |
1 change: 1 addition & 0 deletions
1
samples/server/petstore/jaxrs-spec-jakarta/.openapi-generator/VERSION
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
6.4.0-SNAPSHOT |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# JAX-RS server with OpenAPI | ||
|
||
## Overview | ||
This server was generated by the [OpenAPI Generator](https://openapi-generator.tech) project. By using an | ||
[OpenAPI-Spec](https://openapis.org), you can easily generate a server stub. | ||
|
||
This is an example of building a OpenAPI-enabled JAX-RS server. | ||
This example uses the [JAX-RS](https://jax-rs-spec.java.net/) framework. | ||
|
||
|
||
The JAX-RS implementation needs to be provided by the application server you are deploying on. | ||
|
||
To run the server from the command line, you can use maven to provision and start a TomEE Server. | ||
Please execute the following: | ||
|
||
``` | ||
mvn -Dtomee-embedded-plugin.http=80 package org.apache.tomee.maven:tomee-embedded-maven-plugin:7.0.5:run | ||
``` | ||
|
||
You can then call your server endpoints under: | ||
|
||
``` | ||
http://localhost:80/v2/ | ||
``` | ||
|
||
Note that if you have configured the `host` to be something other than localhost, the calls through | ||
swagger-ui will be directed to that host and not localhost! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,139 @@ | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
<groupId>org.openapitools</groupId> | ||
<artifactId>jaxrs-spec-petstore-server-jakarta</artifactId> | ||
<packaging>war</packaging> | ||
<name>jaxrs-spec-petstore-server-jakarta</name> | ||
<version>1.0.0</version> | ||
|
||
|
||
<build> | ||
<sourceDirectory>src/main/java</sourceDirectory> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.codehaus.mojo</groupId> | ||
<artifactId>build-helper-maven-plugin</artifactId> | ||
<version>1.9.1</version> | ||
<executions> | ||
<execution> | ||
<id>add-source</id> | ||
<phase>generate-sources</phase> | ||
<goals> | ||
<goal>add-source</goal> | ||
</goals> | ||
<configuration> | ||
<sources> | ||
<source>src/gen/java</source> | ||
</sources> | ||
</configuration> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-war-plugin</artifactId> | ||
<version>3.1.0</version> | ||
<configuration> | ||
<failOnMissingWebXml>false</failOnMissingWebXml> | ||
</configuration> | ||
</plugin> | ||
<plugin> | ||
<artifactId>maven-failsafe-plugin</artifactId> | ||
<version>2.6</version> | ||
<executions> | ||
<execution> | ||
<goals> | ||
<goal>integration-test</goal> | ||
<goal>verify</goal> | ||
</goals> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
<dependencies> | ||
<dependency> | ||
<groupId>jakarta.ws.rs</groupId> | ||
<artifactId>jakarta.ws.rs-api</artifactId> | ||
<version>${jakarta.ws.rs-version}</version> | ||
<scope>provided</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>com.fasterxml.jackson.datatype</groupId> | ||
<artifactId>jackson-datatype-jsr310</artifactId> | ||
<version>${jackson-version}</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>com.fasterxml.jackson.jaxrs</groupId> | ||
<artifactId>jackson-jaxrs-json-provider</artifactId> | ||
<version>${jackson-version}</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>joda-time</groupId> | ||
<artifactId>joda-time</artifactId> | ||
<version>${joda-version}</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>jakarta.annotation</groupId> | ||
<artifactId>jakarta.annotation-api</artifactId> | ||
<version>${javax.annotation-api-version}</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>io.swagger</groupId> | ||
<artifactId>swagger-annotations</artifactId> | ||
<scope>provided</scope> | ||
<version>1.5.3</version> | ||
</dependency> | ||
<!-- @Nullable annotation --> | ||
<dependency> | ||
<groupId>com.google.code.findbugs</groupId> | ||
<artifactId>jsr305</artifactId> | ||
<version>3.0.2</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>junit</groupId> | ||
<artifactId>junit</artifactId> | ||
<version>${junit-version}</version> | ||
<scope>test</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.testng</groupId> | ||
<artifactId>testng</artifactId> | ||
<version>6.8.8</version> | ||
<scope>test</scope> | ||
<exclusions> | ||
<exclusion> | ||
<artifactId>junit</artifactId> | ||
<groupId>junit</groupId> | ||
</exclusion> | ||
<exclusion> | ||
<artifactId>snakeyaml</artifactId> | ||
<groupId>org.yaml</groupId> | ||
</exclusion> | ||
<exclusion> | ||
<artifactId>bsh</artifactId> | ||
<groupId>org.beanshell</groupId> | ||
</exclusion> | ||
</exclusions> | ||
</dependency> | ||
<!-- Bean Validation API support --> | ||
<dependency> | ||
<groupId>jakarta.validation</groupId> | ||
<artifactId>jakarta.validation-api</artifactId> | ||
<version>${beanvalidation-version}</version> | ||
<scope>provided</scope> | ||
</dependency> | ||
</dependencies> | ||
<properties> | ||
<java.version>1.8</java.version> | ||
<maven.compiler.source>${java.version}</maven.compiler.source> | ||
<maven.compiler.target>${java.version}</maven.compiler.target> | ||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> | ||
<jackson-version>2.9.9</jackson-version> | ||
<junit-version>4.13.2</junit-version> | ||
<joda-version>2.10.13</joda-version> | ||
<javax.annotation-api-version>2.1.1</javax.annotation-api-version> | ||
<beanvalidation-version>3.0.2</beanvalidation-version> | ||
<jakarta.ws.rs-version>3.1.0</jakarta.ws.rs-version> | ||
</properties> | ||
</project> |
31 changes: 31 additions & 0 deletions
31
.../server/petstore/jaxrs-spec-jakarta/src/gen/java/org/openapitools/api/AnotherFakeApi.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package org.openapitools.api; | ||
|
||
import org.openapitools.model.Client; | ||
|
||
import jakarta.ws.rs.*; | ||
import jakarta.ws.rs.core.Response; | ||
|
||
import io.swagger.annotations.*; | ||
|
||
import java.io.InputStream; | ||
import java.util.Map; | ||
import java.util.List; | ||
import jakarta.validation.constraints.*; | ||
import jakarta.validation.Valid; | ||
|
||
@Path("/another-fake/dummy") | ||
@Api(description = "the another-fake API") | ||
@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJAXRSSpecServerCodegen") | ||
public class AnotherFakeApi { | ||
|
||
@PATCH | ||
@Consumes({ "application/json" }) | ||
@Produces({ "application/json" }) | ||
@ApiOperation(value = "To test special tags", notes = "To test special tags and operation ID starting with number", response = Client.class, tags={ "$another-fake?" }) | ||
@ApiResponses(value = { | ||
@ApiResponse(code = 200, message = "successful operation", response = Client.class) | ||
}) | ||
public Response call123testSpecialTags(@Valid @NotNull Client body) { | ||
return Response.ok().entity("magic!").build(); | ||
} | ||
} |
Oops, something went wrong.