Skip to content

Commit c514dc3

Browse files
authored
add java native jakarta samples for test (#14381)
1 parent 9bbf729 commit c514dc3

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

58 files changed

+10269
-2
lines changed

.github/workflows/samples-java-client-jdk11.yaml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,15 @@ on:
88
- samples/client/petstore/java-micronaut-client/**
99
- samples/openapi3/client/petstore/java/jersey2-java8-special-characters/**
1010
- samples/openapi3/client/petstore/java/jersey2-java8-swagger1/**
11-
- samples/openapi3/client/petstore/java/native/**
11+
- samples/openapi3/client/petstore/java/native**
1212
pull_request:
1313
paths:
1414
- 'samples/client/petstore/java/**'
1515
- samples/client/petstore/jaxrs-cxf-client/**
1616
- samples/client/petstore/java-micronaut-client/**
1717
- samples/openapi3/client/petstore/java/jersey2-java8-special-characters/**
1818
- samples/openapi3/client/petstore/java/jersey2-java8-swagger1/**
19-
- samples/openapi3/client/petstore/java/native/**
19+
- samples/openapi3/client/petstore/java/native**
2020
jobs:
2121
build:
2222
name: Build Java Client JDK11
@@ -29,6 +29,7 @@ jobs:
2929
- samples/client/petstore/jaxrs-cxf-client
3030
- samples/client/petstore/java/native
3131
- samples/client/petstore/java/native-async
32+
- samples/client/petstore/java/native-jakarta
3233
- samples/client/petstore/java/retrofit2
3334
- samples/client/petstore/java/retrofit2rx2
3435
- samples/client/petstore/java/retrofit2rx3

bin/configs/java-native-jakarta.yaml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
generatorName: java
2+
outputDir: samples/client/petstore/java/native-jakarta
3+
library: native
4+
inputSpec: modules/openapi-generator/src/test/resources/3_0/petstore.yaml
5+
templateDir: modules/openapi-generator/src/main/resources/Java
6+
additionalProperties:
7+
artifactId: petstore-native-jakarta
8+
hideGenerationTimestamp: "true"
9+
useJakartaEe: "true"
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# This workflow will build a Java project with Maven, and cache/restore any dependencies to improve the workflow execution time
2+
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven
3+
#
4+
# This file is auto-generated by OpenAPI Generator (https://openapi-generator.tech)
5+
6+
name: Java CI with Maven
7+
8+
on:
9+
push:
10+
branches: [ main, master ]
11+
pull_request:
12+
branches: [ main, master ]
13+
14+
jobs:
15+
build:
16+
name: Build OpenAPI Petstore
17+
runs-on: ubuntu-latest
18+
strategy:
19+
matrix:
20+
java: [ '8' ]
21+
steps:
22+
- uses: actions/checkout@v2
23+
- name: Set up JDK
24+
uses: actions/setup-java@v2
25+
with:
26+
java-version: ${{ matrix.java }}
27+
distribution: 'temurin'
28+
cache: maven
29+
- name: Build with Maven
30+
run: mvn -B package --no-transfer-progress --file pom.xml
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
*.class
2+
3+
# Mobile Tools for Java (J2ME)
4+
.mtj.tmp/
5+
6+
# Package Files #
7+
*.jar
8+
*.war
9+
*.ear
10+
11+
# exclude jar for gradle wrapper
12+
!gradle/wrapper/*.jar
13+
14+
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
15+
hs_err_pid*
16+
17+
# build files
18+
**/target
19+
target
20+
.gradle
21+
build
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# OpenAPI Generator Ignore
2+
# Generated by openapi-generator https://github.com/openapitools/openapi-generator
3+
4+
# Use this file to prevent files from being overwritten by the generator.
5+
# The patterns follow closely to .gitignore or .dockerignore.
6+
7+
# As an example, the C# client generator defines ApiClient.cs.
8+
# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line:
9+
#ApiClient.cs
10+
11+
# You can match any string of characters against a directory, file or extension with a single asterisk (*):
12+
#foo/*/qux
13+
# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux
14+
15+
# You can recursively match patterns against a directory, file or extension with a double asterisk (**):
16+
#foo/**/qux
17+
# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux
18+
19+
# You can also negate patterns with an exclamation (!).
20+
# For example, you can ignore all files in a docs folder with the file extension .md:
21+
#docs/*.md
22+
# Then explicitly reverse the ignore rule for a single file:
23+
#!docs/README.md
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
.github/workflows/maven.yml
2+
.gitignore
3+
.travis.yml
4+
README.md
5+
api/openapi.yaml
6+
build.gradle
7+
build.sbt
8+
docs/Category.md
9+
docs/ModelApiResponse.md
10+
docs/Order.md
11+
docs/Pet.md
12+
docs/PetApi.md
13+
docs/StoreApi.md
14+
docs/Tag.md
15+
docs/User.md
16+
docs/UserApi.md
17+
git_push.sh
18+
gradle.properties
19+
gradle/wrapper/gradle-wrapper.jar
20+
gradle/wrapper/gradle-wrapper.properties
21+
gradlew
22+
gradlew.bat
23+
pom.xml
24+
settings.gradle
25+
src/main/AndroidManifest.xml
26+
src/main/java/org/openapitools/client/ApiClient.java
27+
src/main/java/org/openapitools/client/ApiException.java
28+
src/main/java/org/openapitools/client/ApiResponse.java
29+
src/main/java/org/openapitools/client/Configuration.java
30+
src/main/java/org/openapitools/client/JSON.java
31+
src/main/java/org/openapitools/client/Pair.java
32+
src/main/java/org/openapitools/client/RFC3339DateFormat.java
33+
src/main/java/org/openapitools/client/ServerConfiguration.java
34+
src/main/java/org/openapitools/client/ServerVariable.java
35+
src/main/java/org/openapitools/client/api/PetApi.java
36+
src/main/java/org/openapitools/client/api/StoreApi.java
37+
src/main/java/org/openapitools/client/api/UserApi.java
38+
src/main/java/org/openapitools/client/model/AbstractOpenApiSchema.java
39+
src/main/java/org/openapitools/client/model/Category.java
40+
src/main/java/org/openapitools/client/model/ModelApiResponse.java
41+
src/main/java/org/openapitools/client/model/Order.java
42+
src/main/java/org/openapitools/client/model/Pet.java
43+
src/main/java/org/openapitools/client/model/Tag.java
44+
src/main/java/org/openapitools/client/model/User.java
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
6.3.0-SNAPSHOT
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#
2+
# Generated by: https://openapi-generator.tech
3+
#
4+
language: java
5+
jdk:
6+
- oraclejdk11
7+
before_install:
8+
# ensure gradlew has proper permission
9+
- chmod a+x ./gradlew
10+
script:
11+
# test using maven
12+
- mvn test
13+
# uncomment below to test using gradle
14+
# - gradle test
15+
# uncomment below to test using sbt
16+
# - sbt test
Lines changed: 189 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,189 @@
1+
# petstore-native-jakarta
2+
3+
OpenAPI Petstore
4+
5+
- API version: 1.0.0
6+
7+
This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
8+
9+
10+
*Automatically generated by the [OpenAPI Generator](https://openapi-generator.tech)*
11+
12+
## Requirements
13+
14+
Building the API client library requires:
15+
16+
1. Java 11+
17+
2. Maven/Gradle
18+
19+
## Installation
20+
21+
To install the API client library to your local Maven repository, simply execute:
22+
23+
```shell
24+
mvn clean install
25+
```
26+
27+
To deploy it to a remote Maven repository instead, configure the settings of the repository and execute:
28+
29+
```shell
30+
mvn clean deploy
31+
```
32+
33+
Refer to the [OSSRH Guide](http://central.sonatype.org/pages/ossrh-guide.html) for more information.
34+
35+
### Maven users
36+
37+
Add this dependency to your project's POM:
38+
39+
```xml
40+
<dependency>
41+
<groupId>org.openapitools</groupId>
42+
<artifactId>petstore-native-jakarta</artifactId>
43+
<version>1.0.0</version>
44+
<scope>compile</scope>
45+
</dependency>
46+
```
47+
48+
### Gradle users
49+
50+
Add this dependency to your project's build file:
51+
52+
```groovy
53+
compile "org.openapitools:petstore-native-jakarta:1.0.0"
54+
```
55+
56+
### Others
57+
58+
At first generate the JAR by executing:
59+
60+
```shell
61+
mvn clean package
62+
```
63+
64+
Then manually install the following JARs:
65+
66+
- `target/petstore-native-jakarta-1.0.0.jar`
67+
- `target/lib/*.jar`
68+
69+
## Getting Started
70+
71+
Please follow the [installation](#installation) instruction and execute the following Java code:
72+
73+
```java
74+
75+
import org.openapitools.client.*;
76+
import org.openapitools.client.model.*;
77+
import org.openapitools.client.api.PetApi;
78+
79+
public class PetApiExample {
80+
81+
public static void main(String[] args) {
82+
ApiClient defaultClient = Configuration.getDefaultApiClient();
83+
// Configure clients using the `defaultClient` object, such as
84+
// overriding the host and port, timeout, etc.
85+
PetApi apiInstance = new PetApi(defaultClient);
86+
Pet pet = new Pet(); // Pet | Pet object that needs to be added to the store
87+
try {
88+
Pet result = apiInstance.addPet(pet);
89+
System.out.println(result);
90+
} catch (ApiException e) {
91+
System.err.println("Exception when calling PetApi#addPet");
92+
System.err.println("Status code: " + e.getCode());
93+
System.err.println("Reason: " + e.getResponseBody());
94+
System.err.println("Response headers: " + e.getResponseHeaders());
95+
e.printStackTrace();
96+
}
97+
}
98+
}
99+
100+
```
101+
102+
## Documentation for API Endpoints
103+
104+
All URIs are relative to *http://petstore.swagger.io/v2*
105+
106+
Class | Method | HTTP request | Description
107+
------------ | ------------- | ------------- | -------------
108+
*PetApi* | [**addPet**](docs/PetApi.md#addPet) | **POST** /pet | Add a new pet to the store
109+
*PetApi* | [**addPetWithHttpInfo**](docs/PetApi.md#addPetWithHttpInfo) | **POST** /pet | Add a new pet to the store
110+
*PetApi* | [**deletePet**](docs/PetApi.md#deletePet) | **DELETE** /pet/{petId} | Deletes a pet
111+
*PetApi* | [**deletePetWithHttpInfo**](docs/PetApi.md#deletePetWithHttpInfo) | **DELETE** /pet/{petId} | Deletes a pet
112+
*PetApi* | [**findPetsByStatus**](docs/PetApi.md#findPetsByStatus) | **GET** /pet/findByStatus | Finds Pets by status
113+
*PetApi* | [**findPetsByStatusWithHttpInfo**](docs/PetApi.md#findPetsByStatusWithHttpInfo) | **GET** /pet/findByStatus | Finds Pets by status
114+
*PetApi* | [**findPetsByTags**](docs/PetApi.md#findPetsByTags) | **GET** /pet/findByTags | Finds Pets by tags
115+
*PetApi* | [**findPetsByTagsWithHttpInfo**](docs/PetApi.md#findPetsByTagsWithHttpInfo) | **GET** /pet/findByTags | Finds Pets by tags
116+
*PetApi* | [**getPetById**](docs/PetApi.md#getPetById) | **GET** /pet/{petId} | Find pet by ID
117+
*PetApi* | [**getPetByIdWithHttpInfo**](docs/PetApi.md#getPetByIdWithHttpInfo) | **GET** /pet/{petId} | Find pet by ID
118+
*PetApi* | [**updatePet**](docs/PetApi.md#updatePet) | **PUT** /pet | Update an existing pet
119+
*PetApi* | [**updatePetWithHttpInfo**](docs/PetApi.md#updatePetWithHttpInfo) | **PUT** /pet | Update an existing pet
120+
*PetApi* | [**updatePetWithForm**](docs/PetApi.md#updatePetWithForm) | **POST** /pet/{petId} | Updates a pet in the store with form data
121+
*PetApi* | [**updatePetWithFormWithHttpInfo**](docs/PetApi.md#updatePetWithFormWithHttpInfo) | **POST** /pet/{petId} | Updates a pet in the store with form data
122+
*PetApi* | [**uploadFile**](docs/PetApi.md#uploadFile) | **POST** /pet/{petId}/uploadImage | uploads an image
123+
*PetApi* | [**uploadFileWithHttpInfo**](docs/PetApi.md#uploadFileWithHttpInfo) | **POST** /pet/{petId}/uploadImage | uploads an image
124+
*StoreApi* | [**deleteOrder**](docs/StoreApi.md#deleteOrder) | **DELETE** /store/order/{orderId} | Delete purchase order by ID
125+
*StoreApi* | [**deleteOrderWithHttpInfo**](docs/StoreApi.md#deleteOrderWithHttpInfo) | **DELETE** /store/order/{orderId} | Delete purchase order by ID
126+
*StoreApi* | [**getInventory**](docs/StoreApi.md#getInventory) | **GET** /store/inventory | Returns pet inventories by status
127+
*StoreApi* | [**getInventoryWithHttpInfo**](docs/StoreApi.md#getInventoryWithHttpInfo) | **GET** /store/inventory | Returns pet inventories by status
128+
*StoreApi* | [**getOrderById**](docs/StoreApi.md#getOrderById) | **GET** /store/order/{orderId} | Find purchase order by ID
129+
*StoreApi* | [**getOrderByIdWithHttpInfo**](docs/StoreApi.md#getOrderByIdWithHttpInfo) | **GET** /store/order/{orderId} | Find purchase order by ID
130+
*StoreApi* | [**placeOrder**](docs/StoreApi.md#placeOrder) | **POST** /store/order | Place an order for a pet
131+
*StoreApi* | [**placeOrderWithHttpInfo**](docs/StoreApi.md#placeOrderWithHttpInfo) | **POST** /store/order | Place an order for a pet
132+
*UserApi* | [**createUser**](docs/UserApi.md#createUser) | **POST** /user | Create user
133+
*UserApi* | [**createUserWithHttpInfo**](docs/UserApi.md#createUserWithHttpInfo) | **POST** /user | Create user
134+
*UserApi* | [**createUsersWithArrayInput**](docs/UserApi.md#createUsersWithArrayInput) | **POST** /user/createWithArray | Creates list of users with given input array
135+
*UserApi* | [**createUsersWithArrayInputWithHttpInfo**](docs/UserApi.md#createUsersWithArrayInputWithHttpInfo) | **POST** /user/createWithArray | Creates list of users with given input array
136+
*UserApi* | [**createUsersWithListInput**](docs/UserApi.md#createUsersWithListInput) | **POST** /user/createWithList | Creates list of users with given input array
137+
*UserApi* | [**createUsersWithListInputWithHttpInfo**](docs/UserApi.md#createUsersWithListInputWithHttpInfo) | **POST** /user/createWithList | Creates list of users with given input array
138+
*UserApi* | [**deleteUser**](docs/UserApi.md#deleteUser) | **DELETE** /user/{username} | Delete user
139+
*UserApi* | [**deleteUserWithHttpInfo**](docs/UserApi.md#deleteUserWithHttpInfo) | **DELETE** /user/{username} | Delete user
140+
*UserApi* | [**getUserByName**](docs/UserApi.md#getUserByName) | **GET** /user/{username} | Get user by user name
141+
*UserApi* | [**getUserByNameWithHttpInfo**](docs/UserApi.md#getUserByNameWithHttpInfo) | **GET** /user/{username} | Get user by user name
142+
*UserApi* | [**loginUser**](docs/UserApi.md#loginUser) | **GET** /user/login | Logs user into the system
143+
*UserApi* | [**loginUserWithHttpInfo**](docs/UserApi.md#loginUserWithHttpInfo) | **GET** /user/login | Logs user into the system
144+
*UserApi* | [**logoutUser**](docs/UserApi.md#logoutUser) | **GET** /user/logout | Logs out current logged in user session
145+
*UserApi* | [**logoutUserWithHttpInfo**](docs/UserApi.md#logoutUserWithHttpInfo) | **GET** /user/logout | Logs out current logged in user session
146+
*UserApi* | [**updateUser**](docs/UserApi.md#updateUser) | **PUT** /user/{username} | Updated user
147+
*UserApi* | [**updateUserWithHttpInfo**](docs/UserApi.md#updateUserWithHttpInfo) | **PUT** /user/{username} | Updated user
148+
149+
150+
## Documentation for Models
151+
152+
- [Category](docs/Category.md)
153+
- [ModelApiResponse](docs/ModelApiResponse.md)
154+
- [Order](docs/Order.md)
155+
- [Pet](docs/Pet.md)
156+
- [Tag](docs/Tag.md)
157+
- [User](docs/User.md)
158+
159+
160+
## Documentation for Authorization
161+
162+
Authentication schemes defined for the API:
163+
### api_key
164+
165+
166+
- **Type**: API key
167+
- **API key parameter name**: api_key
168+
- **Location**: HTTP header
169+
170+
### petstore_auth
171+
172+
173+
- **Type**: OAuth
174+
- **Flow**: implicit
175+
- **Authorization URL**: http://petstore.swagger.io/api/oauth/dialog
176+
- **Scopes**:
177+
- write:pets: modify pets in your account
178+
- read:pets: read your pets
179+
180+
181+
## Recommendation
182+
183+
It's recommended to create an instance of `ApiClient` per thread in a multithreaded environment to avoid any potential issues.
184+
However, the instances of the api clients created from the `ApiClient` are thread-safe and can be re-used.
185+
186+
## Author
187+
188+
189+

0 commit comments

Comments
 (0)