mirror of
https://github.com/OpenAPITools/openapi-generator.git
synced 2025-05-12 12:40:53 +00:00
Merge remote-tracking branch 'origin/master' into okhttp-gson-next-gen-better-error
This commit is contained in:
commit
d2b81b721e
@ -74,6 +74,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
||||
## RESERVED WORDS
|
||||
|
||||
<ul class="column-ul">
|
||||
<li>ApiResponse</li>
|
||||
<li>abstract</li>
|
||||
<li>actual</li>
|
||||
<li>annotation</li>
|
||||
|
@ -76,6 +76,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
||||
## RESERVED WORDS
|
||||
|
||||
<ul class="column-ul">
|
||||
<li>ApiResponse</li>
|
||||
<li>abstract</li>
|
||||
<li>actual</li>
|
||||
<li>annotation</li>
|
||||
|
@ -68,6 +68,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
||||
## RESERVED WORDS
|
||||
|
||||
<ul class="column-ul">
|
||||
<li>ApiResponse</li>
|
||||
<li>abstract</li>
|
||||
<li>actual</li>
|
||||
<li>annotation</li>
|
||||
|
@ -79,6 +79,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
||||
## RESERVED WORDS
|
||||
|
||||
<ul class="column-ul">
|
||||
<li>ApiResponse</li>
|
||||
<li>abstract</li>
|
||||
<li>actual</li>
|
||||
<li>annotation</li>
|
||||
|
@ -21,6 +21,7 @@ import java.util.*;
|
||||
|
||||
public class CodegenResponse implements IJsonSchemaValidationProperties {
|
||||
public final List<CodegenProperty> headers = new ArrayList<CodegenProperty>();
|
||||
private List<CodegenParameter> responseHeaders = new ArrayList<CodegenParameter>();
|
||||
public String code;
|
||||
public boolean is1xx;
|
||||
public boolean is2xx;
|
||||
@ -87,6 +88,7 @@ public class CodegenResponse implements IJsonSchemaValidationProperties {
|
||||
private boolean hasDiscriminatorWithNonEmptyMapping;
|
||||
private CodegenComposedSchemas composedSchemas;
|
||||
private boolean hasMultipleTypes = false;
|
||||
private LinkedHashMap<String, CodegenMediaType> content;
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
@ -98,7 +100,7 @@ public class CodegenResponse implements IJsonSchemaValidationProperties {
|
||||
getMaxProperties(), getMinProperties(), uniqueItems, getMaxItems(), getMinItems(), getMaxLength(),
|
||||
getMinLength(), exclusiveMinimum, exclusiveMaximum, getMinimum(), getMaximum(), getPattern(),
|
||||
is1xx, is2xx, is3xx, is4xx, is5xx, additionalPropertiesIsAnyType, hasVars, hasRequired,
|
||||
hasDiscriminatorWithNonEmptyMapping, composedSchemas, hasMultipleTypes);
|
||||
hasDiscriminatorWithNonEmptyMapping, composedSchemas, hasMultipleTypes, responseHeaders, content);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -147,6 +149,8 @@ public class CodegenResponse implements IJsonSchemaValidationProperties {
|
||||
getAdditionalPropertiesIsAnyType() == that.getAdditionalPropertiesIsAnyType() &&
|
||||
getHasVars() == that.getHasVars() &&
|
||||
getHasRequired() == that.getHasRequired() &&
|
||||
Objects.equals(content, that.getContent()) &&
|
||||
Objects.equals(responseHeaders, that.getResponseHeaders()) &&
|
||||
Objects.equals(composedSchemas, that.getComposedSchemas()) &&
|
||||
Objects.equals(vars, that.vars) &&
|
||||
Objects.equals(requiredVars, that.requiredVars) &&
|
||||
@ -176,6 +180,22 @@ public class CodegenResponse implements IJsonSchemaValidationProperties {
|
||||
|
||||
}
|
||||
|
||||
public LinkedHashMap<String, CodegenMediaType> getContent() {
|
||||
return content;
|
||||
}
|
||||
|
||||
public void setContent(LinkedHashMap<String, CodegenMediaType> content) {
|
||||
this.content = content;
|
||||
}
|
||||
|
||||
public List<CodegenParameter> getResponseHeaders() {
|
||||
return responseHeaders;
|
||||
}
|
||||
|
||||
public void setResponseHeaders(List<CodegenParameter> responseHeaders) {
|
||||
this.responseHeaders = responseHeaders;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPattern() {
|
||||
return pattern;
|
||||
@ -488,6 +508,8 @@ public class CodegenResponse implements IJsonSchemaValidationProperties {
|
||||
sb.append(", getHasDiscriminatorWithNonEmptyMapping=").append(hasDiscriminatorWithNonEmptyMapping);
|
||||
sb.append(", composedSchemas=").append(composedSchemas);
|
||||
sb.append(", hasMultipleTypes=").append(hasMultipleTypes);
|
||||
sb.append(", responseHeaders=").append(responseHeaders);
|
||||
sb.append(", content=").append(content);
|
||||
sb.append('}');
|
||||
return sb.toString();
|
||||
}
|
||||
|
@ -3170,10 +3170,16 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
List<MappedModel> uniqueDescendants = new ArrayList();
|
||||
if (sourceDiscriminator.getMapping() != null && !sourceDiscriminator.getMapping().isEmpty()) {
|
||||
for (Entry<String, String> e : sourceDiscriminator.getMapping().entrySet()) {
|
||||
String nameOrRef = e.getValue();
|
||||
String name = nameOrRef.indexOf('/') >= 0 ? ModelUtils.getSimpleRef(nameOrRef) : nameOrRef;
|
||||
String modelName = toModelName(name);
|
||||
uniqueDescendants.add(new MappedModel(e.getKey(), modelName));
|
||||
String name;
|
||||
if (e.getValue().indexOf('/') >= 0) {
|
||||
name = ModelUtils.getSimpleRef(e.getValue());
|
||||
if (ModelUtils.getSchema(openAPI, name) == null) {
|
||||
LOGGER.error("Failed to lookup the schema '{}' when processing the discriminator mapping of oneOf/anyOf. Please check to ensure it's defined properly.", name);
|
||||
}
|
||||
} else {
|
||||
name = e.getValue();
|
||||
}
|
||||
uniqueDescendants.add(new MappedModel(e.getKey(), toModelName(name)));
|
||||
}
|
||||
}
|
||||
|
||||
@ -3959,6 +3965,20 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
ApiResponse response = operationGetResponsesEntry.getValue();
|
||||
addProducesInfo(response, op);
|
||||
CodegenResponse r = fromResponse(key, response);
|
||||
Map<String, Header> headers = response.getHeaders();
|
||||
if (headers != null) {
|
||||
List<CodegenParameter> responseHeaders = new ArrayList<>();
|
||||
for (Entry<String, Header> entry: headers.entrySet()) {
|
||||
String headerName = entry.getKey();
|
||||
Header header = entry.getValue();
|
||||
CodegenParameter responseHeader = heeaderToCodegenParameter(header, headerName, imports, String.format(Locale.ROOT, "%sResponseParameter", r.code));
|
||||
responseHeaders.add(responseHeader);
|
||||
}
|
||||
r.setResponseHeaders(responseHeaders);
|
||||
}
|
||||
String mediaTypeSchemaSuffix = String.format(Locale.ROOT, "%sResponseBody", r.code);
|
||||
r.setContent(getContent(response.getContent(), imports, mediaTypeSchemaSuffix));
|
||||
|
||||
if (r.baseType != null &&
|
||||
!defaultIncludes.contains(r.baseType) &&
|
||||
!languageSpecificPrimitives.contains(r.baseType)) {
|
||||
@ -4065,6 +4085,7 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
param = ModelUtils.getReferencedParameter(this.openAPI, param);
|
||||
|
||||
CodegenParameter p = fromParameter(param, imports);
|
||||
p.setContent(getContent(param.getContent(), imports, "RequestParameter" + toModelName(param.getName())));
|
||||
|
||||
// ensure unique params
|
||||
if (ensureUniqueParams) {
|
||||
@ -4502,7 +4523,6 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
codegenParameter.isDeprecated = parameter.getDeprecated();
|
||||
}
|
||||
codegenParameter.jsonSchema = Json.pretty(parameter);
|
||||
codegenParameter.setContent(getContent(parameter.getContent(), imports));
|
||||
|
||||
if (GlobalSettings.getProperty("debugParser") != null) {
|
||||
LOGGER.info("working on Parameter {}", parameter.getName());
|
||||
@ -6586,11 +6606,36 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
codegenParameter.pattern = toRegularExpression(schema.getPattern());
|
||||
}
|
||||
|
||||
protected String toMediaTypeSchemaName(String contentType) {
|
||||
return toModelName(contentType + "Schema");
|
||||
protected String toMediaTypeSchemaName(String contentType, String mediaTypeSchemaSuffix) {
|
||||
return "SchemaFor" + mediaTypeSchemaSuffix + toModelName(contentType);
|
||||
}
|
||||
|
||||
protected LinkedHashMap<String, CodegenMediaType> getContent(Content content, Set<String> imports) {
|
||||
private CodegenParameter heeaderToCodegenParameter(Header header, String headerName, Set<String> imports, String mediaTypeSchemaSuffix) {
|
||||
if (header == null) {
|
||||
return null;
|
||||
}
|
||||
Parameter headerParam = new Parameter();
|
||||
headerParam.setName(headerName);
|
||||
headerParam.setIn("header");
|
||||
headerParam.setDescription(header.getDescription());
|
||||
headerParam.setRequired(header.getRequired());
|
||||
headerParam.setDeprecated(header.getDeprecated());
|
||||
Header.StyleEnum style = header.getStyle();
|
||||
if (style != null) {
|
||||
headerParam.setStyle(Parameter.StyleEnum.valueOf(style.name()));
|
||||
}
|
||||
headerParam.setExplode(header.getExplode());
|
||||
headerParam.setSchema(header.getSchema());
|
||||
headerParam.setExamples(header.getExamples());
|
||||
headerParam.setExample(header.getExample());
|
||||
headerParam.setContent(header.getContent());
|
||||
headerParam.setExtensions(header.getExtensions());
|
||||
CodegenParameter param = fromParameter(headerParam, imports);
|
||||
param.setContent(getContent(headerParam.getContent(), imports, mediaTypeSchemaSuffix));
|
||||
return param;
|
||||
}
|
||||
|
||||
protected LinkedHashMap<String, CodegenMediaType> getContent(Content content, Set<String> imports, String mediaTypeSchemaSuffix) {
|
||||
if (content == null) {
|
||||
return null;
|
||||
}
|
||||
@ -6609,20 +6654,7 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
for (Entry<String, Header> headerEntry: encHeaders.entrySet()) {
|
||||
String headerName = headerEntry.getKey();
|
||||
Header header = ModelUtils.getReferencedHeader(this.openAPI, headerEntry.getValue());
|
||||
Parameter headerParam = new Parameter();
|
||||
headerParam.setName(headerName);
|
||||
headerParam.setIn("header");
|
||||
headerParam.setDescription(header.getDescription());
|
||||
headerParam.setRequired(header.getRequired());
|
||||
headerParam.setDeprecated(header.getDeprecated());
|
||||
headerParam.setStyle(Parameter.StyleEnum.valueOf(header.getStyle().name()));
|
||||
headerParam.setExplode(header.getExplode());
|
||||
headerParam.setSchema(header.getSchema());
|
||||
headerParam.setExamples(header.getExamples());
|
||||
headerParam.setExample(header.getExample());
|
||||
headerParam.setContent(header.getContent());
|
||||
headerParam.setExtensions(header.getExtensions());
|
||||
CodegenParameter param = fromParameter(headerParam, imports);
|
||||
CodegenParameter param = heeaderToCodegenParameter(header, headerName, imports, mediaTypeSchemaSuffix);
|
||||
headers.add(param);
|
||||
}
|
||||
}
|
||||
@ -6638,7 +6670,7 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
}
|
||||
}
|
||||
String contentType = contentEntry.getKey();
|
||||
CodegenProperty schemaProp = fromProperty(toMediaTypeSchemaName(contentType), mt.getSchema());
|
||||
CodegenProperty schemaProp = fromProperty(toMediaTypeSchemaName(contentType, mediaTypeSchemaSuffix), mt.getSchema());
|
||||
CodegenMediaType codegenMt = new CodegenMediaType(schemaProp, ceMap);
|
||||
cmtContent.put(contentType, codegenMt);
|
||||
}
|
||||
@ -6666,7 +6698,7 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
if (schema == null) {
|
||||
throw new RuntimeException("Request body cannot be null. Possible cause: missing schema in body parameter (OAS v2): " + body);
|
||||
}
|
||||
codegenParameter.setContent(getContent(body.getContent(), imports));
|
||||
codegenParameter.setContent(getContent(body.getContent(), imports, "RequestBody"));
|
||||
|
||||
if (StringUtils.isNotBlank(schema.get$ref())) {
|
||||
name = ModelUtils.getSimpleRef(schema.get$ref());
|
||||
@ -6721,6 +6753,8 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
} else if (ModelUtils.isObjectSchema(schema)) {
|
||||
// object type schema OR (AnyType schema with properties defined)
|
||||
this.addBodyModelSchema(codegenParameter, name, schema, imports, bodyParameterName, false);
|
||||
} else {
|
||||
updateRequestBodyForPrimitiveType(codegenParameter, schema, bodyParameterName, imports);
|
||||
}
|
||||
addVarsRequiredVarsAdditionalProps(schema, codegenParameter);
|
||||
} else {
|
||||
|
@ -98,6 +98,7 @@ public abstract class AbstractKotlinCodegen extends DefaultCodegen implements Co
|
||||
// this includes hard reserved words defined by https://github.com/JetBrains/kotlin/blob/master/core/descriptors/src/org/jetbrains/kotlin/renderer/KeywordStringsGenerated.java
|
||||
// as well as keywords from https://kotlinlang.org/docs/reference/keyword-reference.html
|
||||
reservedWords = new HashSet<>(Arrays.asList(
|
||||
"ApiResponse", // Used in the auto-generated api client
|
||||
"abstract",
|
||||
"actual",
|
||||
"annotation",
|
||||
|
@ -18,8 +18,21 @@
|
||||
package org.openapitools.codegen.languages;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.openapitools.codegen.*;
|
||||
import org.openapitools.codegen.meta.features.*;
|
||||
import org.openapitools.codegen.CliOption;
|
||||
import org.openapitools.codegen.CodegenConstants;
|
||||
import org.openapitools.codegen.CodegenModel;
|
||||
import org.openapitools.codegen.CodegenOperation;
|
||||
import org.openapitools.codegen.CodegenParameter;
|
||||
import org.openapitools.codegen.CodegenProperty;
|
||||
import org.openapitools.codegen.CodegenType;
|
||||
import org.openapitools.codegen.SupportingFile;
|
||||
import org.openapitools.codegen.meta.features.ClientModificationFeature;
|
||||
import org.openapitools.codegen.meta.features.DocumentationFeature;
|
||||
import org.openapitools.codegen.meta.features.GlobalFeature;
|
||||
import org.openapitools.codegen.meta.features.ParameterFeature;
|
||||
import org.openapitools.codegen.meta.features.SchemaSupportFeature;
|
||||
import org.openapitools.codegen.meta.features.SecurityFeature;
|
||||
import org.openapitools.codegen.meta.features.WireFormatFeature;
|
||||
import org.openapitools.codegen.utils.ProcessUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
@ -28,6 +41,7 @@ import java.io.File;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.function.Predicate;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
@ -479,14 +493,12 @@ public class KotlinClientCodegen extends AbstractKotlinCodegen {
|
||||
break;
|
||||
|
||||
case gson:
|
||||
supportingFiles.add(new SupportingFile("jvm-common/infrastructure/DateAdapter.kt.mustache", infrastructureFolder, "DateAdapter.kt"));
|
||||
supportingFiles.add(new SupportingFile("jvm-common/infrastructure/LocalDateAdapter.kt.mustache", infrastructureFolder, "LocalDateAdapter.kt"));
|
||||
supportingFiles.add(new SupportingFile("jvm-common/infrastructure/LocalDateTimeAdapter.kt.mustache", infrastructureFolder, "LocalDateTimeAdapter.kt"));
|
||||
supportingFiles.add(new SupportingFile("jvm-common/infrastructure/OffsetDateTimeAdapter.kt.mustache", infrastructureFolder, "OffsetDateTimeAdapter.kt"));
|
||||
break;
|
||||
|
||||
case jackson:
|
||||
//supportingFiles.add(new SupportingFile("jvm-common/infrastructure/DateAdapter.kt.mustache", infrastructureFolder, "DateAdapter.kt"));
|
||||
break;
|
||||
|
||||
case kotlinx_serialization:
|
||||
@ -497,7 +509,6 @@ public class KotlinClientCodegen extends AbstractKotlinCodegen {
|
||||
supportingFiles.add(new SupportingFile("jvm-common/infrastructure/URLAdapter.kt.mustache", infrastructureFolder, "URLAdapter.kt"));
|
||||
supportingFiles.add(new SupportingFile("jvm-common/infrastructure/BigIntegerAdapter.kt.mustache", infrastructureFolder, "BigIntegerAdapter.kt"));
|
||||
supportingFiles.add(new SupportingFile("jvm-common/infrastructure/BigDecimalAdapter.kt.mustache", infrastructureFolder, "BigDecimalAdapter.kt"));
|
||||
supportingFiles.add(new SupportingFile("jvm-common/infrastructure/DateAdapter.kt.mustache", infrastructureFolder, "DateAdapter.kt"));
|
||||
supportingFiles.add(new SupportingFile("jvm-common/infrastructure/LocalDateAdapter.kt.mustache", infrastructureFolder, "LocalDateAdapter.kt"));
|
||||
supportingFiles.add(new SupportingFile("jvm-common/infrastructure/LocalDateTimeAdapter.kt.mustache", infrastructureFolder, "LocalDateTimeAdapter.kt"));
|
||||
supportingFiles.add(new SupportingFile("jvm-common/infrastructure/OffsetDateTimeAdapter.kt.mustache", infrastructureFolder, "OffsetDateTimeAdapter.kt"));
|
||||
@ -527,7 +538,7 @@ public class KotlinClientCodegen extends AbstractKotlinCodegen {
|
||||
// jvm specific supporting files
|
||||
supportingFiles.add(new SupportingFile("infrastructure/Errors.kt.mustache", infrastructureFolder, "Errors.kt"));
|
||||
supportingFiles.add(new SupportingFile("infrastructure/ResponseExtensions.kt.mustache", infrastructureFolder, "ResponseExtensions.kt"));
|
||||
supportingFiles.add(new SupportingFile("infrastructure/ApiInfrastructureResponse.kt.mustache", infrastructureFolder, "ApiInfrastructureResponse.kt"));
|
||||
supportingFiles.add(new SupportingFile("infrastructure/ApiResponse.kt.mustache", infrastructureFolder, "ApiResponse.kt"));
|
||||
}
|
||||
|
||||
private void processMultiplatformLibrary(final String infrastructureFolder) {
|
||||
@ -617,14 +628,14 @@ public class KotlinClientCodegen extends AbstractKotlinCodegen {
|
||||
|
||||
// escape the variable base name for use as a string literal
|
||||
List<CodegenProperty> vars = Stream.of(
|
||||
cm.vars,
|
||||
cm.allVars,
|
||||
cm.optionalVars,
|
||||
cm.requiredVars,
|
||||
cm.readOnlyVars,
|
||||
cm.readWriteVars,
|
||||
cm.parentVars
|
||||
)
|
||||
cm.vars,
|
||||
cm.allVars,
|
||||
cm.optionalVars,
|
||||
cm.requiredVars,
|
||||
cm.readOnlyVars,
|
||||
cm.readWriteVars,
|
||||
cm.parentVars
|
||||
)
|
||||
.flatMap(List::stream)
|
||||
.collect(Collectors.toList());
|
||||
|
||||
@ -653,6 +664,35 @@ public class KotlinClientCodegen extends AbstractKotlinCodegen {
|
||||
operation.path = operation.path.substring(1);
|
||||
}
|
||||
|
||||
if (JVM_OKHTTP.equals(getLibrary()) || JVM_OKHTTP3.equals(getLibrary()) || JVM_OKHTTP4.equals(getLibrary())) {
|
||||
// Ideally we would do content negotiation to choose the best mediatype, but that would be a next step.
|
||||
// For now we take the first mediatype we can parse and send that.
|
||||
Predicate<Map<String, String>> isSerializable = typeMapping -> {
|
||||
String mediaTypeValue = typeMapping.get("mediaType");
|
||||
if (mediaTypeValue == null)
|
||||
return false;
|
||||
// match on first part in mediaTypes like 'application/json; charset=utf-8'
|
||||
int endIndex = mediaTypeValue.indexOf(';');
|
||||
String mediaType = (endIndex == -1
|
||||
? mediaTypeValue
|
||||
: mediaTypeValue.substring(0, endIndex)
|
||||
).trim();
|
||||
return "multipart/form-data".equals(mediaType)
|
||||
|| "application/x-www-form-urlencoded".equals(mediaType)
|
||||
|| (mediaType.startsWith("application/") && mediaType.endsWith("json"));
|
||||
};
|
||||
operation.consumes = operation.consumes == null ? null : operation.consumes.stream()
|
||||
.filter(isSerializable)
|
||||
.limit(1)
|
||||
.collect(Collectors.toList());
|
||||
operation.hasConsumes = operation.consumes != null && !operation.consumes.isEmpty();
|
||||
|
||||
operation.produces = operation.produces == null ? null : operation.produces.stream()
|
||||
.filter(isSerializable)
|
||||
.collect(Collectors.toList());
|
||||
operation.hasProduces = operation.produces != null && !operation.produces.isEmpty();
|
||||
}
|
||||
|
||||
// set multipart against all relevant operations
|
||||
if (operation.hasConsumes == Boolean.TRUE) {
|
||||
if (isMultipartType(operation.consumes)) {
|
||||
|
@ -254,6 +254,9 @@ public class ProtobufSchemaCodegen extends DefaultCodegen implements CodegenConf
|
||||
if (Boolean.TRUE.equals(var.isArray)) {
|
||||
var.vendorExtensions.put("x-protobuf-type", "repeated");
|
||||
}
|
||||
else if (Boolean.TRUE.equals(var.isNullable && var.isPrimitiveType)) {
|
||||
var.vendorExtensions.put("x-protobuf-type", "optional");
|
||||
}
|
||||
|
||||
// add x-protobuf-data-type
|
||||
// ref: https://developers.google.com/protocol-buffers/docs/proto3
|
||||
@ -500,9 +503,14 @@ public class ProtobufSchemaCodegen extends DefaultCodegen implements CodegenConf
|
||||
int index = 1;
|
||||
for (CodegenParameter p : op.allParams) {
|
||||
// add x-protobuf-type: repeated if it's an array
|
||||
|
||||
if (Boolean.TRUE.equals(p.isArray)) {
|
||||
p.vendorExtensions.put("x-protobuf-type", "repeated");
|
||||
} else if (Boolean.TRUE.equals(p.isMap)) {
|
||||
}
|
||||
else if (Boolean.TRUE.equals(p.isNullable && p.isPrimitiveType)) {
|
||||
p.vendorExtensions.put("x-protobuf-type", "optional");
|
||||
}
|
||||
else if (Boolean.TRUE.equals(p.isMap)) {
|
||||
LOGGER.warn("Map parameter (name: {}, operation ID: {}) not yet supported", p.paramName, op.operationId);
|
||||
}
|
||||
|
||||
|
@ -125,11 +125,11 @@ if(hasProperty('target') && target == 'android') {
|
||||
}
|
||||
|
||||
ext {
|
||||
swagger_annotations_version = "1.5.22"
|
||||
jackson_version = "2.12.1"
|
||||
swagger_annotations_version = "1.6.3"
|
||||
jackson_version = "2.12.5"
|
||||
jackson_databind_version = "2.10.5.1"
|
||||
{{#openApiNullable}}
|
||||
jackson_databind_nullable_version = "0.2.1"
|
||||
jackson_databind_nullable_version = "0.2.2"
|
||||
{{/openApiNullable}}
|
||||
jakarta_annotation_version = "1.3.5"
|
||||
{{#threetenbp}}
|
||||
|
@ -129,7 +129,7 @@ ext {
|
||||
jackson_version = "2.12.1"
|
||||
jackson_databind_version = "2.10.5.1"
|
||||
{{#openApiNullable}}
|
||||
jackson_databind_nullable_version = "0.2.1"
|
||||
jackson_databind_nullable_version = "0.2.2"
|
||||
{{/openApiNullable}}
|
||||
jakarta_annotation_version = "1.3.5"
|
||||
{{#threetenbp}}
|
||||
|
@ -105,7 +105,7 @@ ext {
|
||||
jackson_version = "2.10.3"
|
||||
jackson_databind_version = "2.10.3"
|
||||
{{#openApiNullable}}
|
||||
jackson_databind_nullable_version = "0.2.1"
|
||||
jackson_databind_nullable_version = "0.2.2"
|
||||
{{/openApiNullable}}
|
||||
jakarta_annotation_version = "1.3.5"
|
||||
{{#threetenbp}}
|
||||
|
@ -365,7 +365,7 @@
|
||||
<feign-form-version>3.8.0</feign-form-version>
|
||||
<jackson-version>2.10.3</jackson-version>
|
||||
{{#openApiNullable}}
|
||||
<jackson-databind-nullable-version>0.2.1</jackson-databind-nullable-version>
|
||||
<jackson-databind-nullable-version>0.2.2</jackson-databind-nullable-version>
|
||||
{{/openApiNullable}}
|
||||
<jackson-databind-version>2.10.3</jackson-databind-version>
|
||||
{{#threetenbp}}
|
||||
|
@ -109,14 +109,14 @@ if(hasProperty('target') && target == 'android') {
|
||||
}
|
||||
|
||||
ext {
|
||||
swagger_annotations_version = "1.5.22"
|
||||
jackson_version = "2.12.1"
|
||||
swagger_annotations_version = "1.6.3"
|
||||
jackson_version = "2.12.5"
|
||||
jackson_databind_version = "2.10.5.1"
|
||||
{{#openApiNullable}}
|
||||
jackson_databind_nullable_version = "0.2.1"
|
||||
jackson_databind_nullable_version = "0.2.2"
|
||||
{{/openApiNullable}}
|
||||
jakarta_annotation_version = "1.3.5"
|
||||
google_api_client_version = "1.23.0"
|
||||
google_api_client_version = "1.32.2"
|
||||
jersey_common_version = "2.25.1"
|
||||
jodatime_version = "2.9.9"
|
||||
junit_version = "4.13.1"
|
||||
|
@ -315,12 +315,12 @@
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<swagger-annotations-version>1.5.22</swagger-annotations-version>
|
||||
<google-api-client-version>1.30.2</google-api-client-version>
|
||||
<google-api-client-version>1.32.2</google-api-client-version>
|
||||
<jersey-common-version>2.25.1</jersey-common-version>
|
||||
<jackson-version>2.12.1</jackson-version>
|
||||
<jackson-databind-version>2.10.4</jackson-databind-version>
|
||||
<jackson-databind-version>2.10.5.1</jackson-databind-version>
|
||||
{{#openApiNullable}}
|
||||
<jackson-databind-nullable-version>0.2.1</jackson-databind-nullable-version>
|
||||
<jackson-databind-nullable-version>0.2.2</jackson-databind-nullable-version>
|
||||
{{/openApiNullable}}
|
||||
{{#joda}}
|
||||
<jodatime-version>2.9.9</jodatime-version>
|
||||
|
@ -114,7 +114,7 @@ ext {
|
||||
jackson_version = "2.13.0"
|
||||
jackson_databind_version = "2.13.0"
|
||||
{{#openApiNullable}}
|
||||
jackson_databind_nullable_version = "0.2.1"
|
||||
jackson_databind_nullable_version = "0.2.2"
|
||||
{{/openApiNullable}}
|
||||
jakarta_annotation_version = "1.3.5"
|
||||
jersey_version = "2.35"
|
||||
|
@ -29,7 +29,7 @@ lazy val root = (project in file(".")).
|
||||
"com.github.joschi.jackson" % "jackson-datatype-threetenbp" % "2.12.5" % "compile",
|
||||
{{/threetenbp}}
|
||||
{{#openApiNullable}}
|
||||
"org.openapitools" % "jackson-databind-nullable" % "0.2.1" % "compile",
|
||||
"org.openapitools" % "jackson-databind-nullable" % "0.2.2" % "compile",
|
||||
{{/openApiNullable}}
|
||||
{{#hasOAuthMethods}}
|
||||
"com.github.scribejava" % "scribejava-apis" % "8.3.1" % "compile",
|
||||
|
@ -391,7 +391,7 @@
|
||||
<jersey-version>2.35</jersey-version>
|
||||
<jackson-version>2.13.0</jackson-version>
|
||||
<jackson-databind-version>2.13.0</jackson-databind-version>
|
||||
<jackson-databind-nullable-version>0.2.1</jackson-databind-nullable-version>
|
||||
<jackson-databind-nullable-version>0.2.2</jackson-databind-nullable-version>
|
||||
{{#threetenbp}}
|
||||
<threetenbp-version>2.9.10</threetenbp-version>
|
||||
{{/threetenbp}}
|
||||
|
@ -229,7 +229,7 @@
|
||||
<maven.compiler.source>11</maven.compiler.source>
|
||||
<maven.compiler.target>11</maven.compiler.target>
|
||||
<jackson-version>2.10.4</jackson-version>
|
||||
<jackson-databind-nullable-version>0.2.1</jackson-databind-nullable-version>
|
||||
<jackson-databind-nullable-version>0.2.2</jackson-databind-nullable-version>
|
||||
<jakarta-annotation-version>1.3.5</jakarta-annotation-version>
|
||||
{{#threetenbp}}
|
||||
<threetenbp-version>2.9.10</threetenbp-version>
|
||||
|
@ -15,7 +15,7 @@ lazy val root = (project in file(".")).
|
||||
"com.google.code.gson" % "gson" % "2.8.6",
|
||||
"org.apache.commons" % "commons-lang3" % "3.10",
|
||||
{{#openApiNullable}}
|
||||
"org.openapitools" % "jackson-databind-nullable" % "0.2.1",
|
||||
"org.openapitools" % "jackson-databind-nullable" % "0.2.2",
|
||||
{{/openApiNullable}}
|
||||
{{#hasOAuthMethods}}
|
||||
"org.apache.oltu.oauth2" % "org.apache.oltu.oauth2.client" % "1.0.1",
|
||||
|
@ -398,7 +398,7 @@
|
||||
<gson-version>2.8.8</gson-version>
|
||||
<commons-lang3-version>3.12.0</commons-lang3-version>
|
||||
{{#openApiNullable}}
|
||||
<jackson-databind-nullable-version>0.2.1</jackson-databind-nullable-version>
|
||||
<jackson-databind-nullable-version>0.2.2</jackson-databind-nullable-version>
|
||||
{{/openApiNullable}}
|
||||
{{#joda}}
|
||||
<jodatime-version>2.10.9</jodatime-version>
|
||||
|
@ -15,7 +15,7 @@ lazy val root = (project in file(".")).
|
||||
"com.google.code.gson" % "gson" % "2.8.6",
|
||||
"org.apache.commons" % "commons-lang3" % "3.10",
|
||||
{{#openApiNullable}}
|
||||
"org.openapitools" % "jackson-databind-nullable" % "0.2.1",
|
||||
"org.openapitools" % "jackson-databind-nullable" % "0.2.2",
|
||||
{{/openApiNullable}}
|
||||
{{#hasOAuthMethods}}
|
||||
"org.apache.oltu.oauth2" % "org.apache.oltu.oauth2.client" % "1.0.1",
|
||||
|
@ -388,7 +388,7 @@
|
||||
<gson-version>2.8.8</gson-version>
|
||||
<commons-lang3-version>3.12.0</commons-lang3-version>
|
||||
{{#openApiNullable}}
|
||||
<jackson-databind-nullable-version>0.2.1</jackson-databind-nullable-version>
|
||||
<jackson-databind-nullable-version>0.2.2</jackson-databind-nullable-version>
|
||||
{{/openApiNullable}}
|
||||
{{#joda}}
|
||||
<jodatime-version>2.10.9</jodatime-version>
|
||||
|
@ -104,7 +104,7 @@ ext {
|
||||
jackson_version = "2.10.3"
|
||||
jackson_databind_version = "2.10.3"
|
||||
{{#openApiNullable}}
|
||||
jackson_databind_nullable_version = "0.2.1"
|
||||
jackson_databind_nullable_version = "0.2.2"
|
||||
{{/openApiNullable}}
|
||||
jakarta_annotation_version = "1.3.5"
|
||||
{{#threetenbp}}
|
||||
|
@ -18,7 +18,7 @@ lazy val root = (project in file(".")).
|
||||
"com.fasterxml.jackson.core" % "jackson-annotations" % "2.10.3",
|
||||
"com.fasterxml.jackson.core" % "jackson-databind" % "2.10.3",
|
||||
{{#openApiNullable}}
|
||||
"org.openapitools" % "jackson-databind-nullable" % "0.2.1",
|
||||
"org.openapitools" % "jackson-databind-nullable" % "0.2.2",
|
||||
{{/openApiNullable}}
|
||||
{{#withXml}}
|
||||
"com.fasterxml.jackson.dataformat" % "jackson-dataformat-xml" % "2.10.3",
|
||||
|
@ -358,7 +358,7 @@
|
||||
{{/threetenbp}}
|
||||
{{#jackson}}
|
||||
<jackson-version>2.10.3</jackson-version>
|
||||
<jackson-databind-nullable-version>0.2.1</jackson-databind-nullable-version>
|
||||
<jackson-databind-nullable-version>0.2.2</jackson-databind-nullable-version>
|
||||
{{#threetenbp}}
|
||||
<jackson-threetenbp-version>2.10.0</jackson-threetenbp-version>
|
||||
{{/threetenbp}}
|
||||
|
@ -97,11 +97,11 @@ if(hasProperty('target') && target == 'android') {
|
||||
}
|
||||
|
||||
ext {
|
||||
swagger_annotations_version = "1.5.22"
|
||||
swagger_annotations_version = "1.6.3"
|
||||
jackson_version = "2.10.5"
|
||||
jackson_databind_version = "2.10.5.1"
|
||||
{{#openApiNullable}}
|
||||
jackson_databind_nullable_version = "0.2.1"
|
||||
jackson_databind_nullable_version = "0.2.2"
|
||||
{{/openApiNullable}}
|
||||
jakarta_annotation_version = "1.3.5"
|
||||
threetenbp_version = "2.9.10"
|
||||
|
@ -272,11 +272,13 @@
|
||||
</dependencies>
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<swagger-annotations-version>1.5.22</swagger-annotations-version>
|
||||
<swagger-annotations-version>1.6.3</swagger-annotations-version>
|
||||
<resteasy-version>4.5.11.Final</resteasy-version>
|
||||
<jackson-version>2.10.5</jackson-version>
|
||||
<jackson-databind-version>2.10.5.1</jackson-databind-version>
|
||||
<jackson-databind-nullable-version>0.2.1</jackson-databind-nullable-version>
|
||||
{{#openApiNullable}}
|
||||
<jackson-databind-nullable-version>0.2.2</jackson-databind-nullable-version>
|
||||
{{/openApiNullable}}
|
||||
<jakarta-annotation-version>1.3.5</jakarta-annotation-version>
|
||||
<threetenbp-version>2.9.10</threetenbp-version>
|
||||
<maven-plugin-version>1.0.0</maven-plugin-version>
|
||||
|
@ -113,7 +113,7 @@ ext {
|
||||
jackson_version = "2.10.5"
|
||||
jackson_databind_version = "2.10.5.1"
|
||||
{{#openApiNullable}}
|
||||
jackson_databind_nullable_version = "0.2.1"
|
||||
jackson_databind_nullable_version = "0.2.2"
|
||||
{{/openApiNullable}}
|
||||
jakarta_annotation_version = "1.3.5"
|
||||
spring_web_version = "5.2.5.RELEASE"
|
||||
|
@ -319,7 +319,7 @@
|
||||
<spring-web-version>5.2.5.RELEASE</spring-web-version>
|
||||
<jackson-version>2.10.5</jackson-version>
|
||||
<jackson-databind-version>2.10.5.1</jackson-databind-version>
|
||||
<jackson-databind-nullable-version>0.2.1</jackson-databind-nullable-version>
|
||||
<jackson-databind-nullable-version>0.2.2</jackson-databind-nullable-version>
|
||||
<jakarta-annotation-version>1.3.5</jakarta-annotation-version>
|
||||
{{#joda}}
|
||||
<jodatime-version>2.9.9</jodatime-version>
|
||||
|
@ -115,7 +115,7 @@ ext {
|
||||
jackson_version = "2.10.5"
|
||||
jackson_databind_version = "2.10.5.1"
|
||||
{{#openApiNullable}}
|
||||
jackson_databind_nullable_version = "0.2.1"
|
||||
jackson_databind_nullable_version = "0.2.2"
|
||||
{{/openApiNullable}}
|
||||
jakarta_annotation_version = "1.3.5"
|
||||
{{#play24}}
|
||||
|
@ -407,7 +407,7 @@
|
||||
<maven.compiler.source>${java.version}</maven.compiler.source>
|
||||
<maven.compiler.target>${java.version}</maven.compiler.target>
|
||||
<gson-fire-version>1.8.3</gson-fire-version>
|
||||
<swagger-annotations-version>1.5.22</swagger-annotations-version>
|
||||
<swagger-annotations-version>1.6.3</swagger-annotations-version>
|
||||
{{#usePlayWS}}
|
||||
<jackson-version>2.12.1</jackson-version>
|
||||
{{#play24}}
|
||||
@ -420,7 +420,7 @@
|
||||
<play-version>2.6.7</play-version>
|
||||
{{/play26}}
|
||||
{{#openApiNullable}}
|
||||
<jackson-databind-nullable-version>0.2.1</jackson-databind-nullable-version>
|
||||
<jackson-databind-nullable-version>0.2.2</jackson-databind-nullable-version>
|
||||
{{/openApiNullable}}
|
||||
{{/usePlayWS}}
|
||||
<retrofit-version>2.5.0</retrofit-version>
|
||||
@ -431,7 +431,7 @@
|
||||
<rxjava-version>2.1.1</rxjava-version>
|
||||
{{/useRxJava2}}
|
||||
{{#useRxJava3}}
|
||||
<rxjava-version>3.0.4</rxjava-version>
|
||||
<rxjava-version>3.0.4</rxjava-version>
|
||||
{{/useRxJava3}}
|
||||
{{#joda}}
|
||||
<jodatime-version>2.9.9</jodatime-version>
|
||||
@ -441,7 +441,7 @@
|
||||
{{/threetenbp}}
|
||||
<jakarta-annotation-version>1.3.5</jakarta-annotation-version>
|
||||
{{#useBeanValidation}}
|
||||
<beanvalidation-version>2.0.2</beanvalidation-version>
|
||||
<beanvalidation-version>2.0.2</beanvalidation-version>
|
||||
{{/useBeanValidation}}
|
||||
<oltu-version>1.0.1</oltu-version>
|
||||
<junit-version>4.13.1</junit-version>
|
||||
|
@ -35,7 +35,7 @@ ext {
|
||||
vertx_version = "3.4.2"
|
||||
junit_version = "4.13.1"
|
||||
{{#openApiNullable}}
|
||||
jackson_databind_nullable_version = "0.2.1"
|
||||
jackson_databind_nullable_version = "0.2.2"
|
||||
{{/openApiNullable}}
|
||||
jakarta_annotation_version = "1.3.5"
|
||||
{{#threetenbp}}
|
||||
|
@ -308,7 +308,7 @@
|
||||
<swagger-annotations-version>1.5.22</swagger-annotations-version>
|
||||
<jackson-version>2.10.5</jackson-version>
|
||||
<jackson-databind>2.10.5.1</jackson-databind>
|
||||
<jackson-databind-nullable-version>0.2.1</jackson-databind-nullable-version>
|
||||
<jackson-databind-nullable-version>0.2.2</jackson-databind-nullable-version>
|
||||
<jakarta-annotation-version>1.3.5</jakarta-annotation-version>
|
||||
<junit-version>4.13.1</junit-version>
|
||||
</properties>
|
||||
|
@ -124,12 +124,12 @@ if(hasProperty('target') && target == 'android') {
|
||||
}
|
||||
|
||||
ext {
|
||||
swagger_annotations_version = "1.6.2"
|
||||
swagger_annotations_version = "1.6.3"
|
||||
spring_web_version = "2.4.3"
|
||||
jackson_version = "2.11.3"
|
||||
jackson_databind_version = "2.11.3"
|
||||
jackson_version = "2.11.4"
|
||||
jackson_databind_version = "2.11.4"
|
||||
{{#openApiNullable}}
|
||||
jackson_databind_nullable_version = "0.2.1"
|
||||
jackson_databind_nullable_version = "0.2.2"
|
||||
{{/openApiNullable}}
|
||||
jakarta_annotation_version = "1.3.5"
|
||||
reactor_version = "3.4.3"
|
||||
|
@ -148,12 +148,12 @@
|
||||
</dependencies>
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<swagger-annotations-version>1.6.2</swagger-annotations-version>
|
||||
<swagger-annotations-version>1.6.3</swagger-annotations-version>
|
||||
<spring-web-version>2.4.3</spring-web-version>
|
||||
<jackson-version>2.11.3</jackson-version>
|
||||
<jackson-databind-version>2.11.3</jackson-databind-version>
|
||||
<jackson-databind-version>2.11.4</jackson-databind-version>
|
||||
{{#openApiNullable}}
|
||||
<jackson-databind-nullable-version>0.2.1</jackson-databind-nullable-version>
|
||||
<jackson-databind-nullable-version>0.2.2</jackson-databind-nullable-version>
|
||||
{{/openApiNullable}}
|
||||
<jakarta-annotation-version>1.3.5</jakarta-annotation-version>
|
||||
<junit-version>4.13.1</junit-version>
|
||||
|
@ -360,9 +360,9 @@
|
||||
</dependencies>
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<swagger-annotations-version>1.5.21</swagger-annotations-version>
|
||||
<swagger-annotations-version>1.6.3</swagger-annotations-version>
|
||||
<jersey-version>1.19.4</jersey-version>
|
||||
<jackson-version>2.12.1</jackson-version>
|
||||
<jackson-version>2.12.5</jackson-version>
|
||||
{{#threetenbp}}
|
||||
<jackson-threetenbp-version>2.9.10</jackson-threetenbp-version>
|
||||
{{/threetenbp}}
|
||||
|
@ -302,7 +302,7 @@
|
||||
{{/useBeanValidation}}
|
||||
<spring-version>4.3.20.RELEASE</spring-version>
|
||||
{{#openApiNullable}}
|
||||
<jackson-databind-nullable-version>0.2.1</jackson-databind-nullable-version>
|
||||
<jackson-databind-nullable-version>0.2.2</jackson-databind-nullable-version>
|
||||
{{/openApiNullable}}
|
||||
<jackson-databind-version>2.9.8</jackson-databind-version>
|
||||
</properties>
|
||||
|
@ -12,7 +12,8 @@ else ()
|
||||
endif ()
|
||||
|
||||
find_package(Qt5Core REQUIRED)
|
||||
find_package(Qt5Network REQUIRED){{#contentCompression}}
|
||||
find_package(Qt5Network REQUIRED){{#authMethods}}{{#isOAuth}}
|
||||
find_package(Qt5Gui REQUIRED){{/isOAuth}}{{/authMethods}}{{#contentCompression}}
|
||||
find_package(ZLIB REQUIRED){{/contentCompression}}
|
||||
|
||||
add_library(${PROJECT_NAME}
|
||||
@ -31,9 +32,9 @@ add_library(${PROJECT_NAME}
|
||||
{{prefix}}Helpers.cpp
|
||||
{{prefix}}HttpRequest.cpp
|
||||
{{prefix}}HttpFileElement.cpp
|
||||
{{prefix}}Oauth.cpp
|
||||
)
|
||||
target_link_libraries(${PROJECT_NAME} PRIVATE Qt5::Core Qt5::Network {{#contentCompression}} ${ZLIB_LIBRARIES}{{/contentCompression}})
|
||||
|
||||
target_link_libraries(${PROJECT_NAME} PRIVATE Qt5::Core Qt5::Network{{#authMethods}}{{#isOAuth}} Qt5::Gui{{/isOAuth}}{{/authMethods}}{{#contentCompression}} ${ZLIB_LIBRARIES}{{/contentCompression}})
|
||||
if(NOT APPLE)
|
||||
target_link_libraries(${PROJECT_NAME} PRIVATE ssl crypto)
|
||||
endif()
|
||||
|
@ -1,6 +1,8 @@
|
||||
#include "{{prefix}}Oauth.h"
|
||||
|
||||
namespace OpenAPI {
|
||||
{{#cppNamespaceDeclarations}}
|
||||
namespace {{this}} {
|
||||
{{/cppNamespaceDeclarations}}
|
||||
|
||||
/*
|
||||
* Base class to perform oauth2 flows
|
||||
@ -343,5 +345,6 @@ void ReplyServer::read()
|
||||
emit dataReceived(queryParams);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
{{#cppNamespaceDeclarations}}
|
||||
} // namespace {{this}}
|
||||
{{/cppNamespaceDeclarations}}
|
@ -21,8 +21,7 @@
|
||||
#include <QUrl>
|
||||
#include <QUrlQuery>
|
||||
#include <QDateTime>
|
||||
|
||||
|
||||
#include <time.h>
|
||||
|
||||
{{#cppNamespaceDeclarations}}
|
||||
namespace {{this}} {
|
||||
@ -32,19 +31,19 @@ class oauthToken
|
||||
{
|
||||
public:
|
||||
oauthToken(QString token, int expiresIn, QString scope, QString tokenType) : m_token(token), m_scope(scope), m_type(tokenType){
|
||||
m_validUntil = QDateTime::fromSecsSinceEpoch(QDateTime::currentSecsSinceEpoch() + expiresIn);
|
||||
m_validUntil = time(0) + expiresIn;
|
||||
}
|
||||
oauthToken(){
|
||||
m_validUntil = QDateTime::fromSecsSinceEpoch(QDateTime::currentSecsSinceEpoch() -1);
|
||||
m_validUntil = time(0) - 1;
|
||||
}
|
||||
QString getToken(){return m_token;};
|
||||
QString getScope(){return m_scope;};
|
||||
QString getType(){return m_type;};
|
||||
bool isValid(){return QDateTime::currentDateTime() < m_validUntil;};
|
||||
bool isValid(){return time(0) < m_validUntil;};
|
||||
|
||||
private:
|
||||
QString m_token;
|
||||
QDateTime m_validUntil;
|
||||
time_t m_validUntil;
|
||||
QString m_scope;
|
||||
QString m_type;
|
||||
};
|
||||
|
@ -1,67 +0,0 @@
|
||||
package {{packageName}}.infrastructure
|
||||
|
||||
{{#kotlinx_serialization}}
|
||||
import kotlinx.serialization.KSerializer
|
||||
import kotlinx.serialization.Serializer
|
||||
import kotlinx.serialization.encoding.Decoder
|
||||
import kotlinx.serialization.encoding.Encoder
|
||||
import kotlinx.serialization.descriptors.PrimitiveSerialDescriptor
|
||||
import kotlinx.serialization.descriptors.PrimitiveKind
|
||||
import kotlinx.serialization.descriptors.SerialDescriptor
|
||||
{{/kotlinx_serialization}}
|
||||
{{#gson}}
|
||||
import com.google.gson.TypeAdapter
|
||||
import com.google.gson.stream.JsonReader
|
||||
import com.google.gson.stream.JsonWriter
|
||||
import com.google.gson.stream.JsonToken.NULL
|
||||
import java.io.IOException
|
||||
{{/gson}}
|
||||
import java.text.DateFormat
|
||||
import java.text.SimpleDateFormat
|
||||
import java.util.Date
|
||||
import java.util.Locale
|
||||
{{#gson}}
|
||||
|
||||
{{#nonPublicApi}}internal {{/nonPublicApi}}class DateAdapter(val formatter: DateFormat = SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSZ", Locale.getDefault())) : TypeAdapter<Date>() {
|
||||
@Throws(IOException::class)
|
||||
override fun write(out: JsonWriter?, value: Date?) {
|
||||
if (value == null) {
|
||||
out?.nullValue()
|
||||
} else {
|
||||
out?.value(formatter.format(value))
|
||||
}
|
||||
}
|
||||
|
||||
@Throws(IOException::class)
|
||||
override fun read(out: JsonReader?): Date? {
|
||||
out ?: return null
|
||||
|
||||
when (out.peek()) {
|
||||
NULL -> {
|
||||
out.nextNull()
|
||||
return null
|
||||
}
|
||||
else -> {
|
||||
return formatter.parse(out.nextString())
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
{{/gson}}
|
||||
{{#kotlinx_serialization}}
|
||||
|
||||
@Serializer(forClass = Date::class)
|
||||
object DateAdapter : KSerializer<Date> {
|
||||
private val df: DateFormat = SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSZ", Locale.getDefault())
|
||||
|
||||
override val descriptor: SerialDescriptor = PrimitiveSerialDescriptor("Date", PrimitiveKind.STRING)
|
||||
|
||||
override fun serialize(encoder: Encoder, value: Date) {
|
||||
encoder.encodeString(df.format(value))
|
||||
}
|
||||
|
||||
override fun deserialize(decoder: Decoder): Date {
|
||||
return df.parse(decoder.decodeString())!!
|
||||
}
|
||||
}
|
||||
{{/kotlinx_serialization}}
|
@ -28,7 +28,6 @@ import com.fasterxml.jackson.annotation.JsonInclude
|
||||
import com.fasterxml.jackson.module.kotlin.jacksonObjectMapper
|
||||
{{/jackson}}
|
||||
{{#kotlinx_serialization}}
|
||||
import java.util.Date
|
||||
import java.math.BigDecimal
|
||||
import java.math.BigInteger
|
||||
{{^threetenbp}}
|
||||
@ -97,7 +96,6 @@ import java.util.concurrent.atomic.AtomicLong
|
||||
val kotlinSerializationAdapters = SerializersModule {
|
||||
contextual(BigDecimal::class, BigDecimalAdapter)
|
||||
contextual(BigInteger::class, BigIntegerAdapter)
|
||||
contextual(Date::class, DateAdapter)
|
||||
contextual(LocalDate::class, LocalDateAdapter)
|
||||
contextual(LocalDateTime::class, LocalDateTimeAdapter)
|
||||
contextual(OffsetDateTime::class, OffsetDateTimeAdapter)
|
||||
|
@ -1,6 +1,8 @@
|
||||
{{>licenseInfo}}
|
||||
package {{apiPackage}}
|
||||
|
||||
import java.io.IOException
|
||||
|
||||
{{#imports}}import {{import}}
|
||||
{{/imports}}
|
||||
|
||||
@ -11,7 +13,7 @@ import kotlinx.coroutines.withContext
|
||||
{{/useCoroutines}}
|
||||
{{/doNotUseRxAndCoroutines}}
|
||||
import {{packageName}}.infrastructure.ApiClient
|
||||
import {{packageName}}.infrastructure.ApiInfrastructureResponse
|
||||
import {{packageName}}.infrastructure.ApiResponse
|
||||
import {{packageName}}.infrastructure.ClientException
|
||||
import {{packageName}}.infrastructure.ClientError
|
||||
import {{packageName}}.infrastructure.ServerException
|
||||
@ -38,12 +40,14 @@ import {{packageName}}.infrastructure.toMultiValue
|
||||
* {{notes}}
|
||||
{{#allParams}}* @param {{{paramName}}} {{description}} {{^required}}(optional{{#defaultValue}}, default to {{{.}}}{{/defaultValue}}){{/required}}
|
||||
{{/allParams}}* @return {{#returnType}}{{{returnType}}}{{#nullableReturnType}} or null{{/nullableReturnType}}{{/returnType}}{{^returnType}}void{{/returnType}}
|
||||
* @throws IllegalStateException If the request is not correctly configured
|
||||
* @throws IOException Rethrows the OkHttp execute method exception
|
||||
* @throws UnsupportedOperationException If the API returns an informational or redirection response
|
||||
* @throws ClientException If the API returns a client error response
|
||||
* @throws ServerException If the API returns a server error response
|
||||
*/{{#returnType}}
|
||||
@Suppress("UNCHECKED_CAST"){{/returnType}}
|
||||
@Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
|
||||
@Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class)
|
||||
{{#isDeprecated}}
|
||||
@Deprecated(message = "This operation is deprecated.")
|
||||
{{/isDeprecated}}
|
||||
@ -72,17 +76,16 @@ import {{packageName}}.infrastructure.toMultiValue
|
||||
* {{summary}}
|
||||
* {{notes}}
|
||||
{{#allParams}}* @param {{{paramName}}} {{description}} {{^required}}(optional{{#defaultValue}}, default to {{{.}}}{{/defaultValue}}){{/required}}
|
||||
{{/allParams}}* @return ApiInfrastructureResponse<{{#returnType}}{{{returnType}}}?{{/returnType}}{{^returnType}}Unit?{{/returnType}}>
|
||||
* @throws UnsupportedOperationException If the API returns an informational or redirection response
|
||||
* @throws ClientException If the API returns a client error response
|
||||
* @throws ServerException If the API returns a server error response
|
||||
{{/allParams}}* @return ApiResponse<{{#returnType}}{{{returnType}}}?{{/returnType}}{{^returnType}}Unit?{{/returnType}}>
|
||||
* @throws IllegalStateException If the request is not correctly configured
|
||||
* @throws IOException Rethrows the OkHttp execute method exception
|
||||
*/{{#returnType}}
|
||||
@Suppress("UNCHECKED_CAST"){{/returnType}}
|
||||
@Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
|
||||
@Throws(IllegalStateException::class, IOException::class)
|
||||
{{#isDeprecated}}
|
||||
@Deprecated(message = "This operation is deprecated.")
|
||||
{{/isDeprecated}}
|
||||
{{^doNotUseRxAndCoroutines}}{{#useCoroutines}}suspend {{/useCoroutines}}{{/doNotUseRxAndCoroutines}}fun {{operationId}}WithHttpInfo({{#allParams}}{{{paramName}}}: {{{dataType}}}{{^required}}?{{/required}}{{^-last}}, {{/-last}}{{/allParams}}) : ApiInfrastructureResponse<{{#returnType}}{{{returnType}}}?{{/returnType}}{{^returnType}}Unit?{{/returnType}}>{{^doNotUseRxAndCoroutines}}{{#useCoroutines}} = withContext(Dispatchers.IO){{/useCoroutines}}{{/doNotUseRxAndCoroutines}} {
|
||||
{{^doNotUseRxAndCoroutines}}{{#useCoroutines}}suspend {{/useCoroutines}}{{/doNotUseRxAndCoroutines}}fun {{operationId}}WithHttpInfo({{#allParams}}{{{paramName}}}: {{{dataType}}}{{^required}}?{{/required}}{{^-last}}, {{/-last}}{{/allParams}}) : ApiResponse<{{#returnType}}{{{returnType}}}?{{/returnType}}{{^returnType}}Unit?{{/returnType}}>{{^doNotUseRxAndCoroutines}}{{#useCoroutines}} = withContext(Dispatchers.IO){{/useCoroutines}}{{/doNotUseRxAndCoroutines}} {
|
||||
{{#isDeprecated}}
|
||||
@Suppress("DEPRECATION")
|
||||
{{/isDeprecated}}
|
||||
@ -130,6 +133,9 @@ import {{packageName}}.infrastructure.toMultiValue
|
||||
{{#headerParams}}
|
||||
{{{paramName}}}{{^required}}?{{/required}}.apply { localVariableHeaders["{{baseName}}"] = {{#isContainer}}this.joinToString(separator = collectionDelimiter("{{collectionFormat}}")){{/isContainer}}{{^isContainer}}this.toString(){{/isContainer}} }
|
||||
{{/headerParams}}
|
||||
{{^hasFormParams}}{{#hasConsumes}}{{#consumes}}localVariableHeaders["Content-Type"] = "{{{mediaType}}}"
|
||||
{{/consumes}}{{/hasConsumes}}{{/hasFormParams}}{{#hasProduces}}localVariableHeaders["Accept"] = "{{#produces}}{{{mediaType}}}{{^-last}}, {{/-last}}{{/produces}}"
|
||||
{{/hasProduces}}
|
||||
|
||||
return RequestConfig(
|
||||
method = RequestMethod.{{httpMethod}},
|
||||
|
@ -47,7 +47,6 @@ import java.time.LocalTime
|
||||
import java.time.OffsetDateTime
|
||||
import java.time.OffsetTime
|
||||
{{/threetenbp}}
|
||||
import java.util.Date
|
||||
import java.util.Locale
|
||||
{{#useCoroutines}}
|
||||
import kotlin.coroutines.resume
|
||||
@ -167,8 +166,8 @@ import com.squareup.moshi.adapter
|
||||
}
|
||||
}.build()
|
||||
}
|
||||
mediaType.startsWith("application/") && mediaType.endsWith("json") ->
|
||||
{{#jvm-okhttp3}}
|
||||
mediaType == JsonMediaType -> {
|
||||
if (content == null) {
|
||||
EMPTY_REQUEST
|
||||
} else {
|
||||
@ -187,10 +186,8 @@ import com.squareup.moshi.adapter
|
||||
{{/kotlinx_serialization}}
|
||||
)
|
||||
}
|
||||
}
|
||||
{{/jvm-okhttp3}}
|
||||
{{#jvm-okhttp4}}
|
||||
mediaType == JsonMediaType -> {
|
||||
if (content == null) {
|
||||
EMPTY_REQUEST
|
||||
} else {
|
||||
@ -210,7 +207,6 @@ import com.squareup.moshi.adapter
|
||||
mediaType.toMediaTypeOrNull()
|
||||
)
|
||||
}
|
||||
}
|
||||
{{/jvm-okhttp4}}
|
||||
mediaType == XmlMediaType -> throw UnsupportedOperationException("xml not currently supported.")
|
||||
// TODO: this should be extended with other serializers
|
||||
@ -247,8 +243,9 @@ import com.squareup.moshi.adapter
|
||||
out.close()
|
||||
return f as T
|
||||
}
|
||||
return when(mediaType) {
|
||||
JsonMediaType -> {{#moshi}}Serializer.moshi.adapter<T>().fromJson(bodyContent){{/moshi}}{{#gson}}Serializer.gson.fromJson(bodyContent, (object: TypeToken<T>(){}).getType()){{/gson}}{{#jackson}}Serializer.jacksonObjectMapper.readValue(bodyContent, object: TypeReference<T>() {}){{/jackson}}{{#kotlinx_serialization}}Serializer.jvmJson.decodeFromString<T>(bodyContent){{/kotlinx_serialization}}
|
||||
return when {
|
||||
mediaType==null || (mediaType.startsWith("application/") && mediaType.endsWith("json")) ->
|
||||
{{#moshi}}Serializer.moshi.adapter<T>().fromJson(bodyContent){{/moshi}}{{#gson}}Serializer.gson.fromJson(bodyContent, (object: TypeToken<T>(){}).getType()){{/gson}}{{#jackson}}Serializer.jacksonObjectMapper.readValue(bodyContent, object: TypeReference<T>() {}){{/jackson}}{{#kotlinx_serialization}}Serializer.jvmJson.decodeFromString<T>(bodyContent){{/kotlinx_serialization}}
|
||||
else -> throw UnsupportedOperationException("responseBody currently only supports JSON body.")
|
||||
}
|
||||
}
|
||||
@ -311,7 +308,7 @@ import com.squareup.moshi.adapter
|
||||
}
|
||||
{{/hasAuthMethods}}
|
||||
|
||||
protected {{#useCoroutines}}suspend {{/useCoroutines}}inline fun <reified I, reified T: Any?> request(requestConfig: RequestConfig<I>): ApiInfrastructureResponse<T?> {
|
||||
protected {{#useCoroutines}}suspend {{/useCoroutines}}inline fun <reified I, reified T: Any?> request(requestConfig: RequestConfig<I>): ApiResponse<T?> {
|
||||
{{#jvm-okhttp3}}
|
||||
val httpUrl = HttpUrl.parse(baseUrl) ?: throw IllegalStateException("baseUrl is invalid.")
|
||||
{{/jvm-okhttp3}}
|
||||
@ -343,11 +340,11 @@ import com.squareup.moshi.adapter
|
||||
}
|
||||
val headers = requestConfig.headers
|
||||
|
||||
if(headers[ContentType] ?: "" == "") {
|
||||
if(headers[ContentType].isNullOrEmpty()) {
|
||||
throw kotlin.IllegalStateException("Missing Content-Type header. This is required.")
|
||||
}
|
||||
|
||||
if(headers[Accept] ?: "" == "") {
|
||||
if(headers[Accept].isNullOrEmpty()) {
|
||||
throw kotlin.IllegalStateException("Missing Accept header. This is required.")
|
||||
}
|
||||
|
||||
@ -421,7 +418,7 @@ import com.squareup.moshi.adapter
|
||||
null -> ""
|
||||
is Array<*> -> toMultiValue(value, "csv").toString()
|
||||
is Iterable<*> -> toMultiValue(value, "csv").toString()
|
||||
is OffsetDateTime, is OffsetTime, is LocalDateTime, is LocalDate, is LocalTime, is Date ->
|
||||
is OffsetDateTime, is OffsetTime, is LocalDateTime, is LocalDate, is LocalTime ->
|
||||
parseDateToQueryString(value)
|
||||
else -> value.toString()
|
||||
}
|
||||
|
@ -6,7 +6,7 @@ package {{packageName}}.infrastructure
|
||||
|
||||
{{#nonPublicApi}}internal {{/nonPublicApi}}interface Response
|
||||
|
||||
{{#nonPublicApi}}internal {{/nonPublicApi}}abstract class ApiInfrastructureResponse<T>(val responseType: ResponseType): Response {
|
||||
{{#nonPublicApi}}internal {{/nonPublicApi}}abstract class ApiResponse<T>(val responseType: ResponseType): Response {
|
||||
abstract val statusCode: Int
|
||||
abstract val headers: Map<String,List<String>>
|
||||
}
|
||||
@ -15,29 +15,29 @@ package {{packageName}}.infrastructure
|
||||
val data: T{{#nullableReturnType}}?{{/nullableReturnType}},
|
||||
override val statusCode: Int = -1,
|
||||
override val headers: Map<String, List<String>> = mapOf()
|
||||
): ApiInfrastructureResponse<T>(ResponseType.Success)
|
||||
): ApiResponse<T>(ResponseType.Success)
|
||||
|
||||
{{#nonPublicApi}}internal {{/nonPublicApi}}class Informational<T>(
|
||||
val statusText: String,
|
||||
override val statusCode: Int = -1,
|
||||
override val headers: Map<String, List<String>> = mapOf()
|
||||
) : ApiInfrastructureResponse<T>(ResponseType.Informational)
|
||||
) : ApiResponse<T>(ResponseType.Informational)
|
||||
|
||||
{{#nonPublicApi}}internal {{/nonPublicApi}}class Redirection<T>(
|
||||
override val statusCode: Int = -1,
|
||||
override val headers: Map<String, List<String>> = mapOf()
|
||||
) : ApiInfrastructureResponse<T>(ResponseType.Redirection)
|
||||
) : ApiResponse<T>(ResponseType.Redirection)
|
||||
|
||||
{{#nonPublicApi}}internal {{/nonPublicApi}}class ClientError<T>(
|
||||
val message: String? = null,
|
||||
val body: Any? = null,
|
||||
override val statusCode: Int = -1,
|
||||
override val headers: Map<String, List<String>> = mapOf()
|
||||
) : ApiInfrastructureResponse<T>(ResponseType.ClientError)
|
||||
) : ApiResponse<T>(ResponseType.ClientError)
|
||||
|
||||
{{#nonPublicApi}}internal {{/nonPublicApi}}class ServerError<T>(
|
||||
val message: String? = null,
|
||||
val body: Any? = null,
|
||||
override val statusCode: Int = -1,
|
||||
override val headers: Map<String, List<String>>
|
||||
): ApiInfrastructureResponse<T>(ResponseType.ServerError)
|
||||
): ApiResponse<T>(ResponseType.ServerError)
|
@ -270,6 +270,9 @@ class {{classname}}(object):
|
||||
_check_return_type (bool): specifies if type checking
|
||||
should be done one the data received from the server.
|
||||
Default is True.
|
||||
_content_type (str/None): force body content-type.
|
||||
Default is None and content-type will be predicted by allowed
|
||||
content-types and body.
|
||||
_host_index (int/None): specifies the index of the server
|
||||
that we want to use.
|
||||
Default is read from the configuration.
|
||||
@ -298,6 +301,8 @@ class {{classname}}(object):
|
||||
kwargs['_check_return_type'] = kwargs.get(
|
||||
'_check_return_type', True
|
||||
)
|
||||
kwargs['_content_type'] = kwargs.get(
|
||||
'_content_type')
|
||||
kwargs['_host_index'] = kwargs.get('_host_index')
|
||||
{{#requiredParams}}
|
||||
kwargs['{{paramName}}'] = \
|
||||
|
@ -129,7 +129,8 @@ class ApiClient(object):
|
||||
_preload_content: bool = True,
|
||||
_request_timeout: typing.Optional[typing.Union[int, float, typing.Tuple]] = None,
|
||||
_host: typing.Optional[str] = None,
|
||||
_check_type: typing.Optional[bool] = None
|
||||
_check_type: typing.Optional[bool] = None,
|
||||
_content_type: typing.Optional[str] = None
|
||||
):
|
||||
|
||||
config = self.configuration
|
||||
@ -584,10 +585,12 @@ class ApiClient(object):
|
||||
else:
|
||||
return ', '.join(accepts)
|
||||
|
||||
def select_header_content_type(self, content_types):
|
||||
def select_header_content_type(self, content_types, method=None, body=None):
|
||||
"""Returns `Content-Type` based on an array of content_types provided.
|
||||
|
||||
:param content_types: List of content-types.
|
||||
:param method: http method (e.g. POST, PATCH).
|
||||
:param body: http body to send.
|
||||
:return: Content-Type (e.g. application/json).
|
||||
"""
|
||||
if not content_types:
|
||||
@ -595,6 +598,11 @@ class ApiClient(object):
|
||||
|
||||
content_types = [x.lower() for x in content_types]
|
||||
|
||||
if (method == 'PATCH' and
|
||||
'application/json-patch+json' in content_types and
|
||||
isinstance(body, list)):
|
||||
return 'application/json-patch+json'
|
||||
|
||||
if 'application/json' in content_types or '*/*' in content_types:
|
||||
return 'application/json'
|
||||
else:
|
||||
@ -685,7 +693,8 @@ class Endpoint(object):
|
||||
'_request_timeout',
|
||||
'_return_http_data_only',
|
||||
'_check_input_type',
|
||||
'_check_return_type'
|
||||
'_check_return_type',
|
||||
'_content_type'
|
||||
])
|
||||
self.params_map['nullable'].extend(['_request_timeout'])
|
||||
self.validations = root_map['validations']
|
||||
@ -698,7 +707,8 @@ class Endpoint(object):
|
||||
'_request_timeout': (none_type, float, (float,), [float], int, (int,), [int]),
|
||||
'_return_http_data_only': (bool,),
|
||||
'_check_input_type': (bool,),
|
||||
'_check_return_type': (bool,)
|
||||
'_check_return_type': (bool,),
|
||||
'_content_type': (none_type, str)
|
||||
}
|
||||
self.openapi_types.update(extra_types)
|
||||
self.attribute_map = root_map['attribute_map']
|
||||
@ -845,12 +855,16 @@ class Endpoint(object):
|
||||
params['header']['Accept'] = self.api_client.select_header_accept(
|
||||
accept_headers_list)
|
||||
|
||||
content_type_headers_list = self.headers_map['content_type']
|
||||
if content_type_headers_list:
|
||||
if params['body'] != "":
|
||||
header_list = self.api_client.select_header_content_type(
|
||||
content_type_headers_list)
|
||||
params['header']['Content-Type'] = header_list
|
||||
if kwargs.get('_content_type'):
|
||||
params['header']['Content-Type'] = kwargs['_content_type']
|
||||
else:
|
||||
content_type_headers_list = self.headers_map['content_type']
|
||||
if content_type_headers_list:
|
||||
if params['body'] != "":
|
||||
header_list = self.api_client.select_header_content_type(
|
||||
content_type_headers_list, self.settings['http_method'],
|
||||
params['body'])
|
||||
params['header']['Content-Type'] = header_list
|
||||
|
||||
return self.api_client.call_api(
|
||||
self.settings['endpoint_path'], self.settings['http_method'],
|
||||
|
@ -36,6 +36,7 @@ import Vapor
|
||||
{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} let parameters: [String: Any]?
|
||||
{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} let method: String
|
||||
{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} let URLString: String
|
||||
{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} let requestTask: RequestTask = RequestTask()
|
||||
|
||||
/// Optional block to obtain a reference to the request's progress instance when available.{{#useURLSession}}
|
||||
/// With the URLSession http client the request's progress only works on iOS 11.0, macOS 10.13, macCatalyst 13.0, tvOS 11.0, watchOS 4.0.
|
||||
@ -58,8 +59,8 @@ import Vapor
|
||||
}
|
||||
|
||||
@discardableResult
|
||||
{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}open{{/nonPublicApi}} func execute(_ apiResponseQueue: DispatchQueue = {{projectName}}API.apiResponseQueue, _ completion: @escaping (_ result: Swift.Result<Response<T>, ErrorResponse>) -> Void) -> URLSessionTask? {
|
||||
return nil
|
||||
{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}open{{/nonPublicApi}} func execute(_ apiResponseQueue: DispatchQueue = {{projectName}}API.apiResponseQueue, _ completion: @escaping (_ result: Swift.Result<Response<T>, ErrorResponse>) -> Void) -> RequestTask {
|
||||
return requestTask
|
||||
}
|
||||
|
||||
{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} func addHeader(name: String, value: String) -> Self {
|
||||
|
@ -4,7 +4,8 @@
|
||||
// https://openapi-generator.tech
|
||||
//
|
||||
|
||||
import Foundation
|
||||
import Foundation{{#useAlamofire}}
|
||||
import Alamofire{{/useAlamofire}}
|
||||
|
||||
protocol JSONEncodable {
|
||||
func encodeToJSON() -> Any
|
||||
@ -78,3 +79,30 @@ extension CaseIterableDefaultsLast {
|
||||
self.init(statusCode: response.statusCode, header: header, body: body)
|
||||
}
|
||||
}
|
||||
|
||||
{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} final class RequestTask {
|
||||
{{#useAlamofire}}
|
||||
private var request: Request?
|
||||
|
||||
internal func set(request: Request) {
|
||||
self.request = request
|
||||
}
|
||||
|
||||
{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} func cancel() {
|
||||
request?.cancel()
|
||||
request = nil
|
||||
}
|
||||
{{/useAlamofire}}
|
||||
{{^useAlamofire}}
|
||||
private var task: URLSessionTask?
|
||||
|
||||
internal func set(task: URLSessionTask) {
|
||||
self.task = task
|
||||
}
|
||||
|
||||
{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} func cancel() {
|
||||
task?.cancel()
|
||||
task = nil
|
||||
}
|
||||
{{/useAlamofire}}
|
||||
}
|
||||
|
@ -57,7 +57,7 @@ extension {{projectName}}API {
|
||||
@available(*, deprecated, message: "This operation is deprecated.")
|
||||
{{/isDeprecated}}
|
||||
@discardableResult
|
||||
{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}open{{/nonPublicApi}} class func {{operationId}}({{#allParams}}{{paramName}}: {{#isEnum}}{{#isContainer}}[{{enumName}}_{{operationId}}]{{/isContainer}}{{^isContainer}}{{enumName}}_{{operationId}}{{/isContainer}}{{/isEnum}}{{^isEnum}}{{{dataType}}}{{/isEnum}}{{^required}}? = nil{{/required}}{{^-last}}, {{/-last}}{{/allParams}}{{#hasParams}}, {{/hasParams}}apiResponseQueue: DispatchQueue = {{projectName}}API.apiResponseQueue, completion: @escaping ((_ data: {{{returnType}}}{{^returnType}}Void{{/returnType}}?, _ error: Error?) -> Void)) -> URLSessionTask? {
|
||||
{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}open{{/nonPublicApi}} class func {{operationId}}({{#allParams}}{{paramName}}: {{#isEnum}}{{#isContainer}}[{{enumName}}_{{operationId}}]{{/isContainer}}{{^isContainer}}{{enumName}}_{{operationId}}{{/isContainer}}{{/isEnum}}{{^isEnum}}{{{dataType}}}{{/isEnum}}{{^required}}? = nil{{/required}}{{^-last}}, {{/-last}}{{/allParams}}{{#hasParams}}, {{/hasParams}}apiResponseQueue: DispatchQueue = {{projectName}}API.apiResponseQueue, completion: @escaping ((_ data: {{{returnType}}}{{^returnType}}Void{{/returnType}}?, _ error: Error?) -> Void)) -> RequestTask {
|
||||
return {{operationId}}WithRequestBuilder({{#allParams}}{{paramName}}: {{paramName}}{{^-last}}, {{/-last}}{{/allParams}}).execute(apiResponseQueue) { result in
|
||||
switch result {
|
||||
{{#returnType}}
|
||||
@ -124,7 +124,7 @@ extension {{projectName}}API {
|
||||
{{/isDeprecated}}
|
||||
{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}open{{/nonPublicApi}} class func {{operationId}}({{#allParams}}{{paramName}}: {{#isEnum}}{{#isContainer}}[{{enumName}}_{{operationId}}]{{/isContainer}}{{^isContainer}}{{enumName}}_{{operationId}}{{/isContainer}}{{/isEnum}}{{^isEnum}}{{{dataType}}}{{/isEnum}}{{^required}}? = nil{{/required}}{{^-last}}, {{/-last}}{{/allParams}}{{#hasParams}}, {{/hasParams}}apiResponseQueue: DispatchQueue = {{projectName}}API.apiResponseQueue) -> Observable<{{{returnType}}}{{^returnType}}Void{{/returnType}}> {
|
||||
return Observable.create { observer -> Disposable in
|
||||
let task = {{operationId}}WithRequestBuilder({{#allParams}}{{paramName}}: {{paramName}}{{^-last}}, {{/-last}}{{/allParams}}).execute(apiResponseQueue) { result in
|
||||
let requestTask = {{operationId}}WithRequestBuilder({{#allParams}}{{paramName}}: {{paramName}}{{^-last}}, {{/-last}}{{/allParams}}).execute(apiResponseQueue) { result in
|
||||
switch result {
|
||||
{{#returnType}}
|
||||
case let .success(response):
|
||||
@ -141,7 +141,7 @@ extension {{projectName}}API {
|
||||
}
|
||||
|
||||
return Disposables.create {
|
||||
task?.cancel()
|
||||
requestTask.cancel()
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -161,9 +161,9 @@ extension {{projectName}}API {
|
||||
{{/isDeprecated}}
|
||||
@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)
|
||||
{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}open{{/nonPublicApi}} class func {{operationId}}({{#allParams}}{{paramName}}: {{#isEnum}}{{#isContainer}}[{{enumName}}_{{operationId}}]{{/isContainer}}{{^isContainer}}{{enumName}}_{{operationId}}{{/isContainer}}{{/isEnum}}{{^isEnum}}{{{dataType}}}{{/isEnum}}{{^required}}? = nil{{/required}}{{^-last}}, {{/-last}}{{/allParams}}{{#hasParams}}, {{/hasParams}}apiResponseQueue: DispatchQueue = {{projectName}}API.apiResponseQueue) -> AnyPublisher<{{{returnType}}}{{^returnType}}Void{{/returnType}}, Error> {
|
||||
var task: URLSessionTask?
|
||||
var requestTask: RequestTask?
|
||||
return Future<{{{returnType}}}{{^returnType}}Void{{/returnType}}, Error> { promise in
|
||||
task = {{operationId}}WithRequestBuilder({{#allParams}}{{paramName}}: {{paramName}}{{^-last}}, {{/-last}}{{/allParams}}).execute(apiResponseQueue) { result in
|
||||
requestTask = {{operationId}}WithRequestBuilder({{#allParams}}{{paramName}}: {{paramName}}{{^-last}}, {{/-last}}{{/allParams}}).execute(apiResponseQueue) { result in
|
||||
switch result {
|
||||
{{#returnType}}
|
||||
case let .success(response):
|
||||
@ -179,7 +179,7 @@ extension {{projectName}}API {
|
||||
}
|
||||
}
|
||||
.handleEvents(receiveCancel: {
|
||||
task?.cancel()
|
||||
requestTask?.cancel()
|
||||
})
|
||||
.eraseToAnyPublisher()
|
||||
}
|
||||
@ -197,9 +197,9 @@ extension {{projectName}}API {
|
||||
{{#isDeprecated}}
|
||||
@available(*, deprecated, message: "This operation is deprecated.")
|
||||
{{/isDeprecated}}
|
||||
@available(macOS 12.0, iOS 15.0, watchOS 8.0, tvOS 15.0, *)
|
||||
@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)
|
||||
{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}open{{/nonPublicApi}} class func {{operationId}}({{#allParams}}{{paramName}}: {{#isEnum}}{{#isContainer}}[{{enumName}}_{{operationId}}]{{/isContainer}}{{^isContainer}}{{enumName}}_{{operationId}}{{/isContainer}}{{/isEnum}}{{^isEnum}}{{{dataType}}}{{/isEnum}}{{^required}}? = nil{{/required}}{{^-last}}, {{/-last}}{{/allParams}}{{#hasParams}}, {{/hasParams}}apiResponseQueue: DispatchQueue = {{projectName}}API.apiResponseQueue) async throws{{#returnType}} -> {{{returnType}}}{{/returnType}} {
|
||||
var task: URLSessionTask?
|
||||
var requestTask: RequestTask?
|
||||
return try await withTaskCancellationHandler {
|
||||
try Task.checkCancellation()
|
||||
return try await withCheckedThrowingContinuation { continuation in
|
||||
@ -208,7 +208,7 @@ extension {{projectName}}API {
|
||||
return
|
||||
}
|
||||
|
||||
task = {{operationId}}WithRequestBuilder({{#allParams}}{{paramName}}: {{paramName}}{{^-last}}, {{/-last}}{{/allParams}}).execute(apiResponseQueue) { result in
|
||||
requestTask = {{operationId}}WithRequestBuilder({{#allParams}}{{paramName}}: {{paramName}}{{^-last}}, {{/-last}}{{/allParams}}).execute(apiResponseQueue) { result in
|
||||
switch result {
|
||||
{{#returnType}}
|
||||
case let .success(response):
|
||||
@ -223,8 +223,8 @@ extension {{projectName}}API {
|
||||
}
|
||||
}
|
||||
}
|
||||
} onCancel: { [task] in
|
||||
task?.cancel()
|
||||
} onCancel: { [requestTask] in
|
||||
requestTask?.cancel()
|
||||
}
|
||||
}
|
||||
{{/useAsyncAwait}}
|
||||
@ -241,7 +241,7 @@ extension {{projectName}}API {
|
||||
@available(*, deprecated, message: "This operation is deprecated.")
|
||||
{{/isDeprecated}}
|
||||
@discardableResult
|
||||
open class func {{operationId}}({{#allParams}}{{paramName}}: {{#isEnum}}{{#isContainer}}[{{enumName}}_{{operationId}}]{{/isContainer}}{{^isContainer}}{{enumName}}_{{operationId}}{{/isContainer}}{{/isEnum}}{{^isEnum}}{{{dataType}}}{{/isEnum}}{{^required}}? = nil{{/required}}{{^-last}}, {{/-last}}{{/allParams}}{{#hasParams}}, {{/hasParams}}apiResponseQueue: DispatchQueue = {{projectName}}API.apiResponseQueue, completion: @escaping ((_ result: Swift.Result<{{{returnType}}}{{^returnType}}Void{{/returnType}}, ErrorResponse>) -> Void)) -> URLSessionTask? {
|
||||
open class func {{operationId}}({{#allParams}}{{paramName}}: {{#isEnum}}{{#isContainer}}[{{enumName}}_{{operationId}}]{{/isContainer}}{{^isContainer}}{{enumName}}_{{operationId}}{{/isContainer}}{{/isEnum}}{{^isEnum}}{{{dataType}}}{{/isEnum}}{{^required}}? = nil{{/required}}{{^-last}}, {{/-last}}{{/allParams}}{{#hasParams}}, {{/hasParams}}apiResponseQueue: DispatchQueue = {{projectName}}API.apiResponseQueue, completion: @escaping ((_ result: Swift.Result<{{{returnType}}}{{^returnType}}Void{{/returnType}}, ErrorResponse>) -> Void)) -> RequestTask {
|
||||
return {{operationId}}WithRequestBuilder({{#allParams}}{{paramName}}: {{paramName}}{{^-last}}, {{/-last}}{{/allParams}}).execute(apiResponseQueue) { result in
|
||||
switch result {
|
||||
{{#returnType}}
|
||||
|
@ -79,7 +79,7 @@ private var managerStore = SynchronizedDictionary<String, Alamofire.Session>()
|
||||
}
|
||||
|
||||
@discardableResult
|
||||
override {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}open{{/nonPublicApi}} func execute(_ apiResponseQueue: DispatchQueue = {{projectName}}API.apiResponseQueue, _ completion: @escaping (_ result: Swift.Result<Response<T>, ErrorResponse>) -> Void) -> URLSessionTask? {
|
||||
override {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}open{{/nonPublicApi}} func execute(_ apiResponseQueue: DispatchQueue = {{projectName}}API.apiResponseQueue, _ completion: @escaping (_ result: Swift.Result<Response<T>, ErrorResponse>) -> Void) -> RequestTask {
|
||||
let managerId = UUID().uuidString
|
||||
// Create a new manager for each request to customize its request header
|
||||
let manager = createAlamofireSession()
|
||||
@ -114,6 +114,8 @@ private var managerStore = SynchronizedDictionary<String, Alamofire.Session>()
|
||||
mpForm.append(string.data(using: String.Encoding.utf8)!, withName: k)
|
||||
case let number as NSNumber:
|
||||
mpForm.append(number.stringValue.data(using: String.Encoding.utf8)!, withName: k)
|
||||
case let data as Data:
|
||||
mpForm.append(data, withName: k)
|
||||
default:
|
||||
fatalError("Unprocessable value \(v) with key \(k)")
|
||||
}
|
||||
@ -125,6 +127,8 @@ private var managerStore = SynchronizedDictionary<String, Alamofire.Session>()
|
||||
}
|
||||
}
|
||||
|
||||
requestTask.set(request: upload)
|
||||
|
||||
self.processRequest(request: upload, managerId, apiResponseQueue, completion)
|
||||
} else if contentType == "application/x-www-form-urlencoded" {
|
||||
encoding = URLEncoding(destination: .httpBody)
|
||||
@ -142,10 +146,10 @@ private var managerStore = SynchronizedDictionary<String, Alamofire.Session>()
|
||||
onProgressReady(request.uploadProgress)
|
||||
}
|
||||
processRequest(request: request, managerId, apiResponseQueue, completion)
|
||||
return request.task
|
||||
requestTask.set(request: request)
|
||||
}
|
||||
|
||||
return nil
|
||||
return requestTask
|
||||
}
|
||||
|
||||
fileprivate func processRequest(request: DataRequest, _ managerId: String, _ apiResponseQueue: DispatchQueue, _ completion: @escaping (_ result: Swift.Result<Response<T>, ErrorResponse>) -> Void) {
|
||||
|
@ -100,7 +100,7 @@ private var credentialStore = SynchronizedDictionary<Int, URLCredential>()
|
||||
}
|
||||
|
||||
@discardableResult
|
||||
override {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}open{{/nonPublicApi}} func execute(_ apiResponseQueue: DispatchQueue = {{projectName}}API.apiResponseQueue, _ completion: @escaping (_ result: Swift.Result<Response<T>, ErrorResponse>) -> Void) -> URLSessionTask? {
|
||||
override {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}open{{/nonPublicApi}} func execute(_ apiResponseQueue: DispatchQueue = {{projectName}}API.apiResponseQueue, _ completion: @escaping (_ result: Swift.Result<Response<T>, ErrorResponse>) -> Void) -> RequestTask {
|
||||
let urlSession = createURLSession()
|
||||
|
||||
guard let xMethod = HTTPMethod(rawValue: method) else {
|
||||
@ -172,14 +172,14 @@ private var credentialStore = SynchronizedDictionary<Int, URLCredential>()
|
||||
|
||||
dataTask.resume()
|
||||
|
||||
return dataTask
|
||||
requestTask.set(task: dataTask)
|
||||
} catch {
|
||||
apiResponseQueue.async {
|
||||
completion(.failure(ErrorResponse.error(415, nil, nil, error)))
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
return requestTask
|
||||
}
|
||||
|
||||
fileprivate func processRequestResponse(urlRequest: URLRequest, data: Data?, response: URLResponse?, error: Error?, completion: @escaping (_ result: Swift.Result<Response<T>, ErrorResponse>) -> Void) {
|
||||
@ -477,6 +477,15 @@ private class FormDataEncoding: ParameterEncoding {
|
||||
)
|
||||
}
|
||||
|
||||
case let data as Data:
|
||||
|
||||
urlRequest = configureDataUploadRequest(
|
||||
urlRequest: urlRequest,
|
||||
boundary: boundary,
|
||||
name: key,
|
||||
data: data
|
||||
)
|
||||
|
||||
default:
|
||||
fatalError("Unprocessable value \(value) with key \(key)")
|
||||
}
|
||||
|
@ -1673,12 +1673,12 @@ public class DefaultCodegenTest {
|
||||
public void testDefaultResponseShouldBeLast() {
|
||||
OpenAPI openAPI = TestUtils.createOpenAPI();
|
||||
Operation myOperation = new Operation().operationId("myOperation").responses(
|
||||
new ApiResponses()
|
||||
.addApiResponse(
|
||||
"default", new ApiResponse().description("Default"))
|
||||
.addApiResponse(
|
||||
"422", new ApiResponse().description("Error"))
|
||||
);
|
||||
new ApiResponses()
|
||||
.addApiResponse(
|
||||
"default", new ApiResponse().description("Default"))
|
||||
.addApiResponse(
|
||||
"422", new ApiResponse().description("Error"))
|
||||
);
|
||||
openAPI.path("/here", new PathItem().get(myOperation));
|
||||
final DefaultCodegen codegen = new DefaultCodegen();
|
||||
codegen.setOpenAPI(openAPI);
|
||||
@ -2353,49 +2353,49 @@ public class DefaultCodegenTest {
|
||||
@Test
|
||||
public void testFormComposedSchema() {
|
||||
OpenAPI openAPI = TestUtils.parseContent("openapi: 3.0.1\n" +
|
||||
"info:\n" +
|
||||
" version: '1.0.0'\n" +
|
||||
" title: the title\n" +
|
||||
"\n" +
|
||||
"paths:\n" +
|
||||
" '/users/me':\n" +
|
||||
" post:\n" +
|
||||
" description: Change user password.\n" +
|
||||
" operationId: changeCurrentUserPassword\n" +
|
||||
" requestBody:\n" +
|
||||
" required: true\n" +
|
||||
" content:\n" +
|
||||
" multipart/form-data:\n" +
|
||||
" schema:\n" +
|
||||
" $ref: '#/components/schemas/ChangePasswordRequest'\n" +
|
||||
" responses:\n" +
|
||||
" '200':\n" +
|
||||
" description: Successful operation\n" +
|
||||
" content: {}\n" +
|
||||
"\n" +
|
||||
"components:\n" +
|
||||
" schemas:\n" +
|
||||
" CommonPasswordRequest:\n" +
|
||||
" type: object\n" +
|
||||
" required: [ password, passwordConfirmation ]\n" +
|
||||
" properties:\n" +
|
||||
" password:\n" +
|
||||
" type: string\n" +
|
||||
" format: password\n" +
|
||||
" passwordConfirmation:\n" +
|
||||
" type: string\n" +
|
||||
" format: password\n" +
|
||||
"\n" +
|
||||
" ChangePasswordRequest:\n" +
|
||||
" type: object\n" +
|
||||
" allOf:\n" +
|
||||
" - $ref: '#/components/schemas/CommonPasswordRequest'\n" +
|
||||
" - type: object\n" +
|
||||
" required: [ oldPassword ]\n" +
|
||||
" properties:\n" +
|
||||
" oldPassword:\n" +
|
||||
" type: string\n" +
|
||||
" format: password\n");
|
||||
"info:\n" +
|
||||
" version: '1.0.0'\n" +
|
||||
" title: the title\n" +
|
||||
"\n" +
|
||||
"paths:\n" +
|
||||
" '/users/me':\n" +
|
||||
" post:\n" +
|
||||
" description: Change user password.\n" +
|
||||
" operationId: changeCurrentUserPassword\n" +
|
||||
" requestBody:\n" +
|
||||
" required: true\n" +
|
||||
" content:\n" +
|
||||
" multipart/form-data:\n" +
|
||||
" schema:\n" +
|
||||
" $ref: '#/components/schemas/ChangePasswordRequest'\n" +
|
||||
" responses:\n" +
|
||||
" '200':\n" +
|
||||
" description: Successful operation\n" +
|
||||
" content: {}\n" +
|
||||
"\n" +
|
||||
"components:\n" +
|
||||
" schemas:\n" +
|
||||
" CommonPasswordRequest:\n" +
|
||||
" type: object\n" +
|
||||
" required: [ password, passwordConfirmation ]\n" +
|
||||
" properties:\n" +
|
||||
" password:\n" +
|
||||
" type: string\n" +
|
||||
" format: password\n" +
|
||||
" passwordConfirmation:\n" +
|
||||
" type: string\n" +
|
||||
" format: password\n" +
|
||||
"\n" +
|
||||
" ChangePasswordRequest:\n" +
|
||||
" type: object\n" +
|
||||
" allOf:\n" +
|
||||
" - $ref: '#/components/schemas/CommonPasswordRequest'\n" +
|
||||
" - type: object\n" +
|
||||
" required: [ oldPassword ]\n" +
|
||||
" properties:\n" +
|
||||
" oldPassword:\n" +
|
||||
" type: string\n" +
|
||||
" format: password\n");
|
||||
|
||||
final DefaultCodegen cg = new DefaultCodegen();
|
||||
cg.setOpenAPI(openAPI);
|
||||
@ -2404,16 +2404,16 @@ public class DefaultCodegenTest {
|
||||
|
||||
final PathItem path = openAPI.getPaths().get("/users/me");
|
||||
final CodegenOperation operation = cg.fromOperation(
|
||||
"/users/me",
|
||||
"post",
|
||||
path.getPost(),
|
||||
path.getServers());
|
||||
"/users/me",
|
||||
"post",
|
||||
path.getPost(),
|
||||
path.getServers());
|
||||
assertEquals(operation.formParams.size(), 3,
|
||||
"The list of parameters should include inherited type");
|
||||
"The list of parameters should include inherited type");
|
||||
|
||||
final List<String> names = operation.formParams.stream()
|
||||
.map(param -> param.paramName)
|
||||
.collect(Collectors.toList());
|
||||
.map(param -> param.paramName)
|
||||
.collect(Collectors.toList());
|
||||
assertTrue(names.contains("password"));
|
||||
assertTrue(names.contains("passwordConfirmation"));
|
||||
assertTrue(names.contains("oldPassword"));
|
||||
@ -3347,7 +3347,7 @@ public class DefaultCodegenTest {
|
||||
assertTrue(hasRequired);
|
||||
} else {
|
||||
// All variables must be in the above sets
|
||||
fail();
|
||||
fail();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -3930,7 +3930,8 @@ public class DefaultCodegenTest {
|
||||
assertFalse(cr.primitiveType);
|
||||
}
|
||||
|
||||
public void testParameterContent() {
|
||||
@Test
|
||||
public void testRequestParameterContent() {
|
||||
DefaultCodegen codegen = new DefaultCodegen();
|
||||
final OpenAPI openAPI = TestUtils.parseFlattenSpec("src/test/resources/3_0/content-data.yaml");
|
||||
codegen.setOpenAPI(openAPI);
|
||||
@ -3948,6 +3949,7 @@ public class DefaultCodegenTest {
|
||||
CodegenProperty cp = mt.getSchema();
|
||||
assertTrue(cp.isMap);
|
||||
assertEquals(cp.complexType, "object");
|
||||
assertEquals(cp.baseName, "SchemaForRequestParameterCoordinatesInlineSchemaApplicationJson");
|
||||
|
||||
CodegenParameter coordinatesReferencedSchema = co.queryParams.get(1);
|
||||
content = coordinatesReferencedSchema.getContent();
|
||||
@ -3956,6 +3958,7 @@ public class DefaultCodegenTest {
|
||||
cp = mt.getSchema();
|
||||
assertFalse(cp.isMap); // because it is a referenced schema
|
||||
assertEquals(cp.complexType, "coordinates");
|
||||
assertEquals(cp.baseName, "SchemaForRequestParameterCoordinatesReferencedSchemaApplicationJson");
|
||||
}
|
||||
|
||||
@Test
|
||||
@ -3975,13 +3978,13 @@ public class DefaultCodegenTest {
|
||||
CodegenMediaType mt = content.get("application/json");
|
||||
assertNull(mt.getEncoding());
|
||||
CodegenProperty cp = mt.getSchema();
|
||||
assertEquals(cp.baseName, "ApplicationJsonSchema");
|
||||
assertEquals(cp.baseName, "SchemaForRequestBodyApplicationJson");
|
||||
assertNotNull(cp);
|
||||
|
||||
mt = content.get("text/plain");
|
||||
assertNull(mt.getEncoding());
|
||||
cp = mt.getSchema();
|
||||
assertEquals(cp.baseName, "TextPlainSchema");
|
||||
assertEquals(cp.baseName, "SchemaForRequestBodyTextPlain");
|
||||
assertNotNull(cp);
|
||||
// Note: the inline model resolver has a bug for this use case; it extracts an inline request body into a component
|
||||
// but the schema it references is not string type
|
||||
@ -3995,13 +3998,72 @@ public class DefaultCodegenTest {
|
||||
mt = content.get("application/json");
|
||||
assertNull(mt.getEncoding());
|
||||
cp = mt.getSchema();
|
||||
assertEquals(cp.baseName, "ApplicationJsonSchema");
|
||||
assertEquals(cp.baseName, "SchemaForRequestBodyApplicationJson");
|
||||
assertEquals(cp.complexType, "coordinates");
|
||||
|
||||
mt = content.get("text/plain");
|
||||
assertNull(mt.getEncoding());
|
||||
cp = mt.getSchema();
|
||||
assertEquals(cp.baseName, "TextPlainSchema");
|
||||
assertEquals(cp.baseName, "SchemaForRequestBodyTextPlain");
|
||||
assertTrue(cp.isString);
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testResponseContentAndHeader() {
|
||||
DefaultCodegen codegen = new DefaultCodegen();
|
||||
final OpenAPI openAPI = TestUtils.parseFlattenSpec("src/test/resources/3_0/content-data.yaml");
|
||||
codegen.setOpenAPI(openAPI);
|
||||
String path;
|
||||
CodegenOperation co;
|
||||
|
||||
path = "/jsonQueryParams";
|
||||
co = codegen.fromOperation(path, "GET", openAPI.getPaths().get(path).getGet(), null);
|
||||
CodegenParameter coordinatesInlineSchema = co.queryParams.get(0);
|
||||
LinkedHashMap<String, CodegenMediaType> content = coordinatesInlineSchema.getContent();
|
||||
assertNotNull(content);
|
||||
assertEquals(content.keySet(), new HashSet<>(Arrays.asList("application/json")));
|
||||
|
||||
CodegenParameter schemaParam = co.queryParams.get(2);
|
||||
assertEquals(schemaParam.getSchema().baseName, "stringWithMinLength");
|
||||
|
||||
|
||||
CodegenResponse cr = co.responses.get(0);
|
||||
List<CodegenParameter> responseHeaders = cr.getResponseHeaders();
|
||||
assertEquals(1, responseHeaders.size());
|
||||
CodegenParameter header = responseHeaders.get(0);
|
||||
assertEquals("X-Rate-Limit", header.baseName);
|
||||
assertTrue(header.isUnboundedInteger);
|
||||
assertEquals(header.getSchema().baseName, "X-Rate-Limit");
|
||||
|
||||
content = cr.getContent();
|
||||
assertEquals(content.keySet(), new HashSet<>(Arrays.asList("application/json", "text/plain")));
|
||||
CodegenMediaType mt = content.get("application/json");
|
||||
assertNull(mt.getEncoding());
|
||||
CodegenProperty cp = mt.getSchema();
|
||||
assertFalse(cp.isMap); // because it is a referenced schema
|
||||
assertEquals(cp.complexType, "coordinates");
|
||||
assertEquals(cp.baseName, "SchemaFor200ResponseBodyApplicationJson");
|
||||
|
||||
mt = content.get("text/plain");
|
||||
assertNull(mt.getEncoding());
|
||||
cp = mt.getSchema();
|
||||
assertEquals(cp.baseName, "SchemaFor200ResponseBodyTextPlain");
|
||||
assertTrue(cp.isString);
|
||||
|
||||
cr = co.responses.get(1);
|
||||
content = cr.getContent();
|
||||
assertEquals(content.keySet(), new HashSet<>(Arrays.asList("application/json", "text/plain")));
|
||||
mt = content.get("application/json");
|
||||
assertNull(mt.getEncoding());
|
||||
cp = mt.getSchema();
|
||||
assertFalse(cp.isMap); // because it is a referenced schema
|
||||
assertEquals(cp.complexType, "coordinates");
|
||||
assertEquals(cp.baseName, "SchemaFor201ResponseBodyApplicationJson");
|
||||
|
||||
mt = content.get("text/plain");
|
||||
assertNull(mt.getEncoding());
|
||||
cp = mt.getSchema();
|
||||
assertEquals(cp.baseName, "SchemaFor201ResponseBodyTextPlain");
|
||||
assertTrue(cp.isString);
|
||||
}
|
||||
}
|
@ -26,9 +26,39 @@ paths:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/coordinates'
|
||||
- name: stringWithMinLength
|
||||
in: query
|
||||
schema:
|
||||
$ref: '#/components/schemas/stringWithMinLength'
|
||||
responses:
|
||||
'201':
|
||||
'200':
|
||||
description: 'OK'
|
||||
headers:
|
||||
X-Rate-Limit:
|
||||
description: "The number of allowed requests in the current period"
|
||||
schema:
|
||||
type: integer
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/coordinates'
|
||||
text/plain:
|
||||
schema:
|
||||
$ref: '#/components/schemas/stringWithMinLength'
|
||||
'201':
|
||||
description: 'Created OK'
|
||||
headers:
|
||||
X-Rate-Limit-Limit:
|
||||
description: "The number of allowed requests in the current period"
|
||||
schema:
|
||||
type: integer
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/coordinates'
|
||||
text/plain:
|
||||
schema:
|
||||
$ref: '#/components/schemas/stringWithMinLength'
|
||||
/inlineRequestBodySchemasDifferingByContentType:
|
||||
post:
|
||||
requestBody:
|
||||
@ -80,4 +110,4 @@ components:
|
||||
lat:
|
||||
type: number
|
||||
long:
|
||||
type: number
|
||||
type: number
|
@ -12,6 +12,16 @@ paths:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/fruit'
|
||||
put:
|
||||
operationId: test
|
||||
parameters: []
|
||||
requestBody:
|
||||
content:
|
||||
application/json:
|
||||
schema: {}
|
||||
responses:
|
||||
'204':
|
||||
description: Success
|
||||
components:
|
||||
schemas:
|
||||
fruit:
|
||||
|
2
pom.xml
2
pom.xml
@ -1148,9 +1148,7 @@
|
||||
<!-- comment out as it's not working as the moment
|
||||
<module>samples/client/petstore/c</module>
|
||||
-->
|
||||
<!--
|
||||
<module>samples/client/petstore/cpp-qt</module>
|
||||
-->
|
||||
<module>samples/client/petstore/rust</module>
|
||||
<module>samples/client/petstore/rust/reqwest/petstore</module>
|
||||
<module>samples/client/petstore/rust/reqwest/petstore-async</module>
|
||||
|
@ -14,7 +14,7 @@ lazy val root = (project in file(".")).
|
||||
"com.squareup.okhttp3" % "logging-interceptor" % "4.9.1",
|
||||
"com.google.code.gson" % "gson" % "2.8.6",
|
||||
"org.apache.commons" % "commons-lang3" % "3.10",
|
||||
"org.openapitools" % "jackson-databind-nullable" % "0.2.1",
|
||||
"org.openapitools" % "jackson-databind-nullable" % "0.2.2",
|
||||
"org.threeten" % "threetenbp" % "1.4.3" % "compile",
|
||||
"io.gsonfire" % "gson-fire" % "1.8.3" % "compile",
|
||||
"jakarta.annotation" % "jakarta.annotation-api" % "1.3.5" % "compile",
|
||||
|
@ -324,7 +324,7 @@
|
||||
<okhttp-version>4.9.2</okhttp-version>
|
||||
<gson-version>2.8.8</gson-version>
|
||||
<commons-lang3-version>3.12.0</commons-lang3-version>
|
||||
<jackson-databind-nullable-version>0.2.1</jackson-databind-nullable-version>
|
||||
<jackson-databind-nullable-version>0.2.2</jackson-databind-nullable-version>
|
||||
<threetenbp-version>1.5.0</threetenbp-version>
|
||||
<jakarta-annotation-version>1.3.5</jakarta-annotation-version>
|
||||
<junit-version>4.13.2</junit-version>
|
||||
|
@ -10,6 +10,7 @@ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC -Wall -Wno-unused-variable")
|
||||
find_package(Qt5Core REQUIRED)
|
||||
find_package(Qt5Network REQUIRED)
|
||||
find_package(Qt5Test REQUIRED)
|
||||
find_package(Qt5Gui REQUIRED)
|
||||
|
||||
include_directories(
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/client
|
||||
@ -23,7 +24,7 @@ add_executable(${PROJECT_NAME}
|
||||
PetStore/UserApiTests.cpp
|
||||
)
|
||||
target_link_libraries(${PROJECT_NAME} PRIVATE client)
|
||||
target_link_libraries(${PROJECT_NAME} PRIVATE Qt5::Core Qt5::Network Qt5::Test)
|
||||
target_link_libraries(${PROJECT_NAME} PRIVATE Qt5::Core Qt5::Network Qt5::Test Qt5::Gui)
|
||||
set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 14)
|
||||
set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD_REQUIRED ON)
|
||||
set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_EXTENSIONS OFF)
|
||||
|
@ -13,6 +13,7 @@ endif ()
|
||||
|
||||
find_package(Qt5Core REQUIRED)
|
||||
find_package(Qt5Network REQUIRED)
|
||||
find_package(Qt5Gui REQUIRED)
|
||||
|
||||
add_library(${PROJECT_NAME}
|
||||
PFXApiResponse.cpp
|
||||
@ -27,9 +28,9 @@ add_library(${PROJECT_NAME}
|
||||
PFXHelpers.cpp
|
||||
PFXHttpRequest.cpp
|
||||
PFXHttpFileElement.cpp
|
||||
PFXOauth.cpp
|
||||
)
|
||||
target_link_libraries(${PROJECT_NAME} PRIVATE Qt5::Core Qt5::Network )
|
||||
|
||||
target_link_libraries(${PROJECT_NAME} PRIVATE Qt5::Core Qt5::Network Qt5::Gui)
|
||||
if(NOT APPLE)
|
||||
target_link_libraries(${PROJECT_NAME} PRIVATE ssl crypto)
|
||||
endif()
|
||||
|
@ -1,6 +1,6 @@
|
||||
#include "PFXOauth.h"
|
||||
|
||||
namespace OpenAPI {
|
||||
namespace test_namespace {
|
||||
|
||||
/*
|
||||
* Base class to perform oauth2 flows
|
||||
@ -343,5 +343,4 @@ void ReplyServer::read()
|
||||
emit dataReceived(queryParams);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
} // namespace test_namespace
|
||||
|
@ -31,8 +31,7 @@
|
||||
#include <QUrl>
|
||||
#include <QUrlQuery>
|
||||
#include <QDateTime>
|
||||
|
||||
|
||||
#include <time.h>
|
||||
|
||||
namespace test_namespace {
|
||||
|
||||
@ -40,19 +39,19 @@ class oauthToken
|
||||
{
|
||||
public:
|
||||
oauthToken(QString token, int expiresIn, QString scope, QString tokenType) : m_token(token), m_scope(scope), m_type(tokenType){
|
||||
m_validUntil = QDateTime::fromSecsSinceEpoch(QDateTime::currentSecsSinceEpoch() + expiresIn);
|
||||
m_validUntil = time(0) + expiresIn;
|
||||
}
|
||||
oauthToken(){
|
||||
m_validUntil = QDateTime::fromSecsSinceEpoch(QDateTime::currentSecsSinceEpoch() -1);
|
||||
m_validUntil = time(0) - 1;
|
||||
}
|
||||
QString getToken(){return m_token;};
|
||||
QString getScope(){return m_scope;};
|
||||
QString getType(){return m_type;};
|
||||
bool isValid(){return QDateTime::currentDateTime() < m_validUntil;};
|
||||
bool isValid(){return time(0) < m_validUntil;};
|
||||
|
||||
private:
|
||||
QString m_token;
|
||||
QDateTime m_validUntil;
|
||||
time_t m_validUntil;
|
||||
QString m_scope;
|
||||
QString m_type;
|
||||
};
|
||||
|
@ -18,6 +18,7 @@ import io.micronaut.http.client.annotation.Client;
|
||||
import org.openapitools.query.QueryParam;
|
||||
import io.micronaut.core.convert.format.Format;
|
||||
import reactor.core.publisher.Mono;
|
||||
import java.time.LocalDateTime;
|
||||
import org.openapitools.model.User;
|
||||
import javax.annotation.Generated;
|
||||
import java.util.ArrayList;
|
||||
|
@ -116,7 +116,7 @@ ext {
|
||||
swagger_annotations_version = "1.5.22"
|
||||
jackson_version = "2.12.1"
|
||||
jackson_databind_version = "2.10.5.1"
|
||||
jackson_databind_nullable_version = "0.2.1"
|
||||
jackson_databind_nullable_version = "0.2.2"
|
||||
jakarta_annotation_version = "1.3.5"
|
||||
jackson_threetenbp_version = "2.9.10"
|
||||
httpclient_version = "4.5.13"
|
||||
|
@ -20,6 +20,7 @@ import org.openapitools.client.Configuration;
|
||||
import org.openapitools.client.model.*;
|
||||
import org.openapitools.client.Pair;
|
||||
|
||||
import org.threeten.bp.OffsetDateTime;
|
||||
import org.openapitools.client.model.User;
|
||||
|
||||
|
||||
|
@ -4,6 +4,7 @@ import org.openapitools.client.ApiClient;
|
||||
import org.openapitools.client.EncodingUtils;
|
||||
import org.openapitools.client.model.ApiResponse;
|
||||
|
||||
import org.threeten.bp.OffsetDateTime;
|
||||
import org.openapitools.client.model.User;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
@ -104,7 +104,7 @@ ext {
|
||||
swagger_annotations_version = "1.5.24"
|
||||
jackson_version = "2.10.3"
|
||||
jackson_databind_version = "2.10.3"
|
||||
jackson_databind_nullable_version = "0.2.1"
|
||||
jackson_databind_nullable_version = "0.2.2"
|
||||
jakarta_annotation_version = "1.3.5"
|
||||
jackson_threetenbp_version = "2.9.10"
|
||||
feign_version = "10.11"
|
||||
|
@ -331,7 +331,7 @@
|
||||
<feign-version>10.11</feign-version>
|
||||
<feign-form-version>3.8.0</feign-form-version>
|
||||
<jackson-version>2.10.3</jackson-version>
|
||||
<jackson-databind-nullable-version>0.2.1</jackson-databind-nullable-version>
|
||||
<jackson-databind-nullable-version>0.2.2</jackson-databind-nullable-version>
|
||||
<jackson-databind-version>2.10.3</jackson-databind-version>
|
||||
<jackson-threetenbp-version>2.9.10</jackson-threetenbp-version>
|
||||
<jakarta-annotation-version>1.3.5</jakarta-annotation-version>
|
||||
|
@ -4,6 +4,7 @@ import org.openapitools.client.ApiClient;
|
||||
import org.openapitools.client.EncodingUtils;
|
||||
import org.openapitools.client.model.ApiResponse;
|
||||
|
||||
import org.threeten.bp.OffsetDateTime;
|
||||
import org.openapitools.client.model.User;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
@ -97,12 +97,12 @@ if(hasProperty('target') && target == 'android') {
|
||||
}
|
||||
|
||||
ext {
|
||||
swagger_annotations_version = "1.5.22"
|
||||
jackson_version = "2.12.1"
|
||||
swagger_annotations_version = "1.6.3"
|
||||
jackson_version = "2.12.5"
|
||||
jackson_databind_version = "2.10.5.1"
|
||||
jackson_databind_nullable_version = "0.2.1"
|
||||
jackson_databind_nullable_version = "0.2.2"
|
||||
jakarta_annotation_version = "1.3.5"
|
||||
google_api_client_version = "1.23.0"
|
||||
google_api_client_version = "1.32.2"
|
||||
jersey_common_version = "2.25.1"
|
||||
jodatime_version = "2.9.9"
|
||||
junit_version = "4.13.1"
|
||||
|
@ -266,11 +266,11 @@
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<swagger-annotations-version>1.5.22</swagger-annotations-version>
|
||||
<google-api-client-version>1.30.2</google-api-client-version>
|
||||
<google-api-client-version>1.32.2</google-api-client-version>
|
||||
<jersey-common-version>2.25.1</jersey-common-version>
|
||||
<jackson-version>2.12.1</jackson-version>
|
||||
<jackson-databind-version>2.10.4</jackson-databind-version>
|
||||
<jackson-databind-nullable-version>0.2.1</jackson-databind-nullable-version>
|
||||
<jackson-databind-version>2.10.5.1</jackson-databind-version>
|
||||
<jackson-databind-nullable-version>0.2.2</jackson-databind-nullable-version>
|
||||
<jackson-threetenbp-version>2.9.10</jackson-threetenbp-version>
|
||||
<jakarta-annotation-version>1.3.5</jakarta-annotation-version>
|
||||
<maven-plugin-version>1.0.0</maven-plugin-version>
|
||||
|
@ -2,6 +2,7 @@ package org.openapitools.client.api;
|
||||
|
||||
import org.openapitools.client.ApiClient;
|
||||
|
||||
import org.threeten.bp.OffsetDateTime;
|
||||
import org.openapitools.client.model.User;
|
||||
|
||||
import com.fasterxml.jackson.core.type.TypeReference;
|
||||
|
@ -113,10 +113,10 @@ if(hasProperty('target') && target == 'android') {
|
||||
}
|
||||
|
||||
ext {
|
||||
swagger_annotations_version = "1.5.22"
|
||||
jackson_version = "2.12.1"
|
||||
swagger_annotations_version = "1.6.3"
|
||||
jackson_version = "2.12.5"
|
||||
jackson_databind_version = "2.10.5.1"
|
||||
jackson_databind_nullable_version = "0.2.1"
|
||||
jackson_databind_nullable_version = "0.2.2"
|
||||
jakarta_annotation_version = "1.3.5"
|
||||
jackson_threetenbp_version = "2.9.10"
|
||||
jersey_version = "1.19.4"
|
||||
|
@ -288,9 +288,9 @@
|
||||
</dependencies>
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<swagger-annotations-version>1.5.21</swagger-annotations-version>
|
||||
<swagger-annotations-version>1.6.3</swagger-annotations-version>
|
||||
<jersey-version>1.19.4</jersey-version>
|
||||
<jackson-version>2.12.1</jackson-version>
|
||||
<jackson-version>2.12.5</jackson-version>
|
||||
<jackson-threetenbp-version>2.9.10</jackson-threetenbp-version>
|
||||
<jakarta-annotation-version>1.3.5</jakarta-annotation-version>
|
||||
<maven-plugin-version>1.0.0</maven-plugin-version>
|
||||
|
@ -20,6 +20,7 @@ import org.openapitools.client.Configuration;
|
||||
import org.openapitools.client.model.*;
|
||||
import org.openapitools.client.Pair;
|
||||
|
||||
import org.threeten.bp.OffsetDateTime;
|
||||
import org.openapitools.client.model.User;
|
||||
|
||||
|
||||
|
@ -101,7 +101,7 @@ ext {
|
||||
swagger_annotations_version = "1.6.3"
|
||||
jackson_version = "2.13.0"
|
||||
jackson_databind_version = "2.13.0"
|
||||
jackson_databind_nullable_version = "0.2.1"
|
||||
jackson_databind_nullable_version = "0.2.2"
|
||||
jakarta_annotation_version = "1.3.5"
|
||||
jersey_version = "2.35"
|
||||
junit_version = "4.13.2"
|
||||
|
@ -20,7 +20,7 @@ lazy val root = (project in file(".")).
|
||||
"com.fasterxml.jackson.core" % "jackson-annotations" % "2.13.0" % "compile",
|
||||
"com.fasterxml.jackson.core" % "jackson-databind" % "2.13.0" % "compile",
|
||||
"com.fasterxml.jackson.datatype" % "jackson-datatype-jsr310" % "2.13.0" % "compile",
|
||||
"org.openapitools" % "jackson-databind-nullable" % "0.2.1" % "compile",
|
||||
"org.openapitools" % "jackson-databind-nullable" % "0.2.2" % "compile",
|
||||
"com.github.scribejava" % "scribejava-apis" % "8.3.1" % "compile",
|
||||
"jakarta.annotation" % "jakarta.annotation-api" % "1.3.5" % "compile",
|
||||
"junit" % "junit" % "4.13.2" % "test",
|
||||
|
@ -342,7 +342,7 @@
|
||||
<jersey-version>2.35</jersey-version>
|
||||
<jackson-version>2.13.0</jackson-version>
|
||||
<jackson-databind-version>2.13.0</jackson-databind-version>
|
||||
<jackson-databind-nullable-version>0.2.1</jackson-databind-nullable-version>
|
||||
<jackson-databind-nullable-version>0.2.2</jackson-databind-nullable-version>
|
||||
<jakarta-annotation-version>1.3.5</jakarta-annotation-version>
|
||||
<junit-version>4.13.2</junit-version>
|
||||
<scribejava-apis-version>8.3.1</scribejava-apis-version>
|
||||
|
@ -8,6 +8,7 @@ import org.openapitools.client.Pair;
|
||||
|
||||
import javax.ws.rs.core.GenericType;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import org.openapitools.client.model.User;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
@ -101,7 +101,7 @@ ext {
|
||||
swagger_annotations_version = "1.6.3"
|
||||
jackson_version = "2.13.0"
|
||||
jackson_databind_version = "2.13.0"
|
||||
jackson_databind_nullable_version = "0.2.1"
|
||||
jackson_databind_nullable_version = "0.2.2"
|
||||
jakarta_annotation_version = "1.3.5"
|
||||
jersey_version = "2.35"
|
||||
junit_version = "4.13.2"
|
||||
|
@ -20,7 +20,7 @@ lazy val root = (project in file(".")).
|
||||
"com.fasterxml.jackson.core" % "jackson-annotations" % "2.13.0" % "compile",
|
||||
"com.fasterxml.jackson.core" % "jackson-databind" % "2.13.0" % "compile",
|
||||
"com.fasterxml.jackson.datatype" % "jackson-datatype-jsr310" % "2.13.0" % "compile",
|
||||
"org.openapitools" % "jackson-databind-nullable" % "0.2.1" % "compile",
|
||||
"org.openapitools" % "jackson-databind-nullable" % "0.2.2" % "compile",
|
||||
"com.github.scribejava" % "scribejava-apis" % "8.3.1" % "compile",
|
||||
"jakarta.annotation" % "jakarta.annotation-api" % "1.3.5" % "compile",
|
||||
"junit" % "junit" % "4.13.2" % "test",
|
||||
|
@ -342,7 +342,7 @@
|
||||
<jersey-version>2.35</jersey-version>
|
||||
<jackson-version>2.13.0</jackson-version>
|
||||
<jackson-databind-version>2.13.0</jackson-databind-version>
|
||||
<jackson-databind-nullable-version>0.2.1</jackson-databind-nullable-version>
|
||||
<jackson-databind-nullable-version>0.2.2</jackson-databind-nullable-version>
|
||||
<jakarta-annotation-version>1.3.5</jakarta-annotation-version>
|
||||
<junit-version>4.13.2</junit-version>
|
||||
<scribejava-apis-version>8.3.1</scribejava-apis-version>
|
||||
|
@ -8,6 +8,7 @@ import org.openapitools.client.Pair;
|
||||
|
||||
import javax.ws.rs.core.GenericType;
|
||||
|
||||
import java.time.OffsetDateTime;
|
||||
import org.openapitools.client.model.User;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
@ -12,6 +12,7 @@
|
||||
|
||||
package org.openapitools.client.api;
|
||||
|
||||
import java.util.Date;
|
||||
import org.openapitools.client.model.User;
|
||||
|
||||
import java.io.InputStream;
|
||||
|
@ -215,7 +215,7 @@
|
||||
<maven.compiler.source>11</maven.compiler.source>
|
||||
<maven.compiler.target>11</maven.compiler.target>
|
||||
<jackson-version>2.10.4</jackson-version>
|
||||
<jackson-databind-nullable-version>0.2.1</jackson-databind-nullable-version>
|
||||
<jackson-databind-nullable-version>0.2.2</jackson-databind-nullable-version>
|
||||
<jakarta-annotation-version>1.3.5</jakarta-annotation-version>
|
||||
<junit-version>4.13.1</junit-version>
|
||||
</properties>
|
||||
|
@ -17,6 +17,7 @@ import org.openapitools.client.ApiException;
|
||||
import org.openapitools.client.ApiResponse;
|
||||
import org.openapitools.client.Pair;
|
||||
|
||||
import java.time.OffsetDateTime;
|
||||
import org.openapitools.client.model.User;
|
||||
|
||||
import com.fasterxml.jackson.core.type.TypeReference;
|
||||
|
@ -215,7 +215,7 @@
|
||||
<maven.compiler.source>11</maven.compiler.source>
|
||||
<maven.compiler.target>11</maven.compiler.target>
|
||||
<jackson-version>2.10.4</jackson-version>
|
||||
<jackson-databind-nullable-version>0.2.1</jackson-databind-nullable-version>
|
||||
<jackson-databind-nullable-version>0.2.2</jackson-databind-nullable-version>
|
||||
<jakarta-annotation-version>1.3.5</jakarta-annotation-version>
|
||||
<junit-version>4.13.1</junit-version>
|
||||
</properties>
|
||||
|
@ -17,6 +17,7 @@ import org.openapitools.client.ApiException;
|
||||
import org.openapitools.client.ApiResponse;
|
||||
import org.openapitools.client.Pair;
|
||||
|
||||
import java.time.OffsetDateTime;
|
||||
import org.openapitools.client.model.User;
|
||||
|
||||
import com.fasterxml.jackson.core.type.TypeReference;
|
||||
|
@ -14,7 +14,7 @@ lazy val root = (project in file(".")).
|
||||
"com.squareup.okhttp3" % "logging-interceptor" % "4.9.1",
|
||||
"com.google.code.gson" % "gson" % "2.8.6",
|
||||
"org.apache.commons" % "commons-lang3" % "3.10",
|
||||
"org.openapitools" % "jackson-databind-nullable" % "0.2.1",
|
||||
"org.openapitools" % "jackson-databind-nullable" % "0.2.2",
|
||||
"org.apache.oltu.oauth2" % "org.apache.oltu.oauth2.client" % "1.0.1",
|
||||
"org.threeten" % "threetenbp" % "1.4.3" % "compile",
|
||||
"io.swagger.parser.v3" % "swagger-parser-v3" "2.0.23" % "compile"
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user