forked from loafle/openapi-generator-original
Support for GSON Decoder in Java Feign Generator (#14254)
* Supporting Gson decoder in Feign * Supporting Gson decoder in Feign * Fixing test failures - and ensuring Jackson is used as the default if nothing selected (back compatible) * Adding in sample files * Updating docs * Switching to echo server version * Adding feign-gson to the github workflow * Empty-Commit
This commit is contained in:
parent
081a6ef466
commit
2a33229158
@ -18,6 +18,7 @@ jobs:
|
||||
# clients
|
||||
- samples/client/echo_api/java/apache-httpclient
|
||||
- samples/client/echo_api/java/native
|
||||
- samples/client/echo_api/java/feign-gson
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/setup-java@v3
|
||||
|
9
bin/configs/java-feign-gson-echo-api.yaml
Normal file
9
bin/configs/java-feign-gson-echo-api.yaml
Normal file
@ -0,0 +1,9 @@
|
||||
generatorName: java
|
||||
outputDir: samples/client/echo_api/java/feign-gson
|
||||
library: feign
|
||||
inputSpec: modules/openapi-generator/src/test/resources/3_0/echo_api.yaml
|
||||
templateDir: modules/openapi-generator/src/main/resources/Java
|
||||
additionalProperties:
|
||||
serializationLibrary: gson
|
||||
artifactId: echo-api-feign-json
|
||||
hideGenerationTimestamp: "true"
|
@ -56,7 +56,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
||||
|implicitHeadersRegex|Skip header parameters that matches given regex in the generated API methods using @ApiImplicitParams annotation. Note: this parameter is ignored when implicitHeaders=true| |null|
|
||||
|invokerPackage|root package for generated code| |org.openapitools.client|
|
||||
|legacyDiscriminatorBehavior|Set to false for generators with better support for discriminators. (Python, Java, Go, PowerShell, C#have this enabled by default).|<dl><dt>**true**</dt><dd>The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document.</dd><dt>**false**</dt><dd>The mapping in the discriminator includes any descendent schemas that allOf inherit from self, any oneOf schemas, any anyOf schemas, any x-discriminator-values, and the discriminator mapping schemas in the OAS document AND Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing.</dd></dl>|true|
|
||||
|library|library template (sub-template) to use|<dl><dt>**jersey1**</dt><dd>HTTP client: Jersey client 1.19.x. JSON processing: Jackson 2.9.x. Enable gzip request encoding using '-DuseGzipFeature=true'. IMPORTANT NOTE: jersey 1.x is no longer actively maintained so please upgrade to 'jersey3' or other HTTP libraries instead.</dd><dt>**jersey2**</dt><dd>HTTP client: Jersey client 2.25.1. JSON processing: Jackson 2.9.x</dd><dt>**jersey3**</dt><dd>HTTP client: Jersey client 3.x. JSON processing: Jackson 2.x</dd><dt>**feign**</dt><dd>HTTP client: OpenFeign 10.x. JSON processing: Jackson 2.9.x.</dd><dt>**okhttp-gson**</dt><dd>[DEFAULT] HTTP client: OkHttp 3.x. JSON processing: Gson 2.8.x. Enable Parcelable models on Android using '-DparcelableModel=true'. Enable gzip request encoding using '-DuseGzipFeature=true'.</dd><dt>**retrofit2**</dt><dd>HTTP client: OkHttp 3.x. JSON processing: Gson 2.x (Retrofit 2.3.0). Enable the RxJava adapter using '-DuseRxJava[2/3]=true'. (RxJava 1.x or 2.x or 3.x)</dd><dt>**resttemplate**</dt><dd>HTTP client: Spring RestTemplate 4.x. JSON processing: Jackson 2.9.x</dd><dt>**webclient**</dt><dd>HTTP client: Spring WebClient 5.x. JSON processing: Jackson 2.9.x</dd><dt>**resteasy**</dt><dd>HTTP client: Resteasy client 3.x. JSON processing: Jackson 2.9.x</dd><dt>**vertx**</dt><dd>HTTP client: VertX client 3.x. JSON processing: Jackson 2.9.x</dd><dt>**google-api-client**</dt><dd>HTTP client: Google API client 1.x. JSON processing: Jackson 2.9.x</dd><dt>**rest-assured**</dt><dd>HTTP client: rest-assured : 4.x. JSON processing: Gson 2.x or Jackson 2.10.x. Only for Java 8</dd><dt>**native**</dt><dd>HTTP client: Java native HttpClient. JSON processing: Jackson 2.9.x. Only for Java11+</dd><dt>**microprofile**</dt><dd>HTTP client: Microprofile client 1.x. JSON processing: JSON-B</dd><dt>**apache-httpclient**</dt><dd>HTTP client: Apache httpclient 4.x</dd></dl>|okhttp-gson|
|
||||
|library|library template (sub-template) to use|<dl><dt>**jersey1**</dt><dd>HTTP client: Jersey client 1.19.x. JSON processing: Jackson 2.9.x. Enable gzip request encoding using '-DuseGzipFeature=true'. IMPORTANT NOTE: jersey 1.x is no longer actively maintained so please upgrade to 'jersey3' or other HTTP libraries instead.</dd><dt>**jersey2**</dt><dd>HTTP client: Jersey client 2.25.1. JSON processing: Jackson 2.9.x</dd><dt>**jersey3**</dt><dd>HTTP client: Jersey client 3.x. JSON processing: Jackson 2.x</dd><dt>**feign**</dt><dd>HTTP client: OpenFeign 10.x. JSON processing: Jackson 2.9.x. or Gson 2.x</dd><dt>**okhttp-gson**</dt><dd>[DEFAULT] HTTP client: OkHttp 3.x. JSON processing: Gson 2.8.x. Enable Parcelable models on Android using '-DparcelableModel=true'. Enable gzip request encoding using '-DuseGzipFeature=true'.</dd><dt>**retrofit2**</dt><dd>HTTP client: OkHttp 3.x. JSON processing: Gson 2.x (Retrofit 2.3.0). Enable the RxJava adapter using '-DuseRxJava[2/3]=true'. (RxJava 1.x or 2.x or 3.x)</dd><dt>**resttemplate**</dt><dd>HTTP client: Spring RestTemplate 4.x. JSON processing: Jackson 2.9.x</dd><dt>**webclient**</dt><dd>HTTP client: Spring WebClient 5.x. JSON processing: Jackson 2.9.x</dd><dt>**resteasy**</dt><dd>HTTP client: Resteasy client 3.x. JSON processing: Jackson 2.9.x</dd><dt>**vertx**</dt><dd>HTTP client: VertX client 3.x. JSON processing: Jackson 2.9.x</dd><dt>**google-api-client**</dt><dd>HTTP client: Google API client 1.x. JSON processing: Jackson 2.9.x</dd><dt>**rest-assured**</dt><dd>HTTP client: rest-assured : 4.x. JSON processing: Gson 2.x or Jackson 2.10.x. Only for Java 8</dd><dt>**native**</dt><dd>HTTP client: Java native HttpClient. JSON processing: Jackson 2.9.x. Only for Java11+</dd><dt>**microprofile**</dt><dd>HTTP client: Microprofile client 1.x. JSON processing: JSON-B</dd><dt>**apache-httpclient**</dt><dd>HTTP client: Apache httpclient 4.x</dd></dl>|okhttp-gson|
|
||||
|licenseName|The name of the license| |Unlicense|
|
||||
|licenseUrl|The URL of the license| |http://unlicense.org|
|
||||
|microprofileFramework|Framework for microprofile. Possible values "kumuluzee"| |null|
|
||||
|
@ -211,7 +211,7 @@ public class JavaClientCodegen extends AbstractJavaCodegen
|
||||
supportedLibraries.put(JERSEY1, "HTTP client: Jersey client 1.19.x. JSON processing: Jackson 2.9.x. Enable gzip request encoding using '-DuseGzipFeature=true'. IMPORTANT NOTE: jersey 1.x is no longer actively maintained so please upgrade to 'jersey3' or other HTTP libraries instead.");
|
||||
supportedLibraries.put(JERSEY2, "HTTP client: Jersey client 2.25.1. JSON processing: Jackson 2.9.x");
|
||||
supportedLibraries.put(JERSEY3, "HTTP client: Jersey client 3.x. JSON processing: Jackson 2.x");
|
||||
supportedLibraries.put(FEIGN, "HTTP client: OpenFeign 10.x. JSON processing: Jackson 2.9.x.");
|
||||
supportedLibraries.put(FEIGN, "HTTP client: OpenFeign 10.x. JSON processing: Jackson 2.9.x. or Gson 2.x");
|
||||
supportedLibraries.put(OKHTTP_GSON, "[DEFAULT] HTTP client: OkHttp 3.x. JSON processing: Gson 2.8.x. Enable Parcelable models on Android using '-DparcelableModel=true'. Enable gzip request encoding using '-DuseGzipFeature=true'.");
|
||||
supportedLibraries.put(RETROFIT_2, "HTTP client: OkHttp 3.x. JSON processing: Gson 2.x (Retrofit 2.3.0). Enable the RxJava adapter using '-DuseRxJava[2/3]=true'. (RxJava 1.x or 2.x or 3.x)");
|
||||
supportedLibraries.put(RESTTEMPLATE, "HTTP client: Spring RestTemplate 4.x. JSON processing: Jackson 2.9.x");
|
||||
@ -485,7 +485,6 @@ public class JavaClientCodegen extends AbstractJavaCodegen
|
||||
apiDocTemplateFiles.remove("api_doc.mustache");
|
||||
//Templates to decode response headers
|
||||
supportingFiles.add(new SupportingFile("model/ApiResponse.mustache", modelsFolder, "ApiResponse.java"));
|
||||
supportingFiles.add(new SupportingFile("ApiResponseDecoder.mustache", invokerFolder, "ApiResponseDecoder.java"));
|
||||
|
||||
// TODO remove "file" from reserved word list as feign client doesn't support using `baseName`
|
||||
// as the parameter name yet
|
||||
@ -503,8 +502,14 @@ public class JavaClientCodegen extends AbstractJavaCodegen
|
||||
}
|
||||
|
||||
if (FEIGN.equals(getLibrary())) {
|
||||
forceSerializationLibrary(SERIALIZATION_LIBRARY_JACKSON);
|
||||
supportingFiles.add(new SupportingFile("ParamExpander.mustache", invokerFolder, "ParamExpander.java"));
|
||||
if (getSerializationLibrary() == null) {
|
||||
LOGGER.info("No serializationLibrary configured, using '{}' as fallback", SERIALIZATION_LIBRARY_JACKSON);
|
||||
setSerializationLibrary(SERIALIZATION_LIBRARY_JACKSON);
|
||||
}
|
||||
if (SERIALIZATION_LIBRARY_JACKSON.equals(getSerializationLibrary())) {
|
||||
supportingFiles.add(new SupportingFile("ApiResponseDecoder.mustache", invokerFolder, "ApiResponseDecoder.java"));
|
||||
supportingFiles.add(new SupportingFile("ParamExpander.mustache", invokerFolder, "ParamExpander.java"));
|
||||
}
|
||||
supportingFiles.add(new SupportingFile("EncodingUtils.mustache", invokerFolder, "EncodingUtils.java"));
|
||||
supportingFiles.add(new SupportingFile("auth/DefaultApi20Impl.mustache", authFolder, "DefaultApi20Impl.java"));
|
||||
} else if (OKHTTP_GSON.equals(getLibrary()) || StringUtils.isEmpty(getLibrary())) {
|
||||
|
@ -5,29 +5,40 @@ import java.util.Map;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
{{#jackson}}
|
||||
import feign.okhttp.OkHttpClient;
|
||||
|
||||
import com.fasterxml.jackson.databind.DeserializationFeature;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.fasterxml.jackson.databind.SerializationFeature;
|
||||
{{#openApiNullable}}
|
||||
import org.openapitools.jackson.nullable.JsonNullableModule;
|
||||
{{/openApiNullable}}
|
||||
{{/jackson}}
|
||||
{{#joda}}
|
||||
import com.fasterxml.jackson.datatype.joda.JodaModule;
|
||||
{{/joda}}
|
||||
{{#jackson}}
|
||||
import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
|
||||
{{/jackson}}
|
||||
|
||||
import feign.Feign;
|
||||
import feign.RequestInterceptor;
|
||||
import feign.form.FormEncoder;
|
||||
{{#jackson}}
|
||||
import feign.jackson.JacksonDecoder;
|
||||
import feign.jackson.JacksonEncoder;
|
||||
{{/jackson}}
|
||||
{{#gson}}
|
||||
import feign.gson.GsonDecoder;
|
||||
import feign.gson.GsonEncoder;
|
||||
{{/gson}}
|
||||
import feign.slf4j.Slf4jLogger;
|
||||
import {{invokerPackage}}.auth.HttpBasicAuth;
|
||||
import {{invokerPackage}}.auth.HttpBearerAuth;
|
||||
import {{invokerPackage}}.auth.ApiKeyAuth;
|
||||
{{#jackson}}
|
||||
import {{invokerPackage}}.ApiResponseDecoder;
|
||||
{{/jackson}}
|
||||
|
||||
{{#hasOAuthMethods}}
|
||||
import {{invokerPackage}}.auth.ApiErrorDecoder;
|
||||
@ -45,14 +56,17 @@ public class ApiClient {
|
||||
|
||||
public interface Api {}
|
||||
|
||||
{{#jackson}}
|
||||
protected ObjectMapper objectMapper;
|
||||
{{/jackson}}
|
||||
private String basePath = "{{{basePath}}}";
|
||||
private Map<String, RequestInterceptor> apiAuthorizations;
|
||||
private Feign.Builder feignBuilder;
|
||||
|
||||
public ApiClient() {
|
||||
objectMapper = createObjectMapper();
|
||||
apiAuthorizations = new LinkedHashMap<String, RequestInterceptor>();
|
||||
{{#jackson}}
|
||||
objectMapper = createObjectMapper();
|
||||
feignBuilder = Feign.builder()
|
||||
.client(new OkHttpClient())
|
||||
.encoder(new FormEncoder(new JacksonEncoder(objectMapper)))
|
||||
@ -62,6 +76,17 @@ public class ApiClient {
|
||||
.retryer(new Retryer.Default(0, 0, 2))
|
||||
{{/hasOAuthMethods}}
|
||||
.logger(new Slf4jLogger());
|
||||
{{/jackson}}
|
||||
{{#gson}}
|
||||
feignBuilder = Feign.builder()
|
||||
.encoder(new FormEncoder(new GsonEncoder()))
|
||||
.decoder(new GsonDecoder())
|
||||
{{#hasOAuthMethods}}
|
||||
.errorDecoder(new ApiErrorDecoder())
|
||||
.retryer(new Retryer.Default(0, 0, 2))
|
||||
{{/hasOAuthMethods}}
|
||||
.logger(new Slf4jLogger());
|
||||
{{/gson}}
|
||||
}
|
||||
|
||||
public ApiClient(String[] authNames) {
|
||||
@ -140,6 +165,7 @@ public class ApiClient {
|
||||
return this;
|
||||
}
|
||||
|
||||
{{#jackson}}
|
||||
private ObjectMapper createObjectMapper() {
|
||||
ObjectMapper objectMapper = new ObjectMapper();
|
||||
objectMapper.enable(SerializationFeature.WRITE_ENUMS_USING_TO_STRING);
|
||||
@ -158,6 +184,7 @@ public class ApiClient {
|
||||
{{/openApiNullable}}
|
||||
return objectMapper;
|
||||
}
|
||||
{{/jackson}}
|
||||
|
||||
{{#hasOAuthMethods}}
|
||||
private RequestInterceptor buildOauthRequestInterceptor(OAuthFlow flow, String authorizationUrl, String tokenUrl, String scopes) {
|
||||
@ -172,6 +199,8 @@ public class ApiClient {
|
||||
}
|
||||
|
||||
{{/hasOAuthMethods}}
|
||||
|
||||
{{#jackson}}
|
||||
public ObjectMapper getObjectMapper(){
|
||||
return objectMapper;
|
||||
}
|
||||
@ -179,6 +208,7 @@ public class ApiClient {
|
||||
public void setObjectMapper(ObjectMapper objectMapper) {
|
||||
this.objectMapper = objectMapper;
|
||||
}
|
||||
{{/jackson}}
|
||||
|
||||
/**
|
||||
* Creates a feign client for given API interface.
|
||||
|
@ -234,11 +234,20 @@
|
||||
<artifactId>feign-core</artifactId>
|
||||
<version>${feign-version}</version>
|
||||
</dependency>
|
||||
{{#jackson}}
|
||||
<dependency>
|
||||
<groupId>io.github.openfeign</groupId>
|
||||
<artifactId>feign-jackson</artifactId>
|
||||
<version>${feign-version}</version>
|
||||
</dependency>
|
||||
{{/jackson}}
|
||||
{{#gson}}
|
||||
<dependency>
|
||||
<groupId>io.github.openfeign</groupId>
|
||||
<artifactId>feign-gson</artifactId>
|
||||
<version>${feign-version}</version>
|
||||
</dependency>
|
||||
{{/gson}}
|
||||
<dependency>
|
||||
<groupId>io.github.openfeign</groupId>
|
||||
<artifactId>feign-slf4j</artifactId>
|
||||
@ -255,6 +264,7 @@
|
||||
<version>${feign-version}</version>
|
||||
</dependency>
|
||||
|
||||
{{#jackson}}
|
||||
<!-- JSON processing: jackson -->
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.core</groupId>
|
||||
@ -271,6 +281,14 @@
|
||||
<artifactId>jackson-databind</artifactId>
|
||||
<version>${jackson-databind-version}</version>
|
||||
</dependency>
|
||||
{{/jackson}}
|
||||
{{#gson}}
|
||||
<dependency>
|
||||
<groupId>com.google.code.gson</groupId>
|
||||
<artifactId>gson</artifactId>
|
||||
<version>${gson-version}</version>
|
||||
</dependency>
|
||||
{{/gson}}
|
||||
{{#openApiNullable}}
|
||||
<dependency>
|
||||
<groupId>org.openapitools</groupId>
|
||||
@ -293,11 +311,13 @@
|
||||
<version>${jackson-version}</version>
|
||||
</dependency>
|
||||
{{/joda}}
|
||||
{{#jackson}}
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.datatype</groupId>
|
||||
<artifactId>jackson-datatype-jsr310</artifactId>
|
||||
<version>${jackson-version}</version>
|
||||
</dependency>
|
||||
{{/jackson}}
|
||||
<dependency>
|
||||
<groupId>com.github.scribejava</groupId>
|
||||
<artifactId>scribejava-core</artifactId>
|
||||
@ -356,7 +376,12 @@
|
||||
<swagger-annotations-version>1.6.6</swagger-annotations-version>
|
||||
<feign-version>10.11</feign-version>
|
||||
<feign-form-version>3.8.0</feign-form-version>
|
||||
{{#jackson}}
|
||||
<jackson-version>2.13.4</jackson-version>
|
||||
{{/jackson}}
|
||||
{{#gson}}
|
||||
<gson-version>2.8.6</gson-version>
|
||||
{{/gson}}
|
||||
{{#openApiNullable}}
|
||||
<jackson-databind-nullable-version>0.2.4</jackson-databind-nullable-version>
|
||||
{{/openApiNullable}}
|
||||
|
30
samples/client/echo_api/java/feign-gson/.github/workflows/maven.yml
vendored
Normal file
30
samples/client/echo_api/java/feign-gson/.github/workflows/maven.yml
vendored
Normal file
@ -0,0 +1,30 @@
|
||||
# This workflow will build a Java project with Maven, and cache/restore any dependencies to improve the workflow execution time
|
||||
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven
|
||||
#
|
||||
# This file is auto-generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||
|
||||
name: Java CI with Maven
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ main, master ]
|
||||
pull_request:
|
||||
branches: [ main, master ]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
name: Build Echo Server API
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
java: [ '8' ]
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Set up JDK
|
||||
uses: actions/setup-java@v2
|
||||
with:
|
||||
java-version: ${{ matrix.java }}
|
||||
distribution: 'temurin'
|
||||
cache: maven
|
||||
- name: Build with Maven
|
||||
run: mvn -B package --no-transfer-progress --file pom.xml
|
21
samples/client/echo_api/java/feign-gson/.gitignore
vendored
Normal file
21
samples/client/echo_api/java/feign-gson/.gitignore
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
*.class
|
||||
|
||||
# Mobile Tools for Java (J2ME)
|
||||
.mtj.tmp/
|
||||
|
||||
# Package Files #
|
||||
*.jar
|
||||
*.war
|
||||
*.ear
|
||||
|
||||
# exclude jar for gradle wrapper
|
||||
!gradle/wrapper/*.jar
|
||||
|
||||
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
|
||||
hs_err_pid*
|
||||
|
||||
# build files
|
||||
**/target
|
||||
target
|
||||
.gradle
|
||||
build
|
@ -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
|
@ -0,0 +1,33 @@
|
||||
.github/workflows/maven.yml
|
||||
.gitignore
|
||||
.travis.yml
|
||||
README.md
|
||||
api/openapi.yaml
|
||||
build.gradle
|
||||
build.sbt
|
||||
git_push.sh
|
||||
gradle.properties
|
||||
gradle/wrapper/gradle-wrapper.jar
|
||||
gradle/wrapper/gradle-wrapper.properties
|
||||
gradlew
|
||||
gradlew.bat
|
||||
pom.xml
|
||||
settings.gradle
|
||||
src/main/AndroidManifest.xml
|
||||
src/main/java/org/openapitools/client/ApiClient.java
|
||||
src/main/java/org/openapitools/client/EncodingUtils.java
|
||||
src/main/java/org/openapitools/client/ServerConfiguration.java
|
||||
src/main/java/org/openapitools/client/ServerVariable.java
|
||||
src/main/java/org/openapitools/client/StringUtil.java
|
||||
src/main/java/org/openapitools/client/api/BodyApi.java
|
||||
src/main/java/org/openapitools/client/api/PathApi.java
|
||||
src/main/java/org/openapitools/client/api/QueryApi.java
|
||||
src/main/java/org/openapitools/client/auth/ApiKeyAuth.java
|
||||
src/main/java/org/openapitools/client/auth/DefaultApi20Impl.java
|
||||
src/main/java/org/openapitools/client/auth/HttpBasicAuth.java
|
||||
src/main/java/org/openapitools/client/auth/HttpBearerAuth.java
|
||||
src/main/java/org/openapitools/client/model/ApiResponse.java
|
||||
src/main/java/org/openapitools/client/model/Category.java
|
||||
src/main/java/org/openapitools/client/model/Pet.java
|
||||
src/main/java/org/openapitools/client/model/Tag.java
|
||||
src/main/java/org/openapitools/client/model/TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter.java
|
@ -0,0 +1 @@
|
||||
6.3.0-SNAPSHOT
|
22
samples/client/echo_api/java/feign-gson/.travis.yml
Normal file
22
samples/client/echo_api/java/feign-gson/.travis.yml
Normal file
@ -0,0 +1,22 @@
|
||||
#
|
||||
# Generated by OpenAPI Generator: https://openapi-generator.tech
|
||||
#
|
||||
# Ref: https://docs.travis-ci.com/user/languages/java/
|
||||
#
|
||||
language: java
|
||||
jdk:
|
||||
- openjdk12
|
||||
- openjdk11
|
||||
- openjdk10
|
||||
- openjdk9
|
||||
- openjdk8
|
||||
before_install:
|
||||
# ensure gradlew has proper permission
|
||||
- chmod a+x ./gradlew
|
||||
script:
|
||||
# test using maven
|
||||
#- mvn test
|
||||
# test using gradle
|
||||
- gradle test
|
||||
# test using sbt
|
||||
# - sbt test
|
77
samples/client/echo_api/java/feign-gson/README.md
Normal file
77
samples/client/echo_api/java/feign-gson/README.md
Normal file
@ -0,0 +1,77 @@
|
||||
# echo-api-feign-json
|
||||
|
||||
## Requirements
|
||||
|
||||
Building the API client library requires [Maven](https://maven.apache.org/) to be installed.
|
||||
|
||||
## Installation & Usage
|
||||
|
||||
To install the API client library to your local Maven repository, simply execute:
|
||||
|
||||
```shell
|
||||
mvn install
|
||||
```
|
||||
|
||||
To deploy it to a remote Maven repository instead, configure the settings of the repository and execute:
|
||||
|
||||
```shell
|
||||
mvn deploy
|
||||
```
|
||||
|
||||
Refer to the [official documentation](https://maven.apache.org/plugins/maven-deploy-plugin/usage.html) for more information.
|
||||
|
||||
After the client library is installed/deployed, you can use it in your Maven project by adding the following to your *pom.xml*:
|
||||
|
||||
```xml
|
||||
<dependency>
|
||||
<groupId>org.openapitools</groupId>
|
||||
<artifactId>echo-api-feign-json</artifactId>
|
||||
<version>0.1.0</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
|
||||
```
|
||||
|
||||
And to use the api you can follow the examples bellow:
|
||||
|
||||
```java
|
||||
|
||||
//Set bearer token manually
|
||||
ApiClient apiClient = new ApiClient("petstore_auth_client");
|
||||
apiClient.setBasePath("https://localhost:8243/petstore/1/");
|
||||
apiClient.setAccessToken("TOKEN", 10000);
|
||||
|
||||
//Use api key
|
||||
ApiClient apiClient = new ApiClient("api_key", "API KEY");
|
||||
apiClient.setBasePath("https://localhost:8243/petstore/1/");
|
||||
|
||||
//Use http basic authentication
|
||||
ApiClient apiClient = new ApiClient("basicAuth");
|
||||
apiClient.setBasePath("https://localhost:8243/petstore/1/");
|
||||
apiClient.setCredentials("username", "password");
|
||||
|
||||
//Oauth password
|
||||
ApiClient apiClient = new ApiClient("oauth_password");
|
||||
apiClient.setBasePath("https://localhost:8243/petstore/1/");
|
||||
apiClient.setOauthPassword("username", "password", "client_id", "client_secret");
|
||||
|
||||
//Oauth client credentials flow
|
||||
ApiClient apiClient = new ApiClient("oauth_client_credentials");
|
||||
apiClient.setBasePath("https://localhost:8243/petstore/1/");
|
||||
apiClient.setClientCredentials("client_id", "client_secret");
|
||||
|
||||
PetApi petApi = apiClient.buildClient(PetApi.class);
|
||||
Pet petById = petApi.getPetById(12345L);
|
||||
|
||||
System.out.println(petById);
|
||||
}
|
||||
```
|
||||
|
||||
## Recommendation
|
||||
|
||||
It's recommended to create an instance of `ApiClient` per thread in a multithreaded environment to avoid any potential issues.
|
||||
|
||||
## Author
|
||||
|
||||
team@openapitools.org
|
||||
|
242
samples/client/echo_api/java/feign-gson/api/openapi.yaml
Normal file
242
samples/client/echo_api/java/feign-gson/api/openapi.yaml
Normal file
@ -0,0 +1,242 @@
|
||||
openapi: 3.0.3
|
||||
info:
|
||||
contact:
|
||||
email: team@openapitools.org
|
||||
description: Echo Server API
|
||||
license:
|
||||
name: Apache 2.0
|
||||
url: http://www.apache.org/licenses/LICENSE-2.0.html
|
||||
title: Echo Server API
|
||||
version: 0.1.0
|
||||
servers:
|
||||
- url: http://localhost:3000/
|
||||
paths:
|
||||
/path/string/{path_string}/integer/{path_integer}:
|
||||
get:
|
||||
description: Test path parameter(s)
|
||||
operationId: "tests/path/string/{path_string}/integer/{path_integer}"
|
||||
parameters:
|
||||
- explode: false
|
||||
in: path
|
||||
name: path_string
|
||||
required: true
|
||||
schema:
|
||||
type: string
|
||||
style: simple
|
||||
- explode: false
|
||||
in: path
|
||||
name: path_integer
|
||||
required: true
|
||||
schema:
|
||||
type: integer
|
||||
style: simple
|
||||
responses:
|
||||
"200":
|
||||
content:
|
||||
text/plain:
|
||||
schema:
|
||||
type: string
|
||||
description: Successful operation
|
||||
summary: Test path parameter(s)
|
||||
tags:
|
||||
- path
|
||||
x-accepts: text/plain
|
||||
/query/integer/boolean/string:
|
||||
get:
|
||||
description: Test query parameter(s)
|
||||
operationId: test/query/integer/boolean/string
|
||||
parameters:
|
||||
- explode: true
|
||||
in: query
|
||||
name: integer_query
|
||||
required: false
|
||||
schema:
|
||||
type: integer
|
||||
style: form
|
||||
- explode: true
|
||||
in: query
|
||||
name: boolean_query
|
||||
required: false
|
||||
schema:
|
||||
type: boolean
|
||||
style: form
|
||||
- explode: true
|
||||
in: query
|
||||
name: string_query
|
||||
required: false
|
||||
schema:
|
||||
type: string
|
||||
style: form
|
||||
responses:
|
||||
"200":
|
||||
content:
|
||||
text/plain:
|
||||
schema:
|
||||
type: string
|
||||
description: Successful operation
|
||||
summary: Test query parameter(s)
|
||||
tags:
|
||||
- query
|
||||
x-accepts: text/plain
|
||||
/query/style_form/explode_true/array_string:
|
||||
get:
|
||||
description: Test query parameter(s)
|
||||
operationId: test/query/style_form/explode_true/array_string
|
||||
parameters:
|
||||
- explode: true
|
||||
in: query
|
||||
name: query_object
|
||||
required: false
|
||||
schema:
|
||||
$ref: '#/components/schemas/test_query_style_form_explode_true_array_string_query_object_parameter'
|
||||
style: form
|
||||
responses:
|
||||
"200":
|
||||
content:
|
||||
text/plain:
|
||||
schema:
|
||||
type: string
|
||||
description: Successful operation
|
||||
summary: Test query parameter(s)
|
||||
tags:
|
||||
- query
|
||||
x-accepts: text/plain
|
||||
/query/style_form/explode_true/object:
|
||||
get:
|
||||
description: Test query parameter(s)
|
||||
operationId: test/query/style_form/explode_true/object
|
||||
parameters:
|
||||
- explode: true
|
||||
in: query
|
||||
name: query_object
|
||||
required: false
|
||||
schema:
|
||||
$ref: '#/components/schemas/Pet'
|
||||
style: form
|
||||
responses:
|
||||
"200":
|
||||
content:
|
||||
text/plain:
|
||||
schema:
|
||||
type: string
|
||||
description: Successful operation
|
||||
summary: Test query parameter(s)
|
||||
tags:
|
||||
- query
|
||||
x-accepts: text/plain
|
||||
/echo/body/Pet:
|
||||
post:
|
||||
description: Test body parameter(s)
|
||||
operationId: test/echo/body/Pet
|
||||
requestBody:
|
||||
$ref: '#/components/requestBodies/Pet'
|
||||
responses:
|
||||
"200":
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/Pet'
|
||||
description: Successful operation
|
||||
summary: Test body parameter(s)
|
||||
tags:
|
||||
- body
|
||||
x-content-type: application/json
|
||||
x-accepts: application/json
|
||||
components:
|
||||
requestBodies:
|
||||
Pet:
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/Pet'
|
||||
description: Pet object that needs to be added to the store
|
||||
schemas:
|
||||
Category:
|
||||
example:
|
||||
name: Dogs
|
||||
id: 1
|
||||
properties:
|
||||
id:
|
||||
example: 1
|
||||
format: int64
|
||||
type: integer
|
||||
name:
|
||||
example: Dogs
|
||||
type: string
|
||||
type: object
|
||||
xml:
|
||||
name: category
|
||||
Tag:
|
||||
example:
|
||||
name: name
|
||||
id: 0
|
||||
properties:
|
||||
id:
|
||||
format: int64
|
||||
type: integer
|
||||
name:
|
||||
type: string
|
||||
type: object
|
||||
xml:
|
||||
name: tag
|
||||
Pet:
|
||||
example:
|
||||
photoUrls:
|
||||
- photoUrls
|
||||
- photoUrls
|
||||
name: doggie
|
||||
id: 10
|
||||
category:
|
||||
name: Dogs
|
||||
id: 1
|
||||
tags:
|
||||
- name: name
|
||||
id: 0
|
||||
- name: name
|
||||
id: 0
|
||||
status: available
|
||||
properties:
|
||||
id:
|
||||
example: 10
|
||||
format: int64
|
||||
type: integer
|
||||
name:
|
||||
example: doggie
|
||||
type: string
|
||||
category:
|
||||
$ref: '#/components/schemas/Category'
|
||||
photoUrls:
|
||||
items:
|
||||
type: string
|
||||
xml:
|
||||
name: photoUrl
|
||||
type: array
|
||||
xml:
|
||||
wrapped: true
|
||||
tags:
|
||||
items:
|
||||
$ref: '#/components/schemas/Tag'
|
||||
type: array
|
||||
xml:
|
||||
wrapped: true
|
||||
status:
|
||||
description: pet status in the store
|
||||
enum:
|
||||
- available
|
||||
- pending
|
||||
- sold
|
||||
type: string
|
||||
required:
|
||||
- name
|
||||
- photoUrls
|
||||
type: object
|
||||
xml:
|
||||
name: pet
|
||||
test_query_style_form_explode_true_array_string_query_object_parameter:
|
||||
properties:
|
||||
values:
|
||||
items:
|
||||
type: string
|
||||
type: array
|
||||
type: object
|
||||
|
139
samples/client/echo_api/java/feign-gson/build.gradle
Normal file
139
samples/client/echo_api/java/feign-gson/build.gradle
Normal file
@ -0,0 +1,139 @@
|
||||
apply plugin: 'idea'
|
||||
apply plugin: 'eclipse'
|
||||
|
||||
group = 'org.openapitools'
|
||||
version = '0.1.0'
|
||||
|
||||
buildscript {
|
||||
repositories {
|
||||
mavenCentral()
|
||||
}
|
||||
dependencies {
|
||||
classpath 'com.android.tools.build:gradle:2.3.+'
|
||||
classpath 'com.github.dcendents:android-maven-gradle-plugin:1.5'
|
||||
}
|
||||
}
|
||||
|
||||
repositories {
|
||||
mavenCentral()
|
||||
}
|
||||
|
||||
|
||||
if(hasProperty('target') && target == 'android') {
|
||||
|
||||
apply plugin: 'com.android.library'
|
||||
apply plugin: 'com.github.dcendents.android-maven'
|
||||
|
||||
android {
|
||||
compileSdkVersion 25
|
||||
buildToolsVersion '25.0.2'
|
||||
defaultConfig {
|
||||
minSdkVersion 14
|
||||
targetSdkVersion 25
|
||||
}
|
||||
compileOptions {
|
||||
sourceCompatibility JavaVersion.VERSION_1_8
|
||||
targetCompatibility JavaVersion.VERSION_1_8
|
||||
}
|
||||
|
||||
// Rename the aar correctly
|
||||
libraryVariants.all { variant ->
|
||||
variant.outputs.each { output ->
|
||||
def outputFile = output.outputFile
|
||||
if (outputFile != null && outputFile.name.endsWith('.aar')) {
|
||||
def fileName = "${project.name}-${variant.baseName}-${version}.aar"
|
||||
output.outputFile = new File(outputFile.parent, fileName)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
provided "jakarta.annotation:jakarta.annotation-api:$jakarta_annotation_version"
|
||||
}
|
||||
}
|
||||
|
||||
afterEvaluate {
|
||||
android.libraryVariants.all { variant ->
|
||||
def task = project.tasks.create "jar${variant.name.capitalize()}", Jar
|
||||
task.description = "Create jar artifact for ${variant.name}"
|
||||
task.dependsOn variant.javaCompile
|
||||
task.from variant.javaCompile.destinationDir
|
||||
task.destinationDir = project.file("${project.buildDir}/outputs/jar")
|
||||
task.archiveName = "${project.name}-${variant.baseName}-${version}.jar"
|
||||
artifacts.add('archives', task);
|
||||
}
|
||||
}
|
||||
|
||||
task sourcesJar(type: Jar) {
|
||||
from android.sourceSets.main.java.srcDirs
|
||||
classifier = 'sources'
|
||||
}
|
||||
|
||||
artifacts {
|
||||
archives sourcesJar
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
apply plugin: 'java'
|
||||
apply plugin: 'maven-publish'
|
||||
|
||||
sourceCompatibility = JavaVersion.VERSION_1_8
|
||||
targetCompatibility = JavaVersion.VERSION_1_8
|
||||
|
||||
publishing {
|
||||
publications {
|
||||
maven(MavenPublication) {
|
||||
artifactId = 'echo-api-feign-json'
|
||||
from components.java
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
task execute(type:JavaExec) {
|
||||
main = System.getProperty('mainClass')
|
||||
classpath = sourceSets.main.runtimeClasspath
|
||||
}
|
||||
}
|
||||
|
||||
test {
|
||||
useJUnitPlatform()
|
||||
}
|
||||
|
||||
ext {
|
||||
swagger_annotations_version = "1.5.24"
|
||||
jackson_version = "2.13.4"
|
||||
jackson_databind_version = "2.13.4.2"
|
||||
jackson_databind_nullable_version = "0.2.4"
|
||||
jakarta_annotation_version = "1.3.5"
|
||||
feign_version = "10.11"
|
||||
feign_form_version = "3.8.0"
|
||||
junit_version = "5.7.0"
|
||||
scribejava_version = "8.0.0"
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation "io.swagger:swagger-annotations:$swagger_annotations_version"
|
||||
implementation "com.google.code.findbugs:jsr305:3.0.2"
|
||||
implementation "io.github.openfeign:feign-core:$feign_version"
|
||||
implementation "io.github.openfeign:feign-jackson:$feign_version"
|
||||
implementation "io.github.openfeign:feign-slf4j:$feign_version"
|
||||
implementation "io.github.openfeign:feign-okhttp:$feign_version"
|
||||
implementation "io.github.openfeign.form:feign-form:$feign_form_version"
|
||||
implementation "com.fasterxml.jackson.core:jackson-core:$jackson_version"
|
||||
implementation "com.fasterxml.jackson.core:jackson-annotations:$jackson_version"
|
||||
implementation "com.fasterxml.jackson.core:jackson-databind:$jackson_databind_version"
|
||||
implementation "org.openapitools:jackson-databind-nullable:$jackson_databind_nullable_version"
|
||||
implementation "com.fasterxml.jackson.datatype:jackson-datatype-jsr310:$jackson_version"
|
||||
implementation "com.brsanthu:migbase64:2.2"
|
||||
implementation "com.github.scribejava:scribejava-core:$scribejava_version"
|
||||
implementation "com.brsanthu:migbase64:2.2"
|
||||
implementation "jakarta.annotation:jakarta.annotation-api:$jakarta_annotation_version"
|
||||
testImplementation "org.junit.jupiter:junit-jupiter:$junit_version"
|
||||
testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:$junit_version"
|
||||
testImplementation "org.junit.jupiter:junit-jupiter-params:$junit_version"
|
||||
testImplementation "com.github.tomakehurst:wiremock-jre8:2.27.2"
|
||||
testImplementation "org.hamcrest:hamcrest:2.2"
|
||||
testImplementation "commons-io:commons-io:2.8.0"
|
||||
testImplementation "ch.qos.logback:logback-classic:1.2.3"
|
||||
}
|
34
samples/client/echo_api/java/feign-gson/build.sbt
Normal file
34
samples/client/echo_api/java/feign-gson/build.sbt
Normal file
@ -0,0 +1,34 @@
|
||||
lazy val root = (project in file(".")).
|
||||
settings(
|
||||
organization := "org.openapitools",
|
||||
name := "echo-api-feign-json",
|
||||
version := "0.1.0",
|
||||
scalaVersion := "2.11.4",
|
||||
scalacOptions ++= Seq("-feature"),
|
||||
javacOptions in compile ++= Seq("-Xlint:deprecation"),
|
||||
publishArtifact in (Compile, packageDoc) := false,
|
||||
resolvers += Resolver.mavenLocal,
|
||||
libraryDependencies ++= Seq(
|
||||
"io.swagger" % "swagger-annotations" % "1.5.24" % "compile",
|
||||
"com.google.code.findbugs" % "jsr305" % "3.0.2" % "compile",
|
||||
"io.github.openfeign" % "feign-core" % "10.11" % "compile",
|
||||
"io.github.openfeign" % "feign-jackson" % "10.11" % "compile",
|
||||
"io.github.openfeign" % "feign-slf4j" % "10.11" % "compile",
|
||||
"io.github.openfeign.form" % "feign-form" % "3.8.0" % "compile",
|
||||
"io.github.openfeign" % "feign-okhttp" % "10.11" % "compile",
|
||||
"com.fasterxml.jackson.core" % "jackson-core" % "2.13.4" % "compile",
|
||||
"com.fasterxml.jackson.core" % "jackson-annotations" % "2.13.4" % "compile",
|
||||
"com.fasterxml.jackson.core" % "jackson-databind" % "2.13.4.2" % "compile",
|
||||
"com.fasterxml.jackson.datatype" % "jackson-datatype-jsr310" % "2.9.10" % "compile",
|
||||
"com.github.joschi.jackson" % "jackson-datatype-threetenbp" % "2.9.10" % "compile",
|
||||
"com.github.scribejava" % "scribejava-core" % "8.0.0" % "compile",
|
||||
"com.brsanthu" % "migbase64" % "2.2" % "compile",
|
||||
"jakarta.annotation" % "jakarta.annotation-api" % "1.3.5" % "compile",
|
||||
"org.junit.jupiter" % "junit-jupiter" % "5.7.0" % "test",
|
||||
"org.junit.jupiter" % "junit-jupiter-params" % "5.7.0" % "test",
|
||||
"com.github.tomakehurst" % "wiremock-jre8" % "2.27.2" % "test",
|
||||
"org.hamcrest" % "hamcrest" % "2.2" % "test",
|
||||
"commons-io" % "commons-io" % "2.8.0" % "test",
|
||||
"com.novocode" % "junit-interface" % "0.10" % "test"
|
||||
)
|
||||
)
|
57
samples/client/echo_api/java/feign-gson/git_push.sh
Normal file
57
samples/client/echo_api/java/feign-gson/git_push.sh
Normal file
@ -0,0 +1,57 @@
|
||||
#!/bin/sh
|
||||
# ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/
|
||||
#
|
||||
# Usage example: /bin/sh ./git_push.sh wing328 openapi-petstore-perl "minor update" "gitlab.com"
|
||||
|
||||
git_user_id=$1
|
||||
git_repo_id=$2
|
||||
release_note=$3
|
||||
git_host=$4
|
||||
|
||||
if [ "$git_host" = "" ]; then
|
||||
git_host="github.com"
|
||||
echo "[INFO] No command line input provided. Set \$git_host to $git_host"
|
||||
fi
|
||||
|
||||
if [ "$git_user_id" = "" ]; then
|
||||
git_user_id="GIT_USER_ID"
|
||||
echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id"
|
||||
fi
|
||||
|
||||
if [ "$git_repo_id" = "" ]; then
|
||||
git_repo_id="GIT_REPO_ID"
|
||||
echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id"
|
||||
fi
|
||||
|
||||
if [ "$release_note" = "" ]; then
|
||||
release_note="Minor update"
|
||||
echo "[INFO] No command line input provided. Set \$release_note to $release_note"
|
||||
fi
|
||||
|
||||
# Initialize the local directory as a Git repository
|
||||
git init
|
||||
|
||||
# Adds the files in the local repository and stages them for commit.
|
||||
git add .
|
||||
|
||||
# Commits the tracked changes and prepares them to be pushed to a remote repository.
|
||||
git commit -m "$release_note"
|
||||
|
||||
# Sets the new remote
|
||||
git_remote=$(git remote)
|
||||
if [ "$git_remote" = "" ]; then # git remote not defined
|
||||
|
||||
if [ "$GIT_TOKEN" = "" ]; then
|
||||
echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git credential in your environment."
|
||||
git remote add origin https://${git_host}/${git_user_id}/${git_repo_id}.git
|
||||
else
|
||||
git remote add origin https://${git_user_id}:"${GIT_TOKEN}"@${git_host}/${git_user_id}/${git_repo_id}.git
|
||||
fi
|
||||
|
||||
fi
|
||||
|
||||
git pull origin master
|
||||
|
||||
# Pushes (Forces) the changes in the local repository up to the remote repository
|
||||
echo "Git pushing to https://${git_host}/${git_user_id}/${git_repo_id}.git"
|
||||
git push origin master 2>&1 | grep -v 'To https'
|
@ -0,0 +1,6 @@
|
||||
# This file is automatically generated by OpenAPI Generator (https://github.com/openAPITools/openapi-generator).
|
||||
# To include other gradle properties as part of the code generation process, please use the `gradleProperties` option.
|
||||
#
|
||||
# Gradle properties reference: https://docs.gradle.org/current/userguide/build_environment.html#sec:gradle_configuration_properties
|
||||
# For example, uncomment below to build for Android
|
||||
#target = android
|
BIN
samples/client/echo_api/java/feign-gson/gradle/wrapper/gradle-wrapper.jar
vendored
Normal file
BIN
samples/client/echo_api/java/feign-gson/gradle/wrapper/gradle-wrapper.jar
vendored
Normal file
Binary file not shown.
5
samples/client/echo_api/java/feign-gson/gradle/wrapper/gradle-wrapper.properties
vendored
Normal file
5
samples/client/echo_api/java/feign-gson/gradle/wrapper/gradle-wrapper.properties
vendored
Normal file
@ -0,0 +1,5 @@
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-bin.zip
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
234
samples/client/echo_api/java/feign-gson/gradlew
vendored
Normal file
234
samples/client/echo_api/java/feign-gson/gradlew
vendored
Normal file
@ -0,0 +1,234 @@
|
||||
#!/bin/sh
|
||||
|
||||
#
|
||||
# Copyright © 2015-2021 the original authors.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# https://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
##############################################################################
|
||||
#
|
||||
# Gradle start up script for POSIX generated by Gradle.
|
||||
#
|
||||
# Important for running:
|
||||
#
|
||||
# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is
|
||||
# noncompliant, but you have some other compliant shell such as ksh or
|
||||
# bash, then to run this script, type that shell name before the whole
|
||||
# command line, like:
|
||||
#
|
||||
# ksh Gradle
|
||||
#
|
||||
# Busybox and similar reduced shells will NOT work, because this script
|
||||
# requires all of these POSIX shell features:
|
||||
# * functions;
|
||||
# * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
|
||||
# «${var#prefix}», «${var%suffix}», and «$( cmd )»;
|
||||
# * compound commands having a testable exit status, especially «case»;
|
||||
# * various built-in commands including «command», «set», and «ulimit».
|
||||
#
|
||||
# Important for patching:
|
||||
#
|
||||
# (2) This script targets any POSIX shell, so it avoids extensions provided
|
||||
# by Bash, Ksh, etc; in particular arrays are avoided.
|
||||
#
|
||||
# The "traditional" practice of packing multiple parameters into a
|
||||
# space-separated string is a well documented source of bugs and security
|
||||
# problems, so this is (mostly) avoided, by progressively accumulating
|
||||
# options in "$@", and eventually passing that to Java.
|
||||
#
|
||||
# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS,
|
||||
# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly;
|
||||
# see the in-line comments for details.
|
||||
#
|
||||
# There are tweaks for specific operating systems such as AIX, CygWin,
|
||||
# Darwin, MinGW, and NonStop.
|
||||
#
|
||||
# (3) This script is generated from the Groovy template
|
||||
# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
|
||||
# within the Gradle project.
|
||||
#
|
||||
# You can find Gradle at https://github.com/gradle/gradle/.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
# Attempt to set APP_HOME
|
||||
|
||||
# Resolve links: $0 may be a link
|
||||
app_path=$0
|
||||
|
||||
# Need this for daisy-chained symlinks.
|
||||
while
|
||||
APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path
|
||||
[ -h "$app_path" ]
|
||||
do
|
||||
ls=$( ls -ld "$app_path" )
|
||||
link=${ls#*' -> '}
|
||||
case $link in #(
|
||||
/*) app_path=$link ;; #(
|
||||
*) app_path=$APP_HOME$link ;;
|
||||
esac
|
||||
done
|
||||
|
||||
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
|
||||
|
||||
APP_NAME="Gradle"
|
||||
APP_BASE_NAME=${0##*/}
|
||||
|
||||
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
DEFAULT_JVM_OPTS='-Dfile.encoding=UTF-8 "-Xmx64m" "-Xms64m"'
|
||||
|
||||
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||
MAX_FD=maximum
|
||||
|
||||
warn () {
|
||||
echo "$*"
|
||||
} >&2
|
||||
|
||||
die () {
|
||||
echo
|
||||
echo "$*"
|
||||
echo
|
||||
exit 1
|
||||
} >&2
|
||||
|
||||
# OS specific support (must be 'true' or 'false').
|
||||
cygwin=false
|
||||
msys=false
|
||||
darwin=false
|
||||
nonstop=false
|
||||
case "$( uname )" in #(
|
||||
CYGWIN* ) cygwin=true ;; #(
|
||||
Darwin* ) darwin=true ;; #(
|
||||
MSYS* | MINGW* ) msys=true ;; #(
|
||||
NONSTOP* ) nonstop=true ;;
|
||||
esac
|
||||
|
||||
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
||||
|
||||
|
||||
# Determine the Java command to use to start the JVM.
|
||||
if [ -n "$JAVA_HOME" ] ; then
|
||||
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
|
||||
# IBM's JDK on AIX uses strange locations for the executables
|
||||
JAVACMD=$JAVA_HOME/jre/sh/java
|
||||
else
|
||||
JAVACMD=$JAVA_HOME/bin/java
|
||||
fi
|
||||
if [ ! -x "$JAVACMD" ] ; then
|
||||
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
|
||||
|
||||
Please set the JAVA_HOME variable in your environment to match the
|
||||
location of your Java installation."
|
||||
fi
|
||||
else
|
||||
JAVACMD=java
|
||||
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
|
||||
Please set the JAVA_HOME variable in your environment to match the
|
||||
location of your Java installation."
|
||||
fi
|
||||
|
||||
# Increase the maximum file descriptors if we can.
|
||||
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
|
||||
case $MAX_FD in #(
|
||||
max*)
|
||||
MAX_FD=$( ulimit -H -n ) ||
|
||||
warn "Could not query maximum file descriptor limit"
|
||||
esac
|
||||
case $MAX_FD in #(
|
||||
'' | soft) :;; #(
|
||||
*)
|
||||
ulimit -n "$MAX_FD" ||
|
||||
warn "Could not set maximum file descriptor limit to $MAX_FD"
|
||||
esac
|
||||
fi
|
||||
|
||||
# Collect all arguments for the java command, stacking in reverse order:
|
||||
# * args from the command line
|
||||
# * the main class name
|
||||
# * -classpath
|
||||
# * -D...appname settings
|
||||
# * --module-path (only if needed)
|
||||
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.
|
||||
|
||||
# For Cygwin or MSYS, switch paths to Windows format before running java
|
||||
if "$cygwin" || "$msys" ; then
|
||||
APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
|
||||
CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
|
||||
|
||||
JAVACMD=$( cygpath --unix "$JAVACMD" )
|
||||
|
||||
# Now convert the arguments - kludge to limit ourselves to /bin/sh
|
||||
for arg do
|
||||
if
|
||||
case $arg in #(
|
||||
-*) false ;; # don't mess with options #(
|
||||
/?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath
|
||||
[ -e "$t" ] ;; #(
|
||||
*) false ;;
|
||||
esac
|
||||
then
|
||||
arg=$( cygpath --path --ignore --mixed "$arg" )
|
||||
fi
|
||||
# Roll the args list around exactly as many times as the number of
|
||||
# args, so each arg winds up back in the position where it started, but
|
||||
# possibly modified.
|
||||
#
|
||||
# NB: a `for` loop captures its iteration list before it begins, so
|
||||
# changing the positional parameters here affects neither the number of
|
||||
# iterations, nor the values presented in `arg`.
|
||||
shift # remove old arg
|
||||
set -- "$@" "$arg" # push replacement arg
|
||||
done
|
||||
fi
|
||||
|
||||
# Collect all arguments for the java command;
|
||||
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
|
||||
# shell script including quotes and variable substitutions, so put them in
|
||||
# double quotes to make sure that they get re-expanded; and
|
||||
# * put everything else in single quotes, so that it's not re-expanded.
|
||||
|
||||
set -- \
|
||||
"-Dorg.gradle.appname=$APP_BASE_NAME" \
|
||||
-classpath "$CLASSPATH" \
|
||||
org.gradle.wrapper.GradleWrapperMain \
|
||||
"$@"
|
||||
|
||||
# Use "xargs" to parse quoted args.
|
||||
#
|
||||
# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
|
||||
#
|
||||
# In Bash we could simply go:
|
||||
#
|
||||
# readarray ARGS < <( xargs -n1 <<<"$var" ) &&
|
||||
# set -- "${ARGS[@]}" "$@"
|
||||
#
|
||||
# but POSIX shell has neither arrays nor command substitution, so instead we
|
||||
# post-process each arg (as a line of input to sed) to backslash-escape any
|
||||
# character that might be a shell metacharacter, then use eval to reverse
|
||||
# that process (while maintaining the separation between arguments), and wrap
|
||||
# the whole thing up as a single "set" statement.
|
||||
#
|
||||
# This will of course break if any of these variables contains a newline or
|
||||
# an unmatched quote.
|
||||
#
|
||||
|
||||
eval "set -- $(
|
||||
printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" |
|
||||
xargs -n1 |
|
||||
sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
|
||||
tr '\n' ' '
|
||||
)" '"$@"'
|
||||
|
||||
exec "$JAVACMD" "$@"
|
89
samples/client/echo_api/java/feign-gson/gradlew.bat
vendored
Normal file
89
samples/client/echo_api/java/feign-gson/gradlew.bat
vendored
Normal file
@ -0,0 +1,89 @@
|
||||
@rem
|
||||
@rem Copyright 2015 the original author or authors.
|
||||
@rem
|
||||
@rem Licensed under the Apache License, Version 2.0 (the "License");
|
||||
@rem you may not use this file except in compliance with the License.
|
||||
@rem You may obtain a copy of the License at
|
||||
@rem
|
||||
@rem https://www.apache.org/licenses/LICENSE-2.0
|
||||
@rem
|
||||
@rem Unless required by applicable law or agreed to in writing, software
|
||||
@rem distributed under the License is distributed on an "AS IS" BASIS,
|
||||
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
@rem See the License for the specific language governing permissions and
|
||||
@rem limitations under the License.
|
||||
@rem
|
||||
|
||||
@if "%DEBUG%" == "" @echo off
|
||||
@rem ##########################################################################
|
||||
@rem
|
||||
@rem Gradle startup script for Windows
|
||||
@rem
|
||||
@rem ##########################################################################
|
||||
|
||||
@rem Set local scope for the variables with windows NT shell
|
||||
if "%OS%"=="Windows_NT" setlocal
|
||||
|
||||
set DIRNAME=%~dp0
|
||||
if "%DIRNAME%" == "" set DIRNAME=.
|
||||
set APP_BASE_NAME=%~n0
|
||||
set APP_HOME=%DIRNAME%
|
||||
|
||||
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
|
||||
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
|
||||
|
||||
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
set DEFAULT_JVM_OPTS=-Dfile.encoding=UTF-8 "-Xmx64m" "-Xms64m"
|
||||
|
||||
@rem Find java.exe
|
||||
if defined JAVA_HOME goto findJavaFromJavaHome
|
||||
|
||||
set JAVA_EXE=java.exe
|
||||
%JAVA_EXE% -version >NUL 2>&1
|
||||
if "%ERRORLEVEL%" == "0" goto execute
|
||||
|
||||
echo.
|
||||
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
echo.
|
||||
echo Please set the JAVA_HOME variable in your environment to match the
|
||||
echo location of your Java installation.
|
||||
|
||||
goto fail
|
||||
|
||||
:findJavaFromJavaHome
|
||||
set JAVA_HOME=%JAVA_HOME:"=%
|
||||
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
||||
|
||||
if exist "%JAVA_EXE%" goto execute
|
||||
|
||||
echo.
|
||||
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
|
||||
echo.
|
||||
echo Please set the JAVA_HOME variable in your environment to match the
|
||||
echo location of your Java installation.
|
||||
|
||||
goto fail
|
||||
|
||||
:execute
|
||||
@rem Setup the command line
|
||||
|
||||
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
|
||||
|
||||
|
||||
@rem Execute Gradle
|
||||
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
|
||||
|
||||
:end
|
||||
@rem End local scope for the variables with windows NT shell
|
||||
if "%ERRORLEVEL%"=="0" goto mainEnd
|
||||
|
||||
:fail
|
||||
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
|
||||
rem the _cmd.exe /c_ return code!
|
||||
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
|
||||
exit /b 1
|
||||
|
||||
:mainEnd
|
||||
if "%OS%"=="Windows_NT" endlocal
|
||||
|
||||
:omega
|
320
samples/client/echo_api/java/feign-gson/pom.xml
Normal file
320
samples/client/echo_api/java/feign-gson/pom.xml
Normal file
@ -0,0 +1,320 @@
|
||||
<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>echo-api-feign-json</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
<name>echo-api-feign-json</name>
|
||||
<version>0.1.0</version>
|
||||
<url>https://github.com/openapitools/openapi-generator</url>
|
||||
<description>OpenAPI Java</description>
|
||||
<scm>
|
||||
<connection>scm:git:git@github.com:openapitools/openapi-generator.git</connection>
|
||||
<developerConnection>scm:git:git@github.com:openapitools/openapi-generator.git</developerConnection>
|
||||
<url>https://github.com/openapitools/openapi-generator</url>
|
||||
</scm>
|
||||
|
||||
<licenses>
|
||||
<license>
|
||||
<name>Unlicense</name>
|
||||
<url>http://www.apache.org/licenses/LICENSE-2.0.html</url>
|
||||
<distribution>repo</distribution>
|
||||
</license>
|
||||
</licenses>
|
||||
|
||||
<developers>
|
||||
<developer>
|
||||
<name>OpenAPI-Generator Contributors</name>
|
||||
<email>team@openapitools.org</email>
|
||||
<organization>OpenAPITools.org</organization>
|
||||
<organizationUrl>http://openapitools.org</organizationUrl>
|
||||
</developer>
|
||||
</developers>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-enforcer-plugin</artifactId>
|
||||
<version>3.0.0-M1</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>enforce-maven</id>
|
||||
<goals>
|
||||
<goal>enforce</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<rules>
|
||||
<requireMavenVersion>
|
||||
<version>2.2.0</version>
|
||||
</requireMavenVersion>
|
||||
</rules>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-surefire-plugin</artifactId>
|
||||
<version>3.0.0-M4</version>
|
||||
<configuration>
|
||||
<systemProperties>
|
||||
<property>
|
||||
<name>loggerPath</name>
|
||||
<value>conf/log4j.properties</value>
|
||||
</property>
|
||||
</systemProperties>
|
||||
<argLine>-Xms512m -Xmx1500m</argLine>
|
||||
<parallel>methods</parallel>
|
||||
<threadCount>10</threadCount>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-dependency-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>copy-dependencies</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<outputDirectory>${project.build.directory}/lib</outputDirectory>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
|
||||
<!-- attach test jar -->
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-jar-plugin</artifactId>
|
||||
<version>2.2</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<goals>
|
||||
<goal>jar</goal>
|
||||
<goal>test-jar</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
<configuration>
|
||||
</configuration>
|
||||
</plugin>
|
||||
|
||||
<plugin>
|
||||
<groupId>org.codehaus.mojo</groupId>
|
||||
<artifactId>build-helper-maven-plugin</artifactId>
|
||||
<version>1.10</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>add_sources</id>
|
||||
<phase>generate-sources</phase>
|
||||
<goals>
|
||||
<goal>add-source</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<sources>
|
||||
<source>src/main/java</source>
|
||||
</sources>
|
||||
</configuration>
|
||||
</execution>
|
||||
<execution>
|
||||
<id>add_test_sources</id>
|
||||
<phase>generate-test-sources</phase>
|
||||
<goals>
|
||||
<goal>add-test-source</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<sources>
|
||||
<source>src/test/java</source>
|
||||
</sources>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>3.8.1</version>
|
||||
<configuration>
|
||||
<source>1.8</source>
|
||||
<target>1.8</target>
|
||||
<fork>true</fork>
|
||||
<meminitial>128m</meminitial>
|
||||
<maxmem>512m</maxmem>
|
||||
<compilerArgs>
|
||||
<arg>-Xlint:all</arg>
|
||||
<arg>-J-Xss4m</arg><!-- Compiling the generated JSON.java file may require larger stack size. -->
|
||||
</compilerArgs>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-javadoc-plugin</artifactId>
|
||||
<version>3.3.2</version>
|
||||
<configuration>
|
||||
<doclint>none</doclint>
|
||||
<source>1.8</source>
|
||||
</configuration>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>attach-javadocs</id>
|
||||
<goals>
|
||||
<goal>jar</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-source-plugin</artifactId>
|
||||
<version>2.2.1</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>attach-sources</id>
|
||||
<goals>
|
||||
<goal>jar-no-fork</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
<profiles>
|
||||
<profile>
|
||||
<id>sign-artifacts</id>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-gpg-plugin</artifactId>
|
||||
<version>1.5</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>sign-artifacts</id>
|
||||
<phase>verify</phase>
|
||||
<goals>
|
||||
<goal>sign</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</profile>
|
||||
</profiles>
|
||||
|
||||
<dependencies>
|
||||
|
||||
<!-- @Nullable annotation -->
|
||||
<dependency>
|
||||
<groupId>com.google.code.findbugs</groupId>
|
||||
<artifactId>jsr305</artifactId>
|
||||
<version>3.0.2</version>
|
||||
</dependency>
|
||||
|
||||
<!-- HTTP client: Netflix Feign -->
|
||||
<dependency>
|
||||
<groupId>io.github.openfeign</groupId>
|
||||
<artifactId>feign-core</artifactId>
|
||||
<version>${feign-version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.github.openfeign</groupId>
|
||||
<artifactId>feign-gson</artifactId>
|
||||
<version>${feign-version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.github.openfeign</groupId>
|
||||
<artifactId>feign-slf4j</artifactId>
|
||||
<version>${feign-version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.github.openfeign.form</groupId>
|
||||
<artifactId>feign-form</artifactId>
|
||||
<version>${feign-form-version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.github.openfeign</groupId>
|
||||
<artifactId>feign-okhttp</artifactId>
|
||||
<version>${feign-version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.google.code.gson</groupId>
|
||||
<artifactId>gson</artifactId>
|
||||
<version>${gson-version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.openapitools</groupId>
|
||||
<artifactId>jackson-databind-nullable</artifactId>
|
||||
<version>${jackson-databind-nullable-version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.github.scribejava</groupId>
|
||||
<artifactId>scribejava-core</artifactId>
|
||||
<version>${scribejava-version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>jakarta.annotation</groupId>
|
||||
<artifactId>jakarta.annotation-api</artifactId>
|
||||
<version>${jakarta-annotation-version}</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<!-- test dependencies -->
|
||||
<dependency>
|
||||
<groupId>ch.qos.logback</groupId>
|
||||
<artifactId>logback-classic</artifactId>
|
||||
<version>1.2.10</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.junit.jupiter</groupId>
|
||||
<artifactId>junit-jupiter</artifactId>
|
||||
<version>${junit-version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.junit.jupiter</groupId>
|
||||
<artifactId>junit-jupiter-params</artifactId>
|
||||
<version>${junit-version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.hamcrest</groupId>
|
||||
<artifactId>hamcrest</artifactId>
|
||||
<version>2.2</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.github.tomakehurst</groupId>
|
||||
<artifactId>wiremock-jre8</artifactId>
|
||||
<version>2.27.2</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>commons-io</groupId>
|
||||
<artifactId>commons-io</artifactId>
|
||||
<version>2.8.0</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<java.version>1.8</java.version>
|
||||
<maven.compiler.source>${java.version}</maven.compiler.source>
|
||||
<maven.compiler.target>${java.version}</maven.compiler.target>
|
||||
<swagger-annotations-version>1.6.6</swagger-annotations-version>
|
||||
<feign-version>10.11</feign-version>
|
||||
<feign-form-version>3.8.0</feign-form-version>
|
||||
<gson-version>2.8.6</gson-version>
|
||||
<jackson-databind-nullable-version>0.2.4</jackson-databind-nullable-version>
|
||||
<jackson-databind-version>2.13.4.2</jackson-databind-version>
|
||||
<jakarta-annotation-version>1.3.5</jakarta-annotation-version>
|
||||
<junit-version>5.7.0</junit-version>
|
||||
<maven-plugin-version>1.0.0</maven-plugin-version>
|
||||
<scribejava-version>8.0.0</scribejava-version>
|
||||
</properties>
|
||||
</project>
|
1
samples/client/echo_api/java/feign-gson/settings.gradle
Normal file
1
samples/client/echo_api/java/feign-gson/settings.gradle
Normal file
@ -0,0 +1 @@
|
||||
rootProject.name = "echo-api-feign-json"
|
@ -0,0 +1,3 @@
|
||||
<manifest package="org.openapitools.client" xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<application />
|
||||
</manifest>
|
@ -0,0 +1,196 @@
|
||||
package org.openapitools.client;
|
||||
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Map;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
|
||||
import feign.Feign;
|
||||
import feign.RequestInterceptor;
|
||||
import feign.form.FormEncoder;
|
||||
import feign.gson.GsonDecoder;
|
||||
import feign.gson.GsonEncoder;
|
||||
import feign.slf4j.Slf4jLogger;
|
||||
import org.openapitools.client.auth.HttpBasicAuth;
|
||||
import org.openapitools.client.auth.HttpBearerAuth;
|
||||
import org.openapitools.client.auth.ApiKeyAuth;
|
||||
|
||||
|
||||
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
|
||||
public class ApiClient {
|
||||
private static final Logger log = Logger.getLogger(ApiClient.class.getName());
|
||||
|
||||
public interface Api {}
|
||||
|
||||
private String basePath = "http://localhost:3000";
|
||||
private Map<String, RequestInterceptor> apiAuthorizations;
|
||||
private Feign.Builder feignBuilder;
|
||||
|
||||
public ApiClient() {
|
||||
apiAuthorizations = new LinkedHashMap<String, RequestInterceptor>();
|
||||
feignBuilder = Feign.builder()
|
||||
.encoder(new FormEncoder(new GsonEncoder()))
|
||||
.decoder(new GsonDecoder())
|
||||
.logger(new Slf4jLogger());
|
||||
}
|
||||
|
||||
public ApiClient(String[] authNames) {
|
||||
this();
|
||||
for(String authName : authNames) {
|
||||
log.log(Level.FINE, "Creating authentication {0}", authName);
|
||||
throw new RuntimeException("auth name \"" + authName + "\" not found in available auth names");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Basic constructor for single auth name
|
||||
* @param authName
|
||||
*/
|
||||
public ApiClient(String authName) {
|
||||
this(new String[]{authName});
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper constructor for single api key
|
||||
* @param authName
|
||||
* @param apiKey
|
||||
*/
|
||||
public ApiClient(String authName, String apiKey) {
|
||||
this(authName);
|
||||
this.setApiKey(apiKey);
|
||||
}
|
||||
|
||||
public String getBasePath() {
|
||||
return basePath;
|
||||
}
|
||||
|
||||
public ApiClient setBasePath(String basePath) {
|
||||
this.basePath = basePath;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Map<String, RequestInterceptor> getApiAuthorizations() {
|
||||
return apiAuthorizations;
|
||||
}
|
||||
|
||||
public void setApiAuthorizations(Map<String, RequestInterceptor> apiAuthorizations) {
|
||||
this.apiAuthorizations = apiAuthorizations;
|
||||
}
|
||||
|
||||
public Feign.Builder getFeignBuilder() {
|
||||
return feignBuilder;
|
||||
}
|
||||
|
||||
public ApiClient setFeignBuilder(Feign.Builder feignBuilder) {
|
||||
this.feignBuilder = feignBuilder;
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Creates a feign client for given API interface.
|
||||
*
|
||||
* Usage:
|
||||
* ApiClient apiClient = new ApiClient();
|
||||
* apiClient.setBasePath("http://localhost:8080");
|
||||
* XYZApi api = apiClient.buildClient(XYZApi.class);
|
||||
* XYZResponse response = api.someMethod(...);
|
||||
* @param <T> Type
|
||||
* @param clientClass Client class
|
||||
* @return The Client
|
||||
*/
|
||||
public <T extends Api> T buildClient(Class<T> clientClass) {
|
||||
return feignBuilder.target(clientClass, basePath);
|
||||
}
|
||||
|
||||
/**
|
||||
* Select the Accept header's value from the given accepts array:
|
||||
* if JSON exists in the given array, use it;
|
||||
* otherwise use all of them (joining into a string)
|
||||
*
|
||||
* @param accepts The accepts array to select from
|
||||
* @return The Accept header to use. If the given array is empty,
|
||||
* null will be returned (not to set the Accept header explicitly).
|
||||
*/
|
||||
public String selectHeaderAccept(String[] accepts) {
|
||||
if (accepts.length == 0) return null;
|
||||
if (StringUtil.containsIgnoreCase(accepts, "application/json")) return "application/json";
|
||||
return StringUtil.join(accepts, ",");
|
||||
}
|
||||
|
||||
/**
|
||||
* Select the Content-Type header's value from the given array:
|
||||
* if JSON exists in the given array, use it;
|
||||
* otherwise use the first one of the array.
|
||||
*
|
||||
* @param contentTypes The Content-Type array to select from
|
||||
* @return The Content-Type header to use. If the given array is empty,
|
||||
* JSON will be used.
|
||||
*/
|
||||
public String selectHeaderContentType(String[] contentTypes) {
|
||||
if (contentTypes.length == 0) return "application/json";
|
||||
if (StringUtil.containsIgnoreCase(contentTypes, "application/json")) return "application/json";
|
||||
return contentTypes[0];
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper method to configure the bearer token.
|
||||
* @param bearerToken the bearer token.
|
||||
*/
|
||||
public void setBearerToken(String bearerToken) {
|
||||
HttpBearerAuth apiAuthorization = getAuthorization(HttpBearerAuth.class);
|
||||
apiAuthorization.setBearerToken(bearerToken);
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper method to configure the first api key found
|
||||
* @param apiKey API key
|
||||
*/
|
||||
public void setApiKey(String apiKey) {
|
||||
ApiKeyAuth apiAuthorization = getAuthorization(ApiKeyAuth.class);
|
||||
apiAuthorization.setApiKey(apiKey);
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper method to configure the username/password for basic auth
|
||||
* @param username Username
|
||||
* @param password Password
|
||||
*/
|
||||
public void setCredentials(String username, String password) {
|
||||
HttpBasicAuth apiAuthorization = getAuthorization(HttpBasicAuth.class);
|
||||
apiAuthorization.setCredentials(username, password);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets request interceptor based on authentication name
|
||||
* @param authName Authentication name
|
||||
* @return Request Interceptor
|
||||
*/
|
||||
public RequestInterceptor getAuthorization(String authName) {
|
||||
return apiAuthorizations.get(authName);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds an authorization to be used by the client
|
||||
* @param authName Authentication name
|
||||
* @param authorization Request interceptor
|
||||
*/
|
||||
public void addAuthorization(String authName, RequestInterceptor authorization) {
|
||||
if (apiAuthorizations.containsKey(authName)) {
|
||||
throw new RuntimeException("auth name \"" + authName + "\" already in api authorizations");
|
||||
}
|
||||
apiAuthorizations.put(authName, authorization);
|
||||
feignBuilder.requestInterceptor(authorization);
|
||||
}
|
||||
|
||||
private <T extends RequestInterceptor> T getAuthorization(Class<T> type) {
|
||||
return (T) apiAuthorizations.values()
|
||||
.stream()
|
||||
.filter(requestInterceptor -> type.isAssignableFrom(requestInterceptor.getClass()))
|
||||
.findFirst()
|
||||
.orElseThrow(() -> new RuntimeException("No Oauth authentication or OAuth configured!"));
|
||||
}
|
||||
}
|
@ -0,0 +1,86 @@
|
||||
package org.openapitools.client;
|
||||
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.net.URLEncoder;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Utilities to support Swagger encoding formats in Feign.
|
||||
*/
|
||||
public final class EncodingUtils {
|
||||
|
||||
/**
|
||||
* Private constructor. Do not construct this class.
|
||||
*/
|
||||
private EncodingUtils() {}
|
||||
|
||||
/**
|
||||
* <p>Encodes a collection of query parameters according to the Swagger
|
||||
* collection format.</p>
|
||||
*
|
||||
* <p>Of the various collection formats defined by Swagger ("csv", "tsv",
|
||||
* etc), Feign only natively supports "multi". This utility generates the
|
||||
* other format types so it will be properly processed by Feign.</p>
|
||||
*
|
||||
* <p>Note, as part of reformatting, it URL encodes the parameters as
|
||||
* well.</p>
|
||||
* @param parameters The collection object to be formatted. This object will
|
||||
* not be changed.
|
||||
* @param collectionFormat The Swagger collection format (eg, "csv", "tsv",
|
||||
* "pipes"). See the
|
||||
* <a href="http://swagger.io/specification/#parameter-object-44">
|
||||
* OpenAPI Spec</a> for more details.
|
||||
* @return An object that will be correctly formatted by Feign.
|
||||
*/
|
||||
public static Object encodeCollection(Collection<?> parameters,
|
||||
String collectionFormat) {
|
||||
if (parameters == null) {
|
||||
return parameters;
|
||||
}
|
||||
List<String> stringValues = new ArrayList<>(parameters.size());
|
||||
for (Object parameter : parameters) {
|
||||
// ignore null values (same behavior as Feign)
|
||||
if (parameter != null) {
|
||||
stringValues.add(encode(parameter));
|
||||
}
|
||||
}
|
||||
// Feign natively handles single-element lists and the "multi" format.
|
||||
if (stringValues.size() < 2 || "multi".equals(collectionFormat)) {
|
||||
return stringValues;
|
||||
}
|
||||
// Otherwise return a formatted String
|
||||
String[] stringArray = stringValues.toArray(new String[0]);
|
||||
switch (collectionFormat) {
|
||||
case "csv":
|
||||
default:
|
||||
return StringUtil.join(stringArray, ",");
|
||||
case "ssv":
|
||||
return StringUtil.join(stringArray, " ");
|
||||
case "tsv":
|
||||
return StringUtil.join(stringArray, "\t");
|
||||
case "pipes":
|
||||
return StringUtil.join(stringArray, "|");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* URL encode a single query parameter.
|
||||
* @param parameter The query parameter to encode. This object will not be
|
||||
* changed.
|
||||
* @return The URL encoded string representation of the parameter. If the
|
||||
* parameter is null, returns null.
|
||||
*/
|
||||
public static String encode(Object parameter) {
|
||||
if (parameter == null) {
|
||||
return null;
|
||||
}
|
||||
try {
|
||||
return URLEncoder.encode(parameter.toString(), "UTF-8").replaceAll("\\+", "%20");
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
// Should never happen, UTF-8 is always supported
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,58 @@
|
||||
package org.openapitools.client;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* Representing a Server configuration.
|
||||
*/
|
||||
public class ServerConfiguration {
|
||||
public String URL;
|
||||
public String description;
|
||||
public Map<String, ServerVariable> variables;
|
||||
|
||||
/**
|
||||
* @param URL A URL to the target host.
|
||||
* @param description A description of the host designated by the URL.
|
||||
* @param variables A map between a variable name and its value. The value is used for substitution in the server's URL template.
|
||||
*/
|
||||
public ServerConfiguration(String URL, String description, Map<String, ServerVariable> variables) {
|
||||
this.URL = URL;
|
||||
this.description = description;
|
||||
this.variables = variables;
|
||||
}
|
||||
|
||||
/**
|
||||
* Format URL template using given variables.
|
||||
*
|
||||
* @param variables A map between a variable name and its value.
|
||||
* @return Formatted URL.
|
||||
*/
|
||||
public String URL(Map<String, String> variables) {
|
||||
String url = this.URL;
|
||||
|
||||
// go through variables and replace placeholders
|
||||
for (Map.Entry<String, ServerVariable> variable: this.variables.entrySet()) {
|
||||
String name = variable.getKey();
|
||||
ServerVariable serverVariable = variable.getValue();
|
||||
String value = serverVariable.defaultValue;
|
||||
|
||||
if (variables != null && variables.containsKey(name)) {
|
||||
value = variables.get(name);
|
||||
if (serverVariable.enumValues.size() > 0 && !serverVariable.enumValues.contains(value)) {
|
||||
throw new IllegalArgumentException("The variable " + name + " in the server URL has invalid value " + value + ".");
|
||||
}
|
||||
}
|
||||
url = url.replace("{" + name + "}", value);
|
||||
}
|
||||
return url;
|
||||
}
|
||||
|
||||
/**
|
||||
* Format URL template using default server variables.
|
||||
*
|
||||
* @return Formatted URL.
|
||||
*/
|
||||
public String URL() {
|
||||
return URL(null);
|
||||
}
|
||||
}
|
@ -0,0 +1,23 @@
|
||||
package org.openapitools.client;
|
||||
|
||||
import java.util.HashSet;
|
||||
|
||||
/**
|
||||
* Representing a Server Variable for server URL template substitution.
|
||||
*/
|
||||
public class ServerVariable {
|
||||
public String description;
|
||||
public String defaultValue;
|
||||
public HashSet<String> enumValues = null;
|
||||
|
||||
/**
|
||||
* @param description A description for the server variable.
|
||||
* @param defaultValue The default value to use for substitution.
|
||||
* @param enumValues An enumeration of string values to be used if the substitution options are from a limited set.
|
||||
*/
|
||||
public ServerVariable(String description, String defaultValue, HashSet<String> enumValues) {
|
||||
this.description = description;
|
||||
this.defaultValue = defaultValue;
|
||||
this.enumValues = enumValues;
|
||||
}
|
||||
}
|
@ -0,0 +1,83 @@
|
||||
/*
|
||||
* Echo Server API
|
||||
* Echo Server API
|
||||
*
|
||||
* The version of the OpenAPI document: 0.1.0
|
||||
* Contact: team@openapitools.org
|
||||
*
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
|
||||
package org.openapitools.client;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Iterator;
|
||||
|
||||
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
|
||||
public class StringUtil {
|
||||
/**
|
||||
* Check if the given array contains the given value (with case-insensitive comparison).
|
||||
*
|
||||
* @param array The array
|
||||
* @param value The value to search
|
||||
* @return true if the array contains the value
|
||||
*/
|
||||
public static boolean containsIgnoreCase(String[] array, String value) {
|
||||
for (String str : array) {
|
||||
if (value == null && str == null) {
|
||||
return true;
|
||||
}
|
||||
if (value != null && value.equalsIgnoreCase(str)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Join an array of strings with the given separator.
|
||||
* <p>
|
||||
* Note: This might be replaced by utility method from commons-lang or guava someday
|
||||
* if one of those libraries is added as dependency.
|
||||
* </p>
|
||||
*
|
||||
* @param array The array of strings
|
||||
* @param separator The separator
|
||||
* @return the resulting string
|
||||
*/
|
||||
public static String join(String[] array, String separator) {
|
||||
int len = array.length;
|
||||
if (len == 0) {
|
||||
return "";
|
||||
}
|
||||
|
||||
StringBuilder out = new StringBuilder();
|
||||
out.append(array[0]);
|
||||
for (int i = 1; i < len; i++) {
|
||||
out.append(separator).append(array[i]);
|
||||
}
|
||||
return out.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Join a list of strings with the given separator.
|
||||
*
|
||||
* @param list The list of strings
|
||||
* @param separator The separator
|
||||
* @return the resulting string
|
||||
*/
|
||||
public static String join(Collection<String> list, String separator) {
|
||||
Iterator<String> iterator = list.iterator();
|
||||
StringBuilder out = new StringBuilder();
|
||||
if (iterator.hasNext()) {
|
||||
out.append(iterator.next());
|
||||
}
|
||||
while (iterator.hasNext()) {
|
||||
out.append(separator).append(iterator.next());
|
||||
}
|
||||
return out.toString();
|
||||
}
|
||||
}
|
@ -0,0 +1,47 @@
|
||||
package org.openapitools.client.api;
|
||||
|
||||
import org.openapitools.client.ApiClient;
|
||||
import org.openapitools.client.EncodingUtils;
|
||||
import org.openapitools.client.model.ApiResponse;
|
||||
|
||||
import org.openapitools.client.model.Pet;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import feign.*;
|
||||
|
||||
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
|
||||
public interface BodyApi extends ApiClient.Api {
|
||||
|
||||
|
||||
/**
|
||||
* Test body parameter(s)
|
||||
* Test body parameter(s)
|
||||
* @param pet Pet object that needs to be added to the store (optional)
|
||||
* @return Pet
|
||||
*/
|
||||
@RequestLine("POST /echo/body/Pet")
|
||||
@Headers({
|
||||
"Content-Type: application/json",
|
||||
"Accept: application/json",
|
||||
})
|
||||
Pet testEchoBodyPet(Pet pet);
|
||||
|
||||
/**
|
||||
* Test body parameter(s)
|
||||
* Similar to <code>testEchoBodyPet</code> but it also returns the http response headers .
|
||||
* Test body parameter(s)
|
||||
* @param pet Pet object that needs to be added to the store (optional)
|
||||
* @return A ApiResponse that wraps the response boyd and the http headers.
|
||||
*/
|
||||
@RequestLine("POST /echo/body/Pet")
|
||||
@Headers({
|
||||
"Content-Type: application/json",
|
||||
"Accept: application/json",
|
||||
})
|
||||
ApiResponse<Pet> testEchoBodyPetWithHttpInfo(Pet pet);
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,46 @@
|
||||
package org.openapitools.client.api;
|
||||
|
||||
import org.openapitools.client.ApiClient;
|
||||
import org.openapitools.client.EncodingUtils;
|
||||
import org.openapitools.client.model.ApiResponse;
|
||||
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import feign.*;
|
||||
|
||||
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
|
||||
public interface PathApi extends ApiClient.Api {
|
||||
|
||||
|
||||
/**
|
||||
* Test path parameter(s)
|
||||
* Test path parameter(s)
|
||||
* @param pathString (required)
|
||||
* @param pathInteger (required)
|
||||
* @return String
|
||||
*/
|
||||
@RequestLine("GET /path/string/{pathString}/integer/{pathInteger}")
|
||||
@Headers({
|
||||
"Accept: text/plain",
|
||||
})
|
||||
String testsPathStringPathStringIntegerPathInteger(@Param("pathString") String pathString, @Param("pathInteger") Integer pathInteger);
|
||||
|
||||
/**
|
||||
* Test path parameter(s)
|
||||
* Similar to <code>testsPathStringPathStringIntegerPathInteger</code> but it also returns the http response headers .
|
||||
* Test path parameter(s)
|
||||
* @param pathString (required)
|
||||
* @param pathInteger (required)
|
||||
* @return A ApiResponse that wraps the response boyd and the http headers.
|
||||
*/
|
||||
@RequestLine("GET /path/string/{pathString}/integer/{pathInteger}")
|
||||
@Headers({
|
||||
"Accept: text/plain",
|
||||
})
|
||||
ApiResponse<String> testsPathStringPathStringIntegerPathIntegerWithHttpInfo(@Param("pathString") String pathString, @Param("pathInteger") Integer pathInteger);
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,266 @@
|
||||
package org.openapitools.client.api;
|
||||
|
||||
import org.openapitools.client.ApiClient;
|
||||
import org.openapitools.client.EncodingUtils;
|
||||
import org.openapitools.client.model.ApiResponse;
|
||||
|
||||
import org.openapitools.client.model.Pet;
|
||||
import org.openapitools.client.model.TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import feign.*;
|
||||
|
||||
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
|
||||
public interface QueryApi extends ApiClient.Api {
|
||||
|
||||
|
||||
/**
|
||||
* Test query parameter(s)
|
||||
* Test query parameter(s)
|
||||
* @param integerQuery (optional)
|
||||
* @param booleanQuery (optional)
|
||||
* @param stringQuery (optional)
|
||||
* @return String
|
||||
*/
|
||||
@RequestLine("GET /query/integer/boolean/string?integer_query={integerQuery}&boolean_query={booleanQuery}&string_query={stringQuery}")
|
||||
@Headers({
|
||||
"Accept: text/plain",
|
||||
})
|
||||
String testQueryIntegerBooleanString(@Param("integerQuery") Integer integerQuery, @Param("booleanQuery") Boolean booleanQuery, @Param("stringQuery") String stringQuery);
|
||||
|
||||
/**
|
||||
* Test query parameter(s)
|
||||
* Similar to <code>testQueryIntegerBooleanString</code> but it also returns the http response headers .
|
||||
* Test query parameter(s)
|
||||
* @param integerQuery (optional)
|
||||
* @param booleanQuery (optional)
|
||||
* @param stringQuery (optional)
|
||||
* @return A ApiResponse that wraps the response boyd and the http headers.
|
||||
*/
|
||||
@RequestLine("GET /query/integer/boolean/string?integer_query={integerQuery}&boolean_query={booleanQuery}&string_query={stringQuery}")
|
||||
@Headers({
|
||||
"Accept: text/plain",
|
||||
})
|
||||
ApiResponse<String> testQueryIntegerBooleanStringWithHttpInfo(@Param("integerQuery") Integer integerQuery, @Param("booleanQuery") Boolean booleanQuery, @Param("stringQuery") String stringQuery);
|
||||
|
||||
|
||||
/**
|
||||
* Test query parameter(s)
|
||||
* Test query parameter(s)
|
||||
* Note, this is equivalent to the other <code>testQueryIntegerBooleanString</code> method,
|
||||
* but with the query parameters collected into a single Map parameter. This
|
||||
* is convenient for services with optional query parameters, especially when
|
||||
* used with the {@link TestQueryIntegerBooleanStringQueryParams} class that allows for
|
||||
* building up this map in a fluent style.
|
||||
* @param queryParams Map of query parameters as name-value pairs
|
||||
* <p>The following elements may be specified in the query map:</p>
|
||||
* <ul>
|
||||
* <li>integerQuery - (optional)</li>
|
||||
* <li>booleanQuery - (optional)</li>
|
||||
* <li>stringQuery - (optional)</li>
|
||||
* </ul>
|
||||
* @return String
|
||||
*/
|
||||
@RequestLine("GET /query/integer/boolean/string?integer_query={integerQuery}&boolean_query={booleanQuery}&string_query={stringQuery}")
|
||||
@Headers({
|
||||
"Accept: text/plain",
|
||||
})
|
||||
String testQueryIntegerBooleanString(@QueryMap(encoded=true) Map<String, Object> queryParams);
|
||||
|
||||
/**
|
||||
* Test query parameter(s)
|
||||
* Test query parameter(s)
|
||||
* Note, this is equivalent to the other <code>testQueryIntegerBooleanString</code> that receives the query parameters as a map,
|
||||
* but this one also exposes the Http response headers
|
||||
* @param queryParams Map of query parameters as name-value pairs
|
||||
* <p>The following elements may be specified in the query map:</p>
|
||||
* <ul>
|
||||
* <li>integerQuery - (optional)</li>
|
||||
* <li>booleanQuery - (optional)</li>
|
||||
* <li>stringQuery - (optional)</li>
|
||||
* </ul>
|
||||
* @return String
|
||||
*/
|
||||
@RequestLine("GET /query/integer/boolean/string?integer_query={integerQuery}&boolean_query={booleanQuery}&string_query={stringQuery}")
|
||||
@Headers({
|
||||
"Accept: text/plain",
|
||||
})
|
||||
ApiResponse<String> testQueryIntegerBooleanStringWithHttpInfo(@QueryMap(encoded=true) Map<String, Object> queryParams);
|
||||
|
||||
|
||||
/**
|
||||
* A convenience class for generating query parameters for the
|
||||
* <code>testQueryIntegerBooleanString</code> method in a fluent style.
|
||||
*/
|
||||
public static class TestQueryIntegerBooleanStringQueryParams extends HashMap<String, Object> {
|
||||
public TestQueryIntegerBooleanStringQueryParams integerQuery(final Integer value) {
|
||||
put("integer_query", EncodingUtils.encode(value));
|
||||
return this;
|
||||
}
|
||||
public TestQueryIntegerBooleanStringQueryParams booleanQuery(final Boolean value) {
|
||||
put("boolean_query", EncodingUtils.encode(value));
|
||||
return this;
|
||||
}
|
||||
public TestQueryIntegerBooleanStringQueryParams stringQuery(final String value) {
|
||||
put("string_query", EncodingUtils.encode(value));
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Test query parameter(s)
|
||||
* Test query parameter(s)
|
||||
* @param queryObject (optional)
|
||||
* @return String
|
||||
*/
|
||||
@RequestLine("GET /query/style_form/explode_true/array_string?query_object={queryObject}")
|
||||
@Headers({
|
||||
"Accept: text/plain",
|
||||
})
|
||||
String testQueryStyleFormExplodeTrueArrayString(@Param("queryObject") TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter queryObject);
|
||||
|
||||
/**
|
||||
* Test query parameter(s)
|
||||
* Similar to <code>testQueryStyleFormExplodeTrueArrayString</code> but it also returns the http response headers .
|
||||
* Test query parameter(s)
|
||||
* @param queryObject (optional)
|
||||
* @return A ApiResponse that wraps the response boyd and the http headers.
|
||||
*/
|
||||
@RequestLine("GET /query/style_form/explode_true/array_string?query_object={queryObject}")
|
||||
@Headers({
|
||||
"Accept: text/plain",
|
||||
})
|
||||
ApiResponse<String> testQueryStyleFormExplodeTrueArrayStringWithHttpInfo(@Param("queryObject") TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter queryObject);
|
||||
|
||||
|
||||
/**
|
||||
* Test query parameter(s)
|
||||
* Test query parameter(s)
|
||||
* Note, this is equivalent to the other <code>testQueryStyleFormExplodeTrueArrayString</code> method,
|
||||
* but with the query parameters collected into a single Map parameter. This
|
||||
* is convenient for services with optional query parameters, especially when
|
||||
* used with the {@link TestQueryStyleFormExplodeTrueArrayStringQueryParams} class that allows for
|
||||
* building up this map in a fluent style.
|
||||
* @param queryParams Map of query parameters as name-value pairs
|
||||
* <p>The following elements may be specified in the query map:</p>
|
||||
* <ul>
|
||||
* <li>queryObject - (optional)</li>
|
||||
* </ul>
|
||||
* @return String
|
||||
*/
|
||||
@RequestLine("GET /query/style_form/explode_true/array_string?query_object={queryObject}")
|
||||
@Headers({
|
||||
"Accept: text/plain",
|
||||
})
|
||||
String testQueryStyleFormExplodeTrueArrayString(@QueryMap(encoded=true) Map<String, Object> queryParams);
|
||||
|
||||
/**
|
||||
* Test query parameter(s)
|
||||
* Test query parameter(s)
|
||||
* Note, this is equivalent to the other <code>testQueryStyleFormExplodeTrueArrayString</code> that receives the query parameters as a map,
|
||||
* but this one also exposes the Http response headers
|
||||
* @param queryParams Map of query parameters as name-value pairs
|
||||
* <p>The following elements may be specified in the query map:</p>
|
||||
* <ul>
|
||||
* <li>queryObject - (optional)</li>
|
||||
* </ul>
|
||||
* @return String
|
||||
*/
|
||||
@RequestLine("GET /query/style_form/explode_true/array_string?query_object={queryObject}")
|
||||
@Headers({
|
||||
"Accept: text/plain",
|
||||
})
|
||||
ApiResponse<String> testQueryStyleFormExplodeTrueArrayStringWithHttpInfo(@QueryMap(encoded=true) Map<String, Object> queryParams);
|
||||
|
||||
|
||||
/**
|
||||
* A convenience class for generating query parameters for the
|
||||
* <code>testQueryStyleFormExplodeTrueArrayString</code> method in a fluent style.
|
||||
*/
|
||||
public static class TestQueryStyleFormExplodeTrueArrayStringQueryParams extends HashMap<String, Object> {
|
||||
public TestQueryStyleFormExplodeTrueArrayStringQueryParams queryObject(final TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter value) {
|
||||
put("query_object", EncodingUtils.encode(value));
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Test query parameter(s)
|
||||
* Test query parameter(s)
|
||||
* @param queryObject (optional)
|
||||
* @return String
|
||||
*/
|
||||
@RequestLine("GET /query/style_form/explode_true/object?query_object={queryObject}")
|
||||
@Headers({
|
||||
"Accept: text/plain",
|
||||
})
|
||||
String testQueryStyleFormExplodeTrueObject(@Param("queryObject") Pet queryObject);
|
||||
|
||||
/**
|
||||
* Test query parameter(s)
|
||||
* Similar to <code>testQueryStyleFormExplodeTrueObject</code> but it also returns the http response headers .
|
||||
* Test query parameter(s)
|
||||
* @param queryObject (optional)
|
||||
* @return A ApiResponse that wraps the response boyd and the http headers.
|
||||
*/
|
||||
@RequestLine("GET /query/style_form/explode_true/object?query_object={queryObject}")
|
||||
@Headers({
|
||||
"Accept: text/plain",
|
||||
})
|
||||
ApiResponse<String> testQueryStyleFormExplodeTrueObjectWithHttpInfo(@Param("queryObject") Pet queryObject);
|
||||
|
||||
|
||||
/**
|
||||
* Test query parameter(s)
|
||||
* Test query parameter(s)
|
||||
* Note, this is equivalent to the other <code>testQueryStyleFormExplodeTrueObject</code> method,
|
||||
* but with the query parameters collected into a single Map parameter. This
|
||||
* is convenient for services with optional query parameters, especially when
|
||||
* used with the {@link TestQueryStyleFormExplodeTrueObjectQueryParams} class that allows for
|
||||
* building up this map in a fluent style.
|
||||
* @param queryParams Map of query parameters as name-value pairs
|
||||
* <p>The following elements may be specified in the query map:</p>
|
||||
* <ul>
|
||||
* <li>queryObject - (optional)</li>
|
||||
* </ul>
|
||||
* @return String
|
||||
*/
|
||||
@RequestLine("GET /query/style_form/explode_true/object?query_object={queryObject}")
|
||||
@Headers({
|
||||
"Accept: text/plain",
|
||||
})
|
||||
String testQueryStyleFormExplodeTrueObject(@QueryMap(encoded=true) Map<String, Object> queryParams);
|
||||
|
||||
/**
|
||||
* Test query parameter(s)
|
||||
* Test query parameter(s)
|
||||
* Note, this is equivalent to the other <code>testQueryStyleFormExplodeTrueObject</code> that receives the query parameters as a map,
|
||||
* but this one also exposes the Http response headers
|
||||
* @param queryParams Map of query parameters as name-value pairs
|
||||
* <p>The following elements may be specified in the query map:</p>
|
||||
* <ul>
|
||||
* <li>queryObject - (optional)</li>
|
||||
* </ul>
|
||||
* @return String
|
||||
*/
|
||||
@RequestLine("GET /query/style_form/explode_true/object?query_object={queryObject}")
|
||||
@Headers({
|
||||
"Accept: text/plain",
|
||||
})
|
||||
ApiResponse<String> testQueryStyleFormExplodeTrueObjectWithHttpInfo(@QueryMap(encoded=true) Map<String, Object> queryParams);
|
||||
|
||||
|
||||
/**
|
||||
* A convenience class for generating query parameters for the
|
||||
* <code>testQueryStyleFormExplodeTrueObject</code> method in a fluent style.
|
||||
*/
|
||||
public static class TestQueryStyleFormExplodeTrueObjectQueryParams extends HashMap<String, Object> {
|
||||
public TestQueryStyleFormExplodeTrueObjectQueryParams queryObject(final Pet value) {
|
||||
put("query_object", EncodingUtils.encode(value));
|
||||
return this;
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,43 @@
|
||||
package org.openapitools.client.auth;
|
||||
|
||||
import feign.RequestInterceptor;
|
||||
import feign.RequestTemplate;
|
||||
|
||||
public class ApiKeyAuth implements RequestInterceptor {
|
||||
private final String location;
|
||||
private final String paramName;
|
||||
|
||||
private String apiKey;
|
||||
|
||||
public ApiKeyAuth(String location, String paramName) {
|
||||
this.location = location;
|
||||
this.paramName = paramName;
|
||||
}
|
||||
|
||||
public String getLocation() {
|
||||
return location;
|
||||
}
|
||||
|
||||
public String getParamName() {
|
||||
return paramName;
|
||||
}
|
||||
|
||||
public String getApiKey() {
|
||||
return apiKey;
|
||||
}
|
||||
|
||||
public void setApiKey(String apiKey) {
|
||||
this.apiKey = apiKey;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void apply(RequestTemplate template) {
|
||||
if ("query".equals(location)) {
|
||||
template.query(paramName, apiKey);
|
||||
} else if ("header".equals(location)) {
|
||||
template.header(paramName, apiKey);
|
||||
} else if ("cookie".equals(location)) {
|
||||
template.header("Cookie", String.format("%s=%s", paramName, apiKey));
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,47 @@
|
||||
package org.openapitools.client.auth;
|
||||
|
||||
import com.github.scribejava.core.builder.api.DefaultApi20;
|
||||
import com.github.scribejava.core.extractors.OAuth2AccessTokenJsonExtractor;
|
||||
import com.github.scribejava.core.extractors.TokenExtractor;
|
||||
import com.github.scribejava.core.model.OAuth2AccessToken;
|
||||
import com.github.scribejava.core.oauth2.bearersignature.BearerSignature;
|
||||
import com.github.scribejava.core.oauth2.bearersignature.BearerSignatureURIQueryParameter;
|
||||
import com.github.scribejava.core.oauth2.clientauthentication.ClientAuthentication;
|
||||
import com.github.scribejava.core.oauth2.clientauthentication.RequestBodyAuthenticationScheme;
|
||||
|
||||
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
|
||||
public class DefaultApi20Impl extends DefaultApi20 {
|
||||
|
||||
private final String accessTokenEndpoint;
|
||||
private final String authorizationBaseUrl;
|
||||
|
||||
protected DefaultApi20Impl(String authorizationBaseUrl, String accessTokenEndpoint) {
|
||||
this.authorizationBaseUrl = authorizationBaseUrl;
|
||||
this.accessTokenEndpoint = accessTokenEndpoint;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getAccessTokenEndpoint() {
|
||||
return accessTokenEndpoint;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getAuthorizationBaseUrl() {
|
||||
return authorizationBaseUrl;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BearerSignature getBearerSignature() {
|
||||
return BearerSignatureURIQueryParameter.instance();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ClientAuthentication getClientAuthentication() {
|
||||
return RequestBodyAuthenticationScheme.instance();
|
||||
}
|
||||
|
||||
@Override
|
||||
public TokenExtractor<OAuth2AccessToken> getAccessTokenExtractor() {
|
||||
return OAuth2AccessTokenJsonExtractor.instance();
|
||||
}
|
||||
}
|
@ -0,0 +1,41 @@
|
||||
package org.openapitools.client.auth;
|
||||
|
||||
import feign.RequestInterceptor;
|
||||
import feign.RequestTemplate;
|
||||
import feign.auth.BasicAuthRequestInterceptor;
|
||||
|
||||
/**
|
||||
* An interceptor that adds the request header needed to use HTTP basic authentication.
|
||||
*/
|
||||
public class HttpBasicAuth implements RequestInterceptor {
|
||||
|
||||
private String username;
|
||||
private String password;
|
||||
|
||||
public String getUsername() {
|
||||
return username;
|
||||
}
|
||||
|
||||
public void setUsername(String username) {
|
||||
this.username = username;
|
||||
}
|
||||
|
||||
public String getPassword() {
|
||||
return password;
|
||||
}
|
||||
|
||||
public void setPassword(String password) {
|
||||
this.password = password;
|
||||
}
|
||||
|
||||
public void setCredentials(String username, String password) {
|
||||
this.username = username;
|
||||
this.password = password;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void apply(RequestTemplate template) {
|
||||
RequestInterceptor requestInterceptor = new BasicAuthRequestInterceptor(username, password);
|
||||
requestInterceptor.apply(template);
|
||||
}
|
||||
}
|
@ -0,0 +1,43 @@
|
||||
package org.openapitools.client.auth;
|
||||
|
||||
import feign.RequestInterceptor;
|
||||
import feign.RequestTemplate;
|
||||
|
||||
/**
|
||||
* An interceptor that adds the request header needed to use HTTP bearer authentication.
|
||||
*/
|
||||
public class HttpBearerAuth implements RequestInterceptor {
|
||||
private final String scheme;
|
||||
private String bearerToken;
|
||||
|
||||
public HttpBearerAuth(String scheme) {
|
||||
this.scheme = scheme;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the token, which together with the scheme, will be sent as the value of the Authorization header.
|
||||
*/
|
||||
public String getBearerToken() {
|
||||
return bearerToken;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the token, which together with the scheme, will be sent as the value of the Authorization header.
|
||||
*/
|
||||
public void setBearerToken(String bearerToken) {
|
||||
this.bearerToken = bearerToken;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void apply(RequestTemplate template) {
|
||||
if(bearerToken == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
template.header("Authorization", (scheme != null ? upperCaseBearer(scheme) + " " : "") + bearerToken);
|
||||
}
|
||||
|
||||
private static String upperCaseBearer(String scheme) {
|
||||
return ("bearer".equalsIgnoreCase(scheme)) ? "Bearer" : scheme;
|
||||
}
|
||||
}
|
@ -0,0 +1,43 @@
|
||||
package org.openapitools.client.model;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.List;
|
||||
|
||||
public class ApiResponse<T>{
|
||||
|
||||
final private int statusCode;
|
||||
final private Map<String, List<String>> headers;
|
||||
final private T data;
|
||||
|
||||
/**
|
||||
* @param statusCode The status code of HTTP response
|
||||
* @param headers The headers of HTTP response
|
||||
*/
|
||||
public ApiResponse(int statusCode, Map<String, List<String>> headers) {
|
||||
this(statusCode, headers, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param statusCode The status code of HTTP response
|
||||
* @param headers The headers of HTTP response
|
||||
* @param data The object deserialized from response bod
|
||||
*/
|
||||
public ApiResponse(int statusCode, Map<String, List<String>> headers, T data) {
|
||||
this.statusCode = statusCode;
|
||||
this.headers = headers;
|
||||
this.data = data;
|
||||
}
|
||||
|
||||
public int getStatusCode() {
|
||||
return statusCode;
|
||||
}
|
||||
|
||||
public Map<String, List<String>> getHeaders() {
|
||||
return headers;
|
||||
}
|
||||
|
||||
public T getData() {
|
||||
return data;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,125 @@
|
||||
/*
|
||||
* Echo Server API
|
||||
* Echo Server API
|
||||
*
|
||||
* The version of the OpenAPI document: 0.1.0
|
||||
* Contact: team@openapitools.org
|
||||
*
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
|
||||
package org.openapitools.client.model;
|
||||
|
||||
import java.util.Objects;
|
||||
import java.util.Arrays;
|
||||
import com.google.gson.TypeAdapter;
|
||||
import com.google.gson.annotations.JsonAdapter;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import com.google.gson.stream.JsonReader;
|
||||
import com.google.gson.stream.JsonWriter;
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
* Category
|
||||
*/
|
||||
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
|
||||
public class Category {
|
||||
public static final String SERIALIZED_NAME_ID = "id";
|
||||
@SerializedName(SERIALIZED_NAME_ID)
|
||||
private Long id;
|
||||
|
||||
public static final String SERIALIZED_NAME_NAME = "name";
|
||||
@SerializedName(SERIALIZED_NAME_NAME)
|
||||
private String name;
|
||||
|
||||
public Category() {
|
||||
}
|
||||
|
||||
public Category id(Long id) {
|
||||
|
||||
this.id = id;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get id
|
||||
* @return id
|
||||
**/
|
||||
@javax.annotation.Nullable
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
|
||||
public Category name(String name) {
|
||||
|
||||
this.name = name;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get name
|
||||
* @return name
|
||||
**/
|
||||
@javax.annotation.Nullable
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) {
|
||||
return true;
|
||||
}
|
||||
if (o == null || getClass() != o.getClass()) {
|
||||
return false;
|
||||
}
|
||||
Category category = (Category) o;
|
||||
return Objects.equals(this.id, category.id) &&
|
||||
Objects.equals(this.name, category.name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(id, name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("class Category {\n");
|
||||
sb.append(" id: ").append(toIndentedString(id)).append("\n");
|
||||
sb.append(" name: ").append(toIndentedString(name)).append("\n");
|
||||
sb.append("}");
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert the given object to string with each line indented by 4 spaces
|
||||
* (except the first line).
|
||||
*/
|
||||
private String toIndentedString(Object o) {
|
||||
if (o == null) {
|
||||
return "null";
|
||||
}
|
||||
return o.toString().replace("\n", "\n ");
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,303 @@
|
||||
/*
|
||||
* Echo Server API
|
||||
* Echo Server API
|
||||
*
|
||||
* The version of the OpenAPI document: 0.1.0
|
||||
* Contact: team@openapitools.org
|
||||
*
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
|
||||
package org.openapitools.client.model;
|
||||
|
||||
import java.util.Objects;
|
||||
import java.util.Arrays;
|
||||
import com.google.gson.TypeAdapter;
|
||||
import com.google.gson.annotations.JsonAdapter;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import com.google.gson.stream.JsonReader;
|
||||
import com.google.gson.stream.JsonWriter;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import org.openapitools.client.model.Category;
|
||||
import org.openapitools.client.model.Tag;
|
||||
|
||||
/**
|
||||
* Pet
|
||||
*/
|
||||
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
|
||||
public class Pet {
|
||||
public static final String SERIALIZED_NAME_ID = "id";
|
||||
@SerializedName(SERIALIZED_NAME_ID)
|
||||
private Long id;
|
||||
|
||||
public static final String SERIALIZED_NAME_NAME = "name";
|
||||
@SerializedName(SERIALIZED_NAME_NAME)
|
||||
private String name;
|
||||
|
||||
public static final String SERIALIZED_NAME_CATEGORY = "category";
|
||||
@SerializedName(SERIALIZED_NAME_CATEGORY)
|
||||
private Category category;
|
||||
|
||||
public static final String SERIALIZED_NAME_PHOTO_URLS = "photoUrls";
|
||||
@SerializedName(SERIALIZED_NAME_PHOTO_URLS)
|
||||
private List<String> photoUrls = new ArrayList<>();
|
||||
|
||||
public static final String SERIALIZED_NAME_TAGS = "tags";
|
||||
@SerializedName(SERIALIZED_NAME_TAGS)
|
||||
private List<Tag> tags = null;
|
||||
|
||||
/**
|
||||
* pet status in the store
|
||||
*/
|
||||
@JsonAdapter(StatusEnum.Adapter.class)
|
||||
public enum StatusEnum {
|
||||
AVAILABLE("available"),
|
||||
|
||||
PENDING("pending"),
|
||||
|
||||
SOLD("sold");
|
||||
|
||||
private String value;
|
||||
|
||||
StatusEnum(String value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public String getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return String.valueOf(value);
|
||||
}
|
||||
|
||||
public static StatusEnum fromValue(String value) {
|
||||
for (StatusEnum b : StatusEnum.values()) {
|
||||
if (b.value.equals(value)) {
|
||||
return b;
|
||||
}
|
||||
}
|
||||
throw new IllegalArgumentException("Unexpected value '" + value + "'");
|
||||
}
|
||||
|
||||
public static class Adapter extends TypeAdapter<StatusEnum> {
|
||||
@Override
|
||||
public void write(final JsonWriter jsonWriter, final StatusEnum enumeration) throws IOException {
|
||||
jsonWriter.value(enumeration.getValue());
|
||||
}
|
||||
|
||||
@Override
|
||||
public StatusEnum read(final JsonReader jsonReader) throws IOException {
|
||||
String value = jsonReader.nextString();
|
||||
return StatusEnum.fromValue(value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static final String SERIALIZED_NAME_STATUS = "status";
|
||||
@SerializedName(SERIALIZED_NAME_STATUS)
|
||||
private StatusEnum status;
|
||||
|
||||
public Pet() {
|
||||
}
|
||||
|
||||
public Pet id(Long id) {
|
||||
|
||||
this.id = id;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get id
|
||||
* @return id
|
||||
**/
|
||||
@javax.annotation.Nullable
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
|
||||
public Pet name(String name) {
|
||||
|
||||
this.name = name;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get name
|
||||
* @return name
|
||||
**/
|
||||
@javax.annotation.Nonnull
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
|
||||
public Pet category(Category category) {
|
||||
|
||||
this.category = category;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get category
|
||||
* @return category
|
||||
**/
|
||||
@javax.annotation.Nullable
|
||||
|
||||
public Category getCategory() {
|
||||
return category;
|
||||
}
|
||||
|
||||
|
||||
public void setCategory(Category category) {
|
||||
this.category = category;
|
||||
}
|
||||
|
||||
|
||||
public Pet photoUrls(List<String> photoUrls) {
|
||||
|
||||
this.photoUrls = photoUrls;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Pet addPhotoUrlsItem(String photoUrlsItem) {
|
||||
this.photoUrls.add(photoUrlsItem);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get photoUrls
|
||||
* @return photoUrls
|
||||
**/
|
||||
@javax.annotation.Nonnull
|
||||
|
||||
public List<String> getPhotoUrls() {
|
||||
return photoUrls;
|
||||
}
|
||||
|
||||
|
||||
public void setPhotoUrls(List<String> photoUrls) {
|
||||
this.photoUrls = photoUrls;
|
||||
}
|
||||
|
||||
|
||||
public Pet tags(List<Tag> tags) {
|
||||
|
||||
this.tags = tags;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Pet addTagsItem(Tag tagsItem) {
|
||||
if (this.tags == null) {
|
||||
this.tags = new ArrayList<>();
|
||||
}
|
||||
this.tags.add(tagsItem);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get tags
|
||||
* @return tags
|
||||
**/
|
||||
@javax.annotation.Nullable
|
||||
|
||||
public List<Tag> getTags() {
|
||||
return tags;
|
||||
}
|
||||
|
||||
|
||||
public void setTags(List<Tag> tags) {
|
||||
this.tags = tags;
|
||||
}
|
||||
|
||||
|
||||
public Pet status(StatusEnum status) {
|
||||
|
||||
this.status = status;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* pet status in the store
|
||||
* @return status
|
||||
**/
|
||||
@javax.annotation.Nullable
|
||||
|
||||
public StatusEnum getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
|
||||
public void setStatus(StatusEnum status) {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) {
|
||||
return true;
|
||||
}
|
||||
if (o == null || getClass() != o.getClass()) {
|
||||
return false;
|
||||
}
|
||||
Pet pet = (Pet) o;
|
||||
return Objects.equals(this.id, pet.id) &&
|
||||
Objects.equals(this.name, pet.name) &&
|
||||
Objects.equals(this.category, pet.category) &&
|
||||
Objects.equals(this.photoUrls, pet.photoUrls) &&
|
||||
Objects.equals(this.tags, pet.tags) &&
|
||||
Objects.equals(this.status, pet.status);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(id, name, category, photoUrls, tags, status);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("class Pet {\n");
|
||||
sb.append(" id: ").append(toIndentedString(id)).append("\n");
|
||||
sb.append(" name: ").append(toIndentedString(name)).append("\n");
|
||||
sb.append(" category: ").append(toIndentedString(category)).append("\n");
|
||||
sb.append(" photoUrls: ").append(toIndentedString(photoUrls)).append("\n");
|
||||
sb.append(" tags: ").append(toIndentedString(tags)).append("\n");
|
||||
sb.append(" status: ").append(toIndentedString(status)).append("\n");
|
||||
sb.append("}");
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert the given object to string with each line indented by 4 spaces
|
||||
* (except the first line).
|
||||
*/
|
||||
private String toIndentedString(Object o) {
|
||||
if (o == null) {
|
||||
return "null";
|
||||
}
|
||||
return o.toString().replace("\n", "\n ");
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,125 @@
|
||||
/*
|
||||
* Echo Server API
|
||||
* Echo Server API
|
||||
*
|
||||
* The version of the OpenAPI document: 0.1.0
|
||||
* Contact: team@openapitools.org
|
||||
*
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
|
||||
package org.openapitools.client.model;
|
||||
|
||||
import java.util.Objects;
|
||||
import java.util.Arrays;
|
||||
import com.google.gson.TypeAdapter;
|
||||
import com.google.gson.annotations.JsonAdapter;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import com.google.gson.stream.JsonReader;
|
||||
import com.google.gson.stream.JsonWriter;
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
* Tag
|
||||
*/
|
||||
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
|
||||
public class Tag {
|
||||
public static final String SERIALIZED_NAME_ID = "id";
|
||||
@SerializedName(SERIALIZED_NAME_ID)
|
||||
private Long id;
|
||||
|
||||
public static final String SERIALIZED_NAME_NAME = "name";
|
||||
@SerializedName(SERIALIZED_NAME_NAME)
|
||||
private String name;
|
||||
|
||||
public Tag() {
|
||||
}
|
||||
|
||||
public Tag id(Long id) {
|
||||
|
||||
this.id = id;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get id
|
||||
* @return id
|
||||
**/
|
||||
@javax.annotation.Nullable
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
|
||||
public Tag name(String name) {
|
||||
|
||||
this.name = name;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get name
|
||||
* @return name
|
||||
**/
|
||||
@javax.annotation.Nullable
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) {
|
||||
return true;
|
||||
}
|
||||
if (o == null || getClass() != o.getClass()) {
|
||||
return false;
|
||||
}
|
||||
Tag tag = (Tag) o;
|
||||
return Objects.equals(this.id, tag.id) &&
|
||||
Objects.equals(this.name, tag.name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(id, name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("class Tag {\n");
|
||||
sb.append(" id: ").append(toIndentedString(id)).append("\n");
|
||||
sb.append(" name: ").append(toIndentedString(name)).append("\n");
|
||||
sb.append("}");
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert the given object to string with each line indented by 4 spaces
|
||||
* (except the first line).
|
||||
*/
|
||||
private String toIndentedString(Object o) {
|
||||
if (o == null) {
|
||||
return "null";
|
||||
}
|
||||
return o.toString().replace("\n", "\n ");
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,107 @@
|
||||
/*
|
||||
* Echo Server API
|
||||
* Echo Server API
|
||||
*
|
||||
* The version of the OpenAPI document: 0.1.0
|
||||
* Contact: team@openapitools.org
|
||||
*
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
|
||||
package org.openapitools.client.model;
|
||||
|
||||
import java.util.Objects;
|
||||
import java.util.Arrays;
|
||||
import com.google.gson.TypeAdapter;
|
||||
import com.google.gson.annotations.JsonAdapter;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import com.google.gson.stream.JsonReader;
|
||||
import com.google.gson.stream.JsonWriter;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter
|
||||
*/
|
||||
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
|
||||
public class TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter {
|
||||
public static final String SERIALIZED_NAME_VALUES = "values";
|
||||
@SerializedName(SERIALIZED_NAME_VALUES)
|
||||
private List<String> values = null;
|
||||
|
||||
public TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter() {
|
||||
}
|
||||
|
||||
public TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter values(List<String> values) {
|
||||
|
||||
this.values = values;
|
||||
return this;
|
||||
}
|
||||
|
||||
public TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter addValuesItem(String valuesItem) {
|
||||
if (this.values == null) {
|
||||
this.values = new ArrayList<>();
|
||||
}
|
||||
this.values.add(valuesItem);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get values
|
||||
* @return values
|
||||
**/
|
||||
@javax.annotation.Nullable
|
||||
|
||||
public List<String> getValues() {
|
||||
return values;
|
||||
}
|
||||
|
||||
|
||||
public void setValues(List<String> values) {
|
||||
this.values = values;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) {
|
||||
return true;
|
||||
}
|
||||
if (o == null || getClass() != o.getClass()) {
|
||||
return false;
|
||||
}
|
||||
TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter testQueryStyleFormExplodeTrueArrayStringQueryObjectParameter = (TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter) o;
|
||||
return Objects.equals(this.values, testQueryStyleFormExplodeTrueArrayStringQueryObjectParameter.values);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(values);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("class TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter {\n");
|
||||
sb.append(" values: ").append(toIndentedString(values)).append("\n");
|
||||
sb.append("}");
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert the given object to string with each line indented by 4 spaces
|
||||
* (except the first line).
|
||||
*/
|
||||
private String toIndentedString(Object o) {
|
||||
if (o == null) {
|
||||
return "null";
|
||||
}
|
||||
return o.toString().replace("\n", "\n ");
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,42 @@
|
||||
package org.openapitools.client.api;
|
||||
|
||||
import org.openapitools.client.ApiClient;
|
||||
import org.openapitools.client.model.Pet;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.time.OffsetDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* API tests for BodyApi
|
||||
*/
|
||||
class BodyApiTest {
|
||||
|
||||
private BodyApi api;
|
||||
|
||||
@BeforeEach
|
||||
public void setup() {
|
||||
api = new ApiClient().buildClient(BodyApi.class);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Test body parameter(s)
|
||||
*
|
||||
* Test body parameter(s)
|
||||
*/
|
||||
@Test
|
||||
void testEchoBodyPetTest() {
|
||||
Pet pet = null;
|
||||
// Pet response = api.testEchoBodyPet(pet);
|
||||
|
||||
// TODO: test validations
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,42 @@
|
||||
package org.openapitools.client.api;
|
||||
|
||||
import org.openapitools.client.ApiClient;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.time.OffsetDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* API tests for PathApi
|
||||
*/
|
||||
class PathApiTest {
|
||||
|
||||
private PathApi api;
|
||||
|
||||
@BeforeEach
|
||||
public void setup() {
|
||||
api = new ApiClient().buildClient(PathApi.class);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Test path parameter(s)
|
||||
*
|
||||
* Test path parameter(s)
|
||||
*/
|
||||
@Test
|
||||
void testsPathStringPathStringIntegerPathIntegerTest() {
|
||||
String pathString = null;
|
||||
Integer pathInteger = null;
|
||||
// String response = api.testsPathStringPathStringIntegerPathInteger(pathString, pathInteger);
|
||||
|
||||
// TODO: test validations
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,123 @@
|
||||
package org.openapitools.client.api;
|
||||
|
||||
import org.openapitools.client.ApiClient;
|
||||
import org.openapitools.client.model.Pet;
|
||||
import org.openapitools.client.model.TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.time.OffsetDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* API tests for QueryApi
|
||||
*/
|
||||
class QueryApiTest {
|
||||
|
||||
private QueryApi api;
|
||||
|
||||
@BeforeEach
|
||||
public void setup() {
|
||||
api = new ApiClient().buildClient(QueryApi.class);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Test query parameter(s)
|
||||
*
|
||||
* Test query parameter(s)
|
||||
*/
|
||||
@Test
|
||||
void testQueryIntegerBooleanStringTest() {
|
||||
Integer integerQuery = null;
|
||||
Boolean booleanQuery = null;
|
||||
String stringQuery = null;
|
||||
// String response = api.testQueryIntegerBooleanString(integerQuery, booleanQuery, stringQuery);
|
||||
|
||||
// TODO: test validations
|
||||
}
|
||||
|
||||
/**
|
||||
* Test query parameter(s)
|
||||
*
|
||||
* Test query parameter(s)
|
||||
*
|
||||
* This tests the overload of the method that uses a Map for query parameters instead of
|
||||
* listing them out individually.
|
||||
*/
|
||||
@Test
|
||||
void testQueryIntegerBooleanStringTestQueryMap() {
|
||||
QueryApi.TestQueryIntegerBooleanStringQueryParams queryParams = new QueryApi.TestQueryIntegerBooleanStringQueryParams()
|
||||
.integerQuery(null)
|
||||
.booleanQuery(null)
|
||||
.stringQuery(null);
|
||||
// String response = api.testQueryIntegerBooleanString(queryParams);
|
||||
|
||||
// TODO: test validations
|
||||
}
|
||||
|
||||
/**
|
||||
* Test query parameter(s)
|
||||
*
|
||||
* Test query parameter(s)
|
||||
*/
|
||||
@Test
|
||||
void testQueryStyleFormExplodeTrueArrayStringTest() {
|
||||
TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter queryObject = null;
|
||||
// String response = api.testQueryStyleFormExplodeTrueArrayString(queryObject);
|
||||
|
||||
// TODO: test validations
|
||||
}
|
||||
|
||||
/**
|
||||
* Test query parameter(s)
|
||||
*
|
||||
* Test query parameter(s)
|
||||
*
|
||||
* This tests the overload of the method that uses a Map for query parameters instead of
|
||||
* listing them out individually.
|
||||
*/
|
||||
@Test
|
||||
void testQueryStyleFormExplodeTrueArrayStringTestQueryMap() {
|
||||
QueryApi.TestQueryStyleFormExplodeTrueArrayStringQueryParams queryParams = new QueryApi.TestQueryStyleFormExplodeTrueArrayStringQueryParams()
|
||||
.queryObject(null);
|
||||
// String response = api.testQueryStyleFormExplodeTrueArrayString(queryParams);
|
||||
|
||||
// TODO: test validations
|
||||
}
|
||||
|
||||
/**
|
||||
* Test query parameter(s)
|
||||
*
|
||||
* Test query parameter(s)
|
||||
*/
|
||||
@Test
|
||||
void testQueryStyleFormExplodeTrueObjectTest() {
|
||||
Pet queryObject = null;
|
||||
// String response = api.testQueryStyleFormExplodeTrueObject(queryObject);
|
||||
|
||||
// TODO: test validations
|
||||
}
|
||||
|
||||
/**
|
||||
* Test query parameter(s)
|
||||
*
|
||||
* Test query parameter(s)
|
||||
*
|
||||
* This tests the overload of the method that uses a Map for query parameters instead of
|
||||
* listing them out individually.
|
||||
*/
|
||||
@Test
|
||||
void testQueryStyleFormExplodeTrueObjectTestQueryMap() {
|
||||
QueryApi.TestQueryStyleFormExplodeTrueObjectQueryParams queryParams = new QueryApi.TestQueryStyleFormExplodeTrueObjectQueryParams()
|
||||
.queryObject(null);
|
||||
// String response = api.testQueryStyleFormExplodeTrueObject(queryParams);
|
||||
|
||||
// TODO: test validations
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,55 @@
|
||||
/*
|
||||
* Echo Server API
|
||||
* Echo Server API
|
||||
*
|
||||
* The version of the OpenAPI document: 0.1.0
|
||||
* Contact: team@openapitools.org
|
||||
*
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
|
||||
package org.openapitools.client.model;
|
||||
|
||||
import com.google.gson.TypeAdapter;
|
||||
import com.google.gson.annotations.JsonAdapter;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import com.google.gson.stream.JsonReader;
|
||||
import com.google.gson.stream.JsonWriter;
|
||||
import java.io.IOException;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
|
||||
/**
|
||||
* Model tests for Category
|
||||
*/
|
||||
class CategoryTest {
|
||||
private final Category model = new Category();
|
||||
|
||||
/**
|
||||
* Model tests for Category
|
||||
*/
|
||||
@Test
|
||||
void testCategory() {
|
||||
// TODO: test Category
|
||||
}
|
||||
|
||||
/**
|
||||
* Test the property 'id'
|
||||
*/
|
||||
@Test
|
||||
void idTest() {
|
||||
// TODO: test id
|
||||
}
|
||||
|
||||
/**
|
||||
* Test the property 'name'
|
||||
*/
|
||||
@Test
|
||||
void nameTest() {
|
||||
// TODO: test name
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,91 @@
|
||||
/*
|
||||
* Echo Server API
|
||||
* Echo Server API
|
||||
*
|
||||
* The version of the OpenAPI document: 0.1.0
|
||||
* Contact: team@openapitools.org
|
||||
*
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
|
||||
package org.openapitools.client.model;
|
||||
|
||||
import com.google.gson.TypeAdapter;
|
||||
import com.google.gson.annotations.JsonAdapter;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import com.google.gson.stream.JsonReader;
|
||||
import com.google.gson.stream.JsonWriter;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import org.openapitools.client.model.Category;
|
||||
import org.openapitools.client.model.Tag;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
|
||||
/**
|
||||
* Model tests for Pet
|
||||
*/
|
||||
class PetTest {
|
||||
private final Pet model = new Pet();
|
||||
|
||||
/**
|
||||
* Model tests for Pet
|
||||
*/
|
||||
@Test
|
||||
void testPet() {
|
||||
// TODO: test Pet
|
||||
}
|
||||
|
||||
/**
|
||||
* Test the property 'id'
|
||||
*/
|
||||
@Test
|
||||
void idTest() {
|
||||
// TODO: test id
|
||||
}
|
||||
|
||||
/**
|
||||
* Test the property 'name'
|
||||
*/
|
||||
@Test
|
||||
void nameTest() {
|
||||
// TODO: test name
|
||||
}
|
||||
|
||||
/**
|
||||
* Test the property 'category'
|
||||
*/
|
||||
@Test
|
||||
void categoryTest() {
|
||||
// TODO: test category
|
||||
}
|
||||
|
||||
/**
|
||||
* Test the property 'photoUrls'
|
||||
*/
|
||||
@Test
|
||||
void photoUrlsTest() {
|
||||
// TODO: test photoUrls
|
||||
}
|
||||
|
||||
/**
|
||||
* Test the property 'tags'
|
||||
*/
|
||||
@Test
|
||||
void tagsTest() {
|
||||
// TODO: test tags
|
||||
}
|
||||
|
||||
/**
|
||||
* Test the property 'status'
|
||||
*/
|
||||
@Test
|
||||
void statusTest() {
|
||||
// TODO: test status
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,55 @@
|
||||
/*
|
||||
* Echo Server API
|
||||
* Echo Server API
|
||||
*
|
||||
* The version of the OpenAPI document: 0.1.0
|
||||
* Contact: team@openapitools.org
|
||||
*
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
|
||||
package org.openapitools.client.model;
|
||||
|
||||
import com.google.gson.TypeAdapter;
|
||||
import com.google.gson.annotations.JsonAdapter;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import com.google.gson.stream.JsonReader;
|
||||
import com.google.gson.stream.JsonWriter;
|
||||
import java.io.IOException;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
|
||||
/**
|
||||
* Model tests for Tag
|
||||
*/
|
||||
class TagTest {
|
||||
private final Tag model = new Tag();
|
||||
|
||||
/**
|
||||
* Model tests for Tag
|
||||
*/
|
||||
@Test
|
||||
void testTag() {
|
||||
// TODO: test Tag
|
||||
}
|
||||
|
||||
/**
|
||||
* Test the property 'id'
|
||||
*/
|
||||
@Test
|
||||
void idTest() {
|
||||
// TODO: test id
|
||||
}
|
||||
|
||||
/**
|
||||
* Test the property 'name'
|
||||
*/
|
||||
@Test
|
||||
void nameTest() {
|
||||
// TODO: test name
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,49 @@
|
||||
/*
|
||||
* Echo Server API
|
||||
* Echo Server API
|
||||
*
|
||||
* The version of the OpenAPI document: 0.1.0
|
||||
* Contact: team@openapitools.org
|
||||
*
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
|
||||
package org.openapitools.client.model;
|
||||
|
||||
import com.google.gson.TypeAdapter;
|
||||
import com.google.gson.annotations.JsonAdapter;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import com.google.gson.stream.JsonReader;
|
||||
import com.google.gson.stream.JsonWriter;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
|
||||
/**
|
||||
* Model tests for TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter
|
||||
*/
|
||||
class TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameterTest {
|
||||
private final TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter model = new TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter();
|
||||
|
||||
/**
|
||||
* Model tests for TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter
|
||||
*/
|
||||
@Test
|
||||
void testTestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter() {
|
||||
// TODO: test TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter
|
||||
}
|
||||
|
||||
/**
|
||||
* Test the property 'values'
|
||||
*/
|
||||
@Test
|
||||
void valuesTest() {
|
||||
// TODO: test values
|
||||
}
|
||||
|
||||
}
|
@ -6,7 +6,6 @@ import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import feign.okhttp.OkHttpClient;
|
||||
|
||||
import com.fasterxml.jackson.databind.DeserializationFeature;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.fasterxml.jackson.databind.SerializationFeature;
|
||||
@ -43,8 +42,8 @@ public class ApiClient {
|
||||
private Feign.Builder feignBuilder;
|
||||
|
||||
public ApiClient() {
|
||||
objectMapper = createObjectMapper();
|
||||
apiAuthorizations = new LinkedHashMap<String, RequestInterceptor>();
|
||||
objectMapper = createObjectMapper();
|
||||
feignBuilder = Feign.builder()
|
||||
.client(new OkHttpClient())
|
||||
.encoder(new FormEncoder(new JacksonEncoder(objectMapper)))
|
||||
@ -141,6 +140,7 @@ public class ApiClient {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public ObjectMapper getObjectMapper(){
|
||||
return objectMapper;
|
||||
}
|
||||
|
@ -6,7 +6,6 @@ import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import feign.okhttp.OkHttpClient;
|
||||
|
||||
import com.fasterxml.jackson.databind.DeserializationFeature;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.fasterxml.jackson.databind.SerializationFeature;
|
||||
@ -44,8 +43,8 @@ public class ApiClient {
|
||||
private Feign.Builder feignBuilder;
|
||||
|
||||
public ApiClient() {
|
||||
objectMapper = createObjectMapper();
|
||||
apiAuthorizations = new LinkedHashMap<String, RequestInterceptor>();
|
||||
objectMapper = createObjectMapper();
|
||||
feignBuilder = Feign.builder()
|
||||
.client(new OkHttpClient())
|
||||
.encoder(new FormEncoder(new JacksonEncoder(objectMapper)))
|
||||
@ -148,6 +147,7 @@ public class ApiClient {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public ObjectMapper getObjectMapper(){
|
||||
return objectMapper;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user