forked from loafle/openapi-generator-original
[java] Add jersey3 support to the Java client (#12046)
* add jersey3 client support * update code to support jersey3 * test jersey3 in ci * update doc * update sbt, gradle build files
This commit is contained in:
13
bin/configs/java-jersey3.yaml
Normal file
13
bin/configs/java-jersey3.yaml
Normal file
@@ -0,0 +1,13 @@
|
||||
generatorName: java
|
||||
outputDir: samples/client/petstore/java/jersey3
|
||||
library: jersey3
|
||||
inputSpec: modules/openapi-generator/src/test/resources/3_0/java/petstore-with-fake-endpoints-models-for-testing-with-http-signature.yaml
|
||||
templateDir: modules/openapi-generator/src/main/resources/Java
|
||||
additionalProperties:
|
||||
artifactId: petstore-jersey3
|
||||
hideGenerationTimestamp: true
|
||||
serverPort: "8082"
|
||||
dateLibrary: java8
|
||||
useOneOfDiscriminatorLookup: true
|
||||
disallowAdditionalPropertiesIfNotPresent: false
|
||||
gradleProperties: "\n# JVM arguments\norg.gradle.jvmargs=-Xmx2024m -XX:MaxPermSize=512m\n# set timeout\norg.gradle.daemon.idletimeout=3600000\n# show all warnings\norg.gradle.warning.mode=all"
|
||||
@@ -52,7 +52,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 'jersey2' 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>**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.</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|
|
||||
@@ -78,7 +78,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
||||
|useAbstractionForFiles|Use alternative types instead of java.io.File to allow passing bytes without a file on disk. Available on resttemplate, webclient, libraries| |false|
|
||||
|useBeanValidation|Use BeanValidation API annotations| |false|
|
||||
|useGzipFeature|Send gzip-encoded requests| |false|
|
||||
|useOneOfDiscriminatorLookup|Use the discriminator's mapping in oneOf to speed up the model lookup. IMPORTANT: Validation (e.g. one and only one match in oneOf's schemas) will be skipped. Only jersey2, native, okhttp-gson support this option.| |false|
|
||||
|useOneOfDiscriminatorLookup|Use the discriminator's mapping in oneOf to speed up the model lookup. IMPORTANT: Validation (e.g. one and only one match in oneOf's schemas) will be skipped. Only jersey2, jersey3, native, okhttp-gson support this option.| |false|
|
||||
|usePlayWS|Use Play! Async HTTP client (Play WS API)| |false|
|
||||
|useReflectionEqualsHashCode|Use org.apache.commons.lang3.builder for equals and hashCode in the models. WARNING: This will fail under a security manager, unless the appropriate permissions are set up correctly and also there's potential performance impact.| |false|
|
||||
|useRuntimeException|Use RuntimeException instead of Exception| |false|
|
||||
|
||||
@@ -76,6 +76,7 @@ public class JavaClientCodegen extends AbstractJavaCodegen
|
||||
public static final String GOOGLE_API_CLIENT = "google-api-client";
|
||||
public static final String JERSEY1 = "jersey1";
|
||||
public static final String JERSEY2 = "jersey2";
|
||||
public static final String JERSEY3 = "jersey3";
|
||||
public static final String NATIVE = "native";
|
||||
public static final String OKHTTP_GSON = "okhttp-gson";
|
||||
public static final String RESTEASY = "resteasy";
|
||||
@@ -162,10 +163,11 @@ public class JavaClientCodegen extends AbstractJavaCodegen
|
||||
cliOptions.add(CliOption.newString(GRADLE_PROPERTIES, "Append additional Gradle properties to the gradle.properties file"));
|
||||
cliOptions.add(CliOption.newString(ERROR_OBJECT_TYPE, "Error Object type. (This option is for okhttp-gson-next-gen only)"));
|
||||
cliOptions.add(CliOption.newString(CONFIG_KEY, "Config key in @RegisterRestClient. Default to none. Only `microprofile` supports this option."));
|
||||
cliOptions.add(CliOption.newBoolean(CodegenConstants.USE_ONEOF_DISCRIMINATOR_LOOKUP, CodegenConstants.USE_ONEOF_DISCRIMINATOR_LOOKUP_DESC + " Only jersey2, native, okhttp-gson support this option."));
|
||||
cliOptions.add(CliOption.newBoolean(CodegenConstants.USE_ONEOF_DISCRIMINATOR_LOOKUP, CodegenConstants.USE_ONEOF_DISCRIMINATOR_LOOKUP_DESC + " Only jersey2, jersey3, native, okhttp-gson support this option."));
|
||||
|
||||
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 'jersey2' or other HTTP libraries instead.");
|
||||
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(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)");
|
||||
@@ -369,7 +371,7 @@ public class JavaClientCodegen extends AbstractJavaCodegen
|
||||
}
|
||||
|
||||
// helper for client library that allow to parse/format java.time.OffsetDateTime or org.threeten.bp.OffsetDateTime
|
||||
if (additionalProperties.containsKey("jsr310") && (isLibrary(WEBCLIENT) || isLibrary(VERTX) || isLibrary(RESTTEMPLATE) || isLibrary(RESTEASY) || isLibrary(MICROPROFILE) || isLibrary(JERSEY1) || isLibrary(JERSEY2) || isLibrary(APACHE))) {
|
||||
if (additionalProperties.containsKey("jsr310") && (isLibrary(WEBCLIENT) || isLibrary(VERTX) || isLibrary(RESTTEMPLATE) || isLibrary(RESTEASY) || isLibrary(MICROPROFILE) || isLibrary(JERSEY1) || isLibrary(JERSEY2) || isLibrary(JERSEY3) || isLibrary(APACHE))) {
|
||||
supportingFiles.add(new SupportingFile("JavaTimeFormatter.mustache", invokerFolder, "JavaTimeFormatter.java"));
|
||||
}
|
||||
|
||||
@@ -478,6 +480,23 @@ public class JavaClientCodegen extends AbstractJavaCodegen
|
||||
// one by one for each library.
|
||||
supportsAdditionalPropertiesWithComposedSchema = true;
|
||||
|
||||
} else if (JERSEY3.equals(getLibrary())) {
|
||||
additionalProperties.put("jersey3", true);
|
||||
supportingFiles.add(new SupportingFile("JSON.mustache", invokerFolder, "JSON.java"));
|
||||
supportingFiles.add(new SupportingFile("ApiResponse.mustache", invokerFolder, "ApiResponse.java"));
|
||||
if (ProcessUtils.hasHttpSignatureMethods(openAPI)) {
|
||||
supportingFiles.add(new SupportingFile("auth/HttpSignatureAuth.mustache", authFolder, "HttpSignatureAuth.java"));
|
||||
}
|
||||
supportingFiles.add(new SupportingFile("AbstractOpenApiSchema.mustache", modelsFolder, "AbstractOpenApiSchema.java"));
|
||||
forceSerializationLibrary(SERIALIZATION_LIBRARY_JACKSON);
|
||||
|
||||
// Composed schemas can have the 'additionalProperties' keyword, as specified in JSON schema.
|
||||
// In principle, this should be enabled by default for all code generators. However due to limitations
|
||||
// in other code generators, support needs to be enabled on a case-by-case basis.
|
||||
// The flag below should be set for all Java libraries, but the templates need to be ported
|
||||
// one by one for each library.
|
||||
supportsAdditionalPropertiesWithComposedSchema = true;
|
||||
|
||||
} else if (NATIVE.equals(getLibrary())) {
|
||||
supportingFiles.add(new SupportingFile("ApiResponse.mustache", invokerFolder, "ApiResponse.java"));
|
||||
supportingFiles.add(new SupportingFile("JSON.mustache", invokerFolder, "JSON.java"));
|
||||
@@ -892,7 +911,7 @@ public class JavaClientCodegen extends AbstractJavaCodegen
|
||||
CodegenModel cm = mo.getModel();
|
||||
|
||||
cm.getVendorExtensions().putIfAbsent("x-implements", new ArrayList<String>());
|
||||
if (JERSEY2.equals(getLibrary()) || NATIVE.equals(getLibrary()) || OKHTTP_GSON.equals(getLibrary())) {
|
||||
if (JERSEY2.equals(getLibrary()) || JERSEY3.equals(getLibrary()) || NATIVE.equals(getLibrary()) || OKHTTP_GSON.equals(getLibrary())) {
|
||||
cm.getVendorExtensions().put("x-implements", new ArrayList<String>());
|
||||
|
||||
if (cm.oneOf != null && !cm.oneOf.isEmpty() && cm.oneOf.contains("ModelNull")) {
|
||||
|
||||
138
modules/openapi-generator/src/main/resources/Java/libraries/jersey3/AbstractOpenApiSchema.mustache
vendored
Normal file
138
modules/openapi-generator/src/main/resources/Java/libraries/jersey3/AbstractOpenApiSchema.mustache
vendored
Normal file
@@ -0,0 +1,138 @@
|
||||
{{>licenseInfo}}
|
||||
|
||||
package {{modelPackage}};
|
||||
|
||||
import {{invokerPackage}}.ApiException;
|
||||
import java.util.Objects;
|
||||
import java.lang.reflect.Type;
|
||||
import java.util.Map;
|
||||
import jakarta.ws.rs.core.GenericType;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonValue;
|
||||
|
||||
/**
|
||||
* Abstract class for oneOf,anyOf schemas defined in OpenAPI spec
|
||||
*/
|
||||
{{>additionalModelTypeAnnotations}}{{>generatedAnnotation}}
|
||||
public abstract class AbstractOpenApiSchema {
|
||||
|
||||
// store the actual instance of the schema/object
|
||||
private Object instance;
|
||||
|
||||
// is nullable
|
||||
private Boolean isNullable;
|
||||
|
||||
// schema type (e.g. oneOf, anyOf)
|
||||
private final String schemaType;
|
||||
|
||||
public AbstractOpenApiSchema(String schemaType, Boolean isNullable) {
|
||||
this.schemaType = schemaType;
|
||||
this.isNullable = isNullable;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the list of oneOf/anyOf composed schemas allowed to be stored in this object
|
||||
*
|
||||
* @return an instance of the actual schema/object
|
||||
*/
|
||||
public abstract Map<String, GenericType> getSchemas();
|
||||
|
||||
/**
|
||||
* Get the actual instance
|
||||
*
|
||||
* @return an instance of the actual schema/object
|
||||
*/
|
||||
@JsonValue
|
||||
public Object getActualInstance() {return instance;}
|
||||
|
||||
/**
|
||||
* Set the actual instance
|
||||
*
|
||||
* @param instance the actual instance of the schema/object
|
||||
*/
|
||||
public void setActualInstance(Object instance) {this.instance = instance;}
|
||||
|
||||
/**
|
||||
* Get the instant recursively when the schemas defined in oneOf/anyof happen to be oneOf/anyOf schema as well
|
||||
*
|
||||
* @return an instance of the actual schema/object
|
||||
*/
|
||||
public Object getActualInstanceRecursively() {
|
||||
return getActualInstanceRecursively(this);
|
||||
}
|
||||
|
||||
private Object getActualInstanceRecursively(AbstractOpenApiSchema object) {
|
||||
if (object.getActualInstance() == null) {
|
||||
return null;
|
||||
} else if (object.getActualInstance() instanceof AbstractOpenApiSchema) {
|
||||
return getActualInstanceRecursively((AbstractOpenApiSchema)object.getActualInstance());
|
||||
} else {
|
||||
return object.getActualInstance();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the schema type (e.g. anyOf, oneOf)
|
||||
*
|
||||
* @return the schema type
|
||||
*/
|
||||
public String getSchemaType() {
|
||||
return schemaType;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("class ").append(getClass()).append(" {\n");
|
||||
sb.append(" instance: ").append(toIndentedString(instance)).append("\n");
|
||||
sb.append(" isNullable: ").append(toIndentedString(isNullable)).append("\n");
|
||||
sb.append(" schemaType: ").append(toIndentedString(schemaType)).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 ");
|
||||
}
|
||||
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) {
|
||||
return true;
|
||||
}
|
||||
if (o == null || getClass() != o.getClass()) {
|
||||
return false;
|
||||
}
|
||||
AbstractOpenApiSchema a = (AbstractOpenApiSchema) o;
|
||||
return Objects.equals(this.instance, a.instance) &&
|
||||
Objects.equals(this.isNullable, a.isNullable) &&
|
||||
Objects.equals(this.schemaType, a.schemaType);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(instance, isNullable, schemaType);
|
||||
}
|
||||
|
||||
/**
|
||||
* Is nullable
|
||||
*
|
||||
* @return true if it's nullable
|
||||
*/
|
||||
public Boolean isNullable() {
|
||||
if (Boolean.TRUE.equals(isNullable)) {
|
||||
return Boolean.TRUE;
|
||||
} else {
|
||||
return Boolean.FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
{{>libraries/jersey2/additional_properties}}
|
||||
|
||||
}
|
||||
1444
modules/openapi-generator/src/main/resources/Java/libraries/jersey3/ApiClient.mustache
vendored
Normal file
1444
modules/openapi-generator/src/main/resources/Java/libraries/jersey3/ApiClient.mustache
vendored
Normal file
File diff suppressed because it is too large
Load Diff
73
modules/openapi-generator/src/main/resources/Java/libraries/jersey3/ApiResponse.mustache
vendored
Normal file
73
modules/openapi-generator/src/main/resources/Java/libraries/jersey3/ApiResponse.mustache
vendored
Normal file
@@ -0,0 +1,73 @@
|
||||
{{>licenseInfo}}
|
||||
|
||||
package {{invokerPackage}};
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
{{#caseInsensitiveResponseHeaders}}
|
||||
import java.util.Map.Entry;
|
||||
import java.util.TreeMap;
|
||||
{{/caseInsensitiveResponseHeaders}}
|
||||
|
||||
/**
|
||||
* API response returned by API call.
|
||||
*
|
||||
* @param <T> The type of data that is deserialized from response body
|
||||
*/
|
||||
public class ApiResponse<T> {
|
||||
private final int statusCode;
|
||||
private final Map<String, List<String>> headers;
|
||||
private final 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;
|
||||
{{#caseInsensitiveResponseHeaders}}
|
||||
Map<String, List<String>> responseHeaders = new TreeMap<String, List<String>>(String.CASE_INSENSITIVE_ORDER);
|
||||
for(Entry<String, List<String>> entry : headers.entrySet()){
|
||||
responseHeaders.put(entry.getKey().toLowerCase(), entry.getValue());
|
||||
}
|
||||
{{/caseInsensitiveResponseHeaders}}
|
||||
this.headers = {{#caseInsensitiveResponseHeaders}}responseHeaders{{/caseInsensitiveResponseHeaders}}{{^caseInsensitiveResponseHeaders}}headers{{/caseInsensitiveResponseHeaders}};
|
||||
this.data = data;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the status code
|
||||
*
|
||||
* @return status code
|
||||
*/
|
||||
public int getStatusCode() {
|
||||
return statusCode;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the headers
|
||||
*
|
||||
* @return map of headers
|
||||
*/
|
||||
public Map<String, List<String>> getHeaders() {
|
||||
return headers;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the data
|
||||
*
|
||||
* @return data
|
||||
*/
|
||||
public T getData() {
|
||||
return data;
|
||||
}
|
||||
}
|
||||
261
modules/openapi-generator/src/main/resources/Java/libraries/jersey3/JSON.mustache
vendored
Normal file
261
modules/openapi-generator/src/main/resources/Java/libraries/jersey3/JSON.mustache
vendored
Normal file
@@ -0,0 +1,261 @@
|
||||
package {{invokerPackage}};
|
||||
|
||||
import com.fasterxml.jackson.annotation.*;
|
||||
import com.fasterxml.jackson.databind.*;
|
||||
import com.fasterxml.jackson.databind.json.JsonMapper;
|
||||
{{#openApiNullable}}
|
||||
import org.openapitools.jackson.nullable.JsonNullableModule;
|
||||
{{/openApiNullable}}
|
||||
import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
|
||||
{{#joda}}
|
||||
import com.fasterxml.jackson.datatype.joda.JodaModule;
|
||||
{{/joda}}
|
||||
{{#models.0}}
|
||||
import {{modelPackage}}.*;
|
||||
{{/models.0}}
|
||||
|
||||
import java.text.DateFormat;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import jakarta.ws.rs.core.GenericType;
|
||||
import jakarta.ws.rs.ext.ContextResolver;
|
||||
|
||||
{{>generatedAnnotation}}
|
||||
public class JSON implements ContextResolver<ObjectMapper> {
|
||||
private ObjectMapper mapper;
|
||||
|
||||
public JSON() {
|
||||
mapper = new ObjectMapper();
|
||||
mapper.setSerializationInclusion(JsonInclude.Include.NON_NULL);
|
||||
JsonMapper.builder().configure(MapperFeature.ALLOW_COERCION_OF_SCALARS, false);
|
||||
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, true);
|
||||
mapper.configure(DeserializationFeature.FAIL_ON_INVALID_SUBTYPE, true);
|
||||
mapper.disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS);
|
||||
mapper.enable(SerializationFeature.WRITE_ENUMS_USING_TO_STRING);
|
||||
mapper.enable(DeserializationFeature.READ_ENUMS_USING_TO_STRING);
|
||||
mapper.setDateFormat(new RFC3339DateFormat());
|
||||
mapper.registerModule(new JavaTimeModule());
|
||||
{{#joda}}
|
||||
mapper.registerModule(new JodaModule());
|
||||
{{/joda}}
|
||||
{{#openApiNullable}}
|
||||
JsonNullableModule jnm = new JsonNullableModule();
|
||||
mapper.registerModule(jnm);
|
||||
{{/openApiNullable}}
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the date format for JSON (de)serialization with Date properties.
|
||||
* @param dateFormat Date format
|
||||
*/
|
||||
public void setDateFormat(DateFormat dateFormat) {
|
||||
mapper.setDateFormat(dateFormat);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ObjectMapper getContext(Class<?> type) {
|
||||
return mapper;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the object mapper
|
||||
*
|
||||
* @return object mapper
|
||||
*/
|
||||
public ObjectMapper getMapper() { return mapper; }
|
||||
|
||||
/**
|
||||
* Returns the target model class that should be used to deserialize the input data.
|
||||
* The discriminator mappings are used to determine the target model class.
|
||||
*
|
||||
* @param node The input data.
|
||||
* @param modelClass The class that contains the discriminator mappings.
|
||||
*/
|
||||
public static Class<?> getClassForElement(JsonNode node, Class<?> modelClass) {
|
||||
ClassDiscriminatorMapping cdm = modelDiscriminators.get(modelClass);
|
||||
if (cdm != null) {
|
||||
return cdm.getClassForElement(node, new HashSet<Class<?>>());
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper class to register the discriminator mappings.
|
||||
*/
|
||||
private static class ClassDiscriminatorMapping {
|
||||
// The model class name.
|
||||
Class<?> modelClass;
|
||||
// The name of the discriminator property.
|
||||
String discriminatorName;
|
||||
// The discriminator mappings for a model class.
|
||||
Map<String, Class<?>> discriminatorMappings;
|
||||
|
||||
// Constructs a new class discriminator.
|
||||
ClassDiscriminatorMapping(Class<?> cls, String propertyName, Map<String, Class<?>> mappings) {
|
||||
modelClass = cls;
|
||||
discriminatorName = propertyName;
|
||||
discriminatorMappings = new HashMap<String, Class<?>>();
|
||||
if (mappings != null) {
|
||||
discriminatorMappings.putAll(mappings);
|
||||
}
|
||||
}
|
||||
|
||||
// Return the name of the discriminator property for this model class.
|
||||
String getDiscriminatorPropertyName() {
|
||||
return discriminatorName;
|
||||
}
|
||||
|
||||
// Return the discriminator value or null if the discriminator is not
|
||||
// present in the payload.
|
||||
String getDiscriminatorValue(JsonNode node) {
|
||||
// Determine the value of the discriminator property in the input data.
|
||||
if (discriminatorName != null) {
|
||||
// Get the value of the discriminator property, if present in the input payload.
|
||||
node = node.get(discriminatorName);
|
||||
if (node != null && node.isValueNode()) {
|
||||
String discrValue = node.asText();
|
||||
if (discrValue != null) {
|
||||
return discrValue;
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the target model class that should be used to deserialize the input data.
|
||||
* This function can be invoked for anyOf/oneOf composed models with discriminator mappings.
|
||||
* The discriminator mappings are used to determine the target model class.
|
||||
*
|
||||
* @param node The input data.
|
||||
* @param visitedClasses The set of classes that have already been visited.
|
||||
*/
|
||||
Class<?> getClassForElement(JsonNode node, Set<Class<?>> visitedClasses) {
|
||||
if (visitedClasses.contains(modelClass)) {
|
||||
// Class has already been visited.
|
||||
return null;
|
||||
}
|
||||
// Determine the value of the discriminator property in the input data.
|
||||
String discrValue = getDiscriminatorValue(node);
|
||||
if (discrValue == null) {
|
||||
return null;
|
||||
}
|
||||
Class<?> cls = discriminatorMappings.get(discrValue);
|
||||
// It may not be sufficient to return this cls directly because that target class
|
||||
// may itself be a composed schema, possibly with its own discriminator.
|
||||
visitedClasses.add(modelClass);
|
||||
for (Class<?> childClass : discriminatorMappings.values()) {
|
||||
ClassDiscriminatorMapping childCdm = modelDiscriminators.get(childClass);
|
||||
if (childCdm == null) {
|
||||
continue;
|
||||
}
|
||||
if (!discriminatorName.equals(childCdm.discriminatorName)) {
|
||||
discrValue = getDiscriminatorValue(node);
|
||||
if (discrValue == null) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if (childCdm != null) {
|
||||
// Recursively traverse the discriminator mappings.
|
||||
Class<?> childDiscr = childCdm.getClassForElement(node, visitedClasses);
|
||||
if (childDiscr != null) {
|
||||
return childDiscr;
|
||||
}
|
||||
}
|
||||
}
|
||||
return cls;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if inst is an instance of modelClass in the OpenAPI model hierarchy.
|
||||
*
|
||||
* The Java class hierarchy is not implemented the same way as the OpenAPI model hierarchy,
|
||||
* so it's not possible to use the instanceof keyword.
|
||||
*
|
||||
* @param modelClass A OpenAPI model class.
|
||||
* @param inst The instance object.
|
||||
*/
|
||||
public static boolean isInstanceOf(Class<?> modelClass, Object inst, Set<Class<?>> visitedClasses) {
|
||||
if (modelClass.isInstance(inst)) {
|
||||
// This handles the 'allOf' use case with single parent inheritance.
|
||||
return true;
|
||||
}
|
||||
if (visitedClasses.contains(modelClass)) {
|
||||
// This is to prevent infinite recursion when the composed schemas have
|
||||
// a circular dependency.
|
||||
return false;
|
||||
}
|
||||
visitedClasses.add(modelClass);
|
||||
|
||||
// Traverse the oneOf/anyOf composed schemas.
|
||||
Map<String, GenericType> descendants = modelDescendants.get(modelClass);
|
||||
if (descendants != null) {
|
||||
for (GenericType childType : descendants.values()) {
|
||||
if (isInstanceOf(childType.getRawType(), inst, visitedClasses)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* A map of discriminators for all model classes.
|
||||
*/
|
||||
private static Map<Class<?>, ClassDiscriminatorMapping> modelDiscriminators = new HashMap<Class<?>, ClassDiscriminatorMapping>();
|
||||
|
||||
/**
|
||||
* A map of oneOf/anyOf descendants for each model class.
|
||||
*/
|
||||
private static Map<Class<?>, Map<String, GenericType>> modelDescendants = new HashMap<Class<?>, Map<String, GenericType>>();
|
||||
|
||||
/**
|
||||
* Register a model class discriminator.
|
||||
*
|
||||
* @param modelClass the model class
|
||||
* @param discriminatorPropertyName the name of the discriminator property
|
||||
* @param mappings a map with the discriminator mappings.
|
||||
*/
|
||||
public static void registerDiscriminator(Class<?> modelClass, String discriminatorPropertyName, Map<String, Class<?>> mappings) {
|
||||
ClassDiscriminatorMapping m = new ClassDiscriminatorMapping(modelClass, discriminatorPropertyName, mappings);
|
||||
modelDiscriminators.put(modelClass, m);
|
||||
}
|
||||
|
||||
/**
|
||||
* Register the oneOf/anyOf descendants of the modelClass.
|
||||
*
|
||||
* @param modelClass the model class
|
||||
* @param descendants a map of oneOf/anyOf descendants.
|
||||
*/
|
||||
public static void registerDescendants(Class<?> modelClass, Map<String, GenericType> descendants) {
|
||||
modelDescendants.put(modelClass, descendants);
|
||||
}
|
||||
|
||||
private static JSON json;
|
||||
|
||||
static
|
||||
{
|
||||
json = new JSON();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the default JSON instance.
|
||||
*
|
||||
* @return the default JSON instance
|
||||
*/
|
||||
public static JSON getDefault() {
|
||||
return json;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the default JSON instance.
|
||||
*
|
||||
* @param json JSON instance to be used
|
||||
*/
|
||||
public static void setDefault(JSON json) {
|
||||
JSON.json = json;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
{{#additionalPropertiesType}}
|
||||
/**
|
||||
* A container for additional, undeclared properties.
|
||||
* This is a holder for any undeclared properties as specified with
|
||||
* the 'additionalProperties' keyword in the OAS document.
|
||||
*/
|
||||
private Map<String, {{{.}}}> additionalProperties;
|
||||
|
||||
/**
|
||||
* Set the additional (undeclared) property with the specified name and value.
|
||||
* If the property does not already exist, create it otherwise replace it.
|
||||
*/
|
||||
@JsonAnySetter
|
||||
public {{classname}} putAdditionalProperty(String key, {{{.}}} value) {
|
||||
if (this.additionalProperties == null) {
|
||||
this.additionalProperties = new HashMap<String, {{{.}}}>();
|
||||
}
|
||||
this.additionalProperties.put(key, value);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the additional (undeclared) property.
|
||||
*/
|
||||
@JsonAnyGetter
|
||||
public Map<String, {{{.}}}> getAdditionalProperties() {
|
||||
return additionalProperties;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the additional (undeclared) property with the specified name.
|
||||
*/
|
||||
public {{{.}}} getAdditionalProperty(String key) {
|
||||
if (this.additionalProperties == null) {
|
||||
return null;
|
||||
}
|
||||
return this.additionalProperties.get(key);
|
||||
}
|
||||
{{/additionalPropertiesType}}
|
||||
202
modules/openapi-generator/src/main/resources/Java/libraries/jersey3/anyof_model.mustache
vendored
Normal file
202
modules/openapi-generator/src/main/resources/Java/libraries/jersey3/anyof_model.mustache
vendored
Normal file
@@ -0,0 +1,202 @@
|
||||
import jakarta.ws.rs.core.GenericType;
|
||||
import jakarta.ws.rs.core.Response;
|
||||
import java.io.IOException;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.HashSet;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonGenerator;
|
||||
import com.fasterxml.jackson.core.JsonParser;
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.fasterxml.jackson.core.type.TypeReference;
|
||||
import com.fasterxml.jackson.databind.DeserializationContext;
|
||||
import com.fasterxml.jackson.databind.JsonMappingException;
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
import com.fasterxml.jackson.databind.SerializerProvider;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.deser.std.StdDeserializer;
|
||||
import com.fasterxml.jackson.databind.ser.std.StdSerializer;
|
||||
import {{invokerPackage}}.JSON;
|
||||
|
||||
{{>additionalModelTypeAnnotations}}{{>generatedAnnotation}}{{>xmlAnnotation}}
|
||||
@JsonDeserialize(using={{classname}}.{{classname}}Deserializer.class)
|
||||
@JsonSerialize(using = {{classname}}.{{classname}}Serializer.class)
|
||||
public class {{classname}} extends AbstractOpenApiSchema{{#vendorExtensions.x-implements}}, {{{.}}}{{/vendorExtensions.x-implements}} {
|
||||
private static final Logger log = Logger.getLogger({{classname}}.class.getName());
|
||||
|
||||
public static class {{classname}}Serializer extends StdSerializer<{{classname}}> {
|
||||
public {{classname}}Serializer(Class<{{classname}}> t) {
|
||||
super(t);
|
||||
}
|
||||
|
||||
public {{classname}}Serializer() {
|
||||
this(null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void serialize({{classname}} value, JsonGenerator jgen, SerializerProvider provider) throws IOException, JsonProcessingException {
|
||||
jgen.writeObject(value.getActualInstance());
|
||||
}
|
||||
}
|
||||
|
||||
public static class {{classname}}Deserializer extends StdDeserializer<{{classname}}> {
|
||||
public {{classname}}Deserializer() {
|
||||
this({{classname}}.class);
|
||||
}
|
||||
|
||||
public {{classname}}Deserializer(Class<?> vc) {
|
||||
super(vc);
|
||||
}
|
||||
|
||||
@Override
|
||||
public {{classname}} deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException, JsonProcessingException {
|
||||
JsonNode tree = jp.readValueAsTree();
|
||||
|
||||
Object deserialized = null;
|
||||
{{#discriminator}}
|
||||
Class<?> cls = JSON.getClassForElement(tree, {{classname}}.class);
|
||||
if (cls != null) {
|
||||
// When the OAS schema includes a discriminator, use the discriminator value to
|
||||
// discriminate the anyOf schemas.
|
||||
// Get the discriminator mapping value to get the class.
|
||||
deserialized = tree.traverse(jp.getCodec()).readValueAs(cls);
|
||||
{{classname}} ret = new {{classname}}();
|
||||
ret.setActualInstance(deserialized);
|
||||
return ret;
|
||||
}
|
||||
{{/discriminator}}
|
||||
{{#anyOf}}
|
||||
// deserialize {{{.}}}
|
||||
try {
|
||||
deserialized = tree.traverse(jp.getCodec()).readValueAs({{{.}}}.class);
|
||||
{{classname}} ret = new {{classname}}();
|
||||
ret.setActualInstance(deserialized);
|
||||
return ret;
|
||||
} catch (Exception e) {
|
||||
// deserialization failed, continue, log to help debugging
|
||||
log.log(Level.FINER, "Input data does not match '{{classname}}'", e);
|
||||
}
|
||||
|
||||
{{/anyOf}}
|
||||
throw new IOException(String.format("Failed deserialization for {{classname}}: no match found"));
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle deserialization of the 'null' value.
|
||||
*/
|
||||
@Override
|
||||
public {{classname}} getNullValue(DeserializationContext ctxt) throws JsonMappingException {
|
||||
{{#isNullable}}
|
||||
return null;
|
||||
{{/isNullable}}
|
||||
{{^isNullable}}
|
||||
throw new JsonMappingException(ctxt.getParser(), "{{classname}} cannot be null");
|
||||
{{/isNullable}}
|
||||
}
|
||||
}
|
||||
|
||||
// store a list of schema names defined in anyOf
|
||||
public static final Map<String, GenericType> schemas = new HashMap<String, GenericType>();
|
||||
|
||||
public {{classname}}() {
|
||||
super("anyOf", {{#isNullable}}Boolean.TRUE{{/isNullable}}{{^isNullable}}Boolean.FALSE{{/isNullable}});
|
||||
}
|
||||
{{> libraries/jersey2/additional_properties }}
|
||||
{{#additionalPropertiesType}}
|
||||
/**
|
||||
* Return true if this {{name}} object is equal to o.
|
||||
*/
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
return super.equals(o) && Objects.equals(this.additionalProperties, (({{classname}})o).additionalProperties);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(getActualInstance(), isNullable(), getSchemaType(), additionalProperties);
|
||||
}
|
||||
{{/additionalPropertiesType}}
|
||||
{{#anyOf}}
|
||||
public {{classname}}({{{.}}} o) {
|
||||
super("anyOf", {{#isNullable}}Boolean.TRUE{{/isNullable}}{{^isNullable}}Boolean.FALSE{{/isNullable}});
|
||||
setActualInstance(o);
|
||||
}
|
||||
|
||||
{{/anyOf}}
|
||||
static {
|
||||
{{#anyOf}}
|
||||
schemas.put("{{{.}}}", new GenericType<{{{.}}}>() {
|
||||
});
|
||||
{{/anyOf}}
|
||||
JSON.registerDescendants({{classname}}.class, Collections.unmodifiableMap(schemas));
|
||||
{{#discriminator}}
|
||||
// Initialize and register the discriminator mappings.
|
||||
Map<String, Class<?>> mappings = new HashMap<String, Class<?>>();
|
||||
{{#mappedModels}}
|
||||
mappings.put("{{mappingName}}", {{modelName}}.class);
|
||||
{{/mappedModels}}
|
||||
mappings.put("{{name}}", {{classname}}.class);
|
||||
JSON.registerDiscriminator({{classname}}.class, "{{propertyBaseName}}", mappings);
|
||||
{{/discriminator}}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, GenericType> getSchemas() {
|
||||
return {{classname}}.schemas;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the instance that matches the anyOf child schema, check
|
||||
* the instance parameter is valid against the anyOf child schemas:
|
||||
* {{#anyOf}}{{{.}}}{{^-last}}, {{/-last}}{{/anyOf}}
|
||||
*
|
||||
* It could be an instance of the 'anyOf' schemas.
|
||||
* The anyOf child schemas may themselves be a composed schema (allOf, anyOf, anyOf).
|
||||
*/
|
||||
@Override
|
||||
public void setActualInstance(Object instance) {
|
||||
{{#isNullable}}
|
||||
if (instance == null) {
|
||||
super.setActualInstance(instance);
|
||||
return;
|
||||
}
|
||||
|
||||
{{/isNullable}}
|
||||
{{#anyOf}}
|
||||
if (JSON.isInstanceOf({{{.}}}.class, instance, new HashSet<Class<?>>())) {
|
||||
super.setActualInstance(instance);
|
||||
return;
|
||||
}
|
||||
|
||||
{{/anyOf}}
|
||||
throw new RuntimeException("Invalid instance type. Must be {{#anyOf}}{{{.}}}{{^-last}}, {{/-last}}{{/anyOf}}");
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the actual instance, which can be the following:
|
||||
* {{#anyOf}}{{{.}}}{{^-last}}, {{/-last}}{{/anyOf}}
|
||||
*
|
||||
* @return The actual instance ({{#anyOf}}{{{.}}}{{^-last}}, {{/-last}}{{/anyOf}})
|
||||
*/
|
||||
@Override
|
||||
public Object getActualInstance() {
|
||||
return super.getActualInstance();
|
||||
}
|
||||
|
||||
{{#anyOf}}
|
||||
/**
|
||||
* Get the actual instance of `{{{.}}}`. If the actual instance is not `{{{.}}}`,
|
||||
* the ClassCastException will be thrown.
|
||||
*
|
||||
* @return The actual instance of `{{{.}}}`
|
||||
* @throws ClassCastException if the instance is not `{{{.}}}`
|
||||
*/
|
||||
public {{{.}}} get{{{.}}}() throws ClassCastException {
|
||||
return ({{{.}}})super.getActualInstance();
|
||||
}
|
||||
|
||||
{{/anyOf}}
|
||||
}
|
||||
262
modules/openapi-generator/src/main/resources/Java/libraries/jersey3/api.mustache
vendored
Normal file
262
modules/openapi-generator/src/main/resources/Java/libraries/jersey3/api.mustache
vendored
Normal file
@@ -0,0 +1,262 @@
|
||||
package {{package}};
|
||||
|
||||
import {{invokerPackage}}.ApiException;
|
||||
import {{invokerPackage}}.ApiClient;
|
||||
import {{invokerPackage}}.ApiResponse;
|
||||
import {{invokerPackage}}.Configuration;
|
||||
import {{invokerPackage}}.Pair;
|
||||
|
||||
import jakarta.ws.rs.core.GenericType;
|
||||
|
||||
{{#imports}}import {{import}};
|
||||
{{/imports}}
|
||||
|
||||
{{^fullJavaUtil}}
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
{{/fullJavaUtil}}
|
||||
{{>generatedAnnotation}}
|
||||
{{#operations}}
|
||||
public class {{classname}} {
|
||||
private ApiClient apiClient;
|
||||
|
||||
public {{classname}}() {
|
||||
this(Configuration.getDefaultApiClient());
|
||||
}
|
||||
|
||||
public {{classname}}(ApiClient apiClient) {
|
||||
this.apiClient = apiClient;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the API client
|
||||
*
|
||||
* @return API client
|
||||
*/
|
||||
public ApiClient getApiClient() {
|
||||
return apiClient;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the API client
|
||||
*
|
||||
* @param apiClient an instance of API client
|
||||
*/
|
||||
public void setApiClient(ApiClient apiClient) {
|
||||
this.apiClient = apiClient;
|
||||
}
|
||||
|
||||
{{#operation}}
|
||||
{{^vendorExtensions.x-group-parameters}}
|
||||
/**
|
||||
* {{summary}}
|
||||
* {{notes}}
|
||||
{{#allParams}}
|
||||
* @param {{paramName}} {{description}}{{#required}} (required){{/required}}{{^required}} (optional{{#defaultValue}}, default to {{.}}{{/defaultValue}}){{/required}}
|
||||
{{/allParams}}
|
||||
{{#returnType}}
|
||||
* @return {{.}}
|
||||
{{/returnType}}
|
||||
* @throws ApiException if fails to make API call
|
||||
{{#responses.0}}
|
||||
* @http.response.details
|
||||
<table summary="Response Details" border="1">
|
||||
<tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
|
||||
{{#responses}}
|
||||
<tr><td> {{code}} </td><td> {{message}} </td><td> {{#headers}} * {{baseName}} - {{description}} <br> {{/headers}}{{^headers.0}} - {{/headers.0}} </td></tr>
|
||||
{{/responses}}
|
||||
</table>
|
||||
{{/responses.0}}
|
||||
{{#isDeprecated}}
|
||||
* @deprecated
|
||||
{{/isDeprecated}}
|
||||
{{#externalDocs}}
|
||||
* {{description}}
|
||||
* @see <a href="{{url}}">{{summary}} Documentation</a>
|
||||
{{/externalDocs}}
|
||||
*/
|
||||
{{#isDeprecated}}
|
||||
@Deprecated
|
||||
{{/isDeprecated}}
|
||||
public {{#returnType}}{{{.}}} {{/returnType}}{{^returnType}}void {{/returnType}}{{operationId}}({{#allParams}}{{{dataType}}} {{paramName}}{{^-last}}, {{/-last}}{{/allParams}}) throws ApiException {
|
||||
{{#returnType}}return {{/returnType}}{{operationId}}WithHttpInfo({{#allParams}}{{paramName}}{{^-last}}, {{/-last}}{{/allParams}}){{#returnType}}.getData(){{/returnType}};
|
||||
}
|
||||
{{/vendorExtensions.x-group-parameters}}
|
||||
|
||||
{{^vendorExtensions.x-group-parameters}}
|
||||
/**
|
||||
* {{summary}}
|
||||
* {{notes}}
|
||||
{{#allParams}}
|
||||
* @param {{paramName}} {{description}}{{#required}} (required){{/required}}{{^required}} (optional{{#defaultValue}}, default to {{.}}{{/defaultValue}}){{/required}}
|
||||
{{/allParams}}
|
||||
* @return ApiResponse<{{returnType}}{{^returnType}}Void{{/returnType}}>
|
||||
* @throws ApiException if fails to make API call
|
||||
{{#responses.0}}
|
||||
* @http.response.details
|
||||
<table summary="Response Details" border="1">
|
||||
<tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
|
||||
{{#responses}}
|
||||
<tr><td> {{code}} </td><td> {{message}} </td><td> {{#headers}} * {{baseName}} - {{description}} <br> {{/headers}}{{^headers.0}} - {{/headers.0}} </td></tr>
|
||||
{{/responses}}
|
||||
</table>
|
||||
{{/responses.0}}
|
||||
{{#isDeprecated}}
|
||||
* @deprecated
|
||||
{{/isDeprecated}}
|
||||
{{#externalDocs}}
|
||||
* {{description}}
|
||||
* @see <a href="{{url}}">{{summary}} Documentation</a>
|
||||
{{/externalDocs}}
|
||||
*/
|
||||
{{#isDeprecated}}
|
||||
@Deprecated
|
||||
{{/isDeprecated}}
|
||||
public{{/vendorExtensions.x-group-parameters}}{{#vendorExtensions.x-group-parameters}}private{{/vendorExtensions.x-group-parameters}} ApiResponse<{{{returnType}}}{{^returnType}}Void{{/returnType}}> {{operationId}}WithHttpInfo({{#allParams}}{{{dataType}}} {{paramName}}{{^-last}}, {{/-last}}{{/allParams}}) throws ApiException {
|
||||
Object localVarPostBody = {{#bodyParam}}{{paramName}}{{/bodyParam}}{{^bodyParam}}null{{/bodyParam}};
|
||||
{{#allParams}}{{#required}}
|
||||
// verify the required parameter '{{paramName}}' is set
|
||||
if ({{paramName}} == null) {
|
||||
throw new ApiException(400, "Missing the required parameter '{{paramName}}' when calling {{operationId}}");
|
||||
}
|
||||
{{/required}}{{/allParams}}
|
||||
// create path and map variables
|
||||
String localVarPath = "{{{path}}}"{{#pathParams}}
|
||||
.replaceAll("\\{" + "{{baseName}}" + "\\}", apiClient.escapeString({{{paramName}}}.toString())){{/pathParams}};
|
||||
|
||||
// query params
|
||||
{{javaUtilPrefix}}List<Pair> localVarQueryParams = new {{javaUtilPrefix}}ArrayList<Pair>();
|
||||
{{javaUtilPrefix}}Map<String, String> localVarHeaderParams = new {{javaUtilPrefix}}HashMap<String, String>();
|
||||
{{javaUtilPrefix}}Map<String, String> localVarCookieParams = new {{javaUtilPrefix}}HashMap<String, String>();
|
||||
{{javaUtilPrefix}}Map<String, Object> localVarFormParams = new {{javaUtilPrefix}}HashMap<String, Object>();
|
||||
|
||||
{{#queryParams}}
|
||||
localVarQueryParams.addAll(apiClient.parameterToPairs("{{{collectionFormat}}}", "{{baseName}}", {{paramName}}));
|
||||
{{/queryParams}}
|
||||
|
||||
{{#headerParams}}if ({{paramName}} != null)
|
||||
localVarHeaderParams.put("{{baseName}}", apiClient.parameterToString({{paramName}}));
|
||||
{{/headerParams}}
|
||||
|
||||
{{#cookieParams}}if ({{paramName}} != null)
|
||||
localVarCookieParams.put("{{baseName}}", apiClient.parameterToString({{paramName}}));
|
||||
{{/cookieParams}}
|
||||
|
||||
{{#formParams}}if ({{paramName}} != null)
|
||||
localVarFormParams.put("{{baseName}}", {{paramName}});
|
||||
{{/formParams}}
|
||||
|
||||
final String[] localVarAccepts = {
|
||||
{{#produces}}"{{{mediaType}}}"{{^-last}}, {{/-last}}{{/produces}}
|
||||
};
|
||||
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
|
||||
|
||||
final String[] localVarContentTypes = {
|
||||
{{#consumes}}"{{{mediaType}}}"{{^-last}}, {{/-last}}{{/consumes}}
|
||||
};
|
||||
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
|
||||
|
||||
String[] localVarAuthNames = new String[] { {{#authMethods}}"{{name}}"{{^-last}}, {{/-last}}{{/authMethods}} };
|
||||
|
||||
{{#returnType}}
|
||||
GenericType<{{{returnType}}}> localVarReturnType = new GenericType<{{{returnType}}}>() {};
|
||||
|
||||
{{/returnType}}
|
||||
return apiClient.invokeAPI("{{classname}}.{{operationId}}", localVarPath, "{{httpMethod}}", localVarQueryParams, localVarPostBody,
|
||||
localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType,
|
||||
localVarAuthNames, {{#returnType}}localVarReturnType{{/returnType}}{{^returnType}}null{{/returnType}}, {{#bodyParam}}{{#isNullable}}true{{/isNullable}}{{^isNullable}}false{{/isNullable}}{{/bodyParam}}{{^bodyParam}}false{{/bodyParam}});
|
||||
}
|
||||
{{#vendorExtensions.x-group-parameters}}
|
||||
|
||||
public class API{{operationId}}Request {
|
||||
{{#allParams}}
|
||||
private {{#isRequired}}final {{/isRequired}}{{{dataType}}} {{paramName}};
|
||||
{{/allParams}}
|
||||
|
||||
private API{{operationId}}Request({{#pathParams}}{{{dataType}}} {{paramName}}{{^-last}}, {{/-last}}{{/pathParams}}) {
|
||||
{{#pathParams}}
|
||||
this.{{paramName}} = {{paramName}};
|
||||
{{/pathParams}}
|
||||
}
|
||||
{{#allParams}}
|
||||
{{^isPathParam}}
|
||||
|
||||
/**
|
||||
* Set {{paramName}}
|
||||
* @param {{paramName}} {{description}} ({{^required}}optional{{^isContainer}}{{#defaultValue}}, default to {{.}}{{/defaultValue}}{{/isContainer}}{{/required}}{{#required}}required{{/required}})
|
||||
* @return API{{operationId}}Request
|
||||
*/
|
||||
public API{{operationId}}Request {{paramName}}({{{dataType}}} {{paramName}}) {
|
||||
this.{{paramName}} = {{paramName}};
|
||||
return this;
|
||||
}
|
||||
{{/isPathParam}}
|
||||
{{/allParams}}
|
||||
|
||||
/**
|
||||
* Execute {{operationId}} request
|
||||
{{#returnType}}* @return {{.}}{{/returnType}}
|
||||
* @throws ApiException if fails to make API call
|
||||
{{#responses.0}}
|
||||
* @http.response.details
|
||||
<table summary="Response Details" border="1">
|
||||
<tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
|
||||
{{#responses}}
|
||||
<tr><td> {{code}} </td><td> {{message}} </td><td> {{#headers}} * {{baseName}} - {{description}} <br> {{/headers}}{{^headers.0}} - {{/headers.0}} </td></tr>
|
||||
{{/responses}}
|
||||
</table>
|
||||
{{/responses.0}}
|
||||
{{#isDeprecated}}* @deprecated{{/isDeprecated}}
|
||||
*/
|
||||
{{#isDeprecated}}@Deprecated{{/isDeprecated}}
|
||||
public {{{returnType}}}{{^returnType}}void{{/returnType}} execute() throws ApiException {
|
||||
{{#returnType}}return {{/returnType}}this.executeWithHttpInfo().getData();
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute {{operationId}} request with HTTP info returned
|
||||
* @return ApiResponse<{{returnType}}{{^returnType}}Void{{/returnType}}>
|
||||
* @throws ApiException if fails to make API call
|
||||
{{#responses.0}}
|
||||
* @http.response.details
|
||||
<table summary="Response Details" border="1">
|
||||
<tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
|
||||
{{#responses}}
|
||||
<tr><td> {{code}} </td><td> {{message}} </td><td> {{#headers}} * {{baseName}} - {{description}} <br> {{/headers}}{{^headers.0}} - {{/headers.0}} </td></tr>
|
||||
{{/responses}}
|
||||
</table>
|
||||
{{/responses.0}}
|
||||
{{#isDeprecated}}
|
||||
* @deprecated{{/isDeprecated}}
|
||||
*/
|
||||
{{#isDeprecated}}
|
||||
@Deprecated
|
||||
{{/isDeprecated}}
|
||||
public ApiResponse<{{{returnType}}}{{^returnType}}Void{{/returnType}}> executeWithHttpInfo() throws ApiException {
|
||||
return {{operationId}}WithHttpInfo({{#allParams}}{{paramName}}{{^-last}}, {{/-last}}{{/allParams}});
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* {{summary}}
|
||||
* {{notes}}{{#pathParams}}
|
||||
* @param {{paramName}} {{description}} (required){{/pathParams}}
|
||||
* @return {{operationId}}Request
|
||||
* @throws ApiException if fails to make API call
|
||||
{{#isDeprecated}}* @deprecated{{/isDeprecated}}
|
||||
{{#externalDocs}}* {{description}}
|
||||
* @see <a href="{{url}}">{{summary}} Documentation</a>{{/externalDocs}}
|
||||
*/
|
||||
{{#isDeprecated}}
|
||||
@Deprecated
|
||||
{{/isDeprecated}}
|
||||
public API{{operationId}}Request {{operationId}}({{#pathParams}}{{{dataType}}} {{paramName}}{{^-last}}, {{/-last}}{{/pathParams}}) throws ApiException {
|
||||
return new API{{operationId}}Request({{#pathParams}}{{paramName}}{{^-last}}, {{/-last}}{{/pathParams}});
|
||||
}
|
||||
{{/vendorExtensions.x-group-parameters}}
|
||||
{{/operation}}
|
||||
}
|
||||
{{/operations}}
|
||||
99
modules/openapi-generator/src/main/resources/Java/libraries/jersey3/apiException.mustache
vendored
Normal file
99
modules/openapi-generator/src/main/resources/Java/libraries/jersey3/apiException.mustache
vendored
Normal file
@@ -0,0 +1,99 @@
|
||||
{{>licenseInfo}}
|
||||
|
||||
package {{invokerPackage}};
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.List;
|
||||
{{#caseInsensitiveResponseHeaders}}
|
||||
import java.util.Map.Entry;
|
||||
import java.util.TreeMap;
|
||||
{{/caseInsensitiveResponseHeaders}}
|
||||
|
||||
/**
|
||||
* API Exception
|
||||
*/
|
||||
{{>generatedAnnotation}}
|
||||
public class ApiException extends{{#useRuntimeException}} RuntimeException {{/useRuntimeException}}{{^useRuntimeException}} Exception {{/useRuntimeException}}{
|
||||
private int code = 0;
|
||||
private Map<String, List<String>> responseHeaders = null;
|
||||
private String responseBody = null;
|
||||
|
||||
public ApiException() {}
|
||||
|
||||
public ApiException(Throwable throwable) {
|
||||
super(throwable);
|
||||
}
|
||||
|
||||
public ApiException(String message) {
|
||||
super(message);
|
||||
}
|
||||
|
||||
public ApiException(String message, Throwable throwable, int code, Map<String, List<String>> responseHeaders, String responseBody) {
|
||||
super(message, throwable);
|
||||
this.code = code;
|
||||
{{#caseInsensitiveResponseHeaders}}
|
||||
Map<String, List<String>> headers = new TreeMap<String, List<String>>(String.CASE_INSENSITIVE_ORDER);
|
||||
for(Entry<String, List<String>> entry : responseHeaders.entrySet()){
|
||||
headers.put(entry.getKey().toLowerCase(), entry.getValue());
|
||||
}
|
||||
{{/caseInsensitiveResponseHeaders}}
|
||||
this.responseHeaders = {{#caseInsensitiveResponseHeaders}}headers{{/caseInsensitiveResponseHeaders}}{{^caseInsensitiveResponseHeaders}}responseHeaders{{/caseInsensitiveResponseHeaders}};
|
||||
this.responseBody = responseBody;
|
||||
}
|
||||
|
||||
public ApiException(String message, int code, Map<String, List<String>> responseHeaders, String responseBody) {
|
||||
this(message, (Throwable) null, code, responseHeaders, responseBody);
|
||||
}
|
||||
|
||||
public ApiException(String message, Throwable throwable, int code, Map<String, List<String>> responseHeaders) {
|
||||
this(message, throwable, code, responseHeaders, null);
|
||||
}
|
||||
|
||||
public ApiException(int code, Map<String, List<String>> responseHeaders, String responseBody) {
|
||||
this((String) null, (Throwable) null, code, responseHeaders, responseBody);
|
||||
}
|
||||
|
||||
public ApiException(int code, String message) {
|
||||
super(message);
|
||||
this.code = code;
|
||||
}
|
||||
|
||||
public ApiException(int code, String message, Map<String, List<String>> responseHeaders, String responseBody) {
|
||||
this(code, message);
|
||||
{{#caseInsensitiveResponseHeaders}}
|
||||
Map<String, List<String>> headers = new TreeMap<String, List<String>>(String.CASE_INSENSITIVE_ORDER);
|
||||
for(Entry<String, List<String>> entry : responseHeaders.entrySet()){
|
||||
headers.put(entry.getKey().toLowerCase(), entry.getValue());
|
||||
}
|
||||
{{/caseInsensitiveResponseHeaders}}
|
||||
this.responseHeaders = {{#caseInsensitiveResponseHeaders}}headers{{/caseInsensitiveResponseHeaders}}{{^caseInsensitiveResponseHeaders}}responseHeaders{{/caseInsensitiveResponseHeaders}};
|
||||
this.responseBody = responseBody;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the HTTP status code.
|
||||
*
|
||||
* @return HTTP status code
|
||||
*/
|
||||
public int getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the HTTP response headers.
|
||||
*
|
||||
* @return A map of list of string
|
||||
*/
|
||||
public Map<String, List<String>> getResponseHeaders() {
|
||||
return responseHeaders;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the HTTP response body.
|
||||
*
|
||||
* @return Response body in the form of string
|
||||
*/
|
||||
public String getResponseBody() {
|
||||
return responseBody;
|
||||
}
|
||||
}
|
||||
124
modules/openapi-generator/src/main/resources/Java/libraries/jersey3/api_doc.mustache
vendored
Normal file
124
modules/openapi-generator/src/main/resources/Java/libraries/jersey3/api_doc.mustache
vendored
Normal file
@@ -0,0 +1,124 @@
|
||||
# {{classname}}{{#description}}
|
||||
|
||||
{{.}}{{/description}}
|
||||
|
||||
All URIs are relative to *{{basePath}}*
|
||||
|
||||
| Method | HTTP request | Description |
|
||||
|------------- | ------------- | -------------|
|
||||
{{#operations}}{{#operation}}| [**{{operationId}}**]({{classname}}.md#{{operationId}}) | **{{httpMethod}}** {{path}} | {{summary}} |
|
||||
{{/operation}}{{/operations}}
|
||||
|
||||
{{#operations}}
|
||||
{{#operation}}
|
||||
|
||||
## {{operationId}}
|
||||
|
||||
{{^vendorExtensions.x-group-parameters}}
|
||||
> {{#returnType}}{{.}} {{/returnType}}{{operationId}}({{#allParams}}{{paramName}}{{^-last}}, {{/-last}}{{/allParams}})
|
||||
{{/vendorExtensions.x-group-parameters}}
|
||||
{{#vendorExtensions.x-group-parameters}}
|
||||
> {{#returnType}}{{.}} {{/returnType}}{{operationId}}({{#pathParams}}{{paramName}}{{^-last}}, {{/-last}}{{/pathParams}}){{#allParams}}{{^isPathParam}}.{{paramName}}({{paramName}}){{/isPathParam}}{{/allParams}}.execute();
|
||||
{{/vendorExtensions.x-group-parameters}}
|
||||
|
||||
{{summary}}{{#notes}}
|
||||
|
||||
{{{unescapedNotes}}}{{/notes}}
|
||||
|
||||
### Example
|
||||
|
||||
```java
|
||||
{{#vendorExtensions.x-java-import}}
|
||||
import {{.}};
|
||||
{{/vendorExtensions.x-java-import}}
|
||||
// Import classes:
|
||||
import {{{invokerPackage}}}.ApiClient;
|
||||
import {{{invokerPackage}}}.ApiException;
|
||||
import {{{invokerPackage}}}.Configuration;{{#hasAuthMethods}}
|
||||
import {{{invokerPackage}}}.auth.*;{{/hasAuthMethods}}
|
||||
import {{{invokerPackage}}}.model.*;
|
||||
import {{{package}}}.{{{classname}}};
|
||||
|
||||
public class Example {
|
||||
public static void main(String[] args) {
|
||||
ApiClient defaultClient = Configuration.getDefaultApiClient();
|
||||
defaultClient.setBasePath("{{{basePath}}}");
|
||||
{{#hasAuthMethods}}
|
||||
{{#authMethods}}{{#isBasic}}{{#isBasicBasic}}
|
||||
// Configure HTTP basic authorization: {{{name}}}
|
||||
HttpBasicAuth {{{name}}} = (HttpBasicAuth) defaultClient.getAuthentication("{{{name}}}");
|
||||
{{{name}}}.setUsername("YOUR USERNAME");
|
||||
{{{name}}}.setPassword("YOUR PASSWORD");{{/isBasicBasic}}{{#isBasicBearer}}
|
||||
// Configure HTTP bearer authorization: {{{name}}}
|
||||
HttpBearerAuth {{{name}}} = (HttpBearerAuth) defaultClient.getAuthentication("{{{name}}}");
|
||||
{{{name}}}.setBearerToken("BEARER TOKEN");{{/isBasicBearer}}{{/isBasic}}{{#isApiKey}}
|
||||
// Configure API key authorization: {{{name}}}
|
||||
ApiKeyAuth {{{name}}} = (ApiKeyAuth) defaultClient.getAuthentication("{{{name}}}");
|
||||
{{{name}}}.setApiKey("YOUR API KEY");
|
||||
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
|
||||
//{{{name}}}.setApiKeyPrefix("Token");{{/isApiKey}}{{#isOAuth}}
|
||||
// Configure OAuth2 access token for authorization: {{{name}}}
|
||||
OAuth {{{name}}} = (OAuth) defaultClient.getAuthentication("{{{name}}}");
|
||||
{{{name}}}.setAccessToken("YOUR ACCESS TOKEN");{{/isOAuth}}
|
||||
{{/authMethods}}
|
||||
{{/hasAuthMethods}}
|
||||
|
||||
{{{classname}}} apiInstance = new {{{classname}}}(defaultClient);
|
||||
{{#allParams}}
|
||||
{{{dataType}}} {{{paramName}}} = {{{example}}}; // {{{dataType}}} | {{{description}}}
|
||||
{{/allParams}}
|
||||
try {
|
||||
{{^vendorExtensions.x-group-parameters}}
|
||||
{{#returnType}}{{{.}}} result = {{/returnType}}apiInstance.{{{operationId}}}({{#allParams}}{{{paramName}}}{{^-last}}, {{/-last}}{{/allParams}});
|
||||
{{/vendorExtensions.x-group-parameters}}
|
||||
{{#vendorExtensions.x-group-parameters}}
|
||||
{{#returnType}}{{{.}}} result = {{/returnType}}api.{{operationId}}({{#pathParams}}{{paramName}}{{^-last}}, {{/-last}}{{/pathParams}}){{#allParams}}{{^isPathParam}}
|
||||
.{{paramName}}({{paramName}}){{/isPathParam}}{{/allParams}}
|
||||
.execute();
|
||||
{{/vendorExtensions.x-group-parameters}}
|
||||
{{#returnType}}
|
||||
System.out.println(result);
|
||||
{{/returnType}}
|
||||
} catch (ApiException e) {
|
||||
System.err.println("Exception when calling {{{classname}}}#{{{operationId}}}");
|
||||
System.err.println("Status code: " + e.getCode());
|
||||
System.err.println("Reason: " + e.getResponseBody());
|
||||
System.err.println("Response headers: " + e.getResponseHeaders());
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### Parameters
|
||||
|
||||
{{^allParams}}This endpoint does not need any parameter.{{/allParams}}{{#allParams}}{{#-last}}
|
||||
| Name | Type | Description | Notes |
|
||||
|------------- | ------------- | ------------- | -------------|{{/-last}}{{/allParams}}
|
||||
{{#allParams}}| **{{paramName}}** | {{#isContainer}}{{#isArray}}{{#items}}{{#isModel}}{{^isFile}}[{{/isFile}}{{/isModel}}**List<{{dataType}}>**{{#isModel}}{{^isFile}}]({{^baseType}}{{dataType}}{{/baseType}}{{baseType}}.md){{/isFile}}{{/isModel}}{{/items}}{{/isArray}}{{#isMap}}{{#items}}{{#isModel}}{{^isFile}}[{{/isFile}}{{/isModel}}**Map<String,{{dataType}}>**{{#isModel}}{{^isFile}}]({{^baseType}}{{dataType}}{{/baseType}}{{baseType}}.md){{/isFile}}{{/isModel}}{{/items}}{{/isMap}}{{/isContainer}}{{^isContainer}}{{#isModel}}{{^isFile}}[{{/isFile}}{{/isModel}}**{{dataType}}**{{#isModel}}{{^isFile}}]({{^baseType}}{{dataType}}{{/baseType}}{{baseType}}.md){{/isFile}}{{/isModel}}{{/isContainer}}| {{description}} |{{^required}} [optional]{{/required}}{{^isContainer}}{{#defaultValue}} [default to {{.}}]{{/defaultValue}}{{/isContainer}}{{#allowableValues}} [enum: {{#values}}{{{.}}}{{^-last}}, {{/-last}}{{/values}}]{{/allowableValues}} |
|
||||
{{/allParams}}
|
||||
|
||||
### Return type
|
||||
|
||||
{{#returnType}}{{#returnTypeIsPrimitive}}**{{returnType}}**{{/returnTypeIsPrimitive}}{{^returnTypeIsPrimitive}}[**{{returnType}}**]({{returnBaseType}}.md){{/returnTypeIsPrimitive}}{{/returnType}}{{^returnType}}null (empty response body){{/returnType}}
|
||||
|
||||
### Authorization
|
||||
|
||||
{{^authMethods}}No authorization required{{/authMethods}}{{#authMethods}}[{{name}}](../README.md#{{name}}){{^-last}}, {{/-last}}{{/authMethods}}
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: {{#consumes}}{{{mediaType}}}{{^-last}}, {{/-last}}{{/consumes}}{{^consumes}}Not defined{{/consumes}}
|
||||
- **Accept**: {{#produces}}{{{mediaType}}}{{^-last}}, {{/-last}}{{/produces}}{{^produces}}Not defined{{/produces}}
|
||||
|
||||
{{#responses.0}}
|
||||
### HTTP response details
|
||||
| Status code | Description | Response headers |
|
||||
|-------------|-------------|------------------|
|
||||
{{#responses}}
|
||||
| **{{code}}** | {{message}} | {{#headers}} * {{baseName}} - {{description}} <br> {{/headers}}{{^headers.0}} - {{/headers.0}} |
|
||||
{{/responses}}
|
||||
{{/responses.0}}
|
||||
|
||||
{{/operation}}
|
||||
{{/operations}}
|
||||
59
modules/openapi-generator/src/main/resources/Java/libraries/jersey3/api_test.mustache
vendored
Normal file
59
modules/openapi-generator/src/main/resources/Java/libraries/jersey3/api_test.mustache
vendored
Normal file
@@ -0,0 +1,59 @@
|
||||
{{>licenseInfo}}
|
||||
|
||||
package {{package}};
|
||||
|
||||
import {{invokerPackage}}.*;
|
||||
import {{invokerPackage}}.auth.*;
|
||||
{{#imports}}import {{import}};
|
||||
{{/imports}}
|
||||
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.Disabled;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
{{^fullJavaUtil}}
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
{{/fullJavaUtil}}
|
||||
/**
|
||||
* API tests for {{classname}}
|
||||
*/
|
||||
public class {{classname}}Test {
|
||||
|
||||
private final {{classname}} api = new {{classname}}();
|
||||
|
||||
{{#operations}}
|
||||
{{#operation}}
|
||||
/**
|
||||
{{#summary}}
|
||||
* {{summary}}
|
||||
*
|
||||
{{/summary}}
|
||||
{{#notes}}
|
||||
* {{notes}}
|
||||
*
|
||||
{{/notes}}
|
||||
* @throws ApiException if the Api call fails
|
||||
*/
|
||||
@Test
|
||||
public void {{operationId}}Test() throws ApiException {
|
||||
{{#allParams}}
|
||||
//{{{dataType}}} {{paramName}} = null;
|
||||
{{/allParams}}
|
||||
{{^vendorExtensions.x-group-parameters}}
|
||||
//{{#returnType}}{{{.}}} response = {{/returnType}}api.{{operationId}}({{#allParams}}{{paramName}}{{^-last}}, {{/-last}}{{/allParams}});
|
||||
{{/vendorExtensions.x-group-parameters}}
|
||||
{{#vendorExtensions.x-group-parameters}}
|
||||
//{{#returnType}}{{{.}}} response = {{/returnType}}api.{{operationId}}({{#pathParams}}{{paramName}}{{^-last}}, {{/-last}}{{/pathParams}}){{#allParams}}{{^isPathParam}}
|
||||
// .{{paramName}}({{paramName}}){{/isPathParam}}{{/allParams}}
|
||||
// .execute();
|
||||
{{/vendorExtensions.x-group-parameters}}
|
||||
// TODO: test validations
|
||||
}
|
||||
|
||||
{{/operation}}
|
||||
{{/operations}}
|
||||
}
|
||||
68
modules/openapi-generator/src/main/resources/Java/libraries/jersey3/auth/ApiKeyAuth.mustache
vendored
Normal file
68
modules/openapi-generator/src/main/resources/Java/libraries/jersey3/auth/ApiKeyAuth.mustache
vendored
Normal file
@@ -0,0 +1,68 @@
|
||||
{{>licenseInfo}}
|
||||
|
||||
package {{invokerPackage}}.auth;
|
||||
|
||||
import {{invokerPackage}}.Pair;
|
||||
import {{invokerPackage}}.ApiException;
|
||||
|
||||
import java.net.URI;
|
||||
import java.util.Map;
|
||||
import java.util.List;
|
||||
|
||||
{{>generatedAnnotation}}
|
||||
public class ApiKeyAuth implements Authentication {
|
||||
private final String location;
|
||||
private final String paramName;
|
||||
|
||||
private String apiKey;
|
||||
private String apiKeyPrefix;
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
public String getApiKeyPrefix() {
|
||||
return apiKeyPrefix;
|
||||
}
|
||||
|
||||
public void setApiKeyPrefix(String apiKeyPrefix) {
|
||||
this.apiKeyPrefix = apiKeyPrefix;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void applyToParams(List<Pair> queryParams, Map<String, String> headerParams, Map<String, String> cookieParams, String payload, String method, URI uri) throws ApiException {
|
||||
if (apiKey == null) {
|
||||
return;
|
||||
}
|
||||
String value;
|
||||
if (apiKeyPrefix != null) {
|
||||
value = apiKeyPrefix + " " + apiKey;
|
||||
} else {
|
||||
value = apiKey;
|
||||
}
|
||||
if ("query".equals(location)) {
|
||||
queryParams.add(new Pair(paramName, value));
|
||||
} else if ("header".equals(location)) {
|
||||
headerParams.put(paramName, value);
|
||||
} else if ("cookie".equals(location)) {
|
||||
cookieParams.put(paramName, value);
|
||||
}
|
||||
}
|
||||
}
|
||||
22
modules/openapi-generator/src/main/resources/Java/libraries/jersey3/auth/Authentication.mustache
vendored
Normal file
22
modules/openapi-generator/src/main/resources/Java/libraries/jersey3/auth/Authentication.mustache
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
{{>licenseInfo}}
|
||||
|
||||
package {{invokerPackage}}.auth;
|
||||
|
||||
import {{invokerPackage}}.Pair;
|
||||
import {{invokerPackage}}.ApiException;
|
||||
|
||||
import java.net.URI;
|
||||
import java.util.Map;
|
||||
import java.util.List;
|
||||
|
||||
public interface Authentication {
|
||||
/**
|
||||
* Apply authentication settings to header and query params.
|
||||
*
|
||||
* @param queryParams List of query parameters
|
||||
* @param headerParams Map of header parameters
|
||||
* @param cookieParams Map of cookie parameters
|
||||
*/
|
||||
void applyToParams(List<Pair> queryParams, Map<String, String> headerParams, Map<String, String> cookieParams, String payload, String method, URI uri) throws ApiException;
|
||||
|
||||
}
|
||||
44
modules/openapi-generator/src/main/resources/Java/libraries/jersey3/auth/HttpBasicAuth.mustache
vendored
Normal file
44
modules/openapi-generator/src/main/resources/Java/libraries/jersey3/auth/HttpBasicAuth.mustache
vendored
Normal file
@@ -0,0 +1,44 @@
|
||||
{{>licenseInfo}}
|
||||
|
||||
package {{invokerPackage}}.auth;
|
||||
|
||||
import {{invokerPackage}}.Pair;
|
||||
import {{invokerPackage}}.ApiException;
|
||||
|
||||
import java.util.Base64;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
|
||||
import java.net.URI;
|
||||
import java.util.Map;
|
||||
import java.util.List;
|
||||
|
||||
{{>generatedAnnotation}}
|
||||
public class HttpBasicAuth implements Authentication {
|
||||
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;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void applyToParams(List<Pair> queryParams, Map<String, String> headerParams, Map<String, String> cookieParams, String payload, String method, URI uri) throws ApiException {
|
||||
if (username == null && password == null) {
|
||||
return;
|
||||
}
|
||||
String str = (username == null ? "" : username) + ":" + (password == null ? "" : password);
|
||||
headerParams.put("Authorization", "Basic " + Base64.getEncoder().encodeToString(str.getBytes(StandardCharsets.UTF_8)));
|
||||
}
|
||||
}
|
||||
51
modules/openapi-generator/src/main/resources/Java/libraries/jersey3/auth/HttpBearerAuth.mustache
vendored
Normal file
51
modules/openapi-generator/src/main/resources/Java/libraries/jersey3/auth/HttpBearerAuth.mustache
vendored
Normal file
@@ -0,0 +1,51 @@
|
||||
{{>licenseInfo}}
|
||||
|
||||
package {{invokerPackage}}.auth;
|
||||
|
||||
import {{invokerPackage}}.Pair;
|
||||
import {{invokerPackage}}.ApiException;
|
||||
|
||||
import java.net.URI;
|
||||
import java.util.Map;
|
||||
import java.util.List;
|
||||
|
||||
{{>generatedAnnotation}}
|
||||
public class HttpBearerAuth implements Authentication {
|
||||
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.
|
||||
*
|
||||
* @return The bearer token
|
||||
*/
|
||||
public String getBearerToken() {
|
||||
return bearerToken;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the token, which together with the scheme, will be sent as the value of the Authorization header.
|
||||
*
|
||||
* @param bearerToken The bearer token to send in the Authorization header
|
||||
*/
|
||||
public void setBearerToken(String bearerToken) {
|
||||
this.bearerToken = bearerToken;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void applyToParams(List<Pair> queryParams, Map<String, String> headerParams, Map<String, String> cookieParams, String payload, String method, URI uri) throws ApiException {
|
||||
if(bearerToken == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
headerParams.put("Authorization", (scheme != null ? upperCaseBearer(scheme) + " " : "") + bearerToken);
|
||||
}
|
||||
|
||||
private static String upperCaseBearer(String scheme) {
|
||||
return ("bearer".equalsIgnoreCase(scheme)) ? "Bearer" : scheme;
|
||||
}
|
||||
}
|
||||
269
modules/openapi-generator/src/main/resources/Java/libraries/jersey3/auth/HttpSignatureAuth.mustache
vendored
Normal file
269
modules/openapi-generator/src/main/resources/Java/libraries/jersey3/auth/HttpSignatureAuth.mustache
vendored
Normal file
@@ -0,0 +1,269 @@
|
||||
{{>licenseInfo}}
|
||||
|
||||
package {{invokerPackage}}.auth;
|
||||
|
||||
import {{invokerPackage}}.Pair;
|
||||
import {{invokerPackage}}.ApiException;
|
||||
|
||||
import java.net.URI;
|
||||
import java.net.URLEncoder;
|
||||
import java.security.MessageDigest;
|
||||
import java.security.Key;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Base64;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.List;
|
||||
import java.util.TimeZone;
|
||||
import java.security.spec.AlgorithmParameterSpec;
|
||||
import java.security.InvalidKeyException;
|
||||
|
||||
import org.tomitribe.auth.signatures.Algorithm;
|
||||
import org.tomitribe.auth.signatures.Signer;
|
||||
import org.tomitribe.auth.signatures.Signature;
|
||||
import org.tomitribe.auth.signatures.SigningAlgorithm;
|
||||
|
||||
/**
|
||||
* A Configuration object for the HTTP message signature security scheme.
|
||||
*/
|
||||
public class HttpSignatureAuth implements Authentication {
|
||||
|
||||
private Signer signer;
|
||||
|
||||
// An opaque string that the server can use to look up the component they need to validate the signature.
|
||||
private String keyId;
|
||||
|
||||
// The HTTP signature algorithm.
|
||||
private SigningAlgorithm signingAlgorithm;
|
||||
|
||||
// The HTTP cryptographic algorithm.
|
||||
private Algorithm algorithm;
|
||||
|
||||
// The cryptographic parameters.
|
||||
private AlgorithmParameterSpec parameterSpec;
|
||||
|
||||
// The list of HTTP headers that should be included in the HTTP signature.
|
||||
private List<String> headers;
|
||||
|
||||
// The digest algorithm which is used to calculate a cryptographic digest of the HTTP request body.
|
||||
private String digestAlgorithm;
|
||||
|
||||
// The maximum validity duration of the HTTP signature.
|
||||
private Long maxSignatureValidity;
|
||||
|
||||
/**
|
||||
* Construct a new HTTP signature auth configuration object.
|
||||
*
|
||||
* @param keyId An opaque string that the server can use to look up the component they need to validate the signature.
|
||||
* @param signingAlgorithm The signature algorithm.
|
||||
* @param algorithm The cryptographic algorithm.
|
||||
* @param digestAlgorithm The digest algorithm.
|
||||
* @param headers The list of HTTP headers that should be included in the HTTP signature.
|
||||
* @param maxSignatureValidity The maximum validity duration of the HTTP signature.
|
||||
* Used to set the '(expires)' field in the HTTP signature.
|
||||
*/
|
||||
public HttpSignatureAuth(String keyId,
|
||||
SigningAlgorithm signingAlgorithm,
|
||||
Algorithm algorithm,
|
||||
String digestAlgorithm,
|
||||
AlgorithmParameterSpec parameterSpec,
|
||||
List<String> headers,
|
||||
Long maxSignatureValidity) {
|
||||
this.keyId = keyId;
|
||||
this.signingAlgorithm = signingAlgorithm;
|
||||
this.algorithm = algorithm;
|
||||
this.parameterSpec = parameterSpec;
|
||||
this.digestAlgorithm = digestAlgorithm;
|
||||
this.headers = headers;
|
||||
this.maxSignatureValidity = maxSignatureValidity;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the opaque string that the server can use to look up the component they need to validate the signature.
|
||||
*
|
||||
* @return The keyId.
|
||||
*/
|
||||
public String getKeyId() {
|
||||
return keyId;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the HTTP signature key id.
|
||||
*
|
||||
* @param keyId An opaque string that the server can use to look up the component they need to validate the signature.
|
||||
*/
|
||||
public void setKeyId(String keyId) {
|
||||
this.keyId = keyId;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the HTTP signature algorithm which is used to sign HTTP requests.
|
||||
*/
|
||||
public SigningAlgorithm getSigningAlgorithm() {
|
||||
return signingAlgorithm;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the HTTP signature algorithm which is used to sign HTTP requests.
|
||||
*
|
||||
* @param signingAlgorithm The HTTP signature algorithm.
|
||||
*/
|
||||
public void setSigningAlgorithm(SigningAlgorithm signingAlgorithm) {
|
||||
this.signingAlgorithm = signingAlgorithm;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the HTTP cryptographic algorithm which is used to sign HTTP requests.
|
||||
*/
|
||||
public Algorithm getAlgorithm() {
|
||||
return algorithm;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the HTTP cryptographic algorithm which is used to sign HTTP requests.
|
||||
*
|
||||
* @param algorithm The HTTP signature algorithm.
|
||||
*/
|
||||
public void setAlgorithm(Algorithm algorithm) {
|
||||
this.algorithm = algorithm;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the cryptographic parameters which are used to sign HTTP requests.
|
||||
*/
|
||||
public AlgorithmParameterSpec getAlgorithmParameterSpec() {
|
||||
return parameterSpec;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the cryptographic parameters which are used to sign HTTP requests.
|
||||
*
|
||||
* @param parameterSpec The cryptographic parameters.
|
||||
*/
|
||||
public void setAlgorithmParameterSpec(AlgorithmParameterSpec parameterSpec) {
|
||||
this.parameterSpec = parameterSpec;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the digest algorithm which is used to calculate a cryptographic digest of the HTTP request body.
|
||||
*
|
||||
* @see java.security.MessageDigest
|
||||
*/
|
||||
public String getDigestAlgorithm() {
|
||||
return digestAlgorithm;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the digest algorithm which is used to calculate a cryptographic digest of the HTTP request body.
|
||||
*
|
||||
* The exact list of supported digest algorithms depends on the installed security providers.
|
||||
* Every implementation of the Java platform is required to support "MD5", "SHA-1" and "SHA-256".
|
||||
* Do not use "MD5" and "SHA-1", they are vulnerable to multiple known attacks.
|
||||
* By default, "SHA-256" is used.
|
||||
*
|
||||
* @param digestAlgorithm The digest algorithm.
|
||||
*
|
||||
* @see java.security.MessageDigest
|
||||
*/
|
||||
public void setDigestAlgorithm(String digestAlgorithm) {
|
||||
this.digestAlgorithm = digestAlgorithm;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the list of HTTP headers that should be included in the HTTP signature.
|
||||
*/
|
||||
public List<String> getHeaders() {
|
||||
return headers;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the list of HTTP headers that should be included in the HTTP signature.
|
||||
*
|
||||
* @param headers The HTTP headers.
|
||||
*/
|
||||
public void setHeaders(List<String> headers) {
|
||||
this.headers = headers;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the maximum validity duration of the HTTP signature.
|
||||
* @return The maximum validity duration of the HTTP signature.
|
||||
*/
|
||||
public Long getMaxSignatureValidity() {
|
||||
return maxSignatureValidity;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the signer instance used to sign HTTP messages.
|
||||
*
|
||||
* @return the signer instance.
|
||||
*/
|
||||
public Signer getSigner() {
|
||||
return signer;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the signer instance used to sign HTTP messages.
|
||||
*
|
||||
* @param signer The signer instance to set.
|
||||
*/
|
||||
public void setSigner(Signer signer) {
|
||||
this.signer = signer;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the private key used to sign HTTP requests using the HTTP signature scheme.
|
||||
*
|
||||
* @param key The private key.
|
||||
*
|
||||
* @throws InvalidKeyException Unable to parse the key, or the security provider for this key
|
||||
* is not installed.
|
||||
*/
|
||||
public void setPrivateKey(Key key) throws InvalidKeyException, ApiException {
|
||||
if (key == null) {
|
||||
throw new ApiException("Private key (java.security.Key) cannot be null");
|
||||
}
|
||||
signer = new Signer(key, new Signature(keyId, signingAlgorithm, algorithm, parameterSpec, null, headers, maxSignatureValidity));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void applyToParams(List<Pair> queryParams, Map<String, String> headerParams, Map<String, String> cookieParams,
|
||||
String payload, String method, URI uri) throws ApiException {
|
||||
try {
|
||||
if (headers.contains("host")) {
|
||||
headerParams.put("host", uri.getHost());
|
||||
}
|
||||
|
||||
if (headers.contains("date")) {
|
||||
SimpleDateFormat dateFormat = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss z", Locale.US);
|
||||
dateFormat.setTimeZone(TimeZone.getTimeZone("GMT"));
|
||||
headerParams.put("date", dateFormat.format(Calendar.getInstance().getTime()));
|
||||
}
|
||||
|
||||
if (headers.contains("digest")) {
|
||||
headerParams.put("digest",
|
||||
this.digestAlgorithm + "=" +
|
||||
new String(Base64.getEncoder().encode(MessageDigest.getInstance(this.digestAlgorithm).digest(payload.getBytes()))));
|
||||
}
|
||||
|
||||
if (signer == null) {
|
||||
throw new ApiException("Signer cannot be null. Please call the method `setPrivateKey` to set it up correctly");
|
||||
}
|
||||
|
||||
// construct the path with the URL-encoded path and query.
|
||||
// Calling getRawPath and getRawQuery ensures the path is URL-encoded as it will be serialized
|
||||
// on the wire. The HTTP signature must use the encode URL as it is sent on the wire.
|
||||
String path = uri.getRawPath();
|
||||
if (uri.getRawQuery() != null && !"".equals(uri.getRawQuery())) {
|
||||
path += "?" + uri.getRawQuery();
|
||||
}
|
||||
|
||||
headerParams.put("Authorization", signer.sign(method, path, headerParams).toString());
|
||||
} catch (Exception ex) {
|
||||
throw new ApiException("Failed to create signature in the HTTP request header: " + ex.toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
182
modules/openapi-generator/src/main/resources/Java/libraries/jersey3/auth/OAuth.mustache
vendored
Normal file
182
modules/openapi-generator/src/main/resources/Java/libraries/jersey3/auth/OAuth.mustache
vendored
Normal file
@@ -0,0 +1,182 @@
|
||||
{{>licenseInfo}}
|
||||
|
||||
package {{invokerPackage}}.auth;
|
||||
|
||||
import {{invokerPackage}}.Pair;
|
||||
import {{invokerPackage}}.ApiException;
|
||||
import com.github.scribejava.core.builder.ServiceBuilder;
|
||||
import com.github.scribejava.core.builder.api.DefaultApi20;
|
||||
import com.github.scribejava.core.exceptions.OAuthException;
|
||||
import com.github.scribejava.core.model.OAuth2AccessToken;
|
||||
import com.github.scribejava.core.oauth.OAuth20Service;
|
||||
|
||||
import jakarta.ws.rs.core.UriBuilder;
|
||||
import java.io.IOException;
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URI;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
{{>generatedAnnotation}}
|
||||
public class OAuth implements Authentication {
|
||||
private static final Logger log = Logger.getLogger(OAuth.class.getName());
|
||||
|
||||
private String tokenUrl;
|
||||
private String absoluteTokenUrl;
|
||||
private OAuthFlow flow = OAuthFlow.APPLICATION;
|
||||
private OAuth20Service service;
|
||||
private DefaultApi20 authApi;
|
||||
private String scope;
|
||||
private String username;
|
||||
private String password;
|
||||
private String code;
|
||||
private volatile OAuth2AccessToken accessToken;
|
||||
|
||||
public OAuth(String basePath, String tokenUrl) {
|
||||
this.tokenUrl = tokenUrl;
|
||||
this.absoluteTokenUrl = createAbsoluteTokenUrl(basePath, tokenUrl);
|
||||
authApi = new DefaultApi20() {
|
||||
@Override
|
||||
public String getAccessTokenEndpoint() {
|
||||
return absoluteTokenUrl;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getAuthorizationBaseUrl() {
|
||||
throw new UnsupportedOperationException("Shouldn't get there !");
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
private static String createAbsoluteTokenUrl(String basePath, String tokenUrl) {
|
||||
if (!URI.create(tokenUrl).isAbsolute()) {
|
||||
try {
|
||||
return UriBuilder.fromPath(basePath).path(tokenUrl).build().toURL().toString();
|
||||
} catch (MalformedURLException e) {
|
||||
log.log(Level.SEVERE, "Couldn't create absolute token URL", e);
|
||||
}
|
||||
}
|
||||
return tokenUrl;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void applyToParams(
|
||||
List<Pair> queryParams,
|
||||
Map<String, String> headerParams,
|
||||
Map<String, String> cookieParams,
|
||||
String payload,
|
||||
String method,
|
||||
URI uri)
|
||||
throws ApiException {
|
||||
|
||||
if (accessToken == null) {
|
||||
obtainAccessToken(null);
|
||||
}
|
||||
if (accessToken != null) {
|
||||
headerParams.put("Authorization", "Bearer " + accessToken.getAccessToken());
|
||||
}
|
||||
}
|
||||
|
||||
public OAuth2AccessToken renewAccessToken() throws ApiException {
|
||||
String refreshToken = null;
|
||||
if (accessToken != null) {
|
||||
refreshToken = accessToken.getRefreshToken();
|
||||
accessToken = null;
|
||||
}
|
||||
return obtainAccessToken(refreshToken);
|
||||
}
|
||||
|
||||
public synchronized OAuth2AccessToken obtainAccessToken(String refreshToken) throws ApiException {
|
||||
if (service == null) {
|
||||
log.log(Level.FINE, "service is null in obtainAccessToken.");
|
||||
return null;
|
||||
}
|
||||
try {
|
||||
if (refreshToken != null) {
|
||||
return service.refreshAccessToken(refreshToken);
|
||||
}
|
||||
} catch (OAuthException | InterruptedException | ExecutionException | IOException e) {
|
||||
log.log(Level.FINE, "Refreshing the access token using the refresh token failed", e);
|
||||
}
|
||||
try {
|
||||
switch (flow) {
|
||||
case PASSWORD:
|
||||
if (username != null && password != null) {
|
||||
accessToken = service.getAccessTokenPasswordGrant(username, password, scope);
|
||||
}
|
||||
break;
|
||||
case ACCESS_CODE:
|
||||
if (code != null) {
|
||||
accessToken = service.getAccessToken(code);
|
||||
code = null;
|
||||
}
|
||||
break;
|
||||
case APPLICATION:
|
||||
accessToken = service.getAccessTokenClientCredentialsGrant(scope);
|
||||
break;
|
||||
default:
|
||||
log.log(Level.SEVERE, "Invalid flow in obtainAccessToken: " + flow);
|
||||
}
|
||||
} catch (OAuthException | InterruptedException | ExecutionException | IOException e) {
|
||||
throw new ApiException(e);
|
||||
}
|
||||
return accessToken;
|
||||
}
|
||||
|
||||
public OAuth2AccessToken getAccessToken() {
|
||||
return accessToken;
|
||||
}
|
||||
|
||||
public OAuth setAccessToken(OAuth2AccessToken accessToken) {
|
||||
this.accessToken = accessToken;
|
||||
return this;
|
||||
}
|
||||
|
||||
public OAuth setAccessToken(String accessToken) {
|
||||
this.accessToken = new OAuth2AccessToken(accessToken);
|
||||
return this;
|
||||
}
|
||||
|
||||
public OAuth setScope(String scope) {
|
||||
this.scope = scope;
|
||||
return this;
|
||||
}
|
||||
|
||||
public OAuth setCredentials(String clientId, String clientSecret, Boolean debug) {
|
||||
if (Boolean.TRUE.equals(debug)) {
|
||||
service = new ServiceBuilder(clientId)
|
||||
.apiSecret(clientSecret).debug()
|
||||
.build(authApi);
|
||||
} else {
|
||||
service = new ServiceBuilder(clientId)
|
||||
.apiSecret(clientSecret)
|
||||
.build(authApi);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
public OAuth usePasswordFlow(String username, String password) {
|
||||
this.flow = OAuthFlow.PASSWORD;
|
||||
this.username = username;
|
||||
this.password = password;
|
||||
return this;
|
||||
}
|
||||
|
||||
public OAuth useAuthorizationCodeFlow(String code) {
|
||||
this.flow = OAuthFlow.ACCESS_CODE;
|
||||
this.code = code;
|
||||
return this;
|
||||
}
|
||||
|
||||
public OAuth setFlow(OAuthFlow flow) {
|
||||
this.flow = flow;
|
||||
return this;
|
||||
}
|
||||
|
||||
public void setBasePath(String basePath) {
|
||||
this.absoluteTokenUrl = createAbsoluteTokenUrl(basePath, tokenUrl);
|
||||
}
|
||||
}
|
||||
13
modules/openapi-generator/src/main/resources/Java/libraries/jersey3/auth/OAuthFlow.mustache
vendored
Normal file
13
modules/openapi-generator/src/main/resources/Java/libraries/jersey3/auth/OAuthFlow.mustache
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
{{>licenseInfo}}
|
||||
|
||||
package {{invokerPackage}}.auth;
|
||||
|
||||
/**
|
||||
* OAuth flows that are supported by this client
|
||||
*/
|
||||
public enum OAuthFlow {
|
||||
ACCESS_CODE,
|
||||
IMPLICIT,
|
||||
PASSWORD,
|
||||
APPLICATION
|
||||
}
|
||||
177
modules/openapi-generator/src/main/resources/Java/libraries/jersey3/build.gradle.mustache
vendored
Normal file
177
modules/openapi-generator/src/main/resources/Java/libraries/jersey3/build.gradle.mustache
vendored
Normal file
@@ -0,0 +1,177 @@
|
||||
apply plugin: 'idea'
|
||||
apply plugin: 'eclipse'
|
||||
apply plugin: 'com.diffplug.spotless'
|
||||
|
||||
group = '{{groupId}}'
|
||||
version = '{{artifactVersion}}'
|
||||
|
||||
buildscript {
|
||||
repositories {
|
||||
mavenCentral()
|
||||
}
|
||||
dependencies {
|
||||
classpath 'com.android.tools.build:gradle:2.3.+'
|
||||
classpath 'com.github.dcendents:android-maven-gradle-plugin:2.1'
|
||||
classpath 'com.diffplug.spotless:spotless-plugin-gradle:6.3.0'
|
||||
}
|
||||
}
|
||||
|
||||
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 = '{{artifactId}}'
|
||||
|
||||
from components.java
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
task execute(type:JavaExec) {
|
||||
main = System.getProperty('mainClass')
|
||||
classpath = sourceSets.main.runtimeClasspath
|
||||
}
|
||||
}
|
||||
|
||||
ext {
|
||||
swagger_annotations_version = "1.6.5"
|
||||
jackson_version = "2.13.2"
|
||||
jackson_databind_version = "2.13.2"
|
||||
{{#openApiNullable}}
|
||||
jackson_databind_nullable_version = "0.2.2"
|
||||
{{/openApiNullable}}
|
||||
jakarta_annotation_version = "2.1.0"
|
||||
jersey_version = "3.0.4"
|
||||
junit_version = "5.8.2"
|
||||
{{#hasOAuthMethods}}
|
||||
scribejava_apis_version = "8.3.1"
|
||||
{{/hasOAuthMethods}}
|
||||
{{#hasHttpSignatureMethods}}
|
||||
tomitribe_http_signatures_version = "1.7"
|
||||
{{/hasHttpSignatureMethods}}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation "io.swagger:swagger-annotations:$swagger_annotations_version"
|
||||
implementation "com.google.code.findbugs:jsr305:3.0.2"
|
||||
implementation "org.glassfish.jersey.core:jersey-client:$jersey_version"
|
||||
implementation "org.glassfish.jersey.inject:jersey-hk2:$jersey_version"
|
||||
implementation "org.glassfish.jersey.media:jersey-media-multipart:$jersey_version"
|
||||
implementation "org.glassfish.jersey.media:jersey-media-json-jackson:$jersey_version"
|
||||
implementation "org.glassfish.jersey.connectors:jersey-apache-connector:$jersey_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"
|
||||
{{#openApiNullable}}
|
||||
implementation "org.openapitools:jackson-databind-nullable:$jackson_databind_nullable_version"
|
||||
{{/openApiNullable}}
|
||||
{{#joda}}
|
||||
implementation "com.fasterxml.jackson.datatype:jackson-datatype-joda:$jackson_version"
|
||||
{{/joda}}
|
||||
implementation "com.fasterxml.jackson.datatype:jackson-datatype-jsr310:$jackson_version"
|
||||
{{#hasOAuthMethods}}
|
||||
implementation "com.github.scribejava:scribejava-apis:$scribejava_apis_version"
|
||||
{{/hasOAuthMethods}}
|
||||
{{#hasHttpSignatureMethods}}
|
||||
implementation "org.tomitribe:tomitribe-http-signatures:$tomitribe_http_signatures_version"
|
||||
{{/hasHttpSignatureMethods}}
|
||||
implementation "jakarta.annotation:jakarta.annotation-api:$jakarta_annotation_version"
|
||||
testImplementation "org.junit.jupiter:junit-jupiter-api:$junit_version"
|
||||
testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:$junit_version"
|
||||
}
|
||||
|
||||
test {
|
||||
useJUnitPlatform()
|
||||
}
|
||||
|
||||
javadoc {
|
||||
options.tags = [ "http.response.details:a:Http Response Details" ]
|
||||
}
|
||||
|
||||
// Use spotless plugin to automatically format code, remove unused import, etc
|
||||
// To apply changes directly to the file, run `gradlew spotlessApply`
|
||||
// Ref: https://github.com/diffplug/spotless/tree/main/plugin-gradle
|
||||
spotless {
|
||||
// comment out below to run spotless as part of the `check` task
|
||||
enforceCheck false
|
||||
|
||||
format 'misc', {
|
||||
// define the files (e.g. '*.gradle', '*.md') to apply `misc` to
|
||||
target '.gitignore'
|
||||
// define the steps to apply to those files
|
||||
trimTrailingWhitespace()
|
||||
indentWithSpaces() // Takes an integer argument if you don't like 4
|
||||
endWithNewline()
|
||||
}
|
||||
java {
|
||||
// don't need to set target, it is inferred from java
|
||||
// apply a specific flavor of google-java-format
|
||||
googleJavaFormat('1.8').aosp().reflowLongStrings()
|
||||
removeUnusedImports()
|
||||
importOrder()
|
||||
}
|
||||
}
|
||||
38
modules/openapi-generator/src/main/resources/Java/libraries/jersey3/build.sbt.mustache
vendored
Normal file
38
modules/openapi-generator/src/main/resources/Java/libraries/jersey3/build.sbt.mustache
vendored
Normal file
@@ -0,0 +1,38 @@
|
||||
lazy val root = (project in file(".")).
|
||||
settings(
|
||||
organization := "{{groupId}}",
|
||||
name := "{{artifactId}}",
|
||||
version := "{{artifactVersion}}",
|
||||
scalaVersion := "2.11.4",
|
||||
scalacOptions ++= Seq("-feature"),
|
||||
Compile / javacOptions ++= Seq("-Xlint:deprecation"),
|
||||
Compile / packageDoc / publishArtifact := false,
|
||||
resolvers += Resolver.mavenLocal,
|
||||
libraryDependencies ++= Seq(
|
||||
"com.google.code.findbugs" % "jsr305" % "3.0.0",
|
||||
"io.swagger" % "swagger-annotations" % "1.6.5",
|
||||
"org.glassfish.jersey.core" % "jersey-client" % "3.0.4",
|
||||
"org.glassfish.jersey.inject" % "jersey-hk2" % "3.0.4",
|
||||
"org.glassfish.jersey.media" % "jersey-media-multipart" % "3.0.4",
|
||||
"org.glassfish.jersey.media" % "jersey-media-json-jackson" % "3.0.4",
|
||||
"org.glassfish.jersey.connectors" % "jersey-apache-connector" % "3.0.4",
|
||||
"com.fasterxml.jackson.core" % "jackson-core" % "2.13.2" % "compile",
|
||||
"com.fasterxml.jackson.core" % "jackson-annotations" % "2.13.2" % "compile",
|
||||
"com.fasterxml.jackson.core" % "jackson-databind" % "2.13.2" % "compile",
|
||||
{{#joda}}
|
||||
"com.fasterxml.jackson.datatype" % "jackson-datatype-joda" % "2.13.0" % "compile",
|
||||
{{/joda}}
|
||||
"com.fasterxml.jackson.datatype" % "jackson-datatype-jsr310" % "2.13.0" % "compile",
|
||||
{{#openApiNullable}}
|
||||
"org.openapitools" % "jackson-databind-nullable" % "0.2.2" % "compile",
|
||||
{{/openApiNullable}}
|
||||
{{#hasOAuthMethods}}
|
||||
"com.github.scribejava" % "scribejava-apis" % "8.3.1" % "compile",
|
||||
{{/hasOAuthMethods}}
|
||||
{{#hasHttpSignatureMethods}}
|
||||
"org.tomitribe" % "tomitribe-http-signatures" % "1.7" % "compile",
|
||||
{{/hasHttpSignatureMethods}}
|
||||
"jakarta.annotation" % "jakarta.annotation-api" % "2.1.0" % "compile",
|
||||
"org.junit.jupiter" % "junit-jupiter-api" % "5.8.2" % "test"
|
||||
)
|
||||
)
|
||||
@@ -0,0 +1 @@
|
||||
@jakarta.annotation.Generated(value = "{{generatorClass}}"{{^hideGenerationTimestamp}}, date = "{{generatedDate}}"{{/hideGenerationTimestamp}})
|
||||
64
modules/openapi-generator/src/main/resources/Java/libraries/jersey3/model.mustache
vendored
Normal file
64
modules/openapi-generator/src/main/resources/Java/libraries/jersey3/model.mustache
vendored
Normal file
@@ -0,0 +1,64 @@
|
||||
{{>licenseInfo}}
|
||||
|
||||
package {{package}};
|
||||
|
||||
{{#useReflectionEqualsHashCode}}
|
||||
import org.apache.commons.lang3.builder.EqualsBuilder;
|
||||
import org.apache.commons.lang3.builder.HashCodeBuilder;
|
||||
{{/useReflectionEqualsHashCode}}
|
||||
{{#models}}
|
||||
{{#model}}
|
||||
{{#additionalPropertiesType}}
|
||||
import java.util.Map;
|
||||
import java.util.HashMap;
|
||||
import com.fasterxml.jackson.annotation.JsonAnyGetter;
|
||||
import com.fasterxml.jackson.annotation.JsonAnySetter;
|
||||
{{/additionalPropertiesType}}
|
||||
{{/model}}
|
||||
{{/models}}
|
||||
import java.util.Objects;
|
||||
import java.util.Arrays;
|
||||
import java.util.Map;
|
||||
import java.util.HashMap;
|
||||
{{#imports}}
|
||||
import {{import}};
|
||||
{{/imports}}
|
||||
{{#serializableModel}}
|
||||
import java.io.Serializable;
|
||||
{{/serializableModel}}
|
||||
{{#jackson}}
|
||||
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
|
||||
{{#withXml}}
|
||||
import com.fasterxml.jackson.dataformat.xml.annotation.*;
|
||||
{{/withXml}}
|
||||
{{#vendorExtensions.x-has-readonly-properties}}
|
||||
import com.fasterxml.jackson.annotation.JsonCreator;
|
||||
{{/vendorExtensions.x-has-readonly-properties}}
|
||||
{{/jackson}}
|
||||
{{#withXml}}
|
||||
import javax.xml.bind.annotation.*;
|
||||
{{/withXml}}
|
||||
{{#parcelableModel}}
|
||||
import android.os.Parcelable;
|
||||
import android.os.Parcel;
|
||||
{{/parcelableModel}}
|
||||
{{#useBeanValidation}}
|
||||
import javax.validation.constraints.*;
|
||||
import javax.validation.Valid;
|
||||
{{/useBeanValidation}}
|
||||
{{#performBeanValidation}}
|
||||
import org.hibernate.validator.constraints.*;
|
||||
{{/performBeanValidation}}
|
||||
import {{invokerPackage}}.JSON;
|
||||
|
||||
{{#models}}
|
||||
{{#model}}
|
||||
{{#oneOf}}
|
||||
{{#-first}}
|
||||
import com.fasterxml.jackson.core.type.TypeReference;
|
||||
{{/-first}}
|
||||
{{/oneOf}}
|
||||
|
||||
{{#isEnum}}{{>modelEnum}}{{/isEnum}}{{^isEnum}}{{#oneOf}}{{#-first}}{{>oneof_model}}{{/-first}}{{/oneOf}}{{^oneOf}}{{#anyOf}}{{#-first}}{{>anyof_model}}{{/-first}}{{/anyOf}}{{^anyOf}}{{>pojo}}{{/anyOf}}{{/oneOf}}{{/isEnum}}
|
||||
{{/model}}
|
||||
{{/models}}
|
||||
38
modules/openapi-generator/src/main/resources/Java/libraries/jersey3/model_anyof_doc.mustache
vendored
Normal file
38
modules/openapi-generator/src/main/resources/Java/libraries/jersey3/model_anyof_doc.mustache
vendored
Normal file
@@ -0,0 +1,38 @@
|
||||
# {{classname}}
|
||||
|
||||
{{#description}}
|
||||
{{&description}}
|
||||
|
||||
{{/description}}
|
||||
## anyOf schemas
|
||||
{{#anyOf}}
|
||||
* [{{{.}}}]({{{.}}}.md)
|
||||
{{/anyOf}}
|
||||
|
||||
{{#isNullable}}
|
||||
NOTE: this class is nullable.
|
||||
|
||||
{{/isNullable}}
|
||||
## Example
|
||||
```java
|
||||
// Import classes:
|
||||
import {{{package}}}.{{{classname}}};
|
||||
{{#anyOf}}
|
||||
import {{{package}}}.{{{.}}};
|
||||
{{/anyOf}}
|
||||
|
||||
public class Example {
|
||||
public static void main(String[] args) {
|
||||
{{classname}} example{{classname}} = new {{classname}}();
|
||||
{{#anyOf}}
|
||||
|
||||
// create a new {{{.}}}
|
||||
{{{.}}} example{{{.}}} = new {{{.}}}();
|
||||
// set {{{classname}}} to {{{.}}}
|
||||
example{{classname}}.setActualInstance(example{{{.}}});
|
||||
// to get back the {{{.}}} set earlier
|
||||
{{{.}}} test{{{.}}} = ({{{.}}}) example{{classname}}.getActualInstance();
|
||||
{{/anyOf}}
|
||||
}
|
||||
}
|
||||
```
|
||||
19
modules/openapi-generator/src/main/resources/Java/libraries/jersey3/model_doc.mustache
vendored
Normal file
19
modules/openapi-generator/src/main/resources/Java/libraries/jersey3/model_doc.mustache
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
{{#models}}{{#model}}
|
||||
|
||||
{{#isEnum}}
|
||||
{{>enum_outer_doc}}
|
||||
{{/isEnum}}
|
||||
{{^isEnum}}
|
||||
{{^oneOf.isEmpty}}
|
||||
{{>model_oneof_doc}}
|
||||
{{/oneOf.isEmpty}}
|
||||
{{^anyOf.isEmpty}}
|
||||
{{>model_anyof_doc}}
|
||||
{{/anyOf.isEmpty}}
|
||||
{{^anyOf}}
|
||||
{{^oneOf}}
|
||||
{{>pojo_doc}}
|
||||
{{/oneOf}}
|
||||
{{/anyOf}}
|
||||
{{/isEnum}}
|
||||
{{/model}}{{/models}}
|
||||
38
modules/openapi-generator/src/main/resources/Java/libraries/jersey3/model_oneof_doc.mustache
vendored
Normal file
38
modules/openapi-generator/src/main/resources/Java/libraries/jersey3/model_oneof_doc.mustache
vendored
Normal file
@@ -0,0 +1,38 @@
|
||||
# {{classname}}
|
||||
|
||||
{{#description}}
|
||||
{{&description}}
|
||||
|
||||
{{/description}}
|
||||
## oneOf schemas
|
||||
{{#oneOf}}
|
||||
* [{{{.}}}]({{{.}}}.md)
|
||||
{{/oneOf}}
|
||||
|
||||
{{#isNullable}}
|
||||
NOTE: this class is nullable.
|
||||
|
||||
{{/isNullable}}
|
||||
## Example
|
||||
```java
|
||||
// Import classes:
|
||||
import {{{package}}}.{{{classname}}};
|
||||
{{#oneOf}}
|
||||
import {{{package}}}.{{{.}}};
|
||||
{{/oneOf}}
|
||||
|
||||
public class Example {
|
||||
public static void main(String[] args) {
|
||||
{{classname}} example{{classname}} = new {{classname}}();
|
||||
{{#oneOf}}
|
||||
|
||||
// create a new {{{.}}}
|
||||
{{{.}}} example{{{.}}} = new {{{.}}}();
|
||||
// set {{{classname}}} to {{{.}}}
|
||||
example{{classname}}.setActualInstance(example{{{.}}});
|
||||
// to get back the {{{.}}} set earlier
|
||||
{{{.}}} test{{{.}}} = ({{{.}}}) example{{classname}}.getActualInstance();
|
||||
{{/oneOf}}
|
||||
}
|
||||
}
|
||||
```
|
||||
51
modules/openapi-generator/src/main/resources/Java/libraries/jersey3/model_test.mustache
vendored
Normal file
51
modules/openapi-generator/src/main/resources/Java/libraries/jersey3/model_test.mustache
vendored
Normal file
@@ -0,0 +1,51 @@
|
||||
{{>licenseInfo}}
|
||||
|
||||
package {{package}};
|
||||
|
||||
{{#imports}}import {{import}};
|
||||
{{/imports}}
|
||||
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.Disabled;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
{{#fullJavaUtil}}
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
{{/fullJavaUtil}}
|
||||
/**
|
||||
* Model tests for {{classname}}
|
||||
*/
|
||||
public class {{classname}}Test {
|
||||
{{#models}}
|
||||
{{#model}}
|
||||
{{^vendorExtensions.x-is-one-of-interface}}
|
||||
{{^isEnum}}
|
||||
private final {{classname}} model = new {{classname}}();
|
||||
|
||||
{{/isEnum}}
|
||||
/**
|
||||
* Model tests for {{classname}}
|
||||
*/
|
||||
@Test
|
||||
public void test{{classname}}() {
|
||||
// TODO: test {{classname}}
|
||||
}
|
||||
|
||||
{{#allVars}}
|
||||
/**
|
||||
* Test the property '{{name}}'
|
||||
*/
|
||||
@Test
|
||||
public void {{name}}Test() {
|
||||
// TODO: test {{name}}
|
||||
}
|
||||
|
||||
{{/allVars}}
|
||||
{{/vendorExtensions.x-is-one-of-interface}}
|
||||
{{/model}}
|
||||
{{/models}}
|
||||
}
|
||||
235
modules/openapi-generator/src/main/resources/Java/libraries/jersey3/oneof_model.mustache
vendored
Normal file
235
modules/openapi-generator/src/main/resources/Java/libraries/jersey3/oneof_model.mustache
vendored
Normal file
@@ -0,0 +1,235 @@
|
||||
import jakarta.ws.rs.core.GenericType;
|
||||
import jakarta.ws.rs.core.Response;
|
||||
import java.io.IOException;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.HashSet;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonGenerator;
|
||||
import com.fasterxml.jackson.core.JsonParser;
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.fasterxml.jackson.core.JsonToken;
|
||||
import com.fasterxml.jackson.core.type.TypeReference;
|
||||
import com.fasterxml.jackson.databind.DeserializationContext;
|
||||
import com.fasterxml.jackson.databind.JsonMappingException;
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
import com.fasterxml.jackson.databind.MapperFeature;
|
||||
import com.fasterxml.jackson.databind.SerializerProvider;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.deser.std.StdDeserializer;
|
||||
import com.fasterxml.jackson.databind.ser.std.StdSerializer;
|
||||
import {{invokerPackage}}.JSON;
|
||||
|
||||
{{>additionalModelTypeAnnotations}}{{>generatedAnnotation}}{{>xmlAnnotation}}
|
||||
@JsonDeserialize(using = {{classname}}.{{classname}}Deserializer.class)
|
||||
@JsonSerialize(using = {{classname}}.{{classname}}Serializer.class)
|
||||
public class {{classname}} extends AbstractOpenApiSchema{{#vendorExtensions.x-implements}}, {{{.}}}{{/vendorExtensions.x-implements}} {
|
||||
private static final Logger log = Logger.getLogger({{classname}}.class.getName());
|
||||
|
||||
public static class {{classname}}Serializer extends StdSerializer<{{classname}}> {
|
||||
public {{classname}}Serializer(Class<{{classname}}> t) {
|
||||
super(t);
|
||||
}
|
||||
|
||||
public {{classname}}Serializer() {
|
||||
this(null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void serialize({{classname}} value, JsonGenerator jgen, SerializerProvider provider) throws IOException, JsonProcessingException {
|
||||
jgen.writeObject(value.getActualInstance());
|
||||
}
|
||||
}
|
||||
|
||||
public static class {{classname}}Deserializer extends StdDeserializer<{{classname}}> {
|
||||
public {{classname}}Deserializer() {
|
||||
this({{classname}}.class);
|
||||
}
|
||||
|
||||
public {{classname}}Deserializer(Class<?> vc) {
|
||||
super(vc);
|
||||
}
|
||||
|
||||
@Override
|
||||
public {{classname}} deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException, JsonProcessingException {
|
||||
JsonNode tree = jp.readValueAsTree();
|
||||
Object deserialized = null;
|
||||
{{#useOneOfDiscriminatorLookup}}
|
||||
{{#discriminator}}
|
||||
{{classname}} new{{classname}} = new {{classname}}();
|
||||
Map<String,Object> result2 = tree.traverse(jp.getCodec()).readValueAs(new TypeReference<Map<String, Object>>() {});
|
||||
String discriminatorValue = (String)result2.get("{{{propertyBaseName}}}");
|
||||
switch (discriminatorValue) {
|
||||
{{#mappedModels}}
|
||||
case "{{{mappingName}}}":
|
||||
deserialized = tree.traverse(jp.getCodec()).readValueAs({{{modelName}}}.class);
|
||||
new{{classname}}.setActualInstance(deserialized);
|
||||
return new{{classname}};
|
||||
{{/mappedModels}}
|
||||
default:
|
||||
log.log(Level.WARNING, String.format("Failed to lookup discriminator value `%s` for {{classname}}. Possible values:{{#mappedModels}} {{{mappingName}}}{{/mappedModels}}", discriminatorValue));
|
||||
}
|
||||
|
||||
{{/discriminator}}
|
||||
{{/useOneOfDiscriminatorLookup}}
|
||||
boolean typeCoercion = ctxt.isEnabled(MapperFeature.ALLOW_COERCION_OF_SCALARS);
|
||||
int match = 0;
|
||||
JsonToken token = tree.traverse(jp.getCodec()).nextToken();
|
||||
{{#oneOf}}
|
||||
// deserialize {{{.}}}
|
||||
try {
|
||||
boolean attemptParsing = true;
|
||||
// ensure that we respect type coercion as set on the client ObjectMapper
|
||||
if ({{{.}}}.class.equals(Integer.class) || {{{.}}}.class.equals(Long.class) || {{{.}}}.class.equals(Float.class) || {{{.}}}.class.equals(Double.class) || {{{.}}}.class.equals(Boolean.class) || {{{.}}}.class.equals(String.class)) {
|
||||
attemptParsing = typeCoercion;
|
||||
if (!attemptParsing) {
|
||||
attemptParsing |= (({{{.}}}.class.equals(Integer.class) || {{{.}}}.class.equals(Long.class)) && token == JsonToken.VALUE_NUMBER_INT);
|
||||
attemptParsing |= (({{{.}}}.class.equals(Float.class) || {{{.}}}.class.equals(Double.class)) && token == JsonToken.VALUE_NUMBER_FLOAT);
|
||||
attemptParsing |= ({{{.}}}.class.equals(Boolean.class) && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE));
|
||||
attemptParsing |= ({{{.}}}.class.equals(String.class) && token == JsonToken.VALUE_STRING);
|
||||
{{#isNullable}}
|
||||
attemptParsing |= (token == JsonToken.VALUE_NULL);
|
||||
{{/isNullable}}
|
||||
}
|
||||
}
|
||||
if (attemptParsing) {
|
||||
deserialized = tree.traverse(jp.getCodec()).readValueAs({{{.}}}.class);
|
||||
// TODO: there is no validation against JSON schema constraints
|
||||
// (min, max, enum, pattern...), this does not perform a strict JSON
|
||||
// validation, which means the 'match' count may be higher than it should be.
|
||||
match++;
|
||||
log.log(Level.FINER, "Input data matches schema '{{{.}}}'");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
// deserialization failed, continue
|
||||
log.log(Level.FINER, "Input data does not match schema '{{{.}}}'", e);
|
||||
}
|
||||
|
||||
{{/oneOf}}
|
||||
if (match == 1) {
|
||||
{{classname}} ret = new {{classname}}();
|
||||
ret.setActualInstance(deserialized);
|
||||
return ret;
|
||||
}
|
||||
throw new IOException(String.format("Failed deserialization for {{classname}}: %d classes match result, expected 1", match));
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle deserialization of the 'null' value.
|
||||
*/
|
||||
@Override
|
||||
public {{classname}} getNullValue(DeserializationContext ctxt) throws JsonMappingException {
|
||||
{{#isNullable}}
|
||||
return null;
|
||||
{{/isNullable}}
|
||||
{{^isNullable}}
|
||||
throw new JsonMappingException(ctxt.getParser(), "{{classname}} cannot be null");
|
||||
{{/isNullable}}
|
||||
}
|
||||
}
|
||||
|
||||
// store a list of schema names defined in oneOf
|
||||
public static final Map<String, GenericType> schemas = new HashMap<String, GenericType>();
|
||||
|
||||
public {{classname}}() {
|
||||
super("oneOf", {{#isNullable}}Boolean.TRUE{{/isNullable}}{{^isNullable}}Boolean.FALSE{{/isNullable}});
|
||||
}
|
||||
{{> libraries/jersey2/additional_properties }}
|
||||
{{#additionalPropertiesType}}
|
||||
/**
|
||||
* Return true if this {{name}} object is equal to o.
|
||||
*/
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
return super.equals(o) && Objects.equals(this.additionalProperties, (({{classname}})o).additionalProperties);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(getActualInstance(), isNullable(), getSchemaType(), additionalProperties);
|
||||
}
|
||||
{{/additionalPropertiesType}}
|
||||
{{#oneOf}}
|
||||
public {{classname}}({{{.}}} o) {
|
||||
super("oneOf", {{#isNullable}}Boolean.TRUE{{/isNullable}}{{^isNullable}}Boolean.FALSE{{/isNullable}});
|
||||
setActualInstance(o);
|
||||
}
|
||||
|
||||
{{/oneOf}}
|
||||
static {
|
||||
{{#oneOf}}
|
||||
schemas.put("{{{.}}}", new GenericType<{{{.}}}>() {
|
||||
});
|
||||
{{/oneOf}}
|
||||
JSON.registerDescendants({{classname}}.class, Collections.unmodifiableMap(schemas));
|
||||
{{#discriminator}}
|
||||
// Initialize and register the discriminator mappings.
|
||||
Map<String, Class<?>> mappings = new HashMap<String, Class<?>>();
|
||||
{{#mappedModels}}
|
||||
mappings.put("{{mappingName}}", {{modelName}}.class);
|
||||
{{/mappedModels}}
|
||||
mappings.put("{{name}}", {{classname}}.class);
|
||||
JSON.registerDiscriminator({{classname}}.class, "{{propertyBaseName}}", mappings);
|
||||
{{/discriminator}}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, GenericType> getSchemas() {
|
||||
return {{classname}}.schemas;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the instance that matches the oneOf child schema, check
|
||||
* the instance parameter is valid against the oneOf child schemas:
|
||||
* {{#oneOf}}{{{.}}}{{^-last}}, {{/-last}}{{/oneOf}}
|
||||
*
|
||||
* It could be an instance of the 'oneOf' schemas.
|
||||
* The oneOf child schemas may themselves be a composed schema (allOf, anyOf, oneOf).
|
||||
*/
|
||||
@Override
|
||||
public void setActualInstance(Object instance) {
|
||||
{{#isNullable}}
|
||||
if (instance == null) {
|
||||
super.setActualInstance(instance);
|
||||
return;
|
||||
}
|
||||
|
||||
{{/isNullable}}
|
||||
{{#oneOf}}
|
||||
if (JSON.isInstanceOf({{{.}}}.class, instance, new HashSet<Class<?>>())) {
|
||||
super.setActualInstance(instance);
|
||||
return;
|
||||
}
|
||||
|
||||
{{/oneOf}}
|
||||
throw new RuntimeException("Invalid instance type. Must be {{#oneOf}}{{{.}}}{{^-last}}, {{/-last}}{{/oneOf}}");
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the actual instance, which can be the following:
|
||||
* {{#oneOf}}{{{.}}}{{^-last}}, {{/-last}}{{/oneOf}}
|
||||
*
|
||||
* @return The actual instance ({{#oneOf}}{{{.}}}{{^-last}}, {{/-last}}{{/oneOf}})
|
||||
*/
|
||||
@Override
|
||||
public Object getActualInstance() {
|
||||
return super.getActualInstance();
|
||||
}
|
||||
|
||||
{{#oneOf}}
|
||||
/**
|
||||
* Get the actual instance of `{{{.}}}`. If the actual instance is not `{{{.}}}`,
|
||||
* the ClassCastException will be thrown.
|
||||
*
|
||||
* @return The actual instance of `{{{.}}}`
|
||||
* @throws ClassCastException if the instance is not `{{{.}}}`
|
||||
*/
|
||||
public {{{.}}} get{{{.}}}() throws ClassCastException {
|
||||
return ({{{.}}})super.getActualInstance();
|
||||
}
|
||||
|
||||
{{/oneOf}}
|
||||
}
|
||||
413
modules/openapi-generator/src/main/resources/Java/libraries/jersey3/pojo.mustache
vendored
Normal file
413
modules/openapi-generator/src/main/resources/Java/libraries/jersey3/pojo.mustache
vendored
Normal file
@@ -0,0 +1,413 @@
|
||||
/**
|
||||
* {{description}}{{^description}}{{classname}}{{/description}}{{#isDeprecated}}
|
||||
* @deprecated{{/isDeprecated}}
|
||||
*/{{#isDeprecated}}
|
||||
@Deprecated{{/isDeprecated}}{{#description}}
|
||||
@ApiModel(description = "{{{.}}}"){{/description}}
|
||||
{{#jackson}}
|
||||
@JsonPropertyOrder({
|
||||
{{#vars}}
|
||||
{{classname}}.JSON_PROPERTY_{{nameInSnakeCase}}{{^-last}},{{/-last}}
|
||||
{{/vars}}
|
||||
})
|
||||
{{#isClassnameSanitized}}
|
||||
@JsonTypeName("{{name}}")
|
||||
{{/isClassnameSanitized}}
|
||||
{{/jackson}}
|
||||
{{>additionalModelTypeAnnotations}}{{>generatedAnnotation}}{{#discriminator}}{{>typeInfoAnnotation}}{{/discriminator}}{{>xmlAnnotation}}
|
||||
{{#vendorExtensions.x-class-extra-annotation}}
|
||||
{{{vendorExtensions.x-class-extra-annotation}}}
|
||||
{{/vendorExtensions.x-class-extra-annotation}}
|
||||
public class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{{#vendorExtensions.x-implements}}{{#-first}}implements {{{.}}}{{/-first}}{{^-first}}, {{{.}}}{{/-first}}{{#-last}} {{/-last}}{{/vendorExtensions.x-implements}}{
|
||||
{{#serializableModel}}
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
{{/serializableModel}}
|
||||
{{#vars}}
|
||||
{{#isEnum}}
|
||||
{{^isContainer}}
|
||||
{{^vendorExtensions.x-enum-as-string}}
|
||||
{{>modelInnerEnum}}
|
||||
{{/vendorExtensions.x-enum-as-string}}
|
||||
{{/isContainer}}
|
||||
{{#isContainer}}
|
||||
{{#mostInnerItems}}
|
||||
{{>modelInnerEnum}}
|
||||
{{/mostInnerItems}}
|
||||
{{/isContainer}}
|
||||
{{/isEnum}}
|
||||
{{#gson}}
|
||||
public static final String SERIALIZED_NAME_{{nameInSnakeCase}} = "{{baseName}}";
|
||||
{{/gson}}
|
||||
{{#jackson}}
|
||||
public static final String JSON_PROPERTY_{{nameInSnakeCase}} = "{{baseName}}";
|
||||
{{/jackson}}
|
||||
{{#withXml}}
|
||||
{{#isXmlAttribute}}
|
||||
@XmlAttribute(name = "{{xmlName}}{{^xmlName}}{{baseName}}{{/xmlName}}")
|
||||
{{/isXmlAttribute}}
|
||||
{{^isXmlAttribute}}
|
||||
{{^isContainer}}
|
||||
@XmlElement({{#xmlNamespace}}namespace="{{.}}", {{/xmlNamespace}}name = "{{xmlName}}{{^xmlName}}{{baseName}}{{/xmlName}}")
|
||||
{{/isContainer}}
|
||||
{{#isContainer}}
|
||||
// Is a container wrapped={{isXmlWrapped}}
|
||||
{{#items}}
|
||||
// items.name={{name}} items.baseName={{baseName}} items.xmlName={{xmlName}} items.xmlNamespace={{xmlNamespace}}
|
||||
// items.example={{example}} items.type={{dataType}}
|
||||
@XmlElement({{#xmlNamespace}}namespace="{{.}}", {{/xmlNamespace}}name = "{{xmlName}}{{^xmlName}}{{baseName}}{{/xmlName}}")
|
||||
{{/items}}
|
||||
{{#isXmlWrapped}}
|
||||
@XmlElementWrapper({{#xmlNamespace}}namespace="{{.}}", {{/xmlNamespace}}name = "{{xmlName}}{{^xmlName}}{{baseName}}{{/xmlName}}")
|
||||
{{/isXmlWrapped}}
|
||||
{{/isContainer}}
|
||||
{{/isXmlAttribute}}
|
||||
{{/withXml}}
|
||||
{{#gson}}
|
||||
@SerializedName(SERIALIZED_NAME_{{nameInSnakeCase}})
|
||||
{{/gson}}
|
||||
{{#vendorExtensions.x-field-extra-annotation}}
|
||||
{{{vendorExtensions.x-field-extra-annotation}}}
|
||||
{{/vendorExtensions.x-field-extra-annotation}}
|
||||
{{#vendorExtensions.x-is-jackson-optional-nullable}}
|
||||
{{#isContainer}}
|
||||
private JsonNullable<{{{datatypeWithEnum}}}> {{name}} = JsonNullable.<{{{datatypeWithEnum}}}>undefined();
|
||||
{{/isContainer}}
|
||||
{{^isContainer}}
|
||||
private JsonNullable<{{{datatypeWithEnum}}}> {{name}} = JsonNullable.<{{{datatypeWithEnum}}}>{{#defaultValue}}of({{{.}}}){{/defaultValue}}{{^defaultValue}}undefined(){{/defaultValue}};
|
||||
{{/isContainer}}
|
||||
{{/vendorExtensions.x-is-jackson-optional-nullable}}
|
||||
{{^vendorExtensions.x-is-jackson-optional-nullable}}
|
||||
{{#isContainer}}
|
||||
private {{{datatypeWithEnum}}} {{name}}{{#required}}{{#defaultValue}} = {{{.}}}{{/defaultValue}}{{/required}}{{^required}} = null{{/required}};
|
||||
{{/isContainer}}
|
||||
{{^isContainer}}
|
||||
private {{{datatypeWithEnum}}} {{name}}{{#defaultValue}} = {{{.}}}{{/defaultValue}};
|
||||
{{/isContainer}}
|
||||
{{/vendorExtensions.x-is-jackson-optional-nullable}}
|
||||
|
||||
{{/vars}}
|
||||
public {{classname}}() { {{#parent}}{{#parcelableModel}}
|
||||
super();{{/parcelableModel}}{{/parent}}{{#gson}}{{#discriminator}}
|
||||
this.{{{discriminatorName}}} = this.getClass().getSimpleName();{{/discriminator}}{{/gson}}
|
||||
}{{#vendorExtensions.x-has-readonly-properties}}{{^withXml}}{{#jackson}}
|
||||
|
||||
@JsonCreator
|
||||
public {{classname}}(
|
||||
{{#readOnlyVars}}
|
||||
{{#jackson}}@JsonProperty(JSON_PROPERTY_{{nameInSnakeCase}}){{/jackson}} {{{datatypeWithEnum}}} {{name}}{{^-last}}, {{/-last}}
|
||||
{{/readOnlyVars}}
|
||||
) {
|
||||
this();
|
||||
{{#readOnlyVars}}
|
||||
this.{{name}} = {{name}};
|
||||
{{/readOnlyVars}}
|
||||
}{{/jackson}}{{/withXml}}{{/vendorExtensions.x-has-readonly-properties}}
|
||||
{{#vars}}
|
||||
|
||||
{{^isReadOnly}}
|
||||
{{#vendorExtensions.x-enum-as-string}}
|
||||
public static final Set<String> {{{nameInSnakeCase}}}_VALUES = new HashSet<>(Arrays.asList(
|
||||
{{#allowableValues}}{{#enumVars}}{{{value}}}{{^-last}}, {{/-last}}{{/enumVars}}{{/allowableValues}}
|
||||
));
|
||||
|
||||
{{/vendorExtensions.x-enum-as-string}}
|
||||
public {{classname}} {{name}}({{{datatypeWithEnum}}} {{name}}) {
|
||||
{{#vendorExtensions.x-enum-as-string}}
|
||||
if (!{{{nameInSnakeCase}}}_VALUES.contains({{name}})) {
|
||||
throw new IllegalArgumentException({{name}} + " is invalid. Possible values for {{name}}: " + String.join(", ", {{{nameInSnakeCase}}}_VALUES));
|
||||
}
|
||||
|
||||
{{/vendorExtensions.x-enum-as-string}}
|
||||
{{#vendorExtensions.x-is-jackson-optional-nullable}}
|
||||
this.{{name}} = JsonNullable.<{{{datatypeWithEnum}}}>of({{name}});
|
||||
{{/vendorExtensions.x-is-jackson-optional-nullable}}
|
||||
{{^vendorExtensions.x-is-jackson-optional-nullable}}
|
||||
this.{{name}} = {{name}};
|
||||
{{/vendorExtensions.x-is-jackson-optional-nullable}}
|
||||
return this;
|
||||
}
|
||||
{{#isArray}}
|
||||
|
||||
public {{classname}} add{{nameInCamelCase}}Item({{{items.datatypeWithEnum}}} {{name}}Item) {
|
||||
{{#vendorExtensions.x-is-jackson-optional-nullable}}
|
||||
if (this.{{name}} == null || !this.{{name}}.isPresent()) {
|
||||
this.{{name}} = JsonNullable.<{{{datatypeWithEnum}}}>of({{{defaultValue}}});
|
||||
}
|
||||
try {
|
||||
this.{{name}}.get().add({{name}}Item);
|
||||
} catch (java.util.NoSuchElementException e) {
|
||||
// this can never happen, as we make sure above that the value is present
|
||||
}
|
||||
return this;
|
||||
{{/vendorExtensions.x-is-jackson-optional-nullable}}
|
||||
{{^vendorExtensions.x-is-jackson-optional-nullable}}
|
||||
{{^required}}
|
||||
if (this.{{name}} == null) {
|
||||
this.{{name}} = {{{defaultValue}}};
|
||||
}
|
||||
{{/required}}
|
||||
this.{{name}}.add({{name}}Item);
|
||||
return this;
|
||||
{{/vendorExtensions.x-is-jackson-optional-nullable}}
|
||||
}
|
||||
{{/isArray}}
|
||||
{{#isMap}}
|
||||
|
||||
public {{classname}} put{{nameInCamelCase}}Item(String key, {{{items.datatypeWithEnum}}} {{name}}Item) {
|
||||
{{#vendorExtensions.x-is-jackson-optional-nullable}}
|
||||
if (this.{{name}} == null || !this.{{name}}.isPresent()) {
|
||||
this.{{name}} = JsonNullable.<{{{datatypeWithEnum}}}>of({{{defaultValue}}});
|
||||
}
|
||||
try {
|
||||
this.{{name}}.get().put(key, {{name}}Item);
|
||||
} catch (java.util.NoSuchElementException e) {
|
||||
// this can never happen, as we make sure above that the value is present
|
||||
}
|
||||
return this;
|
||||
{{/vendorExtensions.x-is-jackson-optional-nullable}}
|
||||
{{^vendorExtensions.x-is-jackson-optional-nullable}}
|
||||
{{^required}}
|
||||
if (this.{{name}} == null) {
|
||||
this.{{name}} = {{{defaultValue}}};
|
||||
}
|
||||
{{/required}}
|
||||
this.{{name}}.put(key, {{name}}Item);
|
||||
return this;
|
||||
{{/vendorExtensions.x-is-jackson-optional-nullable}}
|
||||
}
|
||||
{{/isMap}}
|
||||
|
||||
{{/isReadOnly}}
|
||||
/**
|
||||
{{#description}}
|
||||
* {{.}}
|
||||
{{/description}}
|
||||
{{^description}}
|
||||
* Get {{name}}
|
||||
{{/description}}
|
||||
{{#minimum}}
|
||||
* minimum: {{.}}
|
||||
{{/minimum}}
|
||||
{{#maximum}}
|
||||
* maximum: {{.}}
|
||||
{{/maximum}}
|
||||
* @return {{name}}
|
||||
{{#deprecated}}
|
||||
* @deprecated
|
||||
{{/deprecated}}
|
||||
**/
|
||||
{{#deprecated}}
|
||||
@Deprecated
|
||||
{{/deprecated}}
|
||||
{{#required}}
|
||||
{{#isNullable}}
|
||||
@jakarta.annotation.Nullable
|
||||
{{/isNullable}}
|
||||
{{^isNullable}}
|
||||
@jakarta.annotation.Nonnull
|
||||
{{/isNullable}}
|
||||
{{/required}}
|
||||
{{^required}}
|
||||
@jakarta.annotation.Nullable
|
||||
{{/required}}
|
||||
{{#useBeanValidation}}{{>beanValidation}}{{/useBeanValidation}} @ApiModelProperty({{#example}}example = "{{{.}}}", {{/example}}{{#required}}required = {{required}}, {{/required}}value = "{{{description}}}")
|
||||
{{#vendorExtensions.x-extra-annotation}}
|
||||
{{{vendorExtensions.x-extra-annotation}}}
|
||||
{{/vendorExtensions.x-extra-annotation}}
|
||||
{{#vendorExtensions.x-is-jackson-optional-nullable}}
|
||||
{{!unannotated, Jackson would pick this up automatically and add it *in addition* to the _JsonNullable getter field}}
|
||||
@JsonIgnore
|
||||
{{/vendorExtensions.x-is-jackson-optional-nullable}}
|
||||
{{^vendorExtensions.x-is-jackson-optional-nullable}}{{#jackson}}{{> jackson_annotations}}{{/jackson}}{{/vendorExtensions.x-is-jackson-optional-nullable}}
|
||||
public {{{datatypeWithEnum}}} {{getter}}() {
|
||||
{{#vendorExtensions.x-is-jackson-optional-nullable}}
|
||||
{{#isReadOnly}}{{! A readonly attribute doesn't have setter => jackson will set null directly if explicitly returned by API, so make sure we have an empty JsonNullable}}
|
||||
if ({{name}} == null) {
|
||||
{{name}} = JsonNullable.<{{{datatypeWithEnum}}}>{{#defaultValue}}of({{{.}}}){{/defaultValue}}{{^defaultValue}}undefined(){{/defaultValue}};
|
||||
}
|
||||
{{/isReadOnly}}
|
||||
return {{name}}.orElse(null);
|
||||
{{/vendorExtensions.x-is-jackson-optional-nullable}}
|
||||
{{^vendorExtensions.x-is-jackson-optional-nullable}}
|
||||
return {{name}};
|
||||
{{/vendorExtensions.x-is-jackson-optional-nullable}}
|
||||
}
|
||||
|
||||
{{#vendorExtensions.x-is-jackson-optional-nullable}}
|
||||
{{> jackson_annotations}}
|
||||
public JsonNullable<{{{datatypeWithEnum}}}> {{getter}}_JsonNullable() {
|
||||
return {{name}};
|
||||
}
|
||||
{{/vendorExtensions.x-is-jackson-optional-nullable}}{{#vendorExtensions.x-is-jackson-optional-nullable}}
|
||||
@JsonProperty(JSON_PROPERTY_{{nameInSnakeCase}})
|
||||
{{#isReadOnly}}private{{/isReadOnly}}{{^isReadOnly}}public{{/isReadOnly}} void {{setter}}_JsonNullable(JsonNullable<{{{datatypeWithEnum}}}> {{name}}) {
|
||||
{{! For getters/setters that have name differing from attribute name, we must include setter (albeit private) for jackson to be able to set the attribute}}
|
||||
this.{{name}} = {{name}};
|
||||
}
|
||||
{{/vendorExtensions.x-is-jackson-optional-nullable}}
|
||||
|
||||
{{^isReadOnly}}
|
||||
{{#vendorExtensions.x-setter-extra-annotation}} {{{vendorExtensions.x-setter-extra-annotation}}}
|
||||
{{/vendorExtensions.x-setter-extra-annotation}}{{#jackson}}{{^vendorExtensions.x-is-jackson-optional-nullable}}{{> jackson_annotations}}{{/vendorExtensions.x-is-jackson-optional-nullable}}{{/jackson}} public void {{setter}}({{{datatypeWithEnum}}} {{name}}) {
|
||||
{{#vendorExtensions.x-enum-as-string}}
|
||||
if (!{{{nameInSnakeCase}}}_VALUES.contains({{name}})) {
|
||||
throw new IllegalArgumentException({{name}} + " is invalid. Possible values for {{name}}: " + String.join(", ", {{{nameInSnakeCase}}}_VALUES));
|
||||
}
|
||||
|
||||
{{/vendorExtensions.x-enum-as-string}}
|
||||
{{#vendorExtensions.x-is-jackson-optional-nullable}}
|
||||
this.{{name}} = JsonNullable.<{{{datatypeWithEnum}}}>of({{name}});
|
||||
{{/vendorExtensions.x-is-jackson-optional-nullable}}
|
||||
{{^vendorExtensions.x-is-jackson-optional-nullable}}
|
||||
this.{{name}} = {{name}};
|
||||
{{/vendorExtensions.x-is-jackson-optional-nullable}}
|
||||
}
|
||||
{{/isReadOnly}}
|
||||
|
||||
{{/vars}}
|
||||
{{>libraries/jersey2/additional_properties}}
|
||||
/**
|
||||
* Return true if this {{name}} object is equal to o.
|
||||
*/
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
{{#useReflectionEqualsHashCode}}
|
||||
return EqualsBuilder.reflectionEquals(this, o, false, null, true);
|
||||
{{/useReflectionEqualsHashCode}}
|
||||
{{^useReflectionEqualsHashCode}}
|
||||
if (this == o) {
|
||||
return true;
|
||||
}
|
||||
if (o == null || getClass() != o.getClass()) {
|
||||
return false;
|
||||
}{{#hasVars}}
|
||||
{{classname}} {{classVarName}} = ({{classname}}) o;
|
||||
return {{#vars}}{{#vendorExtensions.x-is-jackson-optional-nullable}}equalsNullable(this.{{name}}, {{classVarName}}.{{name}}){{/vendorExtensions.x-is-jackson-optional-nullable}}{{^vendorExtensions.x-is-jackson-optional-nullable}}{{#isByteArray}}Arrays{{/isByteArray}}{{^isByteArray}}Objects{{/isByteArray}}.equals(this.{{name}}, {{classVarName}}.{{name}}){{/vendorExtensions.x-is-jackson-optional-nullable}}{{^-last}} &&
|
||||
{{/-last}}{{/vars}}{{#additionalPropertiesType}}&&
|
||||
Objects.equals(this.additionalProperties, {{classVarName}}.additionalProperties){{/additionalPropertiesType}}{{#parent}} &&
|
||||
super.equals(o){{/parent}};{{/hasVars}}{{^hasVars}}
|
||||
return {{#parent}}super.equals(o){{/parent}}{{^parent}}true{{/parent}};{{/hasVars}}
|
||||
{{/useReflectionEqualsHashCode}}
|
||||
}{{#vendorExtensions.x-jackson-optional-nullable-helpers}}
|
||||
|
||||
private static <T> boolean equalsNullable(JsonNullable<T> a, JsonNullable<T> b) {
|
||||
return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get()));
|
||||
}{{/vendorExtensions.x-jackson-optional-nullable-helpers}}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
{{#useReflectionEqualsHashCode}}
|
||||
return HashCodeBuilder.reflectionHashCode(this);
|
||||
{{/useReflectionEqualsHashCode}}
|
||||
{{^useReflectionEqualsHashCode}}
|
||||
return Objects.hash({{#vars}}{{#vendorExtensions.x-is-jackson-optional-nullable}}hashCodeNullable({{name}}){{/vendorExtensions.x-is-jackson-optional-nullable}}{{^vendorExtensions.x-is-jackson-optional-nullable}}{{^isByteArray}}{{name}}{{/isByteArray}}{{#isByteArray}}Arrays.hashCode({{name}}){{/isByteArray}}{{/vendorExtensions.x-is-jackson-optional-nullable}}{{^-last}}, {{/-last}}{{/vars}}{{#parent}}{{#hasVars}}, {{/hasVars}}super.hashCode(){{/parent}}{{#additionalPropertiesType}}{{#hasVars}}, {{/hasVars}}{{^hasVars}}{{#parent}}, {{/parent}}{{/hasVars}}additionalProperties{{/additionalPropertiesType}});
|
||||
{{/useReflectionEqualsHashCode}}
|
||||
}{{#vendorExtensions.x-jackson-optional-nullable-helpers}}
|
||||
|
||||
private static <T> int hashCodeNullable(JsonNullable<T> a) {
|
||||
if (a == null) {
|
||||
return 1;
|
||||
}
|
||||
return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31;
|
||||
}{{/vendorExtensions.x-jackson-optional-nullable-helpers}}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("class {{classname}} {\n");
|
||||
{{#parent}}
|
||||
sb.append(" ").append(toIndentedString(super.toString())).append("\n");
|
||||
{{/parent}}
|
||||
{{#vars}}
|
||||
sb.append(" {{name}}: ").append(toIndentedString({{name}})).append("\n");
|
||||
{{/vars}}
|
||||
{{#additionalPropertiesType}}
|
||||
sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n");
|
||||
{{/additionalPropertiesType}}
|
||||
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 ");
|
||||
}
|
||||
|
||||
{{#parcelableModel}}
|
||||
|
||||
public void writeToParcel(Parcel out, int flags) {
|
||||
{{#model}}
|
||||
{{#isArray}}
|
||||
out.writeList(this);
|
||||
{{/isArray}}
|
||||
{{^isArray}}
|
||||
{{#parent}}
|
||||
super.writeToParcel(out, flags);
|
||||
{{/parent}}
|
||||
{{#vars}}
|
||||
out.writeValue({{name}});
|
||||
{{/vars}}
|
||||
{{/isArray}}
|
||||
{{/model}}
|
||||
}
|
||||
|
||||
{{classname}}(Parcel in) {
|
||||
{{#isArray}}
|
||||
in.readTypedList(this, {{arrayModelType}}.CREATOR);
|
||||
{{/isArray}}
|
||||
{{^isArray}}
|
||||
{{#parent}}
|
||||
super(in);
|
||||
{{/parent}}
|
||||
{{#vars}}
|
||||
{{#isPrimitiveType}}
|
||||
{{name}} = ({{{datatypeWithEnum}}})in.readValue(null);
|
||||
{{/isPrimitiveType}}
|
||||
{{^isPrimitiveType}}
|
||||
{{name}} = ({{{datatypeWithEnum}}})in.readValue({{complexType}}.class.getClassLoader());
|
||||
{{/isPrimitiveType}}
|
||||
{{/vars}}
|
||||
{{/isArray}}
|
||||
}
|
||||
|
||||
public int describeContents() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
public static final Parcelable.Creator<{{classname}}> CREATOR = new Parcelable.Creator<{{classname}}>() {
|
||||
public {{classname}} createFromParcel(Parcel in) {
|
||||
{{#model}}
|
||||
{{#isArray}}
|
||||
{{classname}} result = new {{classname}}();
|
||||
result.addAll(in.readArrayList({{arrayModelType}}.class.getClassLoader()));
|
||||
return result;
|
||||
{{/isArray}}
|
||||
{{^isArray}}
|
||||
return new {{classname}}(in);
|
||||
{{/isArray}}
|
||||
{{/model}}
|
||||
}
|
||||
public {{classname}}[] newArray(int size) {
|
||||
return new {{classname}}[size];
|
||||
}
|
||||
};
|
||||
{{/parcelableModel}}
|
||||
{{#discriminator}}
|
||||
static {
|
||||
// Initialize and register the discriminator mappings.
|
||||
Map<String, Class<?>> mappings = new HashMap<String, Class<?>>();
|
||||
{{#mappedModels}}
|
||||
mappings.put("{{mappingName}}", {{modelName}}.class);
|
||||
{{/mappedModels}}
|
||||
mappings.put("{{name}}", {{classname}}.class);
|
||||
JSON.registerDiscriminator({{classname}}.class, "{{propertyBaseName}}", mappings);
|
||||
}
|
||||
{{/discriminator}}
|
||||
}
|
||||
401
modules/openapi-generator/src/main/resources/Java/libraries/jersey3/pom.mustache
vendored
Normal file
401
modules/openapi-generator/src/main/resources/Java/libraries/jersey3/pom.mustache
vendored
Normal file
@@ -0,0 +1,401 @@
|
||||
<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>{{groupId}}</groupId>
|
||||
<artifactId>{{artifactId}}</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
<name>{{artifactId}}</name>
|
||||
<version>{{artifactVersion}}</version>
|
||||
<url>{{artifactUrl}}</url>
|
||||
<description>{{artifactDescription}}</description>
|
||||
<scm>
|
||||
<connection>{{scmConnection}}</connection>
|
||||
<developerConnection>{{scmDeveloperConnection}}</developerConnection>
|
||||
<url>{{scmUrl}}</url>
|
||||
</scm>
|
||||
{{#parentOverridden}}
|
||||
<parent>
|
||||
<groupId>{{{parentGroupId}}}</groupId>
|
||||
<artifactId>{{{parentArtifactId}}}</artifactId>
|
||||
<version>{{{parentVersion}}}</version>
|
||||
</parent>
|
||||
{{/parentOverridden}}
|
||||
|
||||
<licenses>
|
||||
<license>
|
||||
<name>{{licenseName}}</name>
|
||||
<url>{{licenseUrl}}</url>
|
||||
<distribution>repo</distribution>
|
||||
</license>
|
||||
</licenses>
|
||||
|
||||
<developers>
|
||||
<developer>
|
||||
<name>{{developerName}}</name>
|
||||
<email>{{developerEmail}}</email>
|
||||
<organization>{{developerOrganization}}</organization>
|
||||
<organizationUrl>{{developerOrganizationUrl}}</organizationUrl>
|
||||
</developer>
|
||||
</developers>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-enforcer-plugin</artifactId>
|
||||
<version>3.0.0</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-M5</version>
|
||||
<configuration>
|
||||
<systemProperties>
|
||||
<property>
|
||||
<name>loggerPath</name>
|
||||
<value>conf/log4j.properties</value>
|
||||
</property>
|
||||
</systemProperties>
|
||||
<argLine>-Xms512m -Xmx1500m</argLine>
|
||||
<parallel>methods</parallel>
|
||||
<threadCount>10</threadCount>
|
||||
<trimStackTrace>false</trimStackTrace>
|
||||
</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>3.2.2</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<goals>
|
||||
<goal>test-jar</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
<configuration>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.codehaus.mojo</groupId>
|
||||
<artifactId>build-helper-maven-plugin</artifactId>
|
||||
<version>3.3.0</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.10.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>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>attach-javadocs</id>
|
||||
<goals>
|
||||
<goal>jar</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
<configuration>
|
||||
<doclint>none</doclint>
|
||||
<source>1.8</source>
|
||||
<tags>
|
||||
<tag>
|
||||
<name>http.response.details</name>
|
||||
<placement>a</placement>
|
||||
<head>Http Response Details:</head>
|
||||
</tag>
|
||||
</tags>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-source-plugin</artifactId>
|
||||
<version>3.2.0</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>attach-sources</id>
|
||||
<goals>
|
||||
<goal>jar-no-fork</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<!-- Use spotless plugin to automatically format code, remove unused import, etc
|
||||
To apply changes directly to the file, run `mvn spotless:apply`
|
||||
Ref: https://github.com/diffplug/spotless/tree/main/plugin-maven
|
||||
-->
|
||||
<plugin>
|
||||
<groupId>com.diffplug.spotless</groupId>
|
||||
<artifactId>spotless-maven-plugin</artifactId>
|
||||
<version>${spotless.version}</version>
|
||||
<configuration>
|
||||
<formats>
|
||||
<!-- you can define as many formats as you want, each is independent -->
|
||||
<format>
|
||||
<!-- define the files to apply to -->
|
||||
<includes>
|
||||
<include>.gitignore</include>
|
||||
</includes>
|
||||
<!-- define the steps to apply to those files -->
|
||||
<trimTrailingWhitespace/>
|
||||
<endWithNewline/>
|
||||
<indent>
|
||||
<spaces>true</spaces> <!-- or <tabs>true</tabs> -->
|
||||
<spacesPerTab>4</spacesPerTab> <!-- optional, default is 4 -->
|
||||
</indent>
|
||||
</format>
|
||||
</formats>
|
||||
<!-- define a language-specific format -->
|
||||
<java>
|
||||
<!-- no need to specify files, inferred automatically, but you can if you want -->
|
||||
|
||||
<!-- apply a specific flavor of google-java-format and reflow long strings -->
|
||||
<googleJavaFormat>
|
||||
<version>1.8</version>
|
||||
<style>AOSP</style>
|
||||
<reflowLongStrings>true</reflowLongStrings>
|
||||
</googleJavaFormat>
|
||||
<removeUnusedImports/>
|
||||
<importOrder/>
|
||||
</java>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
<profiles>
|
||||
<profile>
|
||||
<id>sign-artifacts</id>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-gpg-plugin</artifactId>
|
||||
<version>3.0.1</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>sign-artifacts</id>
|
||||
<phase>verify</phase>
|
||||
<goals>
|
||||
<goal>sign</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</profile>
|
||||
</profiles>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>io.swagger</groupId>
|
||||
<artifactId>swagger-annotations</artifactId>
|
||||
<version>${swagger-annotations-version}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- @Nullable annotation -->
|
||||
<dependency>
|
||||
<groupId>com.google.code.findbugs</groupId>
|
||||
<artifactId>jsr305</artifactId>
|
||||
<version>3.0.2</version>
|
||||
</dependency>
|
||||
|
||||
<!-- HTTP client: jersey-client -->
|
||||
<dependency>
|
||||
<groupId>org.glassfish.jersey.core</groupId>
|
||||
<artifactId>jersey-client</artifactId>
|
||||
<version>${jersey-version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.glassfish.jersey.inject</groupId>
|
||||
<artifactId>jersey-hk2</artifactId>
|
||||
<version>${jersey-version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.glassfish.jersey.media</groupId>
|
||||
<artifactId>jersey-media-multipart</artifactId>
|
||||
<version>${jersey-version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.glassfish.jersey.media</groupId>
|
||||
<artifactId>jersey-media-json-jackson</artifactId>
|
||||
<version>${jersey-version}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- JSON processing: jackson -->
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.core</groupId>
|
||||
<artifactId>jackson-core</artifactId>
|
||||
<version>${jackson-version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.core</groupId>
|
||||
<artifactId>jackson-annotations</artifactId>
|
||||
<version>${jackson-version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.core</groupId>
|
||||
<artifactId>jackson-databind</artifactId>
|
||||
<version>${jackson-databind-version}</version>
|
||||
</dependency>
|
||||
{{#openApiNullable}}
|
||||
<dependency>
|
||||
<groupId>org.openapitools</groupId>
|
||||
<artifactId>jackson-databind-nullable</artifactId>
|
||||
<version>${jackson-databind-nullable-version}</version>
|
||||
</dependency>
|
||||
{{/openApiNullable}}
|
||||
{{#withXml}}
|
||||
<!-- XML processing: JAXB -->
|
||||
<dependency>
|
||||
<groupId>org.glassfish.jersey.media</groupId>
|
||||
<artifactId>jersey-media-jaxb</artifactId>
|
||||
<version>${jersey-version}</version>
|
||||
</dependency>
|
||||
{{/withXml}}
|
||||
{{#joda}}
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.datatype</groupId>
|
||||
<artifactId>jackson-datatype-joda</artifactId>
|
||||
<version>${jackson-version}</version>
|
||||
</dependency>
|
||||
{{/joda}}
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.datatype</groupId>
|
||||
<artifactId>jackson-datatype-jsr310</artifactId>
|
||||
<version>${jackson-version}</version>
|
||||
</dependency>
|
||||
{{#hasHttpSignatureMethods}}
|
||||
<dependency>
|
||||
<groupId>org.tomitribe</groupId>
|
||||
<artifactId>tomitribe-http-signatures</artifactId>
|
||||
<version>${http-signature-version}</version>
|
||||
</dependency>
|
||||
{{/hasHttpSignatureMethods}}
|
||||
{{#hasOAuthMethods}}
|
||||
<dependency>
|
||||
<groupId>com.github.scribejava</groupId>
|
||||
<artifactId>scribejava-apis</artifactId>
|
||||
<version>${scribejava-apis-version}</version>
|
||||
</dependency>
|
||||
{{/hasOAuthMethods}}
|
||||
{{#useBeanValidation}}
|
||||
<!-- Bean Validation API support -->
|
||||
<dependency>
|
||||
<groupId>jakarta.validation</groupId>
|
||||
<artifactId>jakarta.validation-api</artifactId>
|
||||
<version>${beanvalidation-version}</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
{{/useBeanValidation}}
|
||||
<dependency>
|
||||
<groupId>jakarta.annotation</groupId>
|
||||
<artifactId>jakarta.annotation-api</artifactId>
|
||||
<version>${jakarta-annotation-version}</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.glassfish.jersey.connectors</groupId>
|
||||
<artifactId>jersey-apache-connector</artifactId>
|
||||
<version>${jersey-version}</version>
|
||||
</dependency>
|
||||
<!-- test dependencies -->
|
||||
<dependency>
|
||||
<groupId>org.junit.jupiter</groupId>
|
||||
<artifactId>junit-jupiter-api</artifactId>
|
||||
<version>${junit-version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<swagger-annotations-version>1.6.5</swagger-annotations-version>
|
||||
<jersey-version>3.0.4</jersey-version>
|
||||
<jackson-version>2.13.2</jackson-version>
|
||||
<jackson-databind-version>2.13.2</jackson-databind-version>
|
||||
<jackson-databind-nullable-version>0.2.2</jackson-databind-nullable-version>
|
||||
<jakarta-annotation-version>2.1.0</jakarta-annotation-version>
|
||||
{{#useBeanValidation}}
|
||||
<beanvalidation-version>2.0.2</beanvalidation-version>
|
||||
{{/useBeanValidation}}
|
||||
<junit-version>5.8.2</junit-version>
|
||||
{{#hasHttpSignatureMethods}}
|
||||
<http-signature-version>1.7</http-signature-version>
|
||||
{{/hasHttpSignatureMethods}}
|
||||
{{#hasOAuthMethods}}
|
||||
<scribejava-apis-version>8.3.1</scribejava-apis-version>
|
||||
{{/hasOAuthMethods}}
|
||||
<spotless.version>2.21.0</spotless.version>
|
||||
</properties>
|
||||
</project>
|
||||
1
pom.xml
1
pom.xml
@@ -1250,6 +1250,7 @@
|
||||
<module>samples/client/petstore/clojure</module>
|
||||
<module>samples/client/petstore/java/jersey2-java8</module>
|
||||
<module>samples/openapi3/client/petstore/java/jersey2-java8</module>
|
||||
<module>samples/client/petstore/java/jersey3</module>
|
||||
<module>samples/client/others/java/okhttp-gson-streaming</module>
|
||||
<module>samples/client/petstore/java/okhttp-gson</module>
|
||||
</modules>
|
||||
|
||||
30
samples/client/petstore/java/jersey3/.github/workflows/maven.yml
vendored
Normal file
30
samples/client/petstore/java/jersey3/.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 OpenAPI Petstore
|
||||
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/petstore/java/jersey3/.gitignore
vendored
Normal file
21
samples/client/petstore/java/jersey3/.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,4 @@
|
||||
# OpenAPI Generator Ignore
|
||||
# These are "live" test files which should not be overwritten
|
||||
src/test/java/org/openapitools/client/JSONTest.java
|
||||
src/test/java/org/openapitools/client/JSONComposedSchemaTest.java
|
||||
201
samples/client/petstore/java/jersey3/.openapi-generator/FILES
Normal file
201
samples/client/petstore/java/jersey3/.openapi-generator/FILES
Normal file
@@ -0,0 +1,201 @@
|
||||
.github/workflows/maven.yml
|
||||
.gitignore
|
||||
.travis.yml
|
||||
README.md
|
||||
api/openapi.yaml
|
||||
build.gradle
|
||||
build.sbt
|
||||
docs/AdditionalPropertiesClass.md
|
||||
docs/Animal.md
|
||||
docs/AnotherFakeApi.md
|
||||
docs/Apple.md
|
||||
docs/AppleReq.md
|
||||
docs/ArrayOfArrayOfNumberOnly.md
|
||||
docs/ArrayOfNumberOnly.md
|
||||
docs/ArrayTest.md
|
||||
docs/Banana.md
|
||||
docs/BananaReq.md
|
||||
docs/BasquePig.md
|
||||
docs/Capitalization.md
|
||||
docs/Cat.md
|
||||
docs/CatAllOf.md
|
||||
docs/Category.md
|
||||
docs/ChildCat.md
|
||||
docs/ChildCatAllOf.md
|
||||
docs/ClassModel.md
|
||||
docs/Client.md
|
||||
docs/ComplexQuadrilateral.md
|
||||
docs/DanishPig.md
|
||||
docs/DefaultApi.md
|
||||
docs/DeprecatedObject.md
|
||||
docs/Dog.md
|
||||
docs/DogAllOf.md
|
||||
docs/Drawing.md
|
||||
docs/EnumArrays.md
|
||||
docs/EnumClass.md
|
||||
docs/EnumTest.md
|
||||
docs/EquilateralTriangle.md
|
||||
docs/FakeApi.md
|
||||
docs/FakeClassnameTags123Api.md
|
||||
docs/FileSchemaTestClass.md
|
||||
docs/Foo.md
|
||||
docs/FormatTest.md
|
||||
docs/Fruit.md
|
||||
docs/FruitReq.md
|
||||
docs/GmFruit.md
|
||||
docs/GrandparentAnimal.md
|
||||
docs/HasOnlyReadOnly.md
|
||||
docs/HealthCheckResult.md
|
||||
docs/InlineResponseDefault.md
|
||||
docs/IsoscelesTriangle.md
|
||||
docs/Mammal.md
|
||||
docs/MapTest.md
|
||||
docs/MixedPropertiesAndAdditionalPropertiesClass.md
|
||||
docs/Model200Response.md
|
||||
docs/ModelApiResponse.md
|
||||
docs/ModelFile.md
|
||||
docs/ModelList.md
|
||||
docs/ModelReturn.md
|
||||
docs/Name.md
|
||||
docs/NullableClass.md
|
||||
docs/NullableShape.md
|
||||
docs/NumberOnly.md
|
||||
docs/ObjectWithDeprecatedFields.md
|
||||
docs/Order.md
|
||||
docs/OuterComposite.md
|
||||
docs/OuterEnum.md
|
||||
docs/OuterEnumDefaultValue.md
|
||||
docs/OuterEnumInteger.md
|
||||
docs/OuterEnumIntegerDefaultValue.md
|
||||
docs/ParentPet.md
|
||||
docs/Pet.md
|
||||
docs/PetApi.md
|
||||
docs/Pig.md
|
||||
docs/Quadrilateral.md
|
||||
docs/QuadrilateralInterface.md
|
||||
docs/ReadOnlyFirst.md
|
||||
docs/ScaleneTriangle.md
|
||||
docs/Shape.md
|
||||
docs/ShapeInterface.md
|
||||
docs/ShapeOrNull.md
|
||||
docs/SimpleQuadrilateral.md
|
||||
docs/SpecialModelName.md
|
||||
docs/StoreApi.md
|
||||
docs/Tag.md
|
||||
docs/Triangle.md
|
||||
docs/TriangleInterface.md
|
||||
docs/User.md
|
||||
docs/UserApi.md
|
||||
docs/Whale.md
|
||||
docs/Zebra.md
|
||||
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/ApiException.java
|
||||
src/main/java/org/openapitools/client/ApiResponse.java
|
||||
src/main/java/org/openapitools/client/Configuration.java
|
||||
src/main/java/org/openapitools/client/JSON.java
|
||||
src/main/java/org/openapitools/client/JavaTimeFormatter.java
|
||||
src/main/java/org/openapitools/client/Pair.java
|
||||
src/main/java/org/openapitools/client/RFC3339DateFormat.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/AnotherFakeApi.java
|
||||
src/main/java/org/openapitools/client/api/DefaultApi.java
|
||||
src/main/java/org/openapitools/client/api/FakeApi.java
|
||||
src/main/java/org/openapitools/client/api/FakeClassnameTags123Api.java
|
||||
src/main/java/org/openapitools/client/api/PetApi.java
|
||||
src/main/java/org/openapitools/client/api/StoreApi.java
|
||||
src/main/java/org/openapitools/client/api/UserApi.java
|
||||
src/main/java/org/openapitools/client/auth/ApiKeyAuth.java
|
||||
src/main/java/org/openapitools/client/auth/Authentication.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/auth/HttpSignatureAuth.java
|
||||
src/main/java/org/openapitools/client/auth/OAuth.java
|
||||
src/main/java/org/openapitools/client/auth/OAuthFlow.java
|
||||
src/main/java/org/openapitools/client/model/AbstractOpenApiSchema.java
|
||||
src/main/java/org/openapitools/client/model/AdditionalPropertiesClass.java
|
||||
src/main/java/org/openapitools/client/model/Animal.java
|
||||
src/main/java/org/openapitools/client/model/Apple.java
|
||||
src/main/java/org/openapitools/client/model/AppleReq.java
|
||||
src/main/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnly.java
|
||||
src/main/java/org/openapitools/client/model/ArrayOfNumberOnly.java
|
||||
src/main/java/org/openapitools/client/model/ArrayTest.java
|
||||
src/main/java/org/openapitools/client/model/Banana.java
|
||||
src/main/java/org/openapitools/client/model/BananaReq.java
|
||||
src/main/java/org/openapitools/client/model/BasquePig.java
|
||||
src/main/java/org/openapitools/client/model/Capitalization.java
|
||||
src/main/java/org/openapitools/client/model/Cat.java
|
||||
src/main/java/org/openapitools/client/model/CatAllOf.java
|
||||
src/main/java/org/openapitools/client/model/Category.java
|
||||
src/main/java/org/openapitools/client/model/ChildCat.java
|
||||
src/main/java/org/openapitools/client/model/ChildCatAllOf.java
|
||||
src/main/java/org/openapitools/client/model/ClassModel.java
|
||||
src/main/java/org/openapitools/client/model/Client.java
|
||||
src/main/java/org/openapitools/client/model/ComplexQuadrilateral.java
|
||||
src/main/java/org/openapitools/client/model/DanishPig.java
|
||||
src/main/java/org/openapitools/client/model/DeprecatedObject.java
|
||||
src/main/java/org/openapitools/client/model/Dog.java
|
||||
src/main/java/org/openapitools/client/model/DogAllOf.java
|
||||
src/main/java/org/openapitools/client/model/Drawing.java
|
||||
src/main/java/org/openapitools/client/model/EnumArrays.java
|
||||
src/main/java/org/openapitools/client/model/EnumClass.java
|
||||
src/main/java/org/openapitools/client/model/EnumTest.java
|
||||
src/main/java/org/openapitools/client/model/EquilateralTriangle.java
|
||||
src/main/java/org/openapitools/client/model/FileSchemaTestClass.java
|
||||
src/main/java/org/openapitools/client/model/Foo.java
|
||||
src/main/java/org/openapitools/client/model/FormatTest.java
|
||||
src/main/java/org/openapitools/client/model/Fruit.java
|
||||
src/main/java/org/openapitools/client/model/FruitReq.java
|
||||
src/main/java/org/openapitools/client/model/GmFruit.java
|
||||
src/main/java/org/openapitools/client/model/GrandparentAnimal.java
|
||||
src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java
|
||||
src/main/java/org/openapitools/client/model/HealthCheckResult.java
|
||||
src/main/java/org/openapitools/client/model/InlineResponseDefault.java
|
||||
src/main/java/org/openapitools/client/model/IsoscelesTriangle.java
|
||||
src/main/java/org/openapitools/client/model/Mammal.java
|
||||
src/main/java/org/openapitools/client/model/MapTest.java
|
||||
src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java
|
||||
src/main/java/org/openapitools/client/model/Model200Response.java
|
||||
src/main/java/org/openapitools/client/model/ModelApiResponse.java
|
||||
src/main/java/org/openapitools/client/model/ModelFile.java
|
||||
src/main/java/org/openapitools/client/model/ModelList.java
|
||||
src/main/java/org/openapitools/client/model/ModelReturn.java
|
||||
src/main/java/org/openapitools/client/model/Name.java
|
||||
src/main/java/org/openapitools/client/model/NullableClass.java
|
||||
src/main/java/org/openapitools/client/model/NullableShape.java
|
||||
src/main/java/org/openapitools/client/model/NumberOnly.java
|
||||
src/main/java/org/openapitools/client/model/ObjectWithDeprecatedFields.java
|
||||
src/main/java/org/openapitools/client/model/Order.java
|
||||
src/main/java/org/openapitools/client/model/OuterComposite.java
|
||||
src/main/java/org/openapitools/client/model/OuterEnum.java
|
||||
src/main/java/org/openapitools/client/model/OuterEnumDefaultValue.java
|
||||
src/main/java/org/openapitools/client/model/OuterEnumInteger.java
|
||||
src/main/java/org/openapitools/client/model/OuterEnumIntegerDefaultValue.java
|
||||
src/main/java/org/openapitools/client/model/ParentPet.java
|
||||
src/main/java/org/openapitools/client/model/Pet.java
|
||||
src/main/java/org/openapitools/client/model/Pig.java
|
||||
src/main/java/org/openapitools/client/model/Quadrilateral.java
|
||||
src/main/java/org/openapitools/client/model/QuadrilateralInterface.java
|
||||
src/main/java/org/openapitools/client/model/ReadOnlyFirst.java
|
||||
src/main/java/org/openapitools/client/model/ScaleneTriangle.java
|
||||
src/main/java/org/openapitools/client/model/Shape.java
|
||||
src/main/java/org/openapitools/client/model/ShapeInterface.java
|
||||
src/main/java/org/openapitools/client/model/ShapeOrNull.java
|
||||
src/main/java/org/openapitools/client/model/SimpleQuadrilateral.java
|
||||
src/main/java/org/openapitools/client/model/SpecialModelName.java
|
||||
src/main/java/org/openapitools/client/model/Tag.java
|
||||
src/main/java/org/openapitools/client/model/Triangle.java
|
||||
src/main/java/org/openapitools/client/model/TriangleInterface.java
|
||||
src/main/java/org/openapitools/client/model/User.java
|
||||
src/main/java/org/openapitools/client/model/Whale.java
|
||||
src/main/java/org/openapitools/client/model/Zebra.java
|
||||
@@ -0,0 +1 @@
|
||||
6.0.0-SNAPSHOT
|
||||
22
samples/client/petstore/java/jersey3/.travis.yml
Normal file
22
samples/client/petstore/java/jersey3/.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
|
||||
287
samples/client/petstore/java/jersey3/README.md
Normal file
287
samples/client/petstore/java/jersey3/README.md
Normal file
@@ -0,0 +1,287 @@
|
||||
# petstore-jersey3
|
||||
|
||||
OpenAPI Petstore
|
||||
|
||||
- API version: 1.0.0
|
||||
|
||||
This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||
|
||||
|
||||
*Automatically generated by the [OpenAPI Generator](https://openapi-generator.tech)*
|
||||
|
||||
## Requirements
|
||||
|
||||
Building the API client library requires:
|
||||
|
||||
1. Java 1.8+
|
||||
2. Maven/Gradle
|
||||
|
||||
## Installation
|
||||
|
||||
To install the API client library to your local Maven repository, simply execute:
|
||||
|
||||
```shell
|
||||
mvn clean install
|
||||
```
|
||||
|
||||
To deploy it to a remote Maven repository instead, configure the settings of the repository and execute:
|
||||
|
||||
```shell
|
||||
mvn clean deploy
|
||||
```
|
||||
|
||||
Refer to the [OSSRH Guide](http://central.sonatype.org/pages/ossrh-guide.html) for more information.
|
||||
|
||||
### Maven users
|
||||
|
||||
Add this dependency to your project's POM:
|
||||
|
||||
```xml
|
||||
<dependency>
|
||||
<groupId>org.openapitools</groupId>
|
||||
<artifactId>petstore-jersey3</artifactId>
|
||||
<version>1.0.0</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
```
|
||||
|
||||
### Gradle users
|
||||
|
||||
Add this dependency to your project's build file:
|
||||
|
||||
```groovy
|
||||
repositories {
|
||||
mavenCentral() // Needed if the 'petstore-jersey3' jar has been published to maven central.
|
||||
mavenLocal() // Needed if the 'petstore-jersey3' jar has been published to the local maven repo.
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation "org.openapitools:petstore-jersey3:1.0.0"
|
||||
}
|
||||
```
|
||||
|
||||
### Others
|
||||
|
||||
At first generate the JAR by executing:
|
||||
|
||||
```shell
|
||||
mvn clean package
|
||||
```
|
||||
|
||||
Then manually install the following JARs:
|
||||
|
||||
- `target/petstore-jersey3-1.0.0.jar`
|
||||
- `target/lib/*.jar`
|
||||
|
||||
## Getting Started
|
||||
|
||||
Please follow the [installation](#installation) instruction and execute the following Java code:
|
||||
|
||||
```java
|
||||
|
||||
import org.openapitools.client.*;
|
||||
import org.openapitools.client.auth.*;
|
||||
import org.openapitools.client.model.*;
|
||||
import org.openapitools.client.api.AnotherFakeApi;
|
||||
|
||||
public class AnotherFakeApiExample {
|
||||
|
||||
public static void main(String[] args) {
|
||||
ApiClient defaultClient = Configuration.getDefaultApiClient();
|
||||
defaultClient.setBasePath("http://petstore.swagger.io:80/v2");
|
||||
|
||||
AnotherFakeApi apiInstance = new AnotherFakeApi(defaultClient);
|
||||
Client client = new Client(); // Client | client model
|
||||
try {
|
||||
Client result = apiInstance.call123testSpecialTags(client);
|
||||
System.out.println(result);
|
||||
} catch (ApiException e) {
|
||||
System.err.println("Exception when calling AnotherFakeApi#call123testSpecialTags");
|
||||
System.err.println("Status code: " + e.getCode());
|
||||
System.err.println("Reason: " + e.getResponseBody());
|
||||
System.err.println("Response headers: " + e.getResponseHeaders());
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
```
|
||||
|
||||
## Documentation for API Endpoints
|
||||
|
||||
All URIs are relative to *http://petstore.swagger.io:80/v2*
|
||||
|
||||
Class | Method | HTTP request | Description
|
||||
------------ | ------------- | ------------- | -------------
|
||||
*AnotherFakeApi* | [**call123testSpecialTags**](docs/AnotherFakeApi.md#call123testSpecialTags) | **PATCH** /another-fake/dummy | To test special tags
|
||||
*DefaultApi* | [**fooGet**](docs/DefaultApi.md#fooGet) | **GET** /foo |
|
||||
*FakeApi* | [**fakeHealthGet**](docs/FakeApi.md#fakeHealthGet) | **GET** /fake/health | Health check endpoint
|
||||
*FakeApi* | [**fakeOuterBooleanSerialize**](docs/FakeApi.md#fakeOuterBooleanSerialize) | **POST** /fake/outer/boolean |
|
||||
*FakeApi* | [**fakeOuterCompositeSerialize**](docs/FakeApi.md#fakeOuterCompositeSerialize) | **POST** /fake/outer/composite |
|
||||
*FakeApi* | [**fakeOuterNumberSerialize**](docs/FakeApi.md#fakeOuterNumberSerialize) | **POST** /fake/outer/number |
|
||||
*FakeApi* | [**fakeOuterStringSerialize**](docs/FakeApi.md#fakeOuterStringSerialize) | **POST** /fake/outer/string |
|
||||
*FakeApi* | [**getArrayOfEnums**](docs/FakeApi.md#getArrayOfEnums) | **GET** /fake/array-of-enums | Array of Enums
|
||||
*FakeApi* | [**testBodyWithFileSchema**](docs/FakeApi.md#testBodyWithFileSchema) | **PUT** /fake/body-with-file-schema |
|
||||
*FakeApi* | [**testBodyWithQueryParams**](docs/FakeApi.md#testBodyWithQueryParams) | **PUT** /fake/body-with-query-params |
|
||||
*FakeApi* | [**testClientModel**](docs/FakeApi.md#testClientModel) | **PATCH** /fake | To test \"client\" model
|
||||
*FakeApi* | [**testEndpointParameters**](docs/FakeApi.md#testEndpointParameters) | **POST** /fake | Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
|
||||
*FakeApi* | [**testEnumParameters**](docs/FakeApi.md#testEnumParameters) | **GET** /fake | To test enum parameters
|
||||
*FakeApi* | [**testGroupParameters**](docs/FakeApi.md#testGroupParameters) | **DELETE** /fake | Fake endpoint to test group parameters (optional)
|
||||
*FakeApi* | [**testInlineAdditionalProperties**](docs/FakeApi.md#testInlineAdditionalProperties) | **POST** /fake/inline-additionalProperties | test inline additionalProperties
|
||||
*FakeApi* | [**testJsonFormData**](docs/FakeApi.md#testJsonFormData) | **GET** /fake/jsonFormData | test json serialization of form data
|
||||
*FakeApi* | [**testQueryParameterCollectionFormat**](docs/FakeApi.md#testQueryParameterCollectionFormat) | **PUT** /fake/test-query-parameters |
|
||||
*FakeClassnameTags123Api* | [**testClassname**](docs/FakeClassnameTags123Api.md#testClassname) | **PATCH** /fake_classname_test | To test class name in snake case
|
||||
*PetApi* | [**addPet**](docs/PetApi.md#addPet) | **POST** /pet | Add a new pet to the store
|
||||
*PetApi* | [**deletePet**](docs/PetApi.md#deletePet) | **DELETE** /pet/{petId} | Deletes a pet
|
||||
*PetApi* | [**findPetsByStatus**](docs/PetApi.md#findPetsByStatus) | **GET** /pet/findByStatus | Finds Pets by status
|
||||
*PetApi* | [**findPetsByTags**](docs/PetApi.md#findPetsByTags) | **GET** /pet/findByTags | Finds Pets by tags
|
||||
*PetApi* | [**getPetById**](docs/PetApi.md#getPetById) | **GET** /pet/{petId} | Find pet by ID
|
||||
*PetApi* | [**updatePet**](docs/PetApi.md#updatePet) | **PUT** /pet | Update an existing pet
|
||||
*PetApi* | [**updatePetWithForm**](docs/PetApi.md#updatePetWithForm) | **POST** /pet/{petId} | Updates a pet in the store with form data
|
||||
*PetApi* | [**uploadFile**](docs/PetApi.md#uploadFile) | **POST** /pet/{petId}/uploadImage | uploads an image
|
||||
*PetApi* | [**uploadFileWithRequiredFile**](docs/PetApi.md#uploadFileWithRequiredFile) | **POST** /fake/{petId}/uploadImageWithRequiredFile | uploads an image (required)
|
||||
*StoreApi* | [**deleteOrder**](docs/StoreApi.md#deleteOrder) | **DELETE** /store/order/{order_id} | Delete purchase order by ID
|
||||
*StoreApi* | [**getInventory**](docs/StoreApi.md#getInventory) | **GET** /store/inventory | Returns pet inventories by status
|
||||
*StoreApi* | [**getOrderById**](docs/StoreApi.md#getOrderById) | **GET** /store/order/{order_id} | Find purchase order by ID
|
||||
*StoreApi* | [**placeOrder**](docs/StoreApi.md#placeOrder) | **POST** /store/order | Place an order for a pet
|
||||
*UserApi* | [**createUser**](docs/UserApi.md#createUser) | **POST** /user | Create user
|
||||
*UserApi* | [**createUsersWithArrayInput**](docs/UserApi.md#createUsersWithArrayInput) | **POST** /user/createWithArray | Creates list of users with given input array
|
||||
*UserApi* | [**createUsersWithListInput**](docs/UserApi.md#createUsersWithListInput) | **POST** /user/createWithList | Creates list of users with given input array
|
||||
*UserApi* | [**deleteUser**](docs/UserApi.md#deleteUser) | **DELETE** /user/{username} | Delete user
|
||||
*UserApi* | [**getUserByName**](docs/UserApi.md#getUserByName) | **GET** /user/{username} | Get user by user name
|
||||
*UserApi* | [**loginUser**](docs/UserApi.md#loginUser) | **GET** /user/login | Logs user into the system
|
||||
*UserApi* | [**logoutUser**](docs/UserApi.md#logoutUser) | **GET** /user/logout | Logs out current logged in user session
|
||||
*UserApi* | [**updateUser**](docs/UserApi.md#updateUser) | **PUT** /user/{username} | Updated user
|
||||
|
||||
|
||||
## Documentation for Models
|
||||
|
||||
- [AdditionalPropertiesClass](docs/AdditionalPropertiesClass.md)
|
||||
- [Animal](docs/Animal.md)
|
||||
- [Apple](docs/Apple.md)
|
||||
- [AppleReq](docs/AppleReq.md)
|
||||
- [ArrayOfArrayOfNumberOnly](docs/ArrayOfArrayOfNumberOnly.md)
|
||||
- [ArrayOfNumberOnly](docs/ArrayOfNumberOnly.md)
|
||||
- [ArrayTest](docs/ArrayTest.md)
|
||||
- [Banana](docs/Banana.md)
|
||||
- [BananaReq](docs/BananaReq.md)
|
||||
- [BasquePig](docs/BasquePig.md)
|
||||
- [Capitalization](docs/Capitalization.md)
|
||||
- [Cat](docs/Cat.md)
|
||||
- [CatAllOf](docs/CatAllOf.md)
|
||||
- [Category](docs/Category.md)
|
||||
- [ChildCat](docs/ChildCat.md)
|
||||
- [ChildCatAllOf](docs/ChildCatAllOf.md)
|
||||
- [ClassModel](docs/ClassModel.md)
|
||||
- [Client](docs/Client.md)
|
||||
- [ComplexQuadrilateral](docs/ComplexQuadrilateral.md)
|
||||
- [DanishPig](docs/DanishPig.md)
|
||||
- [DeprecatedObject](docs/DeprecatedObject.md)
|
||||
- [Dog](docs/Dog.md)
|
||||
- [DogAllOf](docs/DogAllOf.md)
|
||||
- [Drawing](docs/Drawing.md)
|
||||
- [EnumArrays](docs/EnumArrays.md)
|
||||
- [EnumClass](docs/EnumClass.md)
|
||||
- [EnumTest](docs/EnumTest.md)
|
||||
- [EquilateralTriangle](docs/EquilateralTriangle.md)
|
||||
- [FileSchemaTestClass](docs/FileSchemaTestClass.md)
|
||||
- [Foo](docs/Foo.md)
|
||||
- [FormatTest](docs/FormatTest.md)
|
||||
- [Fruit](docs/Fruit.md)
|
||||
- [FruitReq](docs/FruitReq.md)
|
||||
- [GmFruit](docs/GmFruit.md)
|
||||
- [GrandparentAnimal](docs/GrandparentAnimal.md)
|
||||
- [HasOnlyReadOnly](docs/HasOnlyReadOnly.md)
|
||||
- [HealthCheckResult](docs/HealthCheckResult.md)
|
||||
- [InlineResponseDefault](docs/InlineResponseDefault.md)
|
||||
- [IsoscelesTriangle](docs/IsoscelesTriangle.md)
|
||||
- [Mammal](docs/Mammal.md)
|
||||
- [MapTest](docs/MapTest.md)
|
||||
- [MixedPropertiesAndAdditionalPropertiesClass](docs/MixedPropertiesAndAdditionalPropertiesClass.md)
|
||||
- [Model200Response](docs/Model200Response.md)
|
||||
- [ModelApiResponse](docs/ModelApiResponse.md)
|
||||
- [ModelFile](docs/ModelFile.md)
|
||||
- [ModelList](docs/ModelList.md)
|
||||
- [ModelReturn](docs/ModelReturn.md)
|
||||
- [Name](docs/Name.md)
|
||||
- [NullableClass](docs/NullableClass.md)
|
||||
- [NullableShape](docs/NullableShape.md)
|
||||
- [NumberOnly](docs/NumberOnly.md)
|
||||
- [ObjectWithDeprecatedFields](docs/ObjectWithDeprecatedFields.md)
|
||||
- [Order](docs/Order.md)
|
||||
- [OuterComposite](docs/OuterComposite.md)
|
||||
- [OuterEnum](docs/OuterEnum.md)
|
||||
- [OuterEnumDefaultValue](docs/OuterEnumDefaultValue.md)
|
||||
- [OuterEnumInteger](docs/OuterEnumInteger.md)
|
||||
- [OuterEnumIntegerDefaultValue](docs/OuterEnumIntegerDefaultValue.md)
|
||||
- [ParentPet](docs/ParentPet.md)
|
||||
- [Pet](docs/Pet.md)
|
||||
- [Pig](docs/Pig.md)
|
||||
- [Quadrilateral](docs/Quadrilateral.md)
|
||||
- [QuadrilateralInterface](docs/QuadrilateralInterface.md)
|
||||
- [ReadOnlyFirst](docs/ReadOnlyFirst.md)
|
||||
- [ScaleneTriangle](docs/ScaleneTriangle.md)
|
||||
- [Shape](docs/Shape.md)
|
||||
- [ShapeInterface](docs/ShapeInterface.md)
|
||||
- [ShapeOrNull](docs/ShapeOrNull.md)
|
||||
- [SimpleQuadrilateral](docs/SimpleQuadrilateral.md)
|
||||
- [SpecialModelName](docs/SpecialModelName.md)
|
||||
- [Tag](docs/Tag.md)
|
||||
- [Triangle](docs/Triangle.md)
|
||||
- [TriangleInterface](docs/TriangleInterface.md)
|
||||
- [User](docs/User.md)
|
||||
- [Whale](docs/Whale.md)
|
||||
- [Zebra](docs/Zebra.md)
|
||||
|
||||
|
||||
## Documentation for Authorization
|
||||
|
||||
Authentication schemes defined for the API:
|
||||
### api_key
|
||||
|
||||
|
||||
- **Type**: API key
|
||||
- **API key parameter name**: api_key
|
||||
- **Location**: HTTP header
|
||||
|
||||
### api_key_query
|
||||
|
||||
|
||||
- **Type**: API key
|
||||
- **API key parameter name**: api_key_query
|
||||
- **Location**: URL query string
|
||||
|
||||
### bearer_test
|
||||
|
||||
|
||||
- **Type**: HTTP basic authentication
|
||||
|
||||
### http_basic_test
|
||||
|
||||
|
||||
- **Type**: HTTP basic authentication
|
||||
|
||||
### http_signature_test
|
||||
|
||||
|
||||
- **Type**: HTTP basic authentication
|
||||
|
||||
### petstore_auth
|
||||
|
||||
|
||||
- **Type**: OAuth
|
||||
- **Flow**: implicit
|
||||
- **Authorization URL**: http://petstore.swagger.io/api/oauth/dialog
|
||||
- **Scopes**:
|
||||
- write:pets: modify pets in your account
|
||||
- read:pets: read your pets
|
||||
|
||||
|
||||
## Recommendation
|
||||
|
||||
It's recommended to create an instance of `ApiClient` per thread in a multithreaded environment to avoid any potential issues.
|
||||
|
||||
## Author
|
||||
|
||||
|
||||
|
||||
2493
samples/client/petstore/java/jersey3/api/openapi.yaml
Normal file
2493
samples/client/petstore/java/jersey3/api/openapi.yaml
Normal file
File diff suppressed because it is too large
Load Diff
162
samples/client/petstore/java/jersey3/build.gradle
Normal file
162
samples/client/petstore/java/jersey3/build.gradle
Normal file
@@ -0,0 +1,162 @@
|
||||
apply plugin: 'idea'
|
||||
apply plugin: 'eclipse'
|
||||
apply plugin: 'com.diffplug.spotless'
|
||||
|
||||
group = 'org.openapitools'
|
||||
version = '1.0.0'
|
||||
|
||||
buildscript {
|
||||
repositories {
|
||||
mavenCentral()
|
||||
}
|
||||
dependencies {
|
||||
classpath 'com.android.tools.build:gradle:2.3.+'
|
||||
classpath 'com.github.dcendents:android-maven-gradle-plugin:2.1'
|
||||
classpath 'com.diffplug.spotless:spotless-plugin-gradle:6.3.0'
|
||||
}
|
||||
}
|
||||
|
||||
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 = 'petstore-jersey3'
|
||||
|
||||
from components.java
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
task execute(type:JavaExec) {
|
||||
main = System.getProperty('mainClass')
|
||||
classpath = sourceSets.main.runtimeClasspath
|
||||
}
|
||||
}
|
||||
|
||||
ext {
|
||||
swagger_annotations_version = "1.6.5"
|
||||
jackson_version = "2.13.2"
|
||||
jackson_databind_version = "2.13.2"
|
||||
jackson_databind_nullable_version = "0.2.2"
|
||||
jakarta_annotation_version = "2.1.0"
|
||||
jersey_version = "3.0.4"
|
||||
junit_version = "5.8.2"
|
||||
scribejava_apis_version = "8.3.1"
|
||||
tomitribe_http_signatures_version = "1.7"
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation "io.swagger:swagger-annotations:$swagger_annotations_version"
|
||||
implementation "com.google.code.findbugs:jsr305:3.0.2"
|
||||
implementation "org.glassfish.jersey.core:jersey-client:$jersey_version"
|
||||
implementation "org.glassfish.jersey.inject:jersey-hk2:$jersey_version"
|
||||
implementation "org.glassfish.jersey.media:jersey-media-multipart:$jersey_version"
|
||||
implementation "org.glassfish.jersey.media:jersey-media-json-jackson:$jersey_version"
|
||||
implementation "org.glassfish.jersey.connectors:jersey-apache-connector:$jersey_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.github.scribejava:scribejava-apis:$scribejava_apis_version"
|
||||
implementation "org.tomitribe:tomitribe-http-signatures:$tomitribe_http_signatures_version"
|
||||
implementation "jakarta.annotation:jakarta.annotation-api:$jakarta_annotation_version"
|
||||
testImplementation "org.junit.jupiter:junit-jupiter-api:$junit_version"
|
||||
testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:$junit_version"
|
||||
}
|
||||
|
||||
test {
|
||||
useJUnitPlatform()
|
||||
}
|
||||
|
||||
javadoc {
|
||||
options.tags = [ "http.response.details:a:Http Response Details" ]
|
||||
}
|
||||
|
||||
// Use spotless plugin to automatically format code, remove unused import, etc
|
||||
// To apply changes directly to the file, run `gradlew spotlessApply`
|
||||
// Ref: https://github.com/diffplug/spotless/tree/main/plugin-gradle
|
||||
spotless {
|
||||
// comment out below to run spotless as part of the `check` task
|
||||
enforceCheck false
|
||||
|
||||
format 'misc', {
|
||||
// define the files (e.g. '*.gradle', '*.md') to apply `misc` to
|
||||
target '.gitignore'
|
||||
// define the steps to apply to those files
|
||||
trimTrailingWhitespace()
|
||||
indentWithSpaces() // Takes an integer argument if you don't like 4
|
||||
endWithNewline()
|
||||
}
|
||||
java {
|
||||
// don't need to set target, it is inferred from java
|
||||
// apply a specific flavor of google-java-format
|
||||
googleJavaFormat('1.8').aosp().reflowLongStrings()
|
||||
removeUnusedImports()
|
||||
importOrder()
|
||||
}
|
||||
}
|
||||
29
samples/client/petstore/java/jersey3/build.sbt
Normal file
29
samples/client/petstore/java/jersey3/build.sbt
Normal file
@@ -0,0 +1,29 @@
|
||||
lazy val root = (project in file(".")).
|
||||
settings(
|
||||
organization := "org.openapitools",
|
||||
name := "petstore-jersey3",
|
||||
version := "1.0.0",
|
||||
scalaVersion := "2.11.4",
|
||||
scalacOptions ++= Seq("-feature"),
|
||||
Compile / javacOptions ++= Seq("-Xlint:deprecation"),
|
||||
Compile / packageDoc / publishArtifact := false,
|
||||
resolvers += Resolver.mavenLocal,
|
||||
libraryDependencies ++= Seq(
|
||||
"com.google.code.findbugs" % "jsr305" % "3.0.0",
|
||||
"io.swagger" % "swagger-annotations" % "1.6.5",
|
||||
"org.glassfish.jersey.core" % "jersey-client" % "3.0.4",
|
||||
"org.glassfish.jersey.inject" % "jersey-hk2" % "3.0.4",
|
||||
"org.glassfish.jersey.media" % "jersey-media-multipart" % "3.0.4",
|
||||
"org.glassfish.jersey.media" % "jersey-media-json-jackson" % "3.0.4",
|
||||
"org.glassfish.jersey.connectors" % "jersey-apache-connector" % "3.0.4",
|
||||
"com.fasterxml.jackson.core" % "jackson-core" % "2.13.2" % "compile",
|
||||
"com.fasterxml.jackson.core" % "jackson-annotations" % "2.13.2" % "compile",
|
||||
"com.fasterxml.jackson.core" % "jackson-databind" % "2.13.2" % "compile",
|
||||
"com.fasterxml.jackson.datatype" % "jackson-datatype-jsr310" % "2.13.0" % "compile",
|
||||
"org.openapitools" % "jackson-databind-nullable" % "0.2.2" % "compile",
|
||||
"com.github.scribejava" % "scribejava-apis" % "8.3.1" % "compile",
|
||||
"org.tomitribe" % "tomitribe-http-signatures" % "1.7" % "compile",
|
||||
"jakarta.annotation" % "jakarta.annotation-api" % "2.1.0" % "compile",
|
||||
"org.junit.jupiter" % "junit-jupiter-api" % "5.8.2" % "test"
|
||||
)
|
||||
)
|
||||
@@ -0,0 +1,20 @@
|
||||
|
||||
|
||||
# AdditionalPropertiesClass
|
||||
|
||||
|
||||
## Properties
|
||||
|
||||
| Name | Type | Description | Notes |
|
||||
|------------ | ------------- | ------------- | -------------|
|
||||
|**mapProperty** | **Map<String, String>** | | [optional] |
|
||||
|**mapOfMapProperty** | **Map<String, Map<String, String>>** | | [optional] |
|
||||
|**anytype1** | **Object** | | [optional] |
|
||||
|**mapWithUndeclaredPropertiesAnytype1** | **Object** | | [optional] |
|
||||
|**mapWithUndeclaredPropertiesAnytype2** | **Object** | | [optional] |
|
||||
|**mapWithUndeclaredPropertiesAnytype3** | **Map<String, Object>** | | [optional] |
|
||||
|**emptyMap** | **Object** | an object with no declared properties and no undeclared properties, hence it's an empty map. | [optional] |
|
||||
|**mapWithUndeclaredPropertiesString** | **Map<String, String>** | | [optional] |
|
||||
|
||||
|
||||
|
||||
14
samples/client/petstore/java/jersey3/docs/Animal.md
Normal file
14
samples/client/petstore/java/jersey3/docs/Animal.md
Normal file
@@ -0,0 +1,14 @@
|
||||
|
||||
|
||||
# Animal
|
||||
|
||||
|
||||
## Properties
|
||||
|
||||
| Name | Type | Description | Notes |
|
||||
|------------ | ------------- | ------------- | -------------|
|
||||
|**className** | **String** | | |
|
||||
|**color** | **String** | | [optional] |
|
||||
|
||||
|
||||
|
||||
74
samples/client/petstore/java/jersey3/docs/AnotherFakeApi.md
Normal file
74
samples/client/petstore/java/jersey3/docs/AnotherFakeApi.md
Normal file
@@ -0,0 +1,74 @@
|
||||
# AnotherFakeApi
|
||||
|
||||
All URIs are relative to *http://petstore.swagger.io:80/v2*
|
||||
|
||||
| Method | HTTP request | Description |
|
||||
|------------- | ------------- | -------------|
|
||||
| [**call123testSpecialTags**](AnotherFakeApi.md#call123testSpecialTags) | **PATCH** /another-fake/dummy | To test special tags |
|
||||
|
||||
|
||||
|
||||
## call123testSpecialTags
|
||||
|
||||
> Client call123testSpecialTags(client)
|
||||
|
||||
To test special tags
|
||||
|
||||
To test special tags and operation ID starting with number
|
||||
|
||||
### Example
|
||||
|
||||
```java
|
||||
// Import classes:
|
||||
import org.openapitools.client.ApiClient;
|
||||
import org.openapitools.client.ApiException;
|
||||
import org.openapitools.client.Configuration;
|
||||
import org.openapitools.client.model.*;
|
||||
import org.openapitools.client.api.AnotherFakeApi;
|
||||
|
||||
public class Example {
|
||||
public static void main(String[] args) {
|
||||
ApiClient defaultClient = Configuration.getDefaultApiClient();
|
||||
defaultClient.setBasePath("http://petstore.swagger.io:80/v2");
|
||||
|
||||
AnotherFakeApi apiInstance = new AnotherFakeApi(defaultClient);
|
||||
Client client = new Client(); // Client | client model
|
||||
try {
|
||||
Client result = apiInstance.call123testSpecialTags(client);
|
||||
System.out.println(result);
|
||||
} catch (ApiException e) {
|
||||
System.err.println("Exception when calling AnotherFakeApi#call123testSpecialTags");
|
||||
System.err.println("Status code: " + e.getCode());
|
||||
System.err.println("Reason: " + e.getResponseBody());
|
||||
System.err.println("Response headers: " + e.getResponseHeaders());
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### Parameters
|
||||
|
||||
|
||||
| Name | Type | Description | Notes |
|
||||
|------------- | ------------- | ------------- | -------------|
|
||||
| **client** | [**Client**](Client.md)| client model | |
|
||||
|
||||
### Return type
|
||||
|
||||
[**Client**](Client.md)
|
||||
|
||||
### Authorization
|
||||
|
||||
No authorization required
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: application/json
|
||||
- **Accept**: application/json
|
||||
|
||||
### HTTP response details
|
||||
| Status code | Description | Response headers |
|
||||
|-------------|-------------|------------------|
|
||||
| **200** | successful operation | - |
|
||||
|
||||
14
samples/client/petstore/java/jersey3/docs/Apple.md
Normal file
14
samples/client/petstore/java/jersey3/docs/Apple.md
Normal file
@@ -0,0 +1,14 @@
|
||||
|
||||
|
||||
# Apple
|
||||
|
||||
|
||||
## Properties
|
||||
|
||||
| Name | Type | Description | Notes |
|
||||
|------------ | ------------- | ------------- | -------------|
|
||||
|**cultivar** | **String** | | [optional] |
|
||||
|**origin** | **String** | | [optional] |
|
||||
|
||||
|
||||
|
||||
14
samples/client/petstore/java/jersey3/docs/AppleReq.md
Normal file
14
samples/client/petstore/java/jersey3/docs/AppleReq.md
Normal file
@@ -0,0 +1,14 @@
|
||||
|
||||
|
||||
# AppleReq
|
||||
|
||||
|
||||
## Properties
|
||||
|
||||
| Name | Type | Description | Notes |
|
||||
|------------ | ------------- | ------------- | -------------|
|
||||
|**cultivar** | **String** | | |
|
||||
|**mealy** | **Boolean** | | [optional] |
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
|
||||
|
||||
# ArrayOfArrayOfNumberOnly
|
||||
|
||||
|
||||
## Properties
|
||||
|
||||
| Name | Type | Description | Notes |
|
||||
|------------ | ------------- | ------------- | -------------|
|
||||
|**arrayArrayNumber** | **List<List<BigDecimal>>** | | [optional] |
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
|
||||
|
||||
# ArrayOfNumberOnly
|
||||
|
||||
|
||||
## Properties
|
||||
|
||||
| Name | Type | Description | Notes |
|
||||
|------------ | ------------- | ------------- | -------------|
|
||||
|**arrayNumber** | **List<BigDecimal>** | | [optional] |
|
||||
|
||||
|
||||
|
||||
15
samples/client/petstore/java/jersey3/docs/ArrayTest.md
Normal file
15
samples/client/petstore/java/jersey3/docs/ArrayTest.md
Normal file
@@ -0,0 +1,15 @@
|
||||
|
||||
|
||||
# ArrayTest
|
||||
|
||||
|
||||
## Properties
|
||||
|
||||
| Name | Type | Description | Notes |
|
||||
|------------ | ------------- | ------------- | -------------|
|
||||
|**arrayOfString** | **List<String>** | | [optional] |
|
||||
|**arrayArrayOfInteger** | **List<List<Long>>** | | [optional] |
|
||||
|**arrayArrayOfModel** | **List<List<ReadOnlyFirst>>** | | [optional] |
|
||||
|
||||
|
||||
|
||||
13
samples/client/petstore/java/jersey3/docs/Banana.md
Normal file
13
samples/client/petstore/java/jersey3/docs/Banana.md
Normal file
@@ -0,0 +1,13 @@
|
||||
|
||||
|
||||
# Banana
|
||||
|
||||
|
||||
## Properties
|
||||
|
||||
| Name | Type | Description | Notes |
|
||||
|------------ | ------------- | ------------- | -------------|
|
||||
|**lengthCm** | **BigDecimal** | | [optional] |
|
||||
|
||||
|
||||
|
||||
14
samples/client/petstore/java/jersey3/docs/BananaReq.md
Normal file
14
samples/client/petstore/java/jersey3/docs/BananaReq.md
Normal file
@@ -0,0 +1,14 @@
|
||||
|
||||
|
||||
# BananaReq
|
||||
|
||||
|
||||
## Properties
|
||||
|
||||
| Name | Type | Description | Notes |
|
||||
|------------ | ------------- | ------------- | -------------|
|
||||
|**lengthCm** | **BigDecimal** | | |
|
||||
|**sweet** | **Boolean** | | [optional] |
|
||||
|
||||
|
||||
|
||||
13
samples/client/petstore/java/jersey3/docs/BasquePig.md
Normal file
13
samples/client/petstore/java/jersey3/docs/BasquePig.md
Normal file
@@ -0,0 +1,13 @@
|
||||
|
||||
|
||||
# BasquePig
|
||||
|
||||
|
||||
## Properties
|
||||
|
||||
| Name | Type | Description | Notes |
|
||||
|------------ | ------------- | ------------- | -------------|
|
||||
|**className** | **String** | | |
|
||||
|
||||
|
||||
|
||||
18
samples/client/petstore/java/jersey3/docs/Capitalization.md
Normal file
18
samples/client/petstore/java/jersey3/docs/Capitalization.md
Normal file
@@ -0,0 +1,18 @@
|
||||
|
||||
|
||||
# Capitalization
|
||||
|
||||
|
||||
## Properties
|
||||
|
||||
| Name | Type | Description | Notes |
|
||||
|------------ | ------------- | ------------- | -------------|
|
||||
|**smallCamel** | **String** | | [optional] |
|
||||
|**capitalCamel** | **String** | | [optional] |
|
||||
|**smallSnake** | **String** | | [optional] |
|
||||
|**capitalSnake** | **String** | | [optional] |
|
||||
|**scAETHFlowPoints** | **String** | | [optional] |
|
||||
|**ATT_NAME** | **String** | Name of the pet | [optional] |
|
||||
|
||||
|
||||
|
||||
13
samples/client/petstore/java/jersey3/docs/Cat.md
Normal file
13
samples/client/petstore/java/jersey3/docs/Cat.md
Normal file
@@ -0,0 +1,13 @@
|
||||
|
||||
|
||||
# Cat
|
||||
|
||||
|
||||
## Properties
|
||||
|
||||
| Name | Type | Description | Notes |
|
||||
|------------ | ------------- | ------------- | -------------|
|
||||
|**declawed** | **Boolean** | | [optional] |
|
||||
|
||||
|
||||
|
||||
13
samples/client/petstore/java/jersey3/docs/CatAllOf.md
Normal file
13
samples/client/petstore/java/jersey3/docs/CatAllOf.md
Normal file
@@ -0,0 +1,13 @@
|
||||
|
||||
|
||||
# CatAllOf
|
||||
|
||||
|
||||
## Properties
|
||||
|
||||
| Name | Type | Description | Notes |
|
||||
|------------ | ------------- | ------------- | -------------|
|
||||
|**declawed** | **Boolean** | | [optional] |
|
||||
|
||||
|
||||
|
||||
14
samples/client/petstore/java/jersey3/docs/Category.md
Normal file
14
samples/client/petstore/java/jersey3/docs/Category.md
Normal file
@@ -0,0 +1,14 @@
|
||||
|
||||
|
||||
# Category
|
||||
|
||||
|
||||
## Properties
|
||||
|
||||
| Name | Type | Description | Notes |
|
||||
|------------ | ------------- | ------------- | -------------|
|
||||
|**id** | **Long** | | [optional] |
|
||||
|**name** | **String** | | |
|
||||
|
||||
|
||||
|
||||
22
samples/client/petstore/java/jersey3/docs/ChildCat.md
Normal file
22
samples/client/petstore/java/jersey3/docs/ChildCat.md
Normal file
@@ -0,0 +1,22 @@
|
||||
|
||||
|
||||
# ChildCat
|
||||
|
||||
|
||||
## Properties
|
||||
|
||||
| Name | Type | Description | Notes |
|
||||
|------------ | ------------- | ------------- | -------------|
|
||||
|**name** | **String** | | [optional] |
|
||||
|**petType** | [**String**](#String) | | |
|
||||
|
||||
|
||||
|
||||
## Enum: String
|
||||
|
||||
| Name | Value |
|
||||
|---- | -----|
|
||||
| CHILDCAT | "ChildCat" |
|
||||
|
||||
|
||||
|
||||
22
samples/client/petstore/java/jersey3/docs/ChildCatAllOf.md
Normal file
22
samples/client/petstore/java/jersey3/docs/ChildCatAllOf.md
Normal file
@@ -0,0 +1,22 @@
|
||||
|
||||
|
||||
# ChildCatAllOf
|
||||
|
||||
|
||||
## Properties
|
||||
|
||||
| Name | Type | Description | Notes |
|
||||
|------------ | ------------- | ------------- | -------------|
|
||||
|**name** | **String** | | [optional] |
|
||||
|**petType** | [**String**](#String) | | [optional] |
|
||||
|
||||
|
||||
|
||||
## Enum: String
|
||||
|
||||
| Name | Value |
|
||||
|---- | -----|
|
||||
| CHILDCAT | "ChildCat" |
|
||||
|
||||
|
||||
|
||||
14
samples/client/petstore/java/jersey3/docs/ClassModel.md
Normal file
14
samples/client/petstore/java/jersey3/docs/ClassModel.md
Normal file
@@ -0,0 +1,14 @@
|
||||
|
||||
|
||||
# ClassModel
|
||||
|
||||
Model for testing model with \"_class\" property
|
||||
|
||||
## Properties
|
||||
|
||||
| Name | Type | Description | Notes |
|
||||
|------------ | ------------- | ------------- | -------------|
|
||||
|**propertyClass** | **String** | | [optional] |
|
||||
|
||||
|
||||
|
||||
13
samples/client/petstore/java/jersey3/docs/Client.md
Normal file
13
samples/client/petstore/java/jersey3/docs/Client.md
Normal file
@@ -0,0 +1,13 @@
|
||||
|
||||
|
||||
# Client
|
||||
|
||||
|
||||
## Properties
|
||||
|
||||
| Name | Type | Description | Notes |
|
||||
|------------ | ------------- | ------------- | -------------|
|
||||
|**client** | **String** | | [optional] |
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
|
||||
|
||||
# ComplexQuadrilateral
|
||||
|
||||
|
||||
## Properties
|
||||
|
||||
| Name | Type | Description | Notes |
|
||||
|------------ | ------------- | ------------- | -------------|
|
||||
|**shapeType** | **String** | | |
|
||||
|**quadrilateralType** | **String** | | |
|
||||
|
||||
|
||||
|
||||
13
samples/client/petstore/java/jersey3/docs/DanishPig.md
Normal file
13
samples/client/petstore/java/jersey3/docs/DanishPig.md
Normal file
@@ -0,0 +1,13 @@
|
||||
|
||||
|
||||
# DanishPig
|
||||
|
||||
|
||||
## Properties
|
||||
|
||||
| Name | Type | Description | Notes |
|
||||
|------------ | ------------- | ------------- | -------------|
|
||||
|**className** | **String** | | |
|
||||
|
||||
|
||||
|
||||
68
samples/client/petstore/java/jersey3/docs/DefaultApi.md
Normal file
68
samples/client/petstore/java/jersey3/docs/DefaultApi.md
Normal file
@@ -0,0 +1,68 @@
|
||||
# DefaultApi
|
||||
|
||||
All URIs are relative to *http://petstore.swagger.io:80/v2*
|
||||
|
||||
| Method | HTTP request | Description |
|
||||
|------------- | ------------- | -------------|
|
||||
| [**fooGet**](DefaultApi.md#fooGet) | **GET** /foo | |
|
||||
|
||||
|
||||
|
||||
## fooGet
|
||||
|
||||
> InlineResponseDefault fooGet()
|
||||
|
||||
|
||||
|
||||
### Example
|
||||
|
||||
```java
|
||||
// Import classes:
|
||||
import org.openapitools.client.ApiClient;
|
||||
import org.openapitools.client.ApiException;
|
||||
import org.openapitools.client.Configuration;
|
||||
import org.openapitools.client.model.*;
|
||||
import org.openapitools.client.api.DefaultApi;
|
||||
|
||||
public class Example {
|
||||
public static void main(String[] args) {
|
||||
ApiClient defaultClient = Configuration.getDefaultApiClient();
|
||||
defaultClient.setBasePath("http://petstore.swagger.io:80/v2");
|
||||
|
||||
DefaultApi apiInstance = new DefaultApi(defaultClient);
|
||||
try {
|
||||
InlineResponseDefault result = apiInstance.fooGet();
|
||||
System.out.println(result);
|
||||
} catch (ApiException e) {
|
||||
System.err.println("Exception when calling DefaultApi#fooGet");
|
||||
System.err.println("Status code: " + e.getCode());
|
||||
System.err.println("Reason: " + e.getResponseBody());
|
||||
System.err.println("Response headers: " + e.getResponseHeaders());
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### Parameters
|
||||
|
||||
This endpoint does not need any parameter.
|
||||
|
||||
### Return type
|
||||
|
||||
[**InlineResponseDefault**](InlineResponseDefault.md)
|
||||
|
||||
### Authorization
|
||||
|
||||
No authorization required
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: Not defined
|
||||
- **Accept**: application/json
|
||||
|
||||
### HTTP response details
|
||||
| Status code | Description | Response headers |
|
||||
|-------------|-------------|------------------|
|
||||
| **0** | response | - |
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
|
||||
|
||||
# DeprecatedObject
|
||||
|
||||
|
||||
## Properties
|
||||
|
||||
| Name | Type | Description | Notes |
|
||||
|------------ | ------------- | ------------- | -------------|
|
||||
|**name** | **String** | | [optional] |
|
||||
|
||||
|
||||
|
||||
13
samples/client/petstore/java/jersey3/docs/Dog.md
Normal file
13
samples/client/petstore/java/jersey3/docs/Dog.md
Normal file
@@ -0,0 +1,13 @@
|
||||
|
||||
|
||||
# Dog
|
||||
|
||||
|
||||
## Properties
|
||||
|
||||
| Name | Type | Description | Notes |
|
||||
|------------ | ------------- | ------------- | -------------|
|
||||
|**breed** | **String** | | [optional] |
|
||||
|
||||
|
||||
|
||||
13
samples/client/petstore/java/jersey3/docs/DogAllOf.md
Normal file
13
samples/client/petstore/java/jersey3/docs/DogAllOf.md
Normal file
@@ -0,0 +1,13 @@
|
||||
|
||||
|
||||
# DogAllOf
|
||||
|
||||
|
||||
## Properties
|
||||
|
||||
| Name | Type | Description | Notes |
|
||||
|------------ | ------------- | ------------- | -------------|
|
||||
|**breed** | **String** | | [optional] |
|
||||
|
||||
|
||||
|
||||
16
samples/client/petstore/java/jersey3/docs/Drawing.md
Normal file
16
samples/client/petstore/java/jersey3/docs/Drawing.md
Normal file
@@ -0,0 +1,16 @@
|
||||
|
||||
|
||||
# Drawing
|
||||
|
||||
|
||||
## Properties
|
||||
|
||||
| Name | Type | Description | Notes |
|
||||
|------------ | ------------- | ------------- | -------------|
|
||||
|**mainShape** | [**Shape**](Shape.md) | | [optional] |
|
||||
|**shapeOrNull** | [**ShapeOrNull**](ShapeOrNull.md) | | [optional] |
|
||||
|**nullableShape** | [**NullableShape**](NullableShape.md) | | [optional] |
|
||||
|**shapes** | [**List<Shape>**](Shape.md) | | [optional] |
|
||||
|
||||
|
||||
|
||||
32
samples/client/petstore/java/jersey3/docs/EnumArrays.md
Normal file
32
samples/client/petstore/java/jersey3/docs/EnumArrays.md
Normal file
@@ -0,0 +1,32 @@
|
||||
|
||||
|
||||
# EnumArrays
|
||||
|
||||
|
||||
## Properties
|
||||
|
||||
| Name | Type | Description | Notes |
|
||||
|------------ | ------------- | ------------- | -------------|
|
||||
|**justSymbol** | [**JustSymbolEnum**](#JustSymbolEnum) | | [optional] |
|
||||
|**arrayEnum** | [**List<ArrayEnumEnum>**](#List<ArrayEnumEnum>) | | [optional] |
|
||||
|
||||
|
||||
|
||||
## Enum: JustSymbolEnum
|
||||
|
||||
| Name | Value |
|
||||
|---- | -----|
|
||||
| GREATER_THAN_OR_EQUAL_TO | ">=" |
|
||||
| DOLLAR | "$" |
|
||||
|
||||
|
||||
|
||||
## Enum: List<ArrayEnumEnum>
|
||||
|
||||
| Name | Value |
|
||||
|---- | -----|
|
||||
| FISH | "fish" |
|
||||
| CRAB | "crab" |
|
||||
|
||||
|
||||
|
||||
15
samples/client/petstore/java/jersey3/docs/EnumClass.md
Normal file
15
samples/client/petstore/java/jersey3/docs/EnumClass.md
Normal file
@@ -0,0 +1,15 @@
|
||||
|
||||
|
||||
# EnumClass
|
||||
|
||||
## Enum
|
||||
|
||||
|
||||
* `_ABC` (value: `"_abc"`)
|
||||
|
||||
* `_EFG` (value: `"-efg"`)
|
||||
|
||||
* `_XYZ_` (value: `"(xyz)"`)
|
||||
|
||||
|
||||
|
||||
68
samples/client/petstore/java/jersey3/docs/EnumTest.md
Normal file
68
samples/client/petstore/java/jersey3/docs/EnumTest.md
Normal file
@@ -0,0 +1,68 @@
|
||||
|
||||
|
||||
# EnumTest
|
||||
|
||||
|
||||
## Properties
|
||||
|
||||
| Name | Type | Description | Notes |
|
||||
|------------ | ------------- | ------------- | -------------|
|
||||
|**enumString** | [**EnumStringEnum**](#EnumStringEnum) | | [optional] |
|
||||
|**enumStringRequired** | [**EnumStringRequiredEnum**](#EnumStringRequiredEnum) | | |
|
||||
|**enumInteger** | [**EnumIntegerEnum**](#EnumIntegerEnum) | | [optional] |
|
||||
|**enumIntegerOnly** | [**EnumIntegerOnlyEnum**](#EnumIntegerOnlyEnum) | | [optional] |
|
||||
|**enumNumber** | [**EnumNumberEnum**](#EnumNumberEnum) | | [optional] |
|
||||
|**outerEnum** | **OuterEnum** | | [optional] |
|
||||
|**outerEnumInteger** | **OuterEnumInteger** | | [optional] |
|
||||
|**outerEnumDefaultValue** | **OuterEnumDefaultValue** | | [optional] |
|
||||
|**outerEnumIntegerDefaultValue** | **OuterEnumIntegerDefaultValue** | | [optional] |
|
||||
|
||||
|
||||
|
||||
## Enum: EnumStringEnum
|
||||
|
||||
| Name | Value |
|
||||
|---- | -----|
|
||||
| UPPER | "UPPER" |
|
||||
| LOWER | "lower" |
|
||||
| EMPTY | "" |
|
||||
|
||||
|
||||
|
||||
## Enum: EnumStringRequiredEnum
|
||||
|
||||
| Name | Value |
|
||||
|---- | -----|
|
||||
| UPPER | "UPPER" |
|
||||
| LOWER | "lower" |
|
||||
| EMPTY | "" |
|
||||
|
||||
|
||||
|
||||
## Enum: EnumIntegerEnum
|
||||
|
||||
| Name | Value |
|
||||
|---- | -----|
|
||||
| NUMBER_1 | 1 |
|
||||
| NUMBER_MINUS_1 | -1 |
|
||||
|
||||
|
||||
|
||||
## Enum: EnumIntegerOnlyEnum
|
||||
|
||||
| Name | Value |
|
||||
|---- | -----|
|
||||
| NUMBER_2 | 2 |
|
||||
| NUMBER_MINUS_2 | -2 |
|
||||
|
||||
|
||||
|
||||
## Enum: EnumNumberEnum
|
||||
|
||||
| Name | Value |
|
||||
|---- | -----|
|
||||
| NUMBER_1_DOT_1 | 1.1 |
|
||||
| NUMBER_MINUS_1_DOT_2 | -1.2 |
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
|
||||
|
||||
# EquilateralTriangle
|
||||
|
||||
|
||||
## Properties
|
||||
|
||||
| Name | Type | Description | Notes |
|
||||
|------------ | ------------- | ------------- | -------------|
|
||||
|**shapeType** | **String** | | |
|
||||
|**triangleType** | **String** | | |
|
||||
|
||||
|
||||
|
||||
1067
samples/client/petstore/java/jersey3/docs/FakeApi.md
Normal file
1067
samples/client/petstore/java/jersey3/docs/FakeApi.md
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,81 @@
|
||||
# FakeClassnameTags123Api
|
||||
|
||||
All URIs are relative to *http://petstore.swagger.io:80/v2*
|
||||
|
||||
| Method | HTTP request | Description |
|
||||
|------------- | ------------- | -------------|
|
||||
| [**testClassname**](FakeClassnameTags123Api.md#testClassname) | **PATCH** /fake_classname_test | To test class name in snake case |
|
||||
|
||||
|
||||
|
||||
## testClassname
|
||||
|
||||
> Client testClassname(client)
|
||||
|
||||
To test class name in snake case
|
||||
|
||||
To test class name in snake case
|
||||
|
||||
### Example
|
||||
|
||||
```java
|
||||
// Import classes:
|
||||
import org.openapitools.client.ApiClient;
|
||||
import org.openapitools.client.ApiException;
|
||||
import org.openapitools.client.Configuration;
|
||||
import org.openapitools.client.auth.*;
|
||||
import org.openapitools.client.model.*;
|
||||
import org.openapitools.client.api.FakeClassnameTags123Api;
|
||||
|
||||
public class Example {
|
||||
public static void main(String[] args) {
|
||||
ApiClient defaultClient = Configuration.getDefaultApiClient();
|
||||
defaultClient.setBasePath("http://petstore.swagger.io:80/v2");
|
||||
|
||||
// Configure API key authorization: api_key_query
|
||||
ApiKeyAuth api_key_query = (ApiKeyAuth) defaultClient.getAuthentication("api_key_query");
|
||||
api_key_query.setApiKey("YOUR API KEY");
|
||||
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
|
||||
//api_key_query.setApiKeyPrefix("Token");
|
||||
|
||||
FakeClassnameTags123Api apiInstance = new FakeClassnameTags123Api(defaultClient);
|
||||
Client client = new Client(); // Client | client model
|
||||
try {
|
||||
Client result = apiInstance.testClassname(client);
|
||||
System.out.println(result);
|
||||
} catch (ApiException e) {
|
||||
System.err.println("Exception when calling FakeClassnameTags123Api#testClassname");
|
||||
System.err.println("Status code: " + e.getCode());
|
||||
System.err.println("Reason: " + e.getResponseBody());
|
||||
System.err.println("Response headers: " + e.getResponseHeaders());
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### Parameters
|
||||
|
||||
|
||||
| Name | Type | Description | Notes |
|
||||
|------------- | ------------- | ------------- | -------------|
|
||||
| **client** | [**Client**](Client.md)| client model | |
|
||||
|
||||
### Return type
|
||||
|
||||
[**Client**](Client.md)
|
||||
|
||||
### Authorization
|
||||
|
||||
[api_key_query](../README.md#api_key_query)
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: application/json
|
||||
- **Accept**: application/json
|
||||
|
||||
### HTTP response details
|
||||
| Status code | Description | Response headers |
|
||||
|-------------|-------------|------------------|
|
||||
| **200** | successful operation | - |
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
|
||||
|
||||
# FileSchemaTestClass
|
||||
|
||||
|
||||
## Properties
|
||||
|
||||
| Name | Type | Description | Notes |
|
||||
|------------ | ------------- | ------------- | -------------|
|
||||
|**_file** | [**ModelFile**](ModelFile.md) | | [optional] |
|
||||
|**files** | [**List<ModelFile>**](ModelFile.md) | | [optional] |
|
||||
|
||||
|
||||
|
||||
13
samples/client/petstore/java/jersey3/docs/Foo.md
Normal file
13
samples/client/petstore/java/jersey3/docs/Foo.md
Normal file
@@ -0,0 +1,13 @@
|
||||
|
||||
|
||||
# Foo
|
||||
|
||||
|
||||
## Properties
|
||||
|
||||
| Name | Type | Description | Notes |
|
||||
|------------ | ------------- | ------------- | -------------|
|
||||
|**bar** | **String** | | [optional] |
|
||||
|
||||
|
||||
|
||||
28
samples/client/petstore/java/jersey3/docs/FormatTest.md
Normal file
28
samples/client/petstore/java/jersey3/docs/FormatTest.md
Normal file
@@ -0,0 +1,28 @@
|
||||
|
||||
|
||||
# FormatTest
|
||||
|
||||
|
||||
## Properties
|
||||
|
||||
| Name | Type | Description | Notes |
|
||||
|------------ | ------------- | ------------- | -------------|
|
||||
|**integer** | **Integer** | | [optional] |
|
||||
|**int32** | **Integer** | | [optional] |
|
||||
|**int64** | **Long** | | [optional] |
|
||||
|**number** | **BigDecimal** | | |
|
||||
|**_float** | **Float** | | [optional] |
|
||||
|**_double** | **Double** | | [optional] |
|
||||
|**decimal** | **BigDecimal** | | [optional] |
|
||||
|**string** | **String** | | [optional] |
|
||||
|**_byte** | **byte[]** | | |
|
||||
|**binary** | **File** | | [optional] |
|
||||
|**date** | **LocalDate** | | |
|
||||
|**dateTime** | **OffsetDateTime** | | [optional] |
|
||||
|**uuid** | **UUID** | | [optional] |
|
||||
|**password** | **String** | | |
|
||||
|**patternWithDigits** | **String** | A string that is a 10 digit number. Can have leading zeros. | [optional] |
|
||||
|**patternWithDigitsAndDelimiter** | **String** | A string starting with 'image_' (case insensitive) and one to three digits following i.e. Image_01. | [optional] |
|
||||
|
||||
|
||||
|
||||
37
samples/client/petstore/java/jersey3/docs/Fruit.md
Normal file
37
samples/client/petstore/java/jersey3/docs/Fruit.md
Normal file
@@ -0,0 +1,37 @@
|
||||
|
||||
|
||||
# Fruit
|
||||
|
||||
## oneOf schemas
|
||||
* [Apple](Apple.md)
|
||||
* [Banana](Banana.md)
|
||||
|
||||
## Example
|
||||
```java
|
||||
// Import classes:
|
||||
import org.openapitools.client.model.Fruit;
|
||||
import org.openapitools.client.model.Apple;
|
||||
import org.openapitools.client.model.Banana;
|
||||
|
||||
public class Example {
|
||||
public static void main(String[] args) {
|
||||
Fruit exampleFruit = new Fruit();
|
||||
|
||||
// create a new Apple
|
||||
Apple exampleApple = new Apple();
|
||||
// set Fruit to Apple
|
||||
exampleFruit.setActualInstance(exampleApple);
|
||||
// to get back the Apple set earlier
|
||||
Apple testApple = (Apple) exampleFruit.getActualInstance();
|
||||
|
||||
// create a new Banana
|
||||
Banana exampleBanana = new Banana();
|
||||
// set Fruit to Banana
|
||||
exampleFruit.setActualInstance(exampleBanana);
|
||||
// to get back the Banana set earlier
|
||||
Banana testBanana = (Banana) exampleFruit.getActualInstance();
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
39
samples/client/petstore/java/jersey3/docs/FruitReq.md
Normal file
39
samples/client/petstore/java/jersey3/docs/FruitReq.md
Normal file
@@ -0,0 +1,39 @@
|
||||
|
||||
|
||||
# FruitReq
|
||||
|
||||
## oneOf schemas
|
||||
* [AppleReq](AppleReq.md)
|
||||
* [BananaReq](BananaReq.md)
|
||||
|
||||
NOTE: this class is nullable.
|
||||
|
||||
## Example
|
||||
```java
|
||||
// Import classes:
|
||||
import org.openapitools.client.model.FruitReq;
|
||||
import org.openapitools.client.model.AppleReq;
|
||||
import org.openapitools.client.model.BananaReq;
|
||||
|
||||
public class Example {
|
||||
public static void main(String[] args) {
|
||||
FruitReq exampleFruitReq = new FruitReq();
|
||||
|
||||
// create a new AppleReq
|
||||
AppleReq exampleAppleReq = new AppleReq();
|
||||
// set FruitReq to AppleReq
|
||||
exampleFruitReq.setActualInstance(exampleAppleReq);
|
||||
// to get back the AppleReq set earlier
|
||||
AppleReq testAppleReq = (AppleReq) exampleFruitReq.getActualInstance();
|
||||
|
||||
// create a new BananaReq
|
||||
BananaReq exampleBananaReq = new BananaReq();
|
||||
// set FruitReq to BananaReq
|
||||
exampleFruitReq.setActualInstance(exampleBananaReq);
|
||||
// to get back the BananaReq set earlier
|
||||
BananaReq testBananaReq = (BananaReq) exampleFruitReq.getActualInstance();
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
37
samples/client/petstore/java/jersey3/docs/GmFruit.md
Normal file
37
samples/client/petstore/java/jersey3/docs/GmFruit.md
Normal file
@@ -0,0 +1,37 @@
|
||||
|
||||
|
||||
# GmFruit
|
||||
|
||||
## anyOf schemas
|
||||
* [Apple](Apple.md)
|
||||
* [Banana](Banana.md)
|
||||
|
||||
## Example
|
||||
```java
|
||||
// Import classes:
|
||||
import org.openapitools.client.model.GmFruit;
|
||||
import org.openapitools.client.model.Apple;
|
||||
import org.openapitools.client.model.Banana;
|
||||
|
||||
public class Example {
|
||||
public static void main(String[] args) {
|
||||
GmFruit exampleGmFruit = new GmFruit();
|
||||
|
||||
// create a new Apple
|
||||
Apple exampleApple = new Apple();
|
||||
// set GmFruit to Apple
|
||||
exampleGmFruit.setActualInstance(exampleApple);
|
||||
// to get back the Apple set earlier
|
||||
Apple testApple = (Apple) exampleGmFruit.getActualInstance();
|
||||
|
||||
// create a new Banana
|
||||
Banana exampleBanana = new Banana();
|
||||
// set GmFruit to Banana
|
||||
exampleGmFruit.setActualInstance(exampleBanana);
|
||||
// to get back the Banana set earlier
|
||||
Banana testBanana = (Banana) exampleGmFruit.getActualInstance();
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
|
||||
|
||||
# GrandparentAnimal
|
||||
|
||||
|
||||
## Properties
|
||||
|
||||
| Name | Type | Description | Notes |
|
||||
|------------ | ------------- | ------------- | -------------|
|
||||
|**petType** | **String** | | |
|
||||
|
||||
|
||||
|
||||
14
samples/client/petstore/java/jersey3/docs/HasOnlyReadOnly.md
Normal file
14
samples/client/petstore/java/jersey3/docs/HasOnlyReadOnly.md
Normal file
@@ -0,0 +1,14 @@
|
||||
|
||||
|
||||
# HasOnlyReadOnly
|
||||
|
||||
|
||||
## Properties
|
||||
|
||||
| Name | Type | Description | Notes |
|
||||
|------------ | ------------- | ------------- | -------------|
|
||||
|**bar** | **String** | | [optional] [readonly] |
|
||||
|**foo** | **String** | | [optional] [readonly] |
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
|
||||
|
||||
# HealthCheckResult
|
||||
|
||||
Just a string to inform instance is up and running. Make it nullable in hope to get it as pointer in generated model.
|
||||
|
||||
## Properties
|
||||
|
||||
| Name | Type | Description | Notes |
|
||||
|------------ | ------------- | ------------- | -------------|
|
||||
|**nullableMessage** | **String** | | [optional] |
|
||||
|
||||
|
||||
|
||||
13
samples/client/petstore/java/jersey3/docs/InlineObject.md
Normal file
13
samples/client/petstore/java/jersey3/docs/InlineObject.md
Normal file
@@ -0,0 +1,13 @@
|
||||
|
||||
|
||||
# InlineObject
|
||||
|
||||
## Properties
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**name** | **String** | Updated name of the pet | [optional]
|
||||
**status** | **String** | Updated status of the pet | [optional]
|
||||
|
||||
|
||||
|
||||
13
samples/client/petstore/java/jersey3/docs/InlineObject1.md
Normal file
13
samples/client/petstore/java/jersey3/docs/InlineObject1.md
Normal file
@@ -0,0 +1,13 @@
|
||||
|
||||
|
||||
# InlineObject1
|
||||
|
||||
## Properties
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**additionalMetadata** | **String** | Additional data to pass to server | [optional]
|
||||
**file** | **File** | file to upload | [optional]
|
||||
|
||||
|
||||
|
||||
32
samples/client/petstore/java/jersey3/docs/InlineObject2.md
Normal file
32
samples/client/petstore/java/jersey3/docs/InlineObject2.md
Normal file
@@ -0,0 +1,32 @@
|
||||
|
||||
|
||||
# InlineObject2
|
||||
|
||||
## Properties
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**enumFormStringArray** | [**List<EnumFormStringArrayEnum>**](#List<EnumFormStringArrayEnum>) | Form parameter enum test (string array) | [optional]
|
||||
**enumFormString** | [**EnumFormStringEnum**](#EnumFormStringEnum) | Form parameter enum test (string) | [optional]
|
||||
|
||||
|
||||
|
||||
## Enum: List<EnumFormStringArrayEnum>
|
||||
|
||||
Name | Value
|
||||
---- | -----
|
||||
GREATER_THAN | ">"
|
||||
DOLLAR | "$"
|
||||
|
||||
|
||||
|
||||
## Enum: EnumFormStringEnum
|
||||
|
||||
Name | Value
|
||||
---- | -----
|
||||
_ABC | "_abc"
|
||||
_EFG | "-efg"
|
||||
_XYZ_ | "(xyz)"
|
||||
|
||||
|
||||
|
||||
25
samples/client/petstore/java/jersey3/docs/InlineObject3.md
Normal file
25
samples/client/petstore/java/jersey3/docs/InlineObject3.md
Normal file
@@ -0,0 +1,25 @@
|
||||
|
||||
|
||||
# InlineObject3
|
||||
|
||||
## Properties
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**integer** | **Integer** | None | [optional]
|
||||
**int32** | **Integer** | None | [optional]
|
||||
**int64** | **Long** | None | [optional]
|
||||
**number** | **BigDecimal** | None |
|
||||
**_float** | **Float** | None | [optional]
|
||||
**_double** | **Double** | None |
|
||||
**string** | **String** | None | [optional]
|
||||
**patternWithoutDelimiter** | **String** | None |
|
||||
**_byte** | **byte[]** | None |
|
||||
**binary** | **File** | None | [optional]
|
||||
**date** | **LocalDate** | None | [optional]
|
||||
**dateTime** | **OffsetDateTime** | None | [optional]
|
||||
**password** | **String** | None | [optional]
|
||||
**callback** | **String** | None | [optional]
|
||||
|
||||
|
||||
|
||||
13
samples/client/petstore/java/jersey3/docs/InlineObject4.md
Normal file
13
samples/client/petstore/java/jersey3/docs/InlineObject4.md
Normal file
@@ -0,0 +1,13 @@
|
||||
|
||||
|
||||
# InlineObject4
|
||||
|
||||
## Properties
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**param** | **String** | field1 |
|
||||
**param2** | **String** | field2 |
|
||||
|
||||
|
||||
|
||||
13
samples/client/petstore/java/jersey3/docs/InlineObject5.md
Normal file
13
samples/client/petstore/java/jersey3/docs/InlineObject5.md
Normal file
@@ -0,0 +1,13 @@
|
||||
|
||||
|
||||
# InlineObject5
|
||||
|
||||
## Properties
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**additionalMetadata** | **String** | Additional data to pass to server | [optional]
|
||||
**requiredFile** | **File** | file to upload |
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
|
||||
|
||||
# InlineResponseDefault
|
||||
|
||||
|
||||
## Properties
|
||||
|
||||
| Name | Type | Description | Notes |
|
||||
|------------ | ------------- | ------------- | -------------|
|
||||
|**string** | [**Foo**](Foo.md) | | [optional] |
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
|
||||
|
||||
# IsoscelesTriangle
|
||||
|
||||
|
||||
## Properties
|
||||
|
||||
| Name | Type | Description | Notes |
|
||||
|------------ | ------------- | ------------- | -------------|
|
||||
|**shapeType** | **String** | | |
|
||||
|**triangleType** | **String** | | |
|
||||
|
||||
|
||||
|
||||
46
samples/client/petstore/java/jersey3/docs/Mammal.md
Normal file
46
samples/client/petstore/java/jersey3/docs/Mammal.md
Normal file
@@ -0,0 +1,46 @@
|
||||
|
||||
|
||||
# Mammal
|
||||
|
||||
## oneOf schemas
|
||||
* [Pig](Pig.md)
|
||||
* [Whale](Whale.md)
|
||||
* [Zebra](Zebra.md)
|
||||
|
||||
## Example
|
||||
```java
|
||||
// Import classes:
|
||||
import org.openapitools.client.model.Mammal;
|
||||
import org.openapitools.client.model.Pig;
|
||||
import org.openapitools.client.model.Whale;
|
||||
import org.openapitools.client.model.Zebra;
|
||||
|
||||
public class Example {
|
||||
public static void main(String[] args) {
|
||||
Mammal exampleMammal = new Mammal();
|
||||
|
||||
// create a new Pig
|
||||
Pig examplePig = new Pig();
|
||||
// set Mammal to Pig
|
||||
exampleMammal.setActualInstance(examplePig);
|
||||
// to get back the Pig set earlier
|
||||
Pig testPig = (Pig) exampleMammal.getActualInstance();
|
||||
|
||||
// create a new Whale
|
||||
Whale exampleWhale = new Whale();
|
||||
// set Mammal to Whale
|
||||
exampleMammal.setActualInstance(exampleWhale);
|
||||
// to get back the Whale set earlier
|
||||
Whale testWhale = (Whale) exampleMammal.getActualInstance();
|
||||
|
||||
// create a new Zebra
|
||||
Zebra exampleZebra = new Zebra();
|
||||
// set Mammal to Zebra
|
||||
exampleMammal.setActualInstance(exampleZebra);
|
||||
// to get back the Zebra set earlier
|
||||
Zebra testZebra = (Zebra) exampleMammal.getActualInstance();
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
25
samples/client/petstore/java/jersey3/docs/MapTest.md
Normal file
25
samples/client/petstore/java/jersey3/docs/MapTest.md
Normal file
@@ -0,0 +1,25 @@
|
||||
|
||||
|
||||
# MapTest
|
||||
|
||||
|
||||
## Properties
|
||||
|
||||
| Name | Type | Description | Notes |
|
||||
|------------ | ------------- | ------------- | -------------|
|
||||
|**mapMapOfString** | **Map<String, Map<String, String>>** | | [optional] |
|
||||
|**mapOfEnumString** | [**Map<String, InnerEnum>**](#Map<String, InnerEnum>) | | [optional] |
|
||||
|**directMap** | **Map<String, Boolean>** | | [optional] |
|
||||
|**indirectMap** | **Map<String, Boolean>** | | [optional] |
|
||||
|
||||
|
||||
|
||||
## Enum: Map<String, InnerEnum>
|
||||
|
||||
| Name | Value |
|
||||
|---- | -----|
|
||||
| UPPER | "UPPER" |
|
||||
| LOWER | "lower" |
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
|
||||
|
||||
# MixedPropertiesAndAdditionalPropertiesClass
|
||||
|
||||
|
||||
## Properties
|
||||
|
||||
| Name | Type | Description | Notes |
|
||||
|------------ | ------------- | ------------- | -------------|
|
||||
|**uuid** | **UUID** | | [optional] |
|
||||
|**dateTime** | **OffsetDateTime** | | [optional] |
|
||||
|**map** | [**Map<String, Animal>**](Animal.md) | | [optional] |
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
|
||||
|
||||
# Model200Response
|
||||
|
||||
Model for testing model name starting with number
|
||||
|
||||
## Properties
|
||||
|
||||
| Name | Type | Description | Notes |
|
||||
|------------ | ------------- | ------------- | -------------|
|
||||
|**name** | **Integer** | | [optional] |
|
||||
|**propertyClass** | **String** | | [optional] |
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
|
||||
|
||||
# ModelApiResponse
|
||||
|
||||
|
||||
## Properties
|
||||
|
||||
| Name | Type | Description | Notes |
|
||||
|------------ | ------------- | ------------- | -------------|
|
||||
|**code** | **Integer** | | [optional] |
|
||||
|**type** | **String** | | [optional] |
|
||||
|**message** | **String** | | [optional] |
|
||||
|
||||
|
||||
|
||||
14
samples/client/petstore/java/jersey3/docs/ModelFile.md
Normal file
14
samples/client/petstore/java/jersey3/docs/ModelFile.md
Normal file
@@ -0,0 +1,14 @@
|
||||
|
||||
|
||||
# ModelFile
|
||||
|
||||
Must be named `File` for test.
|
||||
|
||||
## Properties
|
||||
|
||||
| Name | Type | Description | Notes |
|
||||
|------------ | ------------- | ------------- | -------------|
|
||||
|**sourceURI** | **String** | Test capitalization | [optional] |
|
||||
|
||||
|
||||
|
||||
13
samples/client/petstore/java/jersey3/docs/ModelList.md
Normal file
13
samples/client/petstore/java/jersey3/docs/ModelList.md
Normal file
@@ -0,0 +1,13 @@
|
||||
|
||||
|
||||
# ModelList
|
||||
|
||||
|
||||
## Properties
|
||||
|
||||
| Name | Type | Description | Notes |
|
||||
|------------ | ------------- | ------------- | -------------|
|
||||
|**_123list** | **String** | | [optional] |
|
||||
|
||||
|
||||
|
||||
14
samples/client/petstore/java/jersey3/docs/ModelReturn.md
Normal file
14
samples/client/petstore/java/jersey3/docs/ModelReturn.md
Normal file
@@ -0,0 +1,14 @@
|
||||
|
||||
|
||||
# ModelReturn
|
||||
|
||||
Model for testing reserved words
|
||||
|
||||
## Properties
|
||||
|
||||
| Name | Type | Description | Notes |
|
||||
|------------ | ------------- | ------------- | -------------|
|
||||
|**_return** | **Integer** | | [optional] |
|
||||
|
||||
|
||||
|
||||
17
samples/client/petstore/java/jersey3/docs/Name.md
Normal file
17
samples/client/petstore/java/jersey3/docs/Name.md
Normal file
@@ -0,0 +1,17 @@
|
||||
|
||||
|
||||
# Name
|
||||
|
||||
Model for testing model name same as property name
|
||||
|
||||
## Properties
|
||||
|
||||
| Name | Type | Description | Notes |
|
||||
|------------ | ------------- | ------------- | -------------|
|
||||
|**name** | **Integer** | | |
|
||||
|**snakeCase** | **Integer** | | [optional] [readonly] |
|
||||
|**property** | **String** | | [optional] |
|
||||
|**_123number** | **Integer** | | [optional] [readonly] |
|
||||
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user