mirror of
https://github.com/OpenAPITools/openapi-generator.git
synced 2025-12-04 23:36:09 +00:00
Compare commits
1 Commits
parser-res
...
snakeyaml-
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d36201c211 |
3
.github/workflows/samples-spring-jdk17.yaml
vendored
3
.github/workflows/samples-spring-jdk17.yaml
vendored
@@ -10,7 +10,6 @@ on:
|
||||
- samples/server/petstore/springboot-lombok-tostring
|
||||
- samples/server/petstore/springboot-file-delegate-optional
|
||||
- samples/server/petstore/springboot-petstore-with-api-response-examples
|
||||
- samples/server/petstore/spring-boot-oneof-sealed
|
||||
pull_request:
|
||||
paths:
|
||||
- samples/openapi3/client/petstore/spring-cloud-3-with-optional
|
||||
@@ -20,7 +19,6 @@ on:
|
||||
- samples/server/petstore/springboot-lombok-tostring
|
||||
- samples/server/petstore/springboot-file-delegate-optional
|
||||
- samples/server/petstore/springboot-petstore-with-api-response-examples
|
||||
- samples/server/petstore/spring-boot-oneof-sealed
|
||||
jobs:
|
||||
build:
|
||||
name: Build Java Spring (JDK17)
|
||||
@@ -38,7 +36,6 @@ jobs:
|
||||
- samples/server/petstore/springboot-lombok-tostring
|
||||
- samples/server/petstore/springboot-file-delegate-optional
|
||||
- samples/server/petstore/springboot-petstore-with-api-response-examples
|
||||
- samples/server/petstore/spring-boot-oneof-sealed
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/setup-java@v4
|
||||
|
||||
@@ -76,7 +76,6 @@ If you find OpenAPI Generator useful for work, please consider asking your compa
|
||||
[<img src="https://openapi-generator.tech/img/companies/clickit.jpg" width="128" height="128">](https://www.clickittech.com/?utm_source=openapi-generator&utm_medium=sponsorship&utm_campaign=oss-sponsorship)
|
||||
[<img src="https://openapi-generator.tech/img/companies/unified_to.jpg" width="128" height="128">](https://unified.to/?utm_source=openapi-generator&utm_medium=sponsorship&utm_campaign=oss-sponsorship)
|
||||
[<img src="https://openapi-generator.tech/img/companies/savetwt.jpg" width="128" height="128">](https://savetwt.com/?utm_source=openapi-generator&utm_medium=sponsorship&utm_campaign=oss-sponsorship)
|
||||
[<img src="https://openapi-generator.tech/img/companies/serpapi.png" width="128" height="128">](https://serpapi.com/?utm_source=openapi-generator&utm_medium=sponsorship&utm_campaign=oss-sponsorship)
|
||||
|
||||
#### Thank you GoDaddy for sponsoring the domain names, Linode for sponsoring the VPS, Checkly for sponsoring the API monitoring and Gradle for sponsoring Develocity
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
generatorName: dart-dio
|
||||
outputDir: samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable
|
||||
inputSpec: modules/openapi-generator/src/test/resources/3_0/dart/petstore-with-fake-endpoints-models-for-testing.yaml
|
||||
inputSpec: modules/openapi-generator/src/test/resources/3_0/petstore-with-fake-endpoints-models-for-testing.yaml
|
||||
templateDir: modules/openapi-generator/src/main/resources/dart/libraries/dio
|
||||
typeMappings:
|
||||
Client: "ModelClient"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
generatorName: dart-dio
|
||||
outputDir: samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake
|
||||
inputSpec: modules/openapi-generator/src/test/resources/3_0/dart/petstore-with-fake-endpoints-models-for-testing.yaml
|
||||
inputSpec: modules/openapi-generator/src/test/resources/3_0/petstore-with-fake-endpoints-models-for-testing.yaml
|
||||
templateDir: modules/openapi-generator/src/main/resources/dart/libraries/dio
|
||||
typeMappings:
|
||||
Client: "ModelClient"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
generatorName: dart
|
||||
outputDir: samples/openapi3/client/petstore/dart2/petstore_client_lib_fake
|
||||
inputSpec: modules/openapi-generator/src/test/resources/3_0/dart/petstore-with-fake-endpoints-models-for-testing.yaml
|
||||
inputSpec: modules/openapi-generator/src/test/resources/3_0/petstore-with-fake-endpoints-models-for-testing.yaml
|
||||
templateDir: modules/openapi-generator/src/main/resources/dart2
|
||||
typeMappings:
|
||||
Client: "ModelClient"
|
||||
|
||||
@@ -1,13 +0,0 @@
|
||||
generatorName: spring
|
||||
outputDir: samples/openapi3/server/petstore/spring-boot-oneof-sealed
|
||||
inputSpec: modules/openapi-generator/src/test/resources/3_0/oneof_polymorphism_and_inheritance.yaml
|
||||
templateDir: modules/openapi-generator/src/main/resources/JavaSpring
|
||||
additionalProperties:
|
||||
groupId: org.openapitools.openapi3
|
||||
documentationProvider: springdoc
|
||||
artifactId: springboot-oneof-sealed
|
||||
snapshotVersion: "true"
|
||||
hideGenerationTimestamp: "true"
|
||||
generateBuilders: true
|
||||
useOneOfInterfaces: true
|
||||
useSealed: true
|
||||
@@ -162,7 +162,7 @@ public class Generate extends OpenApiGeneratorCommand {
|
||||
|
||||
@Option(
|
||||
name = {"--openapi-generator-ignore-list"},
|
||||
title = ".openapi-generator-ignore list",
|
||||
title = ".openapi-generaotr-ignore list",
|
||||
description = "specifies entries in the .openapi-generator-ignore file relative/path/to/file1,relative/path/to/file2. For example: README.md,pom.xml"
|
||||
+ " You can also have multiple occurrences of this option.")
|
||||
private List<String> openapiGeneratorIgnoreList = new ArrayList<>();
|
||||
|
||||
@@ -3682,8 +3682,7 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
if (ModelUtils.isComposedSchema(schema) && !this.getLegacyDiscriminatorBehavior()) {
|
||||
List<MappedModel> otherDescendants = getOneOfAnyOfDescendants(schemaName, discriminatorPropertyName, schema);
|
||||
for (MappedModel otherDescendant : otherDescendants) {
|
||||
// add only if the model names are not the same
|
||||
if (uniqueDescendants.stream().map(MappedModel::getModelName).noneMatch(it -> it.equals(otherDescendant.getModelName()))) {
|
||||
if (!uniqueDescendants.contains(otherDescendant)) {
|
||||
uniqueDescendants.add(otherDescendant);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -64,7 +64,6 @@ import {{invokerPackage}}.auth.OAuth;
|
||||
{{/hasOAuthMethods}}
|
||||
|
||||
{{>generatedAnnotation}}
|
||||
|
||||
public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} {
|
||||
protected Map<String, String> defaultHeaderMap = new HashMap<String, String>();
|
||||
protected Map<String, String> defaultCookieMap = new HashMap<String, String>();
|
||||
|
||||
@@ -7,7 +7,6 @@ import java.util.concurrent.atomic.AtomicReference;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
{{>generatedAnnotation}}
|
||||
|
||||
public class Configuration {
|
||||
public static final String VERSION = "{{{artifactVersion}}}";
|
||||
|
||||
|
||||
@@ -10,7 +10,6 @@ import java.time.format.DateTimeParseException;
|
||||
* It's generated for java clients when {@code AbstractJavaCodegen#dateLibrary} specified as {@code java8}.
|
||||
*/
|
||||
{{>generatedAnnotation}}
|
||||
|
||||
public class JavaTimeFormatter {
|
||||
private DateTimeFormatter offsetDateTimeFormatter = DateTimeFormatter.ISO_OFFSET_DATE_TIME;
|
||||
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
package {{invokerPackage}};
|
||||
|
||||
{{>generatedAnnotation}}
|
||||
|
||||
public class Pair {
|
||||
private final String name;
|
||||
private final String value;
|
||||
|
||||
@@ -12,7 +12,6 @@ import java.util.GregorianCalendar;
|
||||
import java.util.TimeZone;
|
||||
|
||||
{{>generatedAnnotation}}
|
||||
|
||||
public class RFC3339DateFormat extends DateFormat {
|
||||
private static final long serialVersionUID = 1L;
|
||||
private static final TimeZone TIMEZONE_Z = TimeZone.getTimeZone("UTC");
|
||||
|
||||
@@ -18,7 +18,6 @@ import com.fasterxml.jackson.datatype.jsr310.JavaTimeFeature;
|
||||
import com.fasterxml.jackson.datatype.jsr310.deser.InstantDeserializer;
|
||||
|
||||
{{>generatedAnnotation}}
|
||||
|
||||
public class RFC3339InstantDeserializer<T extends Temporal> extends InstantDeserializer<T> {
|
||||
private static final long serialVersionUID = 1L;
|
||||
private final static boolean DEFAULT_NORMALIZE_ZONE_ID = JavaTimeFeature.NORMALIZE_DESERIALIZED_ZONE_ID.enabledByDefault();
|
||||
|
||||
@@ -8,7 +8,6 @@ import java.time.ZonedDateTime;
|
||||
import com.fasterxml.jackson.databind.module.SimpleModule;
|
||||
|
||||
{{>generatedAnnotation}}
|
||||
|
||||
public class RFC3339JavaTimeModule extends SimpleModule {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
|
||||
@@ -8,7 +8,6 @@ import java.util.Map;
|
||||
* Representing a Server configuration.
|
||||
*/
|
||||
{{>generatedAnnotation}}
|
||||
|
||||
public class ServerConfiguration {
|
||||
public String URL;
|
||||
public String description;
|
||||
|
||||
@@ -8,7 +8,6 @@ import java.util.HashSet;
|
||||
* Representing a Server Variable for server URL template substitution.
|
||||
*/
|
||||
{{>generatedAnnotation}}
|
||||
|
||||
public class ServerVariable {
|
||||
public String description;
|
||||
public String defaultValue;
|
||||
|
||||
@@ -6,7 +6,6 @@ import java.util.Collection;
|
||||
import java.util.Iterator;
|
||||
|
||||
{{>generatedAnnotation}}
|
||||
|
||||
public class StringUtil {
|
||||
/**
|
||||
* Check if the given array contains the given value (with case-insensitive comparison).
|
||||
|
||||
@@ -19,7 +19,6 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
{{>generatedAnnotation}}
|
||||
|
||||
{{#operations}}
|
||||
public class {{classname}} {
|
||||
private ApiClient apiClient;
|
||||
|
||||
@@ -6,7 +6,6 @@ import java.util.Map;
|
||||
import java.util.List;
|
||||
|
||||
{{>generatedAnnotation}}
|
||||
|
||||
public class ApiException extends{{#useRuntimeException}} RuntimeException {{/useRuntimeException}}{{^useRuntimeException}} Exception {{/useRuntimeException}}{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
|
||||
@@ -8,7 +8,6 @@ import java.util.Map;
|
||||
import java.util.List;
|
||||
|
||||
{{>generatedAnnotation}}
|
||||
|
||||
public class ApiKeyAuth implements Authentication {
|
||||
private final String location;
|
||||
private final String paramName;
|
||||
|
||||
@@ -8,7 +8,6 @@ import java.util.Map;
|
||||
import java.util.List;
|
||||
|
||||
{{>generatedAnnotation}}
|
||||
|
||||
public interface Authentication {
|
||||
/**
|
||||
* Apply authentication settings to header and query params.
|
||||
|
||||
@@ -11,7 +11,6 @@ import java.util.Map;
|
||||
import java.util.List;
|
||||
|
||||
{{>generatedAnnotation}}
|
||||
|
||||
public class HttpBasicAuth implements Authentication {
|
||||
private String username;
|
||||
private String password;
|
||||
|
||||
@@ -9,7 +9,6 @@ import java.util.Map;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
{{>generatedAnnotation}}
|
||||
|
||||
public class HttpBearerAuth implements Authentication {
|
||||
private final String scheme;
|
||||
private Supplier<String> tokenSupplier;
|
||||
|
||||
@@ -8,7 +8,6 @@ import java.util.Map;
|
||||
import java.util.List;
|
||||
|
||||
{{>generatedAnnotation}}
|
||||
|
||||
public class OAuth implements Authentication {
|
||||
private String accessToken;
|
||||
|
||||
|
||||
@@ -6,7 +6,6 @@ package {{invokerPackage}}.auth;
|
||||
* OAuth flows that are supported by this client
|
||||
*/
|
||||
{{>generatedAnnotation}}
|
||||
|
||||
public enum OAuthFlow {
|
||||
ACCESS_CODE, //called authorizationCode in OpenAPI 3.0
|
||||
IMPLICIT,
|
||||
|
||||
@@ -86,7 +86,6 @@ import {{invokerPackage}}.auth.OAuth;
|
||||
{{/hasOAuthMethods}}
|
||||
|
||||
{{>generatedAnnotation}}
|
||||
|
||||
public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} {
|
||||
protected Map<String, String> defaultHeaderMap = new HashMap<String, String>();
|
||||
protected Map<String, String> defaultCookieMap = new HashMap<String, String>();
|
||||
|
||||
@@ -7,7 +7,6 @@ import java.util.Collections;
|
||||
import java.util.Map;
|
||||
|
||||
{{>generatedAnnotation}}
|
||||
|
||||
public abstract class BaseApi {
|
||||
|
||||
protected ApiClient apiClient;
|
||||
|
||||
@@ -29,7 +29,6 @@ import {{javaxPackage}}.validation.Valid;
|
||||
|
||||
{{/useBeanValidation}}
|
||||
{{>generatedAnnotation}}
|
||||
|
||||
{{#operations}}
|
||||
public class {{classname}} extends BaseApi {
|
||||
|
||||
|
||||
@@ -53,7 +53,6 @@ import feign.Retryer;
|
||||
{{/hasOAuthMethods}}
|
||||
|
||||
{{>generatedAnnotation}}
|
||||
|
||||
public class ApiClient {
|
||||
protected static final Logger log = Logger.getLogger(ApiClient.class.getName());
|
||||
|
||||
|
||||
@@ -22,7 +22,6 @@ import {{javaxPackage}}.validation.Valid;
|
||||
import feign.*;
|
||||
|
||||
{{>generatedAnnotation}}
|
||||
|
||||
public interface {{classname}} extends ApiClient.Api {
|
||||
|
||||
{{#operations}}{{#operation}}
|
||||
|
||||
@@ -12,7 +12,6 @@ import com.github.scribejava.core.oauth2.clientauthentication.ClientAuthenticati
|
||||
import com.github.scribejava.core.oauth2.clientauthentication.RequestBodyAuthenticationScheme;
|
||||
|
||||
{{>generatedAnnotation}}
|
||||
|
||||
public class DefaultApi20Impl extends DefaultApi20 {
|
||||
|
||||
private final String accessTokenEndpoint;
|
||||
|
||||
@@ -10,7 +10,6 @@ import feign.RequestTemplate;
|
||||
import java.util.Collection;
|
||||
|
||||
{{>generatedAnnotation}}
|
||||
|
||||
public abstract class OAuth implements RequestInterceptor {
|
||||
|
||||
//https://datatracker.ietf.org/doc/html/rfc7519#section-4.1.4
|
||||
|
||||
@@ -6,7 +6,6 @@ import com.github.scribejava.core.builder.ServiceBuilder;
|
||||
import com.github.scribejava.core.model.OAuth2AccessToken;
|
||||
|
||||
{{>generatedAnnotation}}
|
||||
|
||||
public class OauthClientCredentialsGrant extends OAuth {
|
||||
|
||||
public OauthClientCredentialsGrant(String authorizationUrl, String tokenUrl, String scopes) {
|
||||
|
||||
@@ -6,7 +6,6 @@ import com.github.scribejava.core.builder.ServiceBuilder;
|
||||
import com.github.scribejava.core.model.OAuth2AccessToken;
|
||||
|
||||
{{>generatedAnnotation}}
|
||||
|
||||
public class OauthPasswordGrant extends OAuth {
|
||||
|
||||
private String username;
|
||||
|
||||
@@ -33,12 +33,10 @@ public class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{{#vendorExtens
|
||||
{{#isEnum}}
|
||||
{{^isContainer}}
|
||||
{{>modelInnerEnum}}
|
||||
|
||||
{{/isContainer}}
|
||||
{{#isContainer}}
|
||||
{{#mostInnerItems}}
|
||||
{{>modelInnerEnum}}
|
||||
|
||||
{{/mostInnerItems}}
|
||||
{{/isContainer}}
|
||||
{{/isEnum}}
|
||||
@@ -74,7 +72,7 @@ public class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{{#vendorExtens
|
||||
{{/isContainer}}
|
||||
{{/vendorExtensions.x-is-jackson-optional-nullable}}
|
||||
{{^vendorExtensions.x-is-jackson-optional-nullable}}
|
||||
{{>nullable_var_annotations}}{{! prevent indent}}
|
||||
{{>nullable_var_annotations}}
|
||||
{{#isContainer}}
|
||||
private {{{datatypeWithEnum}}} {{name}}{{#defaultValue}} = {{{.}}}{{/defaultValue}};
|
||||
{{/isContainer}}
|
||||
@@ -192,13 +190,12 @@ public class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{{#vendorExtens
|
||||
{{#deprecated}}
|
||||
@Deprecated
|
||||
{{/deprecated}}
|
||||
{{>nullable_var_annotations}}{{! prevent indent}}
|
||||
{{>nullable_var_annotations}}
|
||||
{{#jsonb}}
|
||||
@JsonbProperty("{{baseName}}")
|
||||
{{/jsonb}}
|
||||
{{#useBeanValidation}}
|
||||
{{>beanValidation}}
|
||||
|
||||
{{/useBeanValidation}}
|
||||
{{#swagger1AnnotationLibrary}}
|
||||
@ApiModelProperty({{#example}}example = "{{{.}}}", {{/example}}{{#required}}required = {{required}}, {{/required}}value = "{{{description}}}")
|
||||
@@ -227,7 +224,6 @@ public class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{{#vendorExtens
|
||||
|
||||
{{#vendorExtensions.x-is-jackson-optional-nullable}}
|
||||
{{> jackson_annotations}}
|
||||
|
||||
public JsonNullable<{{{datatypeWithEnum}}}> {{getter}}_JsonNullable() {
|
||||
return {{name}};
|
||||
}
|
||||
@@ -253,7 +249,6 @@ public class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{{#vendorExtens
|
||||
|
||||
{{/vars}}
|
||||
{{>libraries/feign/additional_properties}}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
{{#useReflectionEqualsHashCode}}
|
||||
|
||||
@@ -24,7 +24,6 @@ import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
|
||||
{{>generatedAnnotation}}
|
||||
|
||||
public class ApiClient {
|
||||
protected final String basePath;
|
||||
protected final HttpRequestFactory httpRequestFactory;
|
||||
|
||||
@@ -23,7 +23,6 @@ import java.util.List;
|
||||
import java.util.ArrayList;
|
||||
|
||||
{{>generatedAnnotation}}
|
||||
|
||||
{{#operations}}
|
||||
public class {{classname}} {
|
||||
private ApiClient apiClient;
|
||||
|
||||
@@ -14,7 +14,6 @@ import com.fasterxml.jackson.annotation.JsonValue;
|
||||
* Abstract class for oneOf,anyOf schemas defined in OpenAPI spec
|
||||
*/
|
||||
{{>generatedAnnotation}}
|
||||
|
||||
public abstract class AbstractOpenApiSchema {
|
||||
|
||||
// store the actual instance of the schema/object
|
||||
@@ -136,5 +135,4 @@ public abstract class AbstractOpenApiSchema {
|
||||
|
||||
{{>libraries/jersey2/additional_properties}}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -84,7 +84,6 @@ import {{invokerPackage}}.auth.OAuth;
|
||||
* <p>ApiClient class.</p>
|
||||
*/
|
||||
{{>generatedAnnotation}}
|
||||
|
||||
public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} {
|
||||
protected static final Pattern JSON_MIME_PATTERN = Pattern.compile("(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$");
|
||||
|
||||
|
||||
@@ -22,7 +22,6 @@ import {{javaxPackage}}.ws.rs.core.GenericType;
|
||||
import {{javaxPackage}}.ws.rs.ext.ContextResolver;
|
||||
|
||||
{{>generatedAnnotation}}
|
||||
|
||||
public class JSON implements ContextResolver<ObjectMapper> {
|
||||
private ObjectMapper mapper;
|
||||
|
||||
|
||||
@@ -119,7 +119,6 @@ public class {{classname}} extends AbstractOpenApiSchema{{#vendorExtensions.x-im
|
||||
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.
|
||||
|
||||
@@ -23,7 +23,6 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
{{>generatedAnnotation}}
|
||||
|
||||
{{#operations}}
|
||||
public class {{classname}} {
|
||||
private ApiClient apiClient;
|
||||
@@ -206,7 +205,7 @@ public class {{classname}} {
|
||||
|
||||
public class API{{operationId}}Request {
|
||||
{{#allParams}}
|
||||
{{>nullable_var_annotations}}{{! prevent indent}}
|
||||
{{>nullable_var_annotations}}
|
||||
private {{{dataType}}} {{paramName}};
|
||||
{{/allParams}}
|
||||
|
||||
|
||||
@@ -13,7 +13,6 @@ import java.util.TreeMap;
|
||||
* API Exception
|
||||
*/
|
||||
{{>generatedAnnotation}}
|
||||
|
||||
public class ApiException extends{{#useRuntimeException}} RuntimeException {{/useRuntimeException}}{{^useRuntimeException}} Exception {{/useRuntimeException}}{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
|
||||
@@ -10,7 +10,6 @@ import java.util.Map;
|
||||
import java.util.List;
|
||||
|
||||
{{>generatedAnnotation}}
|
||||
|
||||
public class ApiKeyAuth implements Authentication {
|
||||
private final String location;
|
||||
private final String paramName;
|
||||
|
||||
@@ -10,7 +10,6 @@ import java.util.Map;
|
||||
import java.util.List;
|
||||
|
||||
{{>generatedAnnotation}}
|
||||
|
||||
public interface Authentication {
|
||||
/**
|
||||
* Apply authentication settings to header and query params.
|
||||
|
||||
@@ -13,7 +13,6 @@ import java.util.Map;
|
||||
import java.util.List;
|
||||
|
||||
{{>generatedAnnotation}}
|
||||
|
||||
public class HttpBasicAuth implements Authentication {
|
||||
private String username;
|
||||
private String password;
|
||||
|
||||
@@ -10,7 +10,6 @@ import java.util.Map;
|
||||
import java.util.List;
|
||||
|
||||
{{>generatedAnnotation}}
|
||||
|
||||
public class HttpBearerAuth implements Authentication {
|
||||
private final String scheme;
|
||||
private String bearerToken;
|
||||
|
||||
@@ -21,7 +21,6 @@ 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());
|
||||
|
||||
|
||||
@@ -2,21 +2,17 @@
|
||||
|
||||
{{#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}}
|
||||
|
||||
@@ -181,7 +181,6 @@ public class {{classname}} extends AbstractOpenApiSchema{{#vendorExtensions.x-im
|
||||
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.
|
||||
|
||||
@@ -37,13 +37,11 @@ public class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{{#vendorExtens
|
||||
{{^isContainer}}
|
||||
{{^vendorExtensions.x-enum-as-string}}
|
||||
{{>modelInnerEnum}}
|
||||
|
||||
{{/vendorExtensions.x-enum-as-string}}
|
||||
{{/isContainer}}
|
||||
{{#isContainer}}
|
||||
{{#mostInnerItems}}
|
||||
{{>modelInnerEnum}}
|
||||
|
||||
{{/mostInnerItems}}
|
||||
{{/isContainer}}
|
||||
{{/isEnum}}
|
||||
@@ -83,7 +81,7 @@ public class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{{#vendorExtens
|
||||
{{#deprecated}}
|
||||
@Deprecated
|
||||
{{/deprecated}}
|
||||
{{>nullable_var_annotations}}{{! prevent indent}}
|
||||
{{>nullable_var_annotations}}
|
||||
private {{{datatypeWithEnum}}} {{name}}{{#defaultValue}} = {{{.}}}{{/defaultValue}};
|
||||
{{/vendorExtensions.x-is-jackson-optional-nullable}}
|
||||
|
||||
@@ -200,10 +198,9 @@ public class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{{#vendorExtens
|
||||
{{#deprecated}}
|
||||
@Deprecated
|
||||
{{/deprecated}}
|
||||
{{>nullable_var_annotations}}{{! prevent indent}}
|
||||
{{>nullable_var_annotations}}
|
||||
{{#useBeanValidation}}
|
||||
{{>beanValidation}}
|
||||
|
||||
{{/useBeanValidation}}
|
||||
{{#swagger1AnnotationLibrary}}
|
||||
@ApiModelProperty({{#example}}example = "{{{.}}}", {{/example}}{{#required}}required = {{required}}, {{/required}}value = "{{{description}}}")
|
||||
@@ -235,7 +232,6 @@ public class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{{#vendorExtens
|
||||
|
||||
{{#vendorExtensions.x-is-jackson-optional-nullable}}
|
||||
{{> jackson_annotations}}
|
||||
|
||||
public JsonNullable<{{{datatypeWithEnum}}}> {{getter}}_JsonNullable() {
|
||||
return {{name}};
|
||||
}
|
||||
@@ -270,7 +266,6 @@ public class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{{#vendorExtens
|
||||
|
||||
{{/vars}}
|
||||
{{>libraries/jersey2/additional_properties}}
|
||||
|
||||
/**
|
||||
* Return true if this {{name}} object is equal to o.
|
||||
*/
|
||||
|
||||
@@ -14,7 +14,6 @@ import com.fasterxml.jackson.annotation.JsonValue;
|
||||
* Abstract class for oneOf,anyOf schemas defined in OpenAPI spec
|
||||
*/
|
||||
{{>generatedAnnotation}}
|
||||
|
||||
public abstract class AbstractOpenApiSchema {
|
||||
|
||||
// store the actual instance of the schema/object
|
||||
@@ -136,5 +135,4 @@ public abstract class AbstractOpenApiSchema {
|
||||
|
||||
{{>libraries/jersey2/additional_properties}}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -84,7 +84,6 @@ import {{invokerPackage}}.auth.OAuth;
|
||||
* <p>ApiClient class.</p>
|
||||
*/
|
||||
{{>generatedAnnotation}}
|
||||
|
||||
public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} {
|
||||
protected static final Pattern JSON_MIME_PATTERN = Pattern.compile("(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$");
|
||||
|
||||
|
||||
@@ -22,7 +22,6 @@ import {{javaxPackage}}.ws.rs.core.GenericType;
|
||||
import {{javaxPackage}}.ws.rs.ext.ContextResolver;
|
||||
|
||||
{{>generatedAnnotation}}
|
||||
|
||||
public class JSON implements ContextResolver<ObjectMapper> {
|
||||
private ObjectMapper mapper;
|
||||
|
||||
|
||||
@@ -119,7 +119,6 @@ public class {{classname}} extends AbstractOpenApiSchema{{#vendorExtensions.x-im
|
||||
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.
|
||||
|
||||
@@ -23,7 +23,6 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
{{>generatedAnnotation}}
|
||||
|
||||
{{#operations}}
|
||||
public class {{classname}} {
|
||||
private ApiClient apiClient;
|
||||
@@ -206,7 +205,7 @@ public class {{classname}} {
|
||||
|
||||
public class API{{operationId}}Request {
|
||||
{{#allParams}}
|
||||
{{>nullable_var_annotations}}{{! prevent indent}}
|
||||
{{>nullable_var_annotations}}
|
||||
private {{{dataType}}} {{paramName}};
|
||||
{{/allParams}}
|
||||
|
||||
|
||||
@@ -13,7 +13,6 @@ import java.util.TreeMap;
|
||||
* API Exception
|
||||
*/
|
||||
{{>generatedAnnotation}}
|
||||
|
||||
public class ApiException extends{{#useRuntimeException}} RuntimeException {{/useRuntimeException}}{{^useRuntimeException}} Exception {{/useRuntimeException}}{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
|
||||
@@ -10,7 +10,6 @@ import java.util.Map;
|
||||
import java.util.List;
|
||||
|
||||
{{>generatedAnnotation}}
|
||||
|
||||
public class ApiKeyAuth implements Authentication {
|
||||
private final String location;
|
||||
private final String paramName;
|
||||
|
||||
@@ -10,7 +10,6 @@ import java.util.Map;
|
||||
import java.util.List;
|
||||
|
||||
{{>generatedAnnotation}}
|
||||
|
||||
public interface Authentication {
|
||||
/**
|
||||
* Apply authentication settings to header and query params.
|
||||
|
||||
@@ -13,7 +13,6 @@ import java.util.Map;
|
||||
import java.util.List;
|
||||
|
||||
{{>generatedAnnotation}}
|
||||
|
||||
public class HttpBasicAuth implements Authentication {
|
||||
private String username;
|
||||
private String password;
|
||||
|
||||
@@ -10,7 +10,6 @@ import java.util.Map;
|
||||
import java.util.List;
|
||||
|
||||
{{>generatedAnnotation}}
|
||||
|
||||
public class HttpBearerAuth implements Authentication {
|
||||
private final String scheme;
|
||||
private String bearerToken;
|
||||
|
||||
@@ -21,7 +21,6 @@ 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());
|
||||
|
||||
|
||||
@@ -2,21 +2,17 @@
|
||||
|
||||
{{#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}}
|
||||
|
||||
@@ -181,7 +181,6 @@ public class {{classname}} extends AbstractOpenApiSchema{{#vendorExtensions.x-im
|
||||
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.
|
||||
|
||||
@@ -37,13 +37,11 @@ public class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{{#vendorExtens
|
||||
{{^isContainer}}
|
||||
{{^vendorExtensions.x-enum-as-string}}
|
||||
{{>modelInnerEnum}}
|
||||
|
||||
{{/vendorExtensions.x-enum-as-string}}
|
||||
{{/isContainer}}
|
||||
{{#isContainer}}
|
||||
{{#mostInnerItems}}
|
||||
{{>modelInnerEnum}}
|
||||
|
||||
{{/mostInnerItems}}
|
||||
{{/isContainer}}
|
||||
{{/isEnum}}
|
||||
@@ -83,7 +81,7 @@ public class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{{#vendorExtens
|
||||
{{#deprecated}}
|
||||
@Deprecated
|
||||
{{/deprecated}}
|
||||
{{>nullable_var_annotations}}{{! prevent indent}}
|
||||
{{>nullable_var_annotations}}
|
||||
private {{{datatypeWithEnum}}} {{name}}{{#defaultValue}} = {{{.}}}{{/defaultValue}};
|
||||
{{/vendorExtensions.x-is-jackson-optional-nullable}}
|
||||
|
||||
@@ -200,10 +198,9 @@ public class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{{#vendorExtens
|
||||
{{#deprecated}}
|
||||
@Deprecated
|
||||
{{/deprecated}}
|
||||
{{>nullable_var_annotations}}{{! prevent indent}}
|
||||
{{>nullable_var_annotations}}
|
||||
{{#useBeanValidation}}
|
||||
{{>beanValidation}}
|
||||
|
||||
{{/useBeanValidation}}
|
||||
{{#swagger1AnnotationLibrary}}
|
||||
@ApiModelProperty({{#example}}example = "{{{.}}}", {{/example}}{{#required}}required = {{required}}, {{/required}}value = "{{{description}}}")
|
||||
@@ -235,7 +232,6 @@ public class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{{#vendorExtens
|
||||
|
||||
{{#vendorExtensions.x-is-jackson-optional-nullable}}
|
||||
{{> jackson_annotations}}
|
||||
|
||||
public JsonNullable<{{{datatypeWithEnum}}}> {{getter}}_JsonNullable() {
|
||||
return {{name}};
|
||||
}
|
||||
@@ -270,7 +266,6 @@ public class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{{#vendorExtens
|
||||
|
||||
{{/vars}}
|
||||
{{>libraries/jersey2/additional_properties}}
|
||||
|
||||
/**
|
||||
* Return true if this {{name}} object is equal to o.
|
||||
*/
|
||||
|
||||
@@ -55,11 +55,9 @@ import {{rootJavaEEPackage}}.validation.Valid;
|
||||
{{#model}}
|
||||
{{#isEnum}}
|
||||
{{>enumOuterClass}}
|
||||
|
||||
{{/isEnum}}
|
||||
{{^isEnum}}
|
||||
{{>pojo}}
|
||||
|
||||
{{/isEnum}}
|
||||
{{/model}}
|
||||
{{/models}}
|
||||
@@ -4,7 +4,6 @@
|
||||
){{/hasVars}}
|
||||
{{^hasVars}}@XmlType(name = "{{classname}}"){{/hasVars}}
|
||||
{{> xmlAnnotation }}
|
||||
|
||||
{{/withXml}}
|
||||
{{#jackson}}
|
||||
@JsonPropertyOrder({
|
||||
@@ -59,7 +58,6 @@ public class {{classname}} {{#parent}}extends {{{.}}}{{/parent}}{{#vendorExtensi
|
||||
{{/isContainer}}
|
||||
{{/vars}}
|
||||
{{>additional_properties}}
|
||||
|
||||
{{#vendorExtensions.x-has-readonly-properties}}{{^withXml}}
|
||||
public {{classname}}() {
|
||||
}
|
||||
@@ -152,5 +150,4 @@ public class {{classname}} {{#parent}}extends {{{.}}}{{/parent}}{{#vendorExtensi
|
||||
|
||||
{{/vars}}
|
||||
{{>pojoOverrides}}
|
||||
|
||||
}
|
||||
|
||||
@@ -12,7 +12,6 @@ import com.fasterxml.jackson.annotation.JsonValue;
|
||||
* Abstract class for oneOf,anyOf schemas defined in OpenAPI spec
|
||||
*/
|
||||
{{>generatedAnnotation}}
|
||||
|
||||
public abstract class AbstractOpenApiSchema {
|
||||
|
||||
// store the actual instance of the schema/object
|
||||
@@ -134,5 +133,4 @@ public abstract class AbstractOpenApiSchema {
|
||||
|
||||
{{>libraries/native/additional_properties}}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -43,7 +43,6 @@ import static java.nio.charset.StandardCharsets.UTF_8;
|
||||
* a fluent style of configuration.</p>
|
||||
*/
|
||||
{{>generatedAnnotation}}
|
||||
|
||||
public class ApiClient {
|
||||
|
||||
protected HttpClient.Builder builder;
|
||||
|
||||
@@ -15,7 +15,6 @@ import java.util.TreeMap;
|
||||
* @param <T> The type of data that is deserialized from response body
|
||||
*/
|
||||
{{>generatedAnnotation}}
|
||||
|
||||
public class ApiResponse<T> {
|
||||
final private int statusCode;
|
||||
final private Map<String, List<String>> headers;
|
||||
|
||||
@@ -23,7 +23,6 @@ import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
{{>generatedAnnotation}}
|
||||
|
||||
public class JSON {
|
||||
private ObjectMapper mapper;
|
||||
|
||||
@@ -89,7 +88,7 @@ public class JSON {
|
||||
/**
|
||||
* Helper class to register the discriminator mappings.
|
||||
*/
|
||||
{{>generatedAnnotation}}{{! prevent indent}}
|
||||
{{>generatedAnnotation}}
|
||||
private static class ClassDiscriminatorMapping {
|
||||
// The model class name.
|
||||
Class<?> modelClass;
|
||||
|
||||
@@ -103,7 +103,6 @@ public class {{classname}} extends AbstractOpenApiSchema{{#vendorExtensions.x-im
|
||||
super("anyOf", {{#isNullable}}Boolean.TRUE{{/isNullable}}{{^isNullable}}Boolean.FALSE{{/isNullable}});
|
||||
}
|
||||
{{> libraries/native/additional_properties }}
|
||||
|
||||
{{#additionalPropertiesType}}
|
||||
/**
|
||||
* Return true if this {{name}} object is equal to o.
|
||||
|
||||
@@ -54,7 +54,6 @@ import java.util.concurrent.CompletableFuture;
|
||||
{{/asyncNative}}
|
||||
|
||||
{{>generatedAnnotation}}
|
||||
|
||||
{{#operations}}
|
||||
public class {{classname}} {
|
||||
private final HttpClient memberVarHttpClient;
|
||||
@@ -101,54 +100,6 @@ public class {{classname}} {
|
||||
return operationId + " call failed with: " + statusCode + " - " + body;
|
||||
}
|
||||
|
||||
/**
|
||||
* Download file from the given response.
|
||||
*
|
||||
* @param response Response
|
||||
* @return File
|
||||
* @throws ApiException If fail to read file content from response and write to disk
|
||||
*/
|
||||
public File downloadFileFromResponse(HttpResponse<InputStream> response) throws ApiException {
|
||||
try {
|
||||
File file = prepareDownloadFile(response);
|
||||
java.nio.file.Files.copy(response.body(), file.toPath(), java.nio.file.StandardCopyOption.REPLACE_EXISTING);
|
||||
return file;
|
||||
} catch (IOException e) {
|
||||
throw new ApiException(e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>Prepare the file for download from the response.</p>
|
||||
*
|
||||
* @param response a {@link java.net.http.HttpResponse} object.
|
||||
* @return a {@link java.io.File} object.
|
||||
* @throws java.io.IOException if any.
|
||||
*/
|
||||
private File prepareDownloadFile(HttpResponse<InputStream> response) throws IOException {
|
||||
String filename = null;
|
||||
java.util.Optional<String> contentDisposition = response.headers().firstValue("Content-Disposition");
|
||||
if (contentDisposition.isPresent() && !"".equals(contentDisposition.get())) {
|
||||
// Get filename from the Content-Disposition header.
|
||||
java.util.regex.Pattern pattern = java.util.regex.Pattern.compile("filename=['\"]?([^'\"\\s]+)['\"]?");
|
||||
java.util.regex.Matcher matcher = pattern.matcher(contentDisposition.get());
|
||||
if (matcher.find())
|
||||
filename = matcher.group(1);
|
||||
}
|
||||
File file = null;
|
||||
if (filename != null) {
|
||||
java.nio.file.Path tempDir = java.nio.file.Files.createTempDirectory("swagger-gen-native");
|
||||
java.nio.file.Path filePath = java.nio.file.Files.createFile(tempDir.resolve(filename));
|
||||
file = filePath.toFile();
|
||||
tempDir.toFile().deleteOnExit(); // best effort cleanup
|
||||
file.deleteOnExit(); // best effort cleanup
|
||||
} else {
|
||||
file = java.nio.file.Files.createTempFile("download-", "").toFile();
|
||||
file.deleteOnExit(); // best effort cleanup
|
||||
}
|
||||
return file;
|
||||
}
|
||||
|
||||
{{#operation}}
|
||||
{{#vendorExtensions.x-group-parameters}}
|
||||
{{#hasParams}}
|
||||
@@ -178,7 +129,7 @@ public class {{classname}} {
|
||||
{{/isDeprecated}}
|
||||
public {{#returnType}}{{#asyncNative}}CompletableFuture<{{{returnType}}}>{{/asyncNative}}{{^asyncNative}}{{{returnType}}}{{/asyncNative}}{{/returnType}}{{^returnType}}{{#asyncNative}}CompletableFuture<Void>{{/asyncNative}}{{^asyncNative}}void{{/asyncNative}}{{/returnType}} {{operationId}}(API{{#lambda.titlecase}}{{operationId}}{{/lambda.titlecase}}Request apiRequest) throws ApiException {
|
||||
{{#allParams}}
|
||||
{{>nullable_var_annotations}}{{! prevent indent}}
|
||||
{{>nullable_var_annotations}}
|
||||
{{{dataType}}} {{paramName}} = apiRequest.{{paramName}}();
|
||||
{{/allParams}}
|
||||
{{#returnType}}return {{/returnType}}{{^returnType}}{{#asyncNative}}return {{/asyncNative}}{{/returnType}}{{operationId}}({{#allParams}}{{paramName}}{{^-last}}, {{/-last}}{{/allParams}});
|
||||
@@ -340,23 +291,13 @@ public class {{classname}} {
|
||||
);
|
||||
}
|
||||
|
||||
{{^isResponseFile}}{{#isResponseBinary}}
|
||||
Byte[] responseValue = localVarResponse.body().readAllBytes();
|
||||
{{/isResponseBinary}}{{/isResponseFile}}
|
||||
{{#isResponseFile}}
|
||||
// Handle file downloading.
|
||||
File responseValue = downloadFileFromResponse(localVarResponse);
|
||||
{{/isResponseFile}}
|
||||
{{^isResponseBinary}}{{^isResponseFile}}
|
||||
String responseBody = new String(localVarResponse.body().readAllBytes());
|
||||
{{{returnType}}} responseValue = responseBody.isBlank()? null: memberVarObjectMapper.readValue(responseBody, new TypeReference<{{{returnType}}}>() {});
|
||||
{{/isResponseFile}}{{/isResponseBinary}}
|
||||
localVarResponse.body().close();
|
||||
|
||||
return new ApiResponse<{{{returnType}}}>(
|
||||
localVarResponse.statusCode(),
|
||||
localVarResponse.headers().map(),
|
||||
responseValue
|
||||
responseBody.isBlank()? null: memberVarObjectMapper.readValue(responseBody, new TypeReference<{{{returnType}}}>() {})
|
||||
);
|
||||
{{/returnType}}
|
||||
{{^returnType}}
|
||||
@@ -639,11 +580,11 @@ public class {{classname}} {
|
||||
|
||||
public static final class API{{#lambda.titlecase}}{{operationId}}{{/lambda.titlecase}}Request {
|
||||
{{#requiredParams}}
|
||||
{{>nullable_var_annotations}}{{! prevent indent}}
|
||||
{{>nullable_var_annotations}}
|
||||
private {{{dataType}}} {{paramName}}; // {{description}} (required)
|
||||
{{/requiredParams}}
|
||||
{{#optionalParams}}
|
||||
{{>nullable_var_annotations}}{{! prevent indent}}
|
||||
{{>nullable_var_annotations}}
|
||||
private {{{dataType}}} {{paramName}}; // {{description}} (optional{{^isContainer}}{{#defaultValue}}, default to {{.}}{{/defaultValue}}{{/isContainer}})
|
||||
{{/optionalParams}}
|
||||
|
||||
@@ -656,7 +597,7 @@ public class {{classname}} {
|
||||
{{/optionalParams}}
|
||||
}
|
||||
{{#allParams}}
|
||||
{{>nullable_var_annotations}}{{! prevent indent}}
|
||||
{{>nullable_var_annotations}}
|
||||
public {{{dataType}}} {{paramName}}() {
|
||||
return {{paramName}};
|
||||
}
|
||||
|
||||
@@ -5,7 +5,6 @@ package {{invokerPackage}};
|
||||
import java.net.http.HttpHeaders;
|
||||
|
||||
{{>generatedAnnotation}}
|
||||
|
||||
public class ApiException extends{{#useRuntimeException}} RuntimeException {{/useRuntimeException}}{{^useRuntimeException}} Exception {{/useRuntimeException}}{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
|
||||
@@ -2,21 +2,17 @@
|
||||
|
||||
{{#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}}
|
||||
|
||||
@@ -136,7 +136,6 @@ public class {{classname}} extends AbstractOpenApiSchema{{#vendorExtensions.x-im
|
||||
super("oneOf", {{#isNullable}}Boolean.TRUE{{/isNullable}}{{^isNullable}}Boolean.FALSE{{/isNullable}});
|
||||
}
|
||||
{{> libraries/native/additional_properties }}
|
||||
|
||||
{{#additionalPropertiesType}}
|
||||
/**
|
||||
* Return true if this {{name}} object is equal to o.
|
||||
|
||||
@@ -40,13 +40,11 @@ public class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{{#vendorExtens
|
||||
{{^isContainer}}
|
||||
{{^vendorExtensions.x-enum-as-string}}
|
||||
{{>modelInnerEnum}}
|
||||
|
||||
{{/vendorExtensions.x-enum-as-string}}
|
||||
{{/isContainer}}
|
||||
{{#isContainer}}
|
||||
{{#mostInnerItems}}
|
||||
{{>modelInnerEnum}}
|
||||
|
||||
{{/mostInnerItems}}
|
||||
{{/isContainer}}
|
||||
{{/isEnum}}
|
||||
@@ -77,7 +75,7 @@ public class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{{#vendorExtens
|
||||
{{/isContainer}}
|
||||
{{/vendorExtensions.x-is-jackson-optional-nullable}}
|
||||
{{^vendorExtensions.x-is-jackson-optional-nullable}}
|
||||
{{>nullable_var_annotations}}{{! prevent indent}}
|
||||
{{>nullable_var_annotations}}
|
||||
private {{{datatypeWithEnum}}} {{name}}{{#defaultValue}} = {{{.}}}{{/defaultValue}};
|
||||
{{/vendorExtensions.x-is-jackson-optional-nullable}}
|
||||
|
||||
@@ -191,10 +189,9 @@ public class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{{#vendorExtens
|
||||
{{#deprecated}}
|
||||
@Deprecated
|
||||
{{/deprecated}}
|
||||
{{>nullable_var_annotations}}{{! prevent indent}}
|
||||
{{>nullable_var_annotations}}
|
||||
{{#useBeanValidation}}
|
||||
{{>beanValidation}}
|
||||
|
||||
{{/useBeanValidation}}
|
||||
{{#swagger1AnnotationLibrary}}
|
||||
@ApiModelProperty({{#example}}example = "{{{.}}}", {{/example}}{{#required}}required = {{required}}, {{/required}}value = "{{{description}}}")
|
||||
@@ -225,7 +222,6 @@ public class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{{#vendorExtens
|
||||
|
||||
{{#vendorExtensions.x-is-jackson-optional-nullable}}
|
||||
{{> jackson_annotations}}
|
||||
|
||||
public JsonNullable<{{{datatypeWithEnum}}}> {{getter}}_JsonNullable() {
|
||||
return {{name}};
|
||||
}
|
||||
@@ -257,7 +253,6 @@ public class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{{#vendorExtens
|
||||
|
||||
{{/vars}}
|
||||
{{>libraries/native/additional_properties}}
|
||||
|
||||
{{#parent}}
|
||||
{{#allVars}}
|
||||
{{#isOverridden}}
|
||||
@@ -578,6 +573,6 @@ static {
|
||||
{{/discriminator}}
|
||||
{{#generateBuilders}}
|
||||
|
||||
{{>javaBuilder}}{{! prevent indent}}
|
||||
{{>javaBuilder}}
|
||||
{{/generateBuilders}}
|
||||
}
|
||||
|
||||
@@ -11,7 +11,6 @@ import java.util.Map;
|
||||
* Abstract class for oneOf,anyOf schemas defined in OpenAPI spec
|
||||
*/
|
||||
{{>generatedAnnotation}}
|
||||
|
||||
public abstract class AbstractOpenApiSchema {
|
||||
|
||||
// store the actual instance of the schema/object
|
||||
@@ -133,5 +132,4 @@ public abstract class AbstractOpenApiSchema {
|
||||
|
||||
{{>libraries/jersey2/additional_properties}}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -431,11 +431,11 @@ public class {{classname}} {
|
||||
|
||||
public class API{{operationId}}Request {
|
||||
{{#requiredParams}}
|
||||
{{>nullable_var_annotations}}{{! prevent indent}}
|
||||
{{>nullable_var_annotations}}
|
||||
private final {{{dataType}}} {{paramName}};
|
||||
{{/requiredParams}}
|
||||
{{#optionalParams}}
|
||||
{{>nullable_var_annotations}}{{! prevent indent}}
|
||||
{{>nullable_var_annotations}}
|
||||
private {{{dataType}}} {{paramName}};
|
||||
{{/optionalParams}}
|
||||
|
||||
|
||||
@@ -15,7 +15,6 @@ import java.util.TreeMap;
|
||||
*/
|
||||
@SuppressWarnings("serial")
|
||||
{{>generatedAnnotation}}
|
||||
|
||||
public class ApiException extends{{#useRuntimeException}} RuntimeException {{/useRuntimeException}}{{^useRuntimeException}} Exception {{/useRuntimeException}}{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
|
||||
@@ -28,7 +28,6 @@ import software.amazon.awssdk.regions.Region;
|
||||
import okio.Buffer;
|
||||
|
||||
{{>generatedAnnotation}}
|
||||
|
||||
public class AWS4Auth implements Authentication {
|
||||
|
||||
private AwsCredentials credentials;
|
||||
|
||||
@@ -10,7 +10,6 @@ import java.util.Map;
|
||||
import java.util.List;
|
||||
|
||||
{{>generatedAnnotation}}
|
||||
|
||||
public class ApiKeyAuth implements Authentication {
|
||||
private final String location;
|
||||
private final String paramName;
|
||||
|
||||
@@ -10,7 +10,6 @@ import java.util.Map;
|
||||
import java.util.List;
|
||||
|
||||
{{>generatedAnnotation}}
|
||||
|
||||
public interface Authentication {
|
||||
/**
|
||||
* Apply authentication settings to header and query params.
|
||||
|
||||
@@ -12,7 +12,6 @@ import java.util.Optional;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
{{>generatedAnnotation}}
|
||||
|
||||
public class HttpBearerAuth implements Authentication {
|
||||
private final String scheme;
|
||||
private Supplier<String> tokenSupplier;
|
||||
|
||||
@@ -10,7 +10,6 @@ import java.util.Map;
|
||||
import java.util.List;
|
||||
|
||||
{{>generatedAnnotation}}
|
||||
|
||||
public class OAuth implements Authentication {
|
||||
private String accessToken;
|
||||
|
||||
|
||||
@@ -49,12 +49,10 @@ public class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{{#vendorExtens
|
||||
{{#isEnum}}
|
||||
{{^isContainer}}
|
||||
{{>modelInnerEnum}}
|
||||
|
||||
{{/isContainer}}
|
||||
{{#isContainer}}
|
||||
{{#mostInnerItems}}
|
||||
{{>modelInnerEnum}}
|
||||
|
||||
{{/mostInnerItems}}
|
||||
{{/isContainer}}
|
||||
{{/isEnum}}
|
||||
@@ -72,7 +70,7 @@ public class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{{#vendorExtens
|
||||
{{#vendorExtensions.x-field-extra-annotation}}
|
||||
{{{vendorExtensions.x-field-extra-annotation}}}
|
||||
{{/vendorExtensions.x-field-extra-annotation}}
|
||||
{{>nullable_var_annotations}}{{! prevent indent}}
|
||||
{{>nullable_var_annotations}}
|
||||
{{#isDiscriminator}}protected{{/isDiscriminator}}{{^isDiscriminator}}private{{/isDiscriminator}} {{{datatypeWithEnum}}} {{name}}{{#defaultValue}} = {{{.}}}{{/defaultValue}};
|
||||
|
||||
{{/vars}}
|
||||
@@ -161,10 +159,9 @@ public class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{{#vendorExtens
|
||||
{{#deprecated}}
|
||||
@Deprecated
|
||||
{{/deprecated}}
|
||||
{{>nullable_var_annotations}}{{! prevent indent}}
|
||||
{{>nullable_var_annotations}}
|
||||
{{#useBeanValidation}}
|
||||
{{>beanValidation}}
|
||||
|
||||
{{/useBeanValidation}}
|
||||
{{#swagger1AnnotationLibrary}}
|
||||
@ApiModelProperty({{#example}}example = "{{{.}}}", {{/example}}{{#required}}required = {{required}}, {{/required}}value = "{{{description}}}")
|
||||
@@ -190,7 +187,6 @@ public class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{{#vendorExtens
|
||||
{{/vars}}
|
||||
{{>libraries/okhttp-gson/additional_properties}}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
{{#useReflectionEqualsHashCode}}
|
||||
|
||||
@@ -67,7 +67,6 @@ import {{invokerPackage}}.auth.OAuth;
|
||||
{{/hasOAuthMethods}}
|
||||
|
||||
{{>generatedAnnotation}}
|
||||
|
||||
{{#generateClientAsBean}}
|
||||
@Component("{{invokerPackage}}.ApiClient")
|
||||
{{/generateClientAsBean}}
|
||||
|
||||
@@ -37,7 +37,6 @@ import org.springframework.web.client.RestClient.ResponseSpec;
|
||||
import org.springframework.web.client.RestClientResponseException;
|
||||
|
||||
{{>generatedAnnotation}}
|
||||
|
||||
{{#generateClientAsBean}}
|
||||
@Component("{{package}}.{{classname}}")
|
||||
{{/generateClientAsBean}}
|
||||
|
||||
@@ -6,7 +6,6 @@ import org.springframework.http.HttpHeaders;
|
||||
import org.springframework.util.MultiValueMap;
|
||||
|
||||
{{>generatedAnnotation}}
|
||||
|
||||
public class ApiKeyAuth implements Authentication {
|
||||
private final String location;
|
||||
private final String paramName;
|
||||
|
||||
@@ -6,7 +6,6 @@ import org.springframework.http.HttpHeaders;
|
||||
import org.springframework.util.MultiValueMap;
|
||||
|
||||
{{>generatedAnnotation}}
|
||||
|
||||
public interface Authentication {
|
||||
/**
|
||||
* Apply authentication settings to header and / or query parameters.
|
||||
|
||||
@@ -9,7 +9,6 @@ import org.springframework.http.HttpHeaders;
|
||||
import org.springframework.util.MultiValueMap;
|
||||
|
||||
{{>generatedAnnotation}}
|
||||
|
||||
public class HttpBasicAuth implements Authentication {
|
||||
private String username;
|
||||
private String password;
|
||||
|
||||
@@ -8,7 +8,6 @@ import org.springframework.http.HttpHeaders;
|
||||
import org.springframework.util.MultiValueMap;
|
||||
|
||||
{{>generatedAnnotation}}
|
||||
|
||||
public class HttpBearerAuth implements Authentication {
|
||||
private final String scheme;
|
||||
private Supplier<String> tokenSupplier;
|
||||
|
||||
@@ -11,7 +11,6 @@ import org.springframework.util.MultiValueMap;
|
||||
* Provides support for RFC 6750 - Bearer Token usage for OAUTH 2.0 Authorization.
|
||||
*/
|
||||
{{>generatedAnnotation}}
|
||||
|
||||
public class OAuth implements Authentication {
|
||||
private Supplier<String> tokenSupplier;
|
||||
|
||||
|
||||
@@ -38,12 +38,10 @@ public class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{{#vendorExtens
|
||||
{{#isEnum}}
|
||||
{{^isContainer}}
|
||||
{{>modelInnerEnum}}
|
||||
|
||||
{{/isContainer}}
|
||||
{{#isContainer}}
|
||||
{{#mostInnerItems}}
|
||||
{{>modelInnerEnum}}
|
||||
|
||||
{{/mostInnerItems}}
|
||||
{{/isContainer}}
|
||||
{{/isEnum}}
|
||||
@@ -67,7 +65,7 @@ public class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{{#vendorExtens
|
||||
{{#gson}}
|
||||
@SerializedName(SERIALIZED_NAME_{{nameInSnakeCase}})
|
||||
{{/gson}}
|
||||
{{>nullable_var_annotations}}{{! prevent indent}}
|
||||
{{>nullable_var_annotations}}
|
||||
{{#vendorExtensions.x-field-extra-annotation}}
|
||||
{{{vendorExtensions.x-field-extra-annotation}}}
|
||||
{{/vendorExtensions.x-field-extra-annotation}}
|
||||
@@ -213,13 +211,12 @@ public class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{{#vendorExtens
|
||||
{{#deprecated}}
|
||||
@Deprecated
|
||||
{{/deprecated}}
|
||||
{{>nullable_var_annotations}}{{! prevent indent}}
|
||||
{{>nullable_var_annotations}}
|
||||
{{#jsonb}}
|
||||
@JsonbProperty("{{baseName}}")
|
||||
{{/jsonb}}
|
||||
{{#useBeanValidation}}
|
||||
{{>beanValidation}}
|
||||
|
||||
{{/useBeanValidation}}
|
||||
{{#swagger1AnnotationLibrary}}
|
||||
@ApiModelProperty({{#example}}example = "{{{.}}}", {{/example}}{{#required}}required = {{required}}, {{/required}}value = "{{{description}}}")
|
||||
@@ -251,7 +248,6 @@ public class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{{#vendorExtens
|
||||
|
||||
{{#vendorExtensions.x-is-jackson-optional-nullable}}
|
||||
{{> jackson_annotations}}
|
||||
|
||||
public JsonNullable<{{{datatypeWithEnum}}}> {{getter}}_JsonNullable() {
|
||||
return {{name}};
|
||||
}
|
||||
@@ -277,7 +273,6 @@ public class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{{#vendorExtens
|
||||
|
||||
{{/vars}}
|
||||
{{>libraries/restclient/additional_properties}}
|
||||
|
||||
{{#parent}}
|
||||
{{#readWriteVars}}
|
||||
{{#isOverridden}}
|
||||
@@ -619,7 +614,7 @@ public class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{{#vendorExtens
|
||||
{{/parcelableModel}}
|
||||
{{#generateBuilders}}
|
||||
|
||||
{{>javaBuilder}}{{! prevent indent}}
|
||||
{{>javaBuilder}}
|
||||
{{/generateBuilders}}
|
||||
|
||||
}
|
||||
|
||||
@@ -55,7 +55,6 @@ import {{invokerPackage}}.auth.OAuth;
|
||||
{{/hasOAuthMethods}}
|
||||
|
||||
{{>generatedAnnotation}}
|
||||
|
||||
public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} {
|
||||
protected Map<String, String> defaultHeaderMap = new HashMap<String, String>();
|
||||
protected Map<String, String> defaultCookieMap = new HashMap<String, String>();
|
||||
|
||||
@@ -14,7 +14,6 @@ import java.text.DateFormat;
|
||||
import {{javaxPackage}}.ws.rs.ext.ContextResolver;
|
||||
|
||||
{{>generatedAnnotation}}
|
||||
|
||||
public class JSON implements ContextResolver<ObjectMapper> {
|
||||
private ObjectMapper mapper;
|
||||
|
||||
|
||||
@@ -16,7 +16,6 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
{{>generatedAnnotation}}
|
||||
|
||||
{{#operations}}
|
||||
public class {{classname}} {
|
||||
private ApiClient apiClient;
|
||||
|
||||
@@ -86,7 +86,6 @@ import {{invokerPackage}}.auth.OAuth;
|
||||
{{/hasOAuthMethods}}
|
||||
|
||||
{{>generatedAnnotation}}
|
||||
|
||||
{{#generateClientAsBean}}
|
||||
@Component("{{invokerPackage}}.ApiClient")
|
||||
{{/generateClientAsBean}}
|
||||
|
||||
@@ -8,7 +8,6 @@ import org.springframework.http.HttpMethod;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
|
||||
{{>generatedAnnotation}}
|
||||
|
||||
public abstract class BaseApi {
|
||||
|
||||
protected ApiClient apiClient;
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user