forked from loafle/openapi-generator-original
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
|
## RESERVED WORDS
|
||||||
|
|
||||||
<ul class="column-ul">
|
<ul class="column-ul">
|
||||||
|
<li>ApiResponse</li>
|
||||||
<li>abstract</li>
|
<li>abstract</li>
|
||||||
<li>actual</li>
|
<li>actual</li>
|
||||||
<li>annotation</li>
|
<li>annotation</li>
|
||||||
|
@ -76,6 +76,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
|||||||
## RESERVED WORDS
|
## RESERVED WORDS
|
||||||
|
|
||||||
<ul class="column-ul">
|
<ul class="column-ul">
|
||||||
|
<li>ApiResponse</li>
|
||||||
<li>abstract</li>
|
<li>abstract</li>
|
||||||
<li>actual</li>
|
<li>actual</li>
|
||||||
<li>annotation</li>
|
<li>annotation</li>
|
||||||
|
@ -68,6 +68,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
|||||||
## RESERVED WORDS
|
## RESERVED WORDS
|
||||||
|
|
||||||
<ul class="column-ul">
|
<ul class="column-ul">
|
||||||
|
<li>ApiResponse</li>
|
||||||
<li>abstract</li>
|
<li>abstract</li>
|
||||||
<li>actual</li>
|
<li>actual</li>
|
||||||
<li>annotation</li>
|
<li>annotation</li>
|
||||||
|
@ -79,6 +79,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
|||||||
## RESERVED WORDS
|
## RESERVED WORDS
|
||||||
|
|
||||||
<ul class="column-ul">
|
<ul class="column-ul">
|
||||||
|
<li>ApiResponse</li>
|
||||||
<li>abstract</li>
|
<li>abstract</li>
|
||||||
<li>actual</li>
|
<li>actual</li>
|
||||||
<li>annotation</li>
|
<li>annotation</li>
|
||||||
|
@ -21,6 +21,7 @@ import java.util.*;
|
|||||||
|
|
||||||
public class CodegenResponse implements IJsonSchemaValidationProperties {
|
public class CodegenResponse implements IJsonSchemaValidationProperties {
|
||||||
public final List<CodegenProperty> headers = new ArrayList<CodegenProperty>();
|
public final List<CodegenProperty> headers = new ArrayList<CodegenProperty>();
|
||||||
|
private List<CodegenParameter> responseHeaders = new ArrayList<CodegenParameter>();
|
||||||
public String code;
|
public String code;
|
||||||
public boolean is1xx;
|
public boolean is1xx;
|
||||||
public boolean is2xx;
|
public boolean is2xx;
|
||||||
@ -87,6 +88,7 @@ public class CodegenResponse implements IJsonSchemaValidationProperties {
|
|||||||
private boolean hasDiscriminatorWithNonEmptyMapping;
|
private boolean hasDiscriminatorWithNonEmptyMapping;
|
||||||
private CodegenComposedSchemas composedSchemas;
|
private CodegenComposedSchemas composedSchemas;
|
||||||
private boolean hasMultipleTypes = false;
|
private boolean hasMultipleTypes = false;
|
||||||
|
private LinkedHashMap<String, CodegenMediaType> content;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
@ -98,7 +100,7 @@ public class CodegenResponse implements IJsonSchemaValidationProperties {
|
|||||||
getMaxProperties(), getMinProperties(), uniqueItems, getMaxItems(), getMinItems(), getMaxLength(),
|
getMaxProperties(), getMinProperties(), uniqueItems, getMaxItems(), getMinItems(), getMaxLength(),
|
||||||
getMinLength(), exclusiveMinimum, exclusiveMaximum, getMinimum(), getMaximum(), getPattern(),
|
getMinLength(), exclusiveMinimum, exclusiveMaximum, getMinimum(), getMaximum(), getPattern(),
|
||||||
is1xx, is2xx, is3xx, is4xx, is5xx, additionalPropertiesIsAnyType, hasVars, hasRequired,
|
is1xx, is2xx, is3xx, is4xx, is5xx, additionalPropertiesIsAnyType, hasVars, hasRequired,
|
||||||
hasDiscriminatorWithNonEmptyMapping, composedSchemas, hasMultipleTypes);
|
hasDiscriminatorWithNonEmptyMapping, composedSchemas, hasMultipleTypes, responseHeaders, content);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -147,6 +149,8 @@ public class CodegenResponse implements IJsonSchemaValidationProperties {
|
|||||||
getAdditionalPropertiesIsAnyType() == that.getAdditionalPropertiesIsAnyType() &&
|
getAdditionalPropertiesIsAnyType() == that.getAdditionalPropertiesIsAnyType() &&
|
||||||
getHasVars() == that.getHasVars() &&
|
getHasVars() == that.getHasVars() &&
|
||||||
getHasRequired() == that.getHasRequired() &&
|
getHasRequired() == that.getHasRequired() &&
|
||||||
|
Objects.equals(content, that.getContent()) &&
|
||||||
|
Objects.equals(responseHeaders, that.getResponseHeaders()) &&
|
||||||
Objects.equals(composedSchemas, that.getComposedSchemas()) &&
|
Objects.equals(composedSchemas, that.getComposedSchemas()) &&
|
||||||
Objects.equals(vars, that.vars) &&
|
Objects.equals(vars, that.vars) &&
|
||||||
Objects.equals(requiredVars, that.requiredVars) &&
|
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
|
@Override
|
||||||
public String getPattern() {
|
public String getPattern() {
|
||||||
return pattern;
|
return pattern;
|
||||||
@ -488,6 +508,8 @@ public class CodegenResponse implements IJsonSchemaValidationProperties {
|
|||||||
sb.append(", getHasDiscriminatorWithNonEmptyMapping=").append(hasDiscriminatorWithNonEmptyMapping);
|
sb.append(", getHasDiscriminatorWithNonEmptyMapping=").append(hasDiscriminatorWithNonEmptyMapping);
|
||||||
sb.append(", composedSchemas=").append(composedSchemas);
|
sb.append(", composedSchemas=").append(composedSchemas);
|
||||||
sb.append(", hasMultipleTypes=").append(hasMultipleTypes);
|
sb.append(", hasMultipleTypes=").append(hasMultipleTypes);
|
||||||
|
sb.append(", responseHeaders=").append(responseHeaders);
|
||||||
|
sb.append(", content=").append(content);
|
||||||
sb.append('}');
|
sb.append('}');
|
||||||
return sb.toString();
|
return sb.toString();
|
||||||
}
|
}
|
||||||
|
@ -3170,10 +3170,16 @@ public class DefaultCodegen implements CodegenConfig {
|
|||||||
List<MappedModel> uniqueDescendants = new ArrayList();
|
List<MappedModel> uniqueDescendants = new ArrayList();
|
||||||
if (sourceDiscriminator.getMapping() != null && !sourceDiscriminator.getMapping().isEmpty()) {
|
if (sourceDiscriminator.getMapping() != null && !sourceDiscriminator.getMapping().isEmpty()) {
|
||||||
for (Entry<String, String> e : sourceDiscriminator.getMapping().entrySet()) {
|
for (Entry<String, String> e : sourceDiscriminator.getMapping().entrySet()) {
|
||||||
String nameOrRef = e.getValue();
|
String name;
|
||||||
String name = nameOrRef.indexOf('/') >= 0 ? ModelUtils.getSimpleRef(nameOrRef) : nameOrRef;
|
if (e.getValue().indexOf('/') >= 0) {
|
||||||
String modelName = toModelName(name);
|
name = ModelUtils.getSimpleRef(e.getValue());
|
||||||
uniqueDescendants.add(new MappedModel(e.getKey(), modelName));
|
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();
|
ApiResponse response = operationGetResponsesEntry.getValue();
|
||||||
addProducesInfo(response, op);
|
addProducesInfo(response, op);
|
||||||
CodegenResponse r = fromResponse(key, response);
|
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 &&
|
if (r.baseType != null &&
|
||||||
!defaultIncludes.contains(r.baseType) &&
|
!defaultIncludes.contains(r.baseType) &&
|
||||||
!languageSpecificPrimitives.contains(r.baseType)) {
|
!languageSpecificPrimitives.contains(r.baseType)) {
|
||||||
@ -4065,6 +4085,7 @@ public class DefaultCodegen implements CodegenConfig {
|
|||||||
param = ModelUtils.getReferencedParameter(this.openAPI, param);
|
param = ModelUtils.getReferencedParameter(this.openAPI, param);
|
||||||
|
|
||||||
CodegenParameter p = fromParameter(param, imports);
|
CodegenParameter p = fromParameter(param, imports);
|
||||||
|
p.setContent(getContent(param.getContent(), imports, "RequestParameter" + toModelName(param.getName())));
|
||||||
|
|
||||||
// ensure unique params
|
// ensure unique params
|
||||||
if (ensureUniqueParams) {
|
if (ensureUniqueParams) {
|
||||||
@ -4502,7 +4523,6 @@ public class DefaultCodegen implements CodegenConfig {
|
|||||||
codegenParameter.isDeprecated = parameter.getDeprecated();
|
codegenParameter.isDeprecated = parameter.getDeprecated();
|
||||||
}
|
}
|
||||||
codegenParameter.jsonSchema = Json.pretty(parameter);
|
codegenParameter.jsonSchema = Json.pretty(parameter);
|
||||||
codegenParameter.setContent(getContent(parameter.getContent(), imports));
|
|
||||||
|
|
||||||
if (GlobalSettings.getProperty("debugParser") != null) {
|
if (GlobalSettings.getProperty("debugParser") != null) {
|
||||||
LOGGER.info("working on Parameter {}", parameter.getName());
|
LOGGER.info("working on Parameter {}", parameter.getName());
|
||||||
@ -6586,11 +6606,36 @@ public class DefaultCodegen implements CodegenConfig {
|
|||||||
codegenParameter.pattern = toRegularExpression(schema.getPattern());
|
codegenParameter.pattern = toRegularExpression(schema.getPattern());
|
||||||
}
|
}
|
||||||
|
|
||||||
protected String toMediaTypeSchemaName(String contentType) {
|
protected String toMediaTypeSchemaName(String contentType, String mediaTypeSchemaSuffix) {
|
||||||
return toModelName(contentType + "Schema");
|
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) {
|
if (content == null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@ -6609,20 +6654,7 @@ public class DefaultCodegen implements CodegenConfig {
|
|||||||
for (Entry<String, Header> headerEntry: encHeaders.entrySet()) {
|
for (Entry<String, Header> headerEntry: encHeaders.entrySet()) {
|
||||||
String headerName = headerEntry.getKey();
|
String headerName = headerEntry.getKey();
|
||||||
Header header = ModelUtils.getReferencedHeader(this.openAPI, headerEntry.getValue());
|
Header header = ModelUtils.getReferencedHeader(this.openAPI, headerEntry.getValue());
|
||||||
Parameter headerParam = new Parameter();
|
CodegenParameter param = heeaderToCodegenParameter(header, headerName, imports, mediaTypeSchemaSuffix);
|
||||||
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);
|
|
||||||
headers.add(param);
|
headers.add(param);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -6638,7 +6670,7 @@ public class DefaultCodegen implements CodegenConfig {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
String contentType = contentEntry.getKey();
|
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);
|
CodegenMediaType codegenMt = new CodegenMediaType(schemaProp, ceMap);
|
||||||
cmtContent.put(contentType, codegenMt);
|
cmtContent.put(contentType, codegenMt);
|
||||||
}
|
}
|
||||||
@ -6666,7 +6698,7 @@ public class DefaultCodegen implements CodegenConfig {
|
|||||||
if (schema == null) {
|
if (schema == null) {
|
||||||
throw new RuntimeException("Request body cannot be null. Possible cause: missing schema in body parameter (OAS v2): " + body);
|
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())) {
|
if (StringUtils.isNotBlank(schema.get$ref())) {
|
||||||
name = ModelUtils.getSimpleRef(schema.get$ref());
|
name = ModelUtils.getSimpleRef(schema.get$ref());
|
||||||
@ -6721,6 +6753,8 @@ public class DefaultCodegen implements CodegenConfig {
|
|||||||
} else if (ModelUtils.isObjectSchema(schema)) {
|
} else if (ModelUtils.isObjectSchema(schema)) {
|
||||||
// object type schema OR (AnyType schema with properties defined)
|
// object type schema OR (AnyType schema with properties defined)
|
||||||
this.addBodyModelSchema(codegenParameter, name, schema, imports, bodyParameterName, false);
|
this.addBodyModelSchema(codegenParameter, name, schema, imports, bodyParameterName, false);
|
||||||
|
} else {
|
||||||
|
updateRequestBodyForPrimitiveType(codegenParameter, schema, bodyParameterName, imports);
|
||||||
}
|
}
|
||||||
addVarsRequiredVarsAdditionalProps(schema, codegenParameter);
|
addVarsRequiredVarsAdditionalProps(schema, codegenParameter);
|
||||||
} else {
|
} 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
|
// 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
|
// as well as keywords from https://kotlinlang.org/docs/reference/keyword-reference.html
|
||||||
reservedWords = new HashSet<>(Arrays.asList(
|
reservedWords = new HashSet<>(Arrays.asList(
|
||||||
|
"ApiResponse", // Used in the auto-generated api client
|
||||||
"abstract",
|
"abstract",
|
||||||
"actual",
|
"actual",
|
||||||
"annotation",
|
"annotation",
|
||||||
|
@ -18,8 +18,21 @@
|
|||||||
package org.openapitools.codegen.languages;
|
package org.openapitools.codegen.languages;
|
||||||
|
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.openapitools.codegen.*;
|
import org.openapitools.codegen.CliOption;
|
||||||
import org.openapitools.codegen.meta.features.*;
|
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.openapitools.codegen.utils.ProcessUtils;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
@ -28,6 +41,7 @@ import java.io.File;
|
|||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.function.Predicate;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
import java.util.stream.Stream;
|
import java.util.stream.Stream;
|
||||||
|
|
||||||
@ -479,14 +493,12 @@ public class KotlinClientCodegen extends AbstractKotlinCodegen {
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case gson:
|
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/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/LocalDateTimeAdapter.kt.mustache", infrastructureFolder, "LocalDateTimeAdapter.kt"));
|
||||||
supportingFiles.add(new SupportingFile("jvm-common/infrastructure/OffsetDateTimeAdapter.kt.mustache", infrastructureFolder, "OffsetDateTimeAdapter.kt"));
|
supportingFiles.add(new SupportingFile("jvm-common/infrastructure/OffsetDateTimeAdapter.kt.mustache", infrastructureFolder, "OffsetDateTimeAdapter.kt"));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case jackson:
|
case jackson:
|
||||||
//supportingFiles.add(new SupportingFile("jvm-common/infrastructure/DateAdapter.kt.mustache", infrastructureFolder, "DateAdapter.kt"));
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case kotlinx_serialization:
|
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/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/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/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/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/LocalDateTimeAdapter.kt.mustache", infrastructureFolder, "LocalDateTimeAdapter.kt"));
|
||||||
supportingFiles.add(new SupportingFile("jvm-common/infrastructure/OffsetDateTimeAdapter.kt.mustache", infrastructureFolder, "OffsetDateTimeAdapter.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
|
// jvm specific supporting files
|
||||||
supportingFiles.add(new SupportingFile("infrastructure/Errors.kt.mustache", infrastructureFolder, "Errors.kt"));
|
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/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) {
|
private void processMultiplatformLibrary(final String infrastructureFolder) {
|
||||||
@ -653,6 +664,35 @@ public class KotlinClientCodegen extends AbstractKotlinCodegen {
|
|||||||
operation.path = operation.path.substring(1);
|
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
|
// set multipart against all relevant operations
|
||||||
if (operation.hasConsumes == Boolean.TRUE) {
|
if (operation.hasConsumes == Boolean.TRUE) {
|
||||||
if (isMultipartType(operation.consumes)) {
|
if (isMultipartType(operation.consumes)) {
|
||||||
|
@ -254,6 +254,9 @@ public class ProtobufSchemaCodegen extends DefaultCodegen implements CodegenConf
|
|||||||
if (Boolean.TRUE.equals(var.isArray)) {
|
if (Boolean.TRUE.equals(var.isArray)) {
|
||||||
var.vendorExtensions.put("x-protobuf-type", "repeated");
|
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
|
// add x-protobuf-data-type
|
||||||
// ref: https://developers.google.com/protocol-buffers/docs/proto3
|
// ref: https://developers.google.com/protocol-buffers/docs/proto3
|
||||||
@ -500,9 +503,14 @@ public class ProtobufSchemaCodegen extends DefaultCodegen implements CodegenConf
|
|||||||
int index = 1;
|
int index = 1;
|
||||||
for (CodegenParameter p : op.allParams) {
|
for (CodegenParameter p : op.allParams) {
|
||||||
// add x-protobuf-type: repeated if it's an array
|
// add x-protobuf-type: repeated if it's an array
|
||||||
|
|
||||||
if (Boolean.TRUE.equals(p.isArray)) {
|
if (Boolean.TRUE.equals(p.isArray)) {
|
||||||
p.vendorExtensions.put("x-protobuf-type", "repeated");
|
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);
|
LOGGER.warn("Map parameter (name: {}, operation ID: {}) not yet supported", p.paramName, op.operationId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -125,11 +125,11 @@ if(hasProperty('target') && target == 'android') {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ext {
|
ext {
|
||||||
swagger_annotations_version = "1.5.22"
|
swagger_annotations_version = "1.6.3"
|
||||||
jackson_version = "2.12.1"
|
jackson_version = "2.12.5"
|
||||||
jackson_databind_version = "2.10.5.1"
|
jackson_databind_version = "2.10.5.1"
|
||||||
{{#openApiNullable}}
|
{{#openApiNullable}}
|
||||||
jackson_databind_nullable_version = "0.2.1"
|
jackson_databind_nullable_version = "0.2.2"
|
||||||
{{/openApiNullable}}
|
{{/openApiNullable}}
|
||||||
jakarta_annotation_version = "1.3.5"
|
jakarta_annotation_version = "1.3.5"
|
||||||
{{#threetenbp}}
|
{{#threetenbp}}
|
||||||
|
@ -129,7 +129,7 @@ ext {
|
|||||||
jackson_version = "2.12.1"
|
jackson_version = "2.12.1"
|
||||||
jackson_databind_version = "2.10.5.1"
|
jackson_databind_version = "2.10.5.1"
|
||||||
{{#openApiNullable}}
|
{{#openApiNullable}}
|
||||||
jackson_databind_nullable_version = "0.2.1"
|
jackson_databind_nullable_version = "0.2.2"
|
||||||
{{/openApiNullable}}
|
{{/openApiNullable}}
|
||||||
jakarta_annotation_version = "1.3.5"
|
jakarta_annotation_version = "1.3.5"
|
||||||
{{#threetenbp}}
|
{{#threetenbp}}
|
||||||
|
@ -105,7 +105,7 @@ ext {
|
|||||||
jackson_version = "2.10.3"
|
jackson_version = "2.10.3"
|
||||||
jackson_databind_version = "2.10.3"
|
jackson_databind_version = "2.10.3"
|
||||||
{{#openApiNullable}}
|
{{#openApiNullable}}
|
||||||
jackson_databind_nullable_version = "0.2.1"
|
jackson_databind_nullable_version = "0.2.2"
|
||||||
{{/openApiNullable}}
|
{{/openApiNullable}}
|
||||||
jakarta_annotation_version = "1.3.5"
|
jakarta_annotation_version = "1.3.5"
|
||||||
{{#threetenbp}}
|
{{#threetenbp}}
|
||||||
|
@ -365,7 +365,7 @@
|
|||||||
<feign-form-version>3.8.0</feign-form-version>
|
<feign-form-version>3.8.0</feign-form-version>
|
||||||
<jackson-version>2.10.3</jackson-version>
|
<jackson-version>2.10.3</jackson-version>
|
||||||
{{#openApiNullable}}
|
{{#openApiNullable}}
|
||||||
<jackson-databind-nullable-version>0.2.1</jackson-databind-nullable-version>
|
<jackson-databind-nullable-version>0.2.2</jackson-databind-nullable-version>
|
||||||
{{/openApiNullable}}
|
{{/openApiNullable}}
|
||||||
<jackson-databind-version>2.10.3</jackson-databind-version>
|
<jackson-databind-version>2.10.3</jackson-databind-version>
|
||||||
{{#threetenbp}}
|
{{#threetenbp}}
|
||||||
|
@ -109,14 +109,14 @@ if(hasProperty('target') && target == 'android') {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ext {
|
ext {
|
||||||
swagger_annotations_version = "1.5.22"
|
swagger_annotations_version = "1.6.3"
|
||||||
jackson_version = "2.12.1"
|
jackson_version = "2.12.5"
|
||||||
jackson_databind_version = "2.10.5.1"
|
jackson_databind_version = "2.10.5.1"
|
||||||
{{#openApiNullable}}
|
{{#openApiNullable}}
|
||||||
jackson_databind_nullable_version = "0.2.1"
|
jackson_databind_nullable_version = "0.2.2"
|
||||||
{{/openApiNullable}}
|
{{/openApiNullable}}
|
||||||
jakarta_annotation_version = "1.3.5"
|
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"
|
jersey_common_version = "2.25.1"
|
||||||
jodatime_version = "2.9.9"
|
jodatime_version = "2.9.9"
|
||||||
junit_version = "4.13.1"
|
junit_version = "4.13.1"
|
||||||
|
@ -315,12 +315,12 @@
|
|||||||
<properties>
|
<properties>
|
||||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
<swagger-annotations-version>1.5.22</swagger-annotations-version>
|
<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>
|
<jersey-common-version>2.25.1</jersey-common-version>
|
||||||
<jackson-version>2.12.1</jackson-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}}
|
{{#openApiNullable}}
|
||||||
<jackson-databind-nullable-version>0.2.1</jackson-databind-nullable-version>
|
<jackson-databind-nullable-version>0.2.2</jackson-databind-nullable-version>
|
||||||
{{/openApiNullable}}
|
{{/openApiNullable}}
|
||||||
{{#joda}}
|
{{#joda}}
|
||||||
<jodatime-version>2.9.9</jodatime-version>
|
<jodatime-version>2.9.9</jodatime-version>
|
||||||
|
@ -114,7 +114,7 @@ ext {
|
|||||||
jackson_version = "2.13.0"
|
jackson_version = "2.13.0"
|
||||||
jackson_databind_version = "2.13.0"
|
jackson_databind_version = "2.13.0"
|
||||||
{{#openApiNullable}}
|
{{#openApiNullable}}
|
||||||
jackson_databind_nullable_version = "0.2.1"
|
jackson_databind_nullable_version = "0.2.2"
|
||||||
{{/openApiNullable}}
|
{{/openApiNullable}}
|
||||||
jakarta_annotation_version = "1.3.5"
|
jakarta_annotation_version = "1.3.5"
|
||||||
jersey_version = "2.35"
|
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",
|
"com.github.joschi.jackson" % "jackson-datatype-threetenbp" % "2.12.5" % "compile",
|
||||||
{{/threetenbp}}
|
{{/threetenbp}}
|
||||||
{{#openApiNullable}}
|
{{#openApiNullable}}
|
||||||
"org.openapitools" % "jackson-databind-nullable" % "0.2.1" % "compile",
|
"org.openapitools" % "jackson-databind-nullable" % "0.2.2" % "compile",
|
||||||
{{/openApiNullable}}
|
{{/openApiNullable}}
|
||||||
{{#hasOAuthMethods}}
|
{{#hasOAuthMethods}}
|
||||||
"com.github.scribejava" % "scribejava-apis" % "8.3.1" % "compile",
|
"com.github.scribejava" % "scribejava-apis" % "8.3.1" % "compile",
|
||||||
|
@ -391,7 +391,7 @@
|
|||||||
<jersey-version>2.35</jersey-version>
|
<jersey-version>2.35</jersey-version>
|
||||||
<jackson-version>2.13.0</jackson-version>
|
<jackson-version>2.13.0</jackson-version>
|
||||||
<jackson-databind-version>2.13.0</jackson-databind-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}}
|
||||||
<threetenbp-version>2.9.10</threetenbp-version>
|
<threetenbp-version>2.9.10</threetenbp-version>
|
||||||
{{/threetenbp}}
|
{{/threetenbp}}
|
||||||
|
@ -229,7 +229,7 @@
|
|||||||
<maven.compiler.source>11</maven.compiler.source>
|
<maven.compiler.source>11</maven.compiler.source>
|
||||||
<maven.compiler.target>11</maven.compiler.target>
|
<maven.compiler.target>11</maven.compiler.target>
|
||||||
<jackson-version>2.10.4</jackson-version>
|
<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>
|
<jakarta-annotation-version>1.3.5</jakarta-annotation-version>
|
||||||
{{#threetenbp}}
|
{{#threetenbp}}
|
||||||
<threetenbp-version>2.9.10</threetenbp-version>
|
<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",
|
"com.google.code.gson" % "gson" % "2.8.6",
|
||||||
"org.apache.commons" % "commons-lang3" % "3.10",
|
"org.apache.commons" % "commons-lang3" % "3.10",
|
||||||
{{#openApiNullable}}
|
{{#openApiNullable}}
|
||||||
"org.openapitools" % "jackson-databind-nullable" % "0.2.1",
|
"org.openapitools" % "jackson-databind-nullable" % "0.2.2",
|
||||||
{{/openApiNullable}}
|
{{/openApiNullable}}
|
||||||
{{#hasOAuthMethods}}
|
{{#hasOAuthMethods}}
|
||||||
"org.apache.oltu.oauth2" % "org.apache.oltu.oauth2.client" % "1.0.1",
|
"org.apache.oltu.oauth2" % "org.apache.oltu.oauth2.client" % "1.0.1",
|
||||||
|
@ -398,7 +398,7 @@
|
|||||||
<gson-version>2.8.8</gson-version>
|
<gson-version>2.8.8</gson-version>
|
||||||
<commons-lang3-version>3.12.0</commons-lang3-version>
|
<commons-lang3-version>3.12.0</commons-lang3-version>
|
||||||
{{#openApiNullable}}
|
{{#openApiNullable}}
|
||||||
<jackson-databind-nullable-version>0.2.1</jackson-databind-nullable-version>
|
<jackson-databind-nullable-version>0.2.2</jackson-databind-nullable-version>
|
||||||
{{/openApiNullable}}
|
{{/openApiNullable}}
|
||||||
{{#joda}}
|
{{#joda}}
|
||||||
<jodatime-version>2.10.9</jodatime-version>
|
<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",
|
"com.google.code.gson" % "gson" % "2.8.6",
|
||||||
"org.apache.commons" % "commons-lang3" % "3.10",
|
"org.apache.commons" % "commons-lang3" % "3.10",
|
||||||
{{#openApiNullable}}
|
{{#openApiNullable}}
|
||||||
"org.openapitools" % "jackson-databind-nullable" % "0.2.1",
|
"org.openapitools" % "jackson-databind-nullable" % "0.2.2",
|
||||||
{{/openApiNullable}}
|
{{/openApiNullable}}
|
||||||
{{#hasOAuthMethods}}
|
{{#hasOAuthMethods}}
|
||||||
"org.apache.oltu.oauth2" % "org.apache.oltu.oauth2.client" % "1.0.1",
|
"org.apache.oltu.oauth2" % "org.apache.oltu.oauth2.client" % "1.0.1",
|
||||||
|
@ -388,7 +388,7 @@
|
|||||||
<gson-version>2.8.8</gson-version>
|
<gson-version>2.8.8</gson-version>
|
||||||
<commons-lang3-version>3.12.0</commons-lang3-version>
|
<commons-lang3-version>3.12.0</commons-lang3-version>
|
||||||
{{#openApiNullable}}
|
{{#openApiNullable}}
|
||||||
<jackson-databind-nullable-version>0.2.1</jackson-databind-nullable-version>
|
<jackson-databind-nullable-version>0.2.2</jackson-databind-nullable-version>
|
||||||
{{/openApiNullable}}
|
{{/openApiNullable}}
|
||||||
{{#joda}}
|
{{#joda}}
|
||||||
<jodatime-version>2.10.9</jodatime-version>
|
<jodatime-version>2.10.9</jodatime-version>
|
||||||
|
@ -104,7 +104,7 @@ ext {
|
|||||||
jackson_version = "2.10.3"
|
jackson_version = "2.10.3"
|
||||||
jackson_databind_version = "2.10.3"
|
jackson_databind_version = "2.10.3"
|
||||||
{{#openApiNullable}}
|
{{#openApiNullable}}
|
||||||
jackson_databind_nullable_version = "0.2.1"
|
jackson_databind_nullable_version = "0.2.2"
|
||||||
{{/openApiNullable}}
|
{{/openApiNullable}}
|
||||||
jakarta_annotation_version = "1.3.5"
|
jakarta_annotation_version = "1.3.5"
|
||||||
{{#threetenbp}}
|
{{#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-annotations" % "2.10.3",
|
||||||
"com.fasterxml.jackson.core" % "jackson-databind" % "2.10.3",
|
"com.fasterxml.jackson.core" % "jackson-databind" % "2.10.3",
|
||||||
{{#openApiNullable}}
|
{{#openApiNullable}}
|
||||||
"org.openapitools" % "jackson-databind-nullable" % "0.2.1",
|
"org.openapitools" % "jackson-databind-nullable" % "0.2.2",
|
||||||
{{/openApiNullable}}
|
{{/openApiNullable}}
|
||||||
{{#withXml}}
|
{{#withXml}}
|
||||||
"com.fasterxml.jackson.dataformat" % "jackson-dataformat-xml" % "2.10.3",
|
"com.fasterxml.jackson.dataformat" % "jackson-dataformat-xml" % "2.10.3",
|
||||||
|
@ -358,7 +358,7 @@
|
|||||||
{{/threetenbp}}
|
{{/threetenbp}}
|
||||||
{{#jackson}}
|
{{#jackson}}
|
||||||
<jackson-version>2.10.3</jackson-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>
|
||||||
{{#threetenbp}}
|
{{#threetenbp}}
|
||||||
<jackson-threetenbp-version>2.10.0</jackson-threetenbp-version>
|
<jackson-threetenbp-version>2.10.0</jackson-threetenbp-version>
|
||||||
{{/threetenbp}}
|
{{/threetenbp}}
|
||||||
|
@ -97,11 +97,11 @@ if(hasProperty('target') && target == 'android') {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ext {
|
ext {
|
||||||
swagger_annotations_version = "1.5.22"
|
swagger_annotations_version = "1.6.3"
|
||||||
jackson_version = "2.10.5"
|
jackson_version = "2.10.5"
|
||||||
jackson_databind_version = "2.10.5.1"
|
jackson_databind_version = "2.10.5.1"
|
||||||
{{#openApiNullable}}
|
{{#openApiNullable}}
|
||||||
jackson_databind_nullable_version = "0.2.1"
|
jackson_databind_nullable_version = "0.2.2"
|
||||||
{{/openApiNullable}}
|
{{/openApiNullable}}
|
||||||
jakarta_annotation_version = "1.3.5"
|
jakarta_annotation_version = "1.3.5"
|
||||||
threetenbp_version = "2.9.10"
|
threetenbp_version = "2.9.10"
|
||||||
|
@ -272,11 +272,13 @@
|
|||||||
</dependencies>
|
</dependencies>
|
||||||
<properties>
|
<properties>
|
||||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
<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>
|
<resteasy-version>4.5.11.Final</resteasy-version>
|
||||||
<jackson-version>2.10.5</jackson-version>
|
<jackson-version>2.10.5</jackson-version>
|
||||||
<jackson-databind-version>2.10.5.1</jackson-databind-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>
|
<jakarta-annotation-version>1.3.5</jakarta-annotation-version>
|
||||||
<threetenbp-version>2.9.10</threetenbp-version>
|
<threetenbp-version>2.9.10</threetenbp-version>
|
||||||
<maven-plugin-version>1.0.0</maven-plugin-version>
|
<maven-plugin-version>1.0.0</maven-plugin-version>
|
||||||
|
@ -113,7 +113,7 @@ ext {
|
|||||||
jackson_version = "2.10.5"
|
jackson_version = "2.10.5"
|
||||||
jackson_databind_version = "2.10.5.1"
|
jackson_databind_version = "2.10.5.1"
|
||||||
{{#openApiNullable}}
|
{{#openApiNullable}}
|
||||||
jackson_databind_nullable_version = "0.2.1"
|
jackson_databind_nullable_version = "0.2.2"
|
||||||
{{/openApiNullable}}
|
{{/openApiNullable}}
|
||||||
jakarta_annotation_version = "1.3.5"
|
jakarta_annotation_version = "1.3.5"
|
||||||
spring_web_version = "5.2.5.RELEASE"
|
spring_web_version = "5.2.5.RELEASE"
|
||||||
|
@ -319,7 +319,7 @@
|
|||||||
<spring-web-version>5.2.5.RELEASE</spring-web-version>
|
<spring-web-version>5.2.5.RELEASE</spring-web-version>
|
||||||
<jackson-version>2.10.5</jackson-version>
|
<jackson-version>2.10.5</jackson-version>
|
||||||
<jackson-databind-version>2.10.5.1</jackson-databind-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>
|
<jakarta-annotation-version>1.3.5</jakarta-annotation-version>
|
||||||
{{#joda}}
|
{{#joda}}
|
||||||
<jodatime-version>2.9.9</jodatime-version>
|
<jodatime-version>2.9.9</jodatime-version>
|
||||||
|
@ -115,7 +115,7 @@ ext {
|
|||||||
jackson_version = "2.10.5"
|
jackson_version = "2.10.5"
|
||||||
jackson_databind_version = "2.10.5.1"
|
jackson_databind_version = "2.10.5.1"
|
||||||
{{#openApiNullable}}
|
{{#openApiNullable}}
|
||||||
jackson_databind_nullable_version = "0.2.1"
|
jackson_databind_nullable_version = "0.2.2"
|
||||||
{{/openApiNullable}}
|
{{/openApiNullable}}
|
||||||
jakarta_annotation_version = "1.3.5"
|
jakarta_annotation_version = "1.3.5"
|
||||||
{{#play24}}
|
{{#play24}}
|
||||||
|
@ -407,7 +407,7 @@
|
|||||||
<maven.compiler.source>${java.version}</maven.compiler.source>
|
<maven.compiler.source>${java.version}</maven.compiler.source>
|
||||||
<maven.compiler.target>${java.version}</maven.compiler.target>
|
<maven.compiler.target>${java.version}</maven.compiler.target>
|
||||||
<gson-fire-version>1.8.3</gson-fire-version>
|
<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}}
|
{{#usePlayWS}}
|
||||||
<jackson-version>2.12.1</jackson-version>
|
<jackson-version>2.12.1</jackson-version>
|
||||||
{{#play24}}
|
{{#play24}}
|
||||||
@ -420,7 +420,7 @@
|
|||||||
<play-version>2.6.7</play-version>
|
<play-version>2.6.7</play-version>
|
||||||
{{/play26}}
|
{{/play26}}
|
||||||
{{#openApiNullable}}
|
{{#openApiNullable}}
|
||||||
<jackson-databind-nullable-version>0.2.1</jackson-databind-nullable-version>
|
<jackson-databind-nullable-version>0.2.2</jackson-databind-nullable-version>
|
||||||
{{/openApiNullable}}
|
{{/openApiNullable}}
|
||||||
{{/usePlayWS}}
|
{{/usePlayWS}}
|
||||||
<retrofit-version>2.5.0</retrofit-version>
|
<retrofit-version>2.5.0</retrofit-version>
|
||||||
|
@ -35,7 +35,7 @@ ext {
|
|||||||
vertx_version = "3.4.2"
|
vertx_version = "3.4.2"
|
||||||
junit_version = "4.13.1"
|
junit_version = "4.13.1"
|
||||||
{{#openApiNullable}}
|
{{#openApiNullable}}
|
||||||
jackson_databind_nullable_version = "0.2.1"
|
jackson_databind_nullable_version = "0.2.2"
|
||||||
{{/openApiNullable}}
|
{{/openApiNullable}}
|
||||||
jakarta_annotation_version = "1.3.5"
|
jakarta_annotation_version = "1.3.5"
|
||||||
{{#threetenbp}}
|
{{#threetenbp}}
|
||||||
|
@ -308,7 +308,7 @@
|
|||||||
<swagger-annotations-version>1.5.22</swagger-annotations-version>
|
<swagger-annotations-version>1.5.22</swagger-annotations-version>
|
||||||
<jackson-version>2.10.5</jackson-version>
|
<jackson-version>2.10.5</jackson-version>
|
||||||
<jackson-databind>2.10.5.1</jackson-databind>
|
<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>
|
<jakarta-annotation-version>1.3.5</jakarta-annotation-version>
|
||||||
<junit-version>4.13.1</junit-version>
|
<junit-version>4.13.1</junit-version>
|
||||||
</properties>
|
</properties>
|
||||||
|
@ -124,12 +124,12 @@ if(hasProperty('target') && target == 'android') {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ext {
|
ext {
|
||||||
swagger_annotations_version = "1.6.2"
|
swagger_annotations_version = "1.6.3"
|
||||||
spring_web_version = "2.4.3"
|
spring_web_version = "2.4.3"
|
||||||
jackson_version = "2.11.3"
|
jackson_version = "2.11.4"
|
||||||
jackson_databind_version = "2.11.3"
|
jackson_databind_version = "2.11.4"
|
||||||
{{#openApiNullable}}
|
{{#openApiNullable}}
|
||||||
jackson_databind_nullable_version = "0.2.1"
|
jackson_databind_nullable_version = "0.2.2"
|
||||||
{{/openApiNullable}}
|
{{/openApiNullable}}
|
||||||
jakarta_annotation_version = "1.3.5"
|
jakarta_annotation_version = "1.3.5"
|
||||||
reactor_version = "3.4.3"
|
reactor_version = "3.4.3"
|
||||||
|
@ -148,12 +148,12 @@
|
|||||||
</dependencies>
|
</dependencies>
|
||||||
<properties>
|
<properties>
|
||||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
<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>
|
<spring-web-version>2.4.3</spring-web-version>
|
||||||
<jackson-version>2.11.3</jackson-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}}
|
{{#openApiNullable}}
|
||||||
<jackson-databind-nullable-version>0.2.1</jackson-databind-nullable-version>
|
<jackson-databind-nullable-version>0.2.2</jackson-databind-nullable-version>
|
||||||
{{/openApiNullable}}
|
{{/openApiNullable}}
|
||||||
<jakarta-annotation-version>1.3.5</jakarta-annotation-version>
|
<jakarta-annotation-version>1.3.5</jakarta-annotation-version>
|
||||||
<junit-version>4.13.1</junit-version>
|
<junit-version>4.13.1</junit-version>
|
||||||
|
@ -360,9 +360,9 @@
|
|||||||
</dependencies>
|
</dependencies>
|
||||||
<properties>
|
<properties>
|
||||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
<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>
|
<jersey-version>1.19.4</jersey-version>
|
||||||
<jackson-version>2.12.1</jackson-version>
|
<jackson-version>2.12.5</jackson-version>
|
||||||
{{#threetenbp}}
|
{{#threetenbp}}
|
||||||
<jackson-threetenbp-version>2.9.10</jackson-threetenbp-version>
|
<jackson-threetenbp-version>2.9.10</jackson-threetenbp-version>
|
||||||
{{/threetenbp}}
|
{{/threetenbp}}
|
||||||
|
@ -302,7 +302,7 @@
|
|||||||
{{/useBeanValidation}}
|
{{/useBeanValidation}}
|
||||||
<spring-version>4.3.20.RELEASE</spring-version>
|
<spring-version>4.3.20.RELEASE</spring-version>
|
||||||
{{#openApiNullable}}
|
{{#openApiNullable}}
|
||||||
<jackson-databind-nullable-version>0.2.1</jackson-databind-nullable-version>
|
<jackson-databind-nullable-version>0.2.2</jackson-databind-nullable-version>
|
||||||
{{/openApiNullable}}
|
{{/openApiNullable}}
|
||||||
<jackson-databind-version>2.9.8</jackson-databind-version>
|
<jackson-databind-version>2.9.8</jackson-databind-version>
|
||||||
</properties>
|
</properties>
|
||||||
|
@ -12,7 +12,8 @@ else ()
|
|||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
find_package(Qt5Core REQUIRED)
|
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}}
|
find_package(ZLIB REQUIRED){{/contentCompression}}
|
||||||
|
|
||||||
add_library(${PROJECT_NAME}
|
add_library(${PROJECT_NAME}
|
||||||
@ -31,9 +32,9 @@ add_library(${PROJECT_NAME}
|
|||||||
{{prefix}}Helpers.cpp
|
{{prefix}}Helpers.cpp
|
||||||
{{prefix}}HttpRequest.cpp
|
{{prefix}}HttpRequest.cpp
|
||||||
{{prefix}}HttpFileElement.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)
|
if(NOT APPLE)
|
||||||
target_link_libraries(${PROJECT_NAME} PRIVATE ssl crypto)
|
target_link_libraries(${PROJECT_NAME} PRIVATE ssl crypto)
|
||||||
endif()
|
endif()
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
#include "{{prefix}}Oauth.h"
|
#include "{{prefix}}Oauth.h"
|
||||||
|
|
||||||
namespace OpenAPI {
|
{{#cppNamespaceDeclarations}}
|
||||||
|
namespace {{this}} {
|
||||||
|
{{/cppNamespaceDeclarations}}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Base class to perform oauth2 flows
|
* Base class to perform oauth2 flows
|
||||||
@ -343,5 +345,6 @@ void ReplyServer::read()
|
|||||||
emit dataReceived(queryParams);
|
emit dataReceived(queryParams);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
{{#cppNamespaceDeclarations}}
|
||||||
}
|
} // namespace {{this}}
|
||||||
|
{{/cppNamespaceDeclarations}}
|
@ -21,8 +21,7 @@
|
|||||||
#include <QUrl>
|
#include <QUrl>
|
||||||
#include <QUrlQuery>
|
#include <QUrlQuery>
|
||||||
#include <QDateTime>
|
#include <QDateTime>
|
||||||
|
#include <time.h>
|
||||||
|
|
||||||
|
|
||||||
{{#cppNamespaceDeclarations}}
|
{{#cppNamespaceDeclarations}}
|
||||||
namespace {{this}} {
|
namespace {{this}} {
|
||||||
@ -32,19 +31,19 @@ class oauthToken
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
oauthToken(QString token, int expiresIn, QString scope, QString tokenType) : m_token(token), m_scope(scope), m_type(tokenType){
|
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(){
|
oauthToken(){
|
||||||
m_validUntil = QDateTime::fromSecsSinceEpoch(QDateTime::currentSecsSinceEpoch() -1);
|
m_validUntil = time(0) - 1;
|
||||||
}
|
}
|
||||||
QString getToken(){return m_token;};
|
QString getToken(){return m_token;};
|
||||||
QString getScope(){return m_scope;};
|
QString getScope(){return m_scope;};
|
||||||
QString getType(){return m_type;};
|
QString getType(){return m_type;};
|
||||||
bool isValid(){return QDateTime::currentDateTime() < m_validUntil;};
|
bool isValid(){return time(0) < m_validUntil;};
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QString m_token;
|
QString m_token;
|
||||||
QDateTime m_validUntil;
|
time_t m_validUntil;
|
||||||
QString m_scope;
|
QString m_scope;
|
||||||
QString m_type;
|
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
|
import com.fasterxml.jackson.module.kotlin.jacksonObjectMapper
|
||||||
{{/jackson}}
|
{{/jackson}}
|
||||||
{{#kotlinx_serialization}}
|
{{#kotlinx_serialization}}
|
||||||
import java.util.Date
|
|
||||||
import java.math.BigDecimal
|
import java.math.BigDecimal
|
||||||
import java.math.BigInteger
|
import java.math.BigInteger
|
||||||
{{^threetenbp}}
|
{{^threetenbp}}
|
||||||
@ -97,7 +96,6 @@ import java.util.concurrent.atomic.AtomicLong
|
|||||||
val kotlinSerializationAdapters = SerializersModule {
|
val kotlinSerializationAdapters = SerializersModule {
|
||||||
contextual(BigDecimal::class, BigDecimalAdapter)
|
contextual(BigDecimal::class, BigDecimalAdapter)
|
||||||
contextual(BigInteger::class, BigIntegerAdapter)
|
contextual(BigInteger::class, BigIntegerAdapter)
|
||||||
contextual(Date::class, DateAdapter)
|
|
||||||
contextual(LocalDate::class, LocalDateAdapter)
|
contextual(LocalDate::class, LocalDateAdapter)
|
||||||
contextual(LocalDateTime::class, LocalDateTimeAdapter)
|
contextual(LocalDateTime::class, LocalDateTimeAdapter)
|
||||||
contextual(OffsetDateTime::class, OffsetDateTimeAdapter)
|
contextual(OffsetDateTime::class, OffsetDateTimeAdapter)
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
{{>licenseInfo}}
|
{{>licenseInfo}}
|
||||||
package {{apiPackage}}
|
package {{apiPackage}}
|
||||||
|
|
||||||
|
import java.io.IOException
|
||||||
|
|
||||||
{{#imports}}import {{import}}
|
{{#imports}}import {{import}}
|
||||||
{{/imports}}
|
{{/imports}}
|
||||||
|
|
||||||
@ -11,7 +13,7 @@ import kotlinx.coroutines.withContext
|
|||||||
{{/useCoroutines}}
|
{{/useCoroutines}}
|
||||||
{{/doNotUseRxAndCoroutines}}
|
{{/doNotUseRxAndCoroutines}}
|
||||||
import {{packageName}}.infrastructure.ApiClient
|
import {{packageName}}.infrastructure.ApiClient
|
||||||
import {{packageName}}.infrastructure.ApiInfrastructureResponse
|
import {{packageName}}.infrastructure.ApiResponse
|
||||||
import {{packageName}}.infrastructure.ClientException
|
import {{packageName}}.infrastructure.ClientException
|
||||||
import {{packageName}}.infrastructure.ClientError
|
import {{packageName}}.infrastructure.ClientError
|
||||||
import {{packageName}}.infrastructure.ServerException
|
import {{packageName}}.infrastructure.ServerException
|
||||||
@ -38,12 +40,14 @@ import {{packageName}}.infrastructure.toMultiValue
|
|||||||
* {{notes}}
|
* {{notes}}
|
||||||
{{#allParams}}* @param {{{paramName}}} {{description}} {{^required}}(optional{{#defaultValue}}, default to {{{.}}}{{/defaultValue}}){{/required}}
|
{{#allParams}}* @param {{{paramName}}} {{description}} {{^required}}(optional{{#defaultValue}}, default to {{{.}}}{{/defaultValue}}){{/required}}
|
||||||
{{/allParams}}* @return {{#returnType}}{{{returnType}}}{{#nullableReturnType}} or null{{/nullableReturnType}}{{/returnType}}{{^returnType}}void{{/returnType}}
|
{{/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 UnsupportedOperationException If the API returns an informational or redirection response
|
||||||
* @throws ClientException If the API returns a client error response
|
* @throws ClientException If the API returns a client error response
|
||||||
* @throws ServerException If the API returns a server error response
|
* @throws ServerException If the API returns a server error response
|
||||||
*/{{#returnType}}
|
*/{{#returnType}}
|
||||||
@Suppress("UNCHECKED_CAST"){{/returnType}}
|
@Suppress("UNCHECKED_CAST"){{/returnType}}
|
||||||
@Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
|
@Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class)
|
||||||
{{#isDeprecated}}
|
{{#isDeprecated}}
|
||||||
@Deprecated(message = "This operation is deprecated.")
|
@Deprecated(message = "This operation is deprecated.")
|
||||||
{{/isDeprecated}}
|
{{/isDeprecated}}
|
||||||
@ -72,17 +76,16 @@ import {{packageName}}.infrastructure.toMultiValue
|
|||||||
* {{summary}}
|
* {{summary}}
|
||||||
* {{notes}}
|
* {{notes}}
|
||||||
{{#allParams}}* @param {{{paramName}}} {{description}} {{^required}}(optional{{#defaultValue}}, default to {{{.}}}{{/defaultValue}}){{/required}}
|
{{#allParams}}* @param {{{paramName}}} {{description}} {{^required}}(optional{{#defaultValue}}, default to {{{.}}}{{/defaultValue}}){{/required}}
|
||||||
{{/allParams}}* @return ApiInfrastructureResponse<{{#returnType}}{{{returnType}}}?{{/returnType}}{{^returnType}}Unit?{{/returnType}}>
|
{{/allParams}}* @return ApiResponse<{{#returnType}}{{{returnType}}}?{{/returnType}}{{^returnType}}Unit?{{/returnType}}>
|
||||||
* @throws UnsupportedOperationException If the API returns an informational or redirection response
|
* @throws IllegalStateException If the request is not correctly configured
|
||||||
* @throws ClientException If the API returns a client error response
|
* @throws IOException Rethrows the OkHttp execute method exception
|
||||||
* @throws ServerException If the API returns a server error response
|
|
||||||
*/{{#returnType}}
|
*/{{#returnType}}
|
||||||
@Suppress("UNCHECKED_CAST"){{/returnType}}
|
@Suppress("UNCHECKED_CAST"){{/returnType}}
|
||||||
@Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
|
@Throws(IllegalStateException::class, IOException::class)
|
||||||
{{#isDeprecated}}
|
{{#isDeprecated}}
|
||||||
@Deprecated(message = "This operation is deprecated.")
|
@Deprecated(message = "This operation is deprecated.")
|
||||||
{{/isDeprecated}}
|
{{/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}}
|
{{#isDeprecated}}
|
||||||
@Suppress("DEPRECATION")
|
@Suppress("DEPRECATION")
|
||||||
{{/isDeprecated}}
|
{{/isDeprecated}}
|
||||||
@ -130,6 +133,9 @@ import {{packageName}}.infrastructure.toMultiValue
|
|||||||
{{#headerParams}}
|
{{#headerParams}}
|
||||||
{{{paramName}}}{{^required}}?{{/required}}.apply { localVariableHeaders["{{baseName}}"] = {{#isContainer}}this.joinToString(separator = collectionDelimiter("{{collectionFormat}}")){{/isContainer}}{{^isContainer}}this.toString(){{/isContainer}} }
|
{{{paramName}}}{{^required}}?{{/required}}.apply { localVariableHeaders["{{baseName}}"] = {{#isContainer}}this.joinToString(separator = collectionDelimiter("{{collectionFormat}}")){{/isContainer}}{{^isContainer}}this.toString(){{/isContainer}} }
|
||||||
{{/headerParams}}
|
{{/headerParams}}
|
||||||
|
{{^hasFormParams}}{{#hasConsumes}}{{#consumes}}localVariableHeaders["Content-Type"] = "{{{mediaType}}}"
|
||||||
|
{{/consumes}}{{/hasConsumes}}{{/hasFormParams}}{{#hasProduces}}localVariableHeaders["Accept"] = "{{#produces}}{{{mediaType}}}{{^-last}}, {{/-last}}{{/produces}}"
|
||||||
|
{{/hasProduces}}
|
||||||
|
|
||||||
return RequestConfig(
|
return RequestConfig(
|
||||||
method = RequestMethod.{{httpMethod}},
|
method = RequestMethod.{{httpMethod}},
|
||||||
|
@ -47,7 +47,6 @@ import java.time.LocalTime
|
|||||||
import java.time.OffsetDateTime
|
import java.time.OffsetDateTime
|
||||||
import java.time.OffsetTime
|
import java.time.OffsetTime
|
||||||
{{/threetenbp}}
|
{{/threetenbp}}
|
||||||
import java.util.Date
|
|
||||||
import java.util.Locale
|
import java.util.Locale
|
||||||
{{#useCoroutines}}
|
{{#useCoroutines}}
|
||||||
import kotlin.coroutines.resume
|
import kotlin.coroutines.resume
|
||||||
@ -167,8 +166,8 @@ import com.squareup.moshi.adapter
|
|||||||
}
|
}
|
||||||
}.build()
|
}.build()
|
||||||
}
|
}
|
||||||
|
mediaType.startsWith("application/") && mediaType.endsWith("json") ->
|
||||||
{{#jvm-okhttp3}}
|
{{#jvm-okhttp3}}
|
||||||
mediaType == JsonMediaType -> {
|
|
||||||
if (content == null) {
|
if (content == null) {
|
||||||
EMPTY_REQUEST
|
EMPTY_REQUEST
|
||||||
} else {
|
} else {
|
||||||
@ -187,10 +186,8 @@ import com.squareup.moshi.adapter
|
|||||||
{{/kotlinx_serialization}}
|
{{/kotlinx_serialization}}
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
|
||||||
{{/jvm-okhttp3}}
|
{{/jvm-okhttp3}}
|
||||||
{{#jvm-okhttp4}}
|
{{#jvm-okhttp4}}
|
||||||
mediaType == JsonMediaType -> {
|
|
||||||
if (content == null) {
|
if (content == null) {
|
||||||
EMPTY_REQUEST
|
EMPTY_REQUEST
|
||||||
} else {
|
} else {
|
||||||
@ -210,7 +207,6 @@ import com.squareup.moshi.adapter
|
|||||||
mediaType.toMediaTypeOrNull()
|
mediaType.toMediaTypeOrNull()
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
|
||||||
{{/jvm-okhttp4}}
|
{{/jvm-okhttp4}}
|
||||||
mediaType == XmlMediaType -> throw UnsupportedOperationException("xml not currently supported.")
|
mediaType == XmlMediaType -> throw UnsupportedOperationException("xml not currently supported.")
|
||||||
// TODO: this should be extended with other serializers
|
// TODO: this should be extended with other serializers
|
||||||
@ -247,8 +243,9 @@ import com.squareup.moshi.adapter
|
|||||||
out.close()
|
out.close()
|
||||||
return f as T
|
return f as T
|
||||||
}
|
}
|
||||||
return when(mediaType) {
|
return when {
|
||||||
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}}
|
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.")
|
else -> throw UnsupportedOperationException("responseBody currently only supports JSON body.")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -311,7 +308,7 @@ import com.squareup.moshi.adapter
|
|||||||
}
|
}
|
||||||
{{/hasAuthMethods}}
|
{{/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}}
|
{{#jvm-okhttp3}}
|
||||||
val httpUrl = HttpUrl.parse(baseUrl) ?: throw IllegalStateException("baseUrl is invalid.")
|
val httpUrl = HttpUrl.parse(baseUrl) ?: throw IllegalStateException("baseUrl is invalid.")
|
||||||
{{/jvm-okhttp3}}
|
{{/jvm-okhttp3}}
|
||||||
@ -343,11 +340,11 @@ import com.squareup.moshi.adapter
|
|||||||
}
|
}
|
||||||
val headers = requestConfig.headers
|
val headers = requestConfig.headers
|
||||||
|
|
||||||
if(headers[ContentType] ?: "" == "") {
|
if(headers[ContentType].isNullOrEmpty()) {
|
||||||
throw kotlin.IllegalStateException("Missing Content-Type header. This is required.")
|
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.")
|
throw kotlin.IllegalStateException("Missing Accept header. This is required.")
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -421,7 +418,7 @@ import com.squareup.moshi.adapter
|
|||||||
null -> ""
|
null -> ""
|
||||||
is Array<*> -> toMultiValue(value, "csv").toString()
|
is Array<*> -> toMultiValue(value, "csv").toString()
|
||||||
is Iterable<*> -> 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)
|
parseDateToQueryString(value)
|
||||||
else -> value.toString()
|
else -> value.toString()
|
||||||
}
|
}
|
||||||
|
@ -6,7 +6,7 @@ package {{packageName}}.infrastructure
|
|||||||
|
|
||||||
{{#nonPublicApi}}internal {{/nonPublicApi}}interface Response
|
{{#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 statusCode: Int
|
||||||
abstract val headers: Map<String,List<String>>
|
abstract val headers: Map<String,List<String>>
|
||||||
}
|
}
|
||||||
@ -15,29 +15,29 @@ package {{packageName}}.infrastructure
|
|||||||
val data: T{{#nullableReturnType}}?{{/nullableReturnType}},
|
val data: T{{#nullableReturnType}}?{{/nullableReturnType}},
|
||||||
override val statusCode: Int = -1,
|
override val statusCode: Int = -1,
|
||||||
override val headers: Map<String, List<String>> = mapOf()
|
override val headers: Map<String, List<String>> = mapOf()
|
||||||
): ApiInfrastructureResponse<T>(ResponseType.Success)
|
): ApiResponse<T>(ResponseType.Success)
|
||||||
|
|
||||||
{{#nonPublicApi}}internal {{/nonPublicApi}}class Informational<T>(
|
{{#nonPublicApi}}internal {{/nonPublicApi}}class Informational<T>(
|
||||||
val statusText: String,
|
val statusText: String,
|
||||||
override val statusCode: Int = -1,
|
override val statusCode: Int = -1,
|
||||||
override val headers: Map<String, List<String>> = mapOf()
|
override val headers: Map<String, List<String>> = mapOf()
|
||||||
) : ApiInfrastructureResponse<T>(ResponseType.Informational)
|
) : ApiResponse<T>(ResponseType.Informational)
|
||||||
|
|
||||||
{{#nonPublicApi}}internal {{/nonPublicApi}}class Redirection<T>(
|
{{#nonPublicApi}}internal {{/nonPublicApi}}class Redirection<T>(
|
||||||
override val statusCode: Int = -1,
|
override val statusCode: Int = -1,
|
||||||
override val headers: Map<String, List<String>> = mapOf()
|
override val headers: Map<String, List<String>> = mapOf()
|
||||||
) : ApiInfrastructureResponse<T>(ResponseType.Redirection)
|
) : ApiResponse<T>(ResponseType.Redirection)
|
||||||
|
|
||||||
{{#nonPublicApi}}internal {{/nonPublicApi}}class ClientError<T>(
|
{{#nonPublicApi}}internal {{/nonPublicApi}}class ClientError<T>(
|
||||||
val message: String? = null,
|
val message: String? = null,
|
||||||
val body: Any? = null,
|
val body: Any? = null,
|
||||||
override val statusCode: Int = -1,
|
override val statusCode: Int = -1,
|
||||||
override val headers: Map<String, List<String>> = mapOf()
|
override val headers: Map<String, List<String>> = mapOf()
|
||||||
) : ApiInfrastructureResponse<T>(ResponseType.ClientError)
|
) : ApiResponse<T>(ResponseType.ClientError)
|
||||||
|
|
||||||
{{#nonPublicApi}}internal {{/nonPublicApi}}class ServerError<T>(
|
{{#nonPublicApi}}internal {{/nonPublicApi}}class ServerError<T>(
|
||||||
val message: String? = null,
|
val message: String? = null,
|
||||||
val body: Any? = null,
|
val body: Any? = null,
|
||||||
override val statusCode: Int = -1,
|
override val statusCode: Int = -1,
|
||||||
override val headers: Map<String, List<String>>
|
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
|
_check_return_type (bool): specifies if type checking
|
||||||
should be done one the data received from the server.
|
should be done one the data received from the server.
|
||||||
Default is True.
|
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
|
_host_index (int/None): specifies the index of the server
|
||||||
that we want to use.
|
that we want to use.
|
||||||
Default is read from the configuration.
|
Default is read from the configuration.
|
||||||
@ -298,6 +301,8 @@ class {{classname}}(object):
|
|||||||
kwargs['_check_return_type'] = kwargs.get(
|
kwargs['_check_return_type'] = kwargs.get(
|
||||||
'_check_return_type', True
|
'_check_return_type', True
|
||||||
)
|
)
|
||||||
|
kwargs['_content_type'] = kwargs.get(
|
||||||
|
'_content_type')
|
||||||
kwargs['_host_index'] = kwargs.get('_host_index')
|
kwargs['_host_index'] = kwargs.get('_host_index')
|
||||||
{{#requiredParams}}
|
{{#requiredParams}}
|
||||||
kwargs['{{paramName}}'] = \
|
kwargs['{{paramName}}'] = \
|
||||||
|
@ -129,7 +129,8 @@ class ApiClient(object):
|
|||||||
_preload_content: bool = True,
|
_preload_content: bool = True,
|
||||||
_request_timeout: typing.Optional[typing.Union[int, float, typing.Tuple]] = None,
|
_request_timeout: typing.Optional[typing.Union[int, float, typing.Tuple]] = None,
|
||||||
_host: typing.Optional[str] = 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
|
config = self.configuration
|
||||||
@ -584,10 +585,12 @@ class ApiClient(object):
|
|||||||
else:
|
else:
|
||||||
return ', '.join(accepts)
|
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.
|
"""Returns `Content-Type` based on an array of content_types provided.
|
||||||
|
|
||||||
:param content_types: List of content-types.
|
: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).
|
:return: Content-Type (e.g. application/json).
|
||||||
"""
|
"""
|
||||||
if not content_types:
|
if not content_types:
|
||||||
@ -595,6 +598,11 @@ class ApiClient(object):
|
|||||||
|
|
||||||
content_types = [x.lower() for x in content_types]
|
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:
|
if 'application/json' in content_types or '*/*' in content_types:
|
||||||
return 'application/json'
|
return 'application/json'
|
||||||
else:
|
else:
|
||||||
@ -685,7 +693,8 @@ class Endpoint(object):
|
|||||||
'_request_timeout',
|
'_request_timeout',
|
||||||
'_return_http_data_only',
|
'_return_http_data_only',
|
||||||
'_check_input_type',
|
'_check_input_type',
|
||||||
'_check_return_type'
|
'_check_return_type',
|
||||||
|
'_content_type'
|
||||||
])
|
])
|
||||||
self.params_map['nullable'].extend(['_request_timeout'])
|
self.params_map['nullable'].extend(['_request_timeout'])
|
||||||
self.validations = root_map['validations']
|
self.validations = root_map['validations']
|
||||||
@ -698,7 +707,8 @@ class Endpoint(object):
|
|||||||
'_request_timeout': (none_type, float, (float,), [float], int, (int,), [int]),
|
'_request_timeout': (none_type, float, (float,), [float], int, (int,), [int]),
|
||||||
'_return_http_data_only': (bool,),
|
'_return_http_data_only': (bool,),
|
||||||
'_check_input_type': (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.openapi_types.update(extra_types)
|
||||||
self.attribute_map = root_map['attribute_map']
|
self.attribute_map = root_map['attribute_map']
|
||||||
@ -845,11 +855,15 @@ class Endpoint(object):
|
|||||||
params['header']['Accept'] = self.api_client.select_header_accept(
|
params['header']['Accept'] = self.api_client.select_header_accept(
|
||||||
accept_headers_list)
|
accept_headers_list)
|
||||||
|
|
||||||
|
if kwargs.get('_content_type'):
|
||||||
|
params['header']['Content-Type'] = kwargs['_content_type']
|
||||||
|
else:
|
||||||
content_type_headers_list = self.headers_map['content_type']
|
content_type_headers_list = self.headers_map['content_type']
|
||||||
if content_type_headers_list:
|
if content_type_headers_list:
|
||||||
if params['body'] != "":
|
if params['body'] != "":
|
||||||
header_list = self.api_client.select_header_content_type(
|
header_list = self.api_client.select_header_content_type(
|
||||||
content_type_headers_list)
|
content_type_headers_list, self.settings['http_method'],
|
||||||
|
params['body'])
|
||||||
params['header']['Content-Type'] = header_list
|
params['header']['Content-Type'] = header_list
|
||||||
|
|
||||||
return self.api_client.call_api(
|
return self.api_client.call_api(
|
||||||
|
@ -36,6 +36,7 @@ import Vapor
|
|||||||
{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} let parameters: [String: Any]?
|
{{#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 method: String
|
||||||
{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} let URLString: 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}}
|
/// 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.
|
/// 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
|
@discardableResult
|
||||||
{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}open{{/nonPublicApi}} func execute(_ apiResponseQueue: DispatchQueue = {{projectName}}API.apiResponseQueue, _ completion: @escaping (_ result: Swift.Result<Response<T>, ErrorResponse>) -> Void) -> URLSessionTask? {
|
{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}open{{/nonPublicApi}} func execute(_ apiResponseQueue: DispatchQueue = {{projectName}}API.apiResponseQueue, _ completion: @escaping (_ result: Swift.Result<Response<T>, ErrorResponse>) -> Void) -> RequestTask {
|
||||||
return nil
|
return requestTask
|
||||||
}
|
}
|
||||||
|
|
||||||
{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} func addHeader(name: String, value: String) -> Self {
|
{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} func addHeader(name: String, value: String) -> Self {
|
||||||
|
@ -4,7 +4,8 @@
|
|||||||
// https://openapi-generator.tech
|
// https://openapi-generator.tech
|
||||||
//
|
//
|
||||||
|
|
||||||
import Foundation
|
import Foundation{{#useAlamofire}}
|
||||||
|
import Alamofire{{/useAlamofire}}
|
||||||
|
|
||||||
protocol JSONEncodable {
|
protocol JSONEncodable {
|
||||||
func encodeToJSON() -> Any
|
func encodeToJSON() -> Any
|
||||||
@ -78,3 +79,30 @@ extension CaseIterableDefaultsLast {
|
|||||||
self.init(statusCode: response.statusCode, header: header, body: body)
|
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.")
|
@available(*, deprecated, message: "This operation is deprecated.")
|
||||||
{{/isDeprecated}}
|
{{/isDeprecated}}
|
||||||
@discardableResult
|
@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
|
return {{operationId}}WithRequestBuilder({{#allParams}}{{paramName}}: {{paramName}}{{^-last}}, {{/-last}}{{/allParams}}).execute(apiResponseQueue) { result in
|
||||||
switch result {
|
switch result {
|
||||||
{{#returnType}}
|
{{#returnType}}
|
||||||
@ -124,7 +124,7 @@ extension {{projectName}}API {
|
|||||||
{{/isDeprecated}}
|
{{/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}}> {
|
{{#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
|
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 {
|
switch result {
|
||||||
{{#returnType}}
|
{{#returnType}}
|
||||||
case let .success(response):
|
case let .success(response):
|
||||||
@ -141,7 +141,7 @@ extension {{projectName}}API {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return Disposables.create {
|
return Disposables.create {
|
||||||
task?.cancel()
|
requestTask.cancel()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -161,9 +161,9 @@ extension {{projectName}}API {
|
|||||||
{{/isDeprecated}}
|
{{/isDeprecated}}
|
||||||
@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.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) -> AnyPublisher<{{{returnType}}}{{^returnType}}Void{{/returnType}}, Error> {
|
{{#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
|
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 {
|
switch result {
|
||||||
{{#returnType}}
|
{{#returnType}}
|
||||||
case let .success(response):
|
case let .success(response):
|
||||||
@ -179,7 +179,7 @@ extension {{projectName}}API {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
.handleEvents(receiveCancel: {
|
.handleEvents(receiveCancel: {
|
||||||
task?.cancel()
|
requestTask?.cancel()
|
||||||
})
|
})
|
||||||
.eraseToAnyPublisher()
|
.eraseToAnyPublisher()
|
||||||
}
|
}
|
||||||
@ -197,9 +197,9 @@ extension {{projectName}}API {
|
|||||||
{{#isDeprecated}}
|
{{#isDeprecated}}
|
||||||
@available(*, deprecated, message: "This operation is deprecated.")
|
@available(*, deprecated, message: "This operation is deprecated.")
|
||||||
{{/isDeprecated}}
|
{{/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}} {
|
{{#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 {
|
return try await withTaskCancellationHandler {
|
||||||
try Task.checkCancellation()
|
try Task.checkCancellation()
|
||||||
return try await withCheckedThrowingContinuation { continuation in
|
return try await withCheckedThrowingContinuation { continuation in
|
||||||
@ -208,7 +208,7 @@ extension {{projectName}}API {
|
|||||||
return
|
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 {
|
switch result {
|
||||||
{{#returnType}}
|
{{#returnType}}
|
||||||
case let .success(response):
|
case let .success(response):
|
||||||
@ -223,8 +223,8 @@ extension {{projectName}}API {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} onCancel: { [task] in
|
} onCancel: { [requestTask] in
|
||||||
task?.cancel()
|
requestTask?.cancel()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
{{/useAsyncAwait}}
|
{{/useAsyncAwait}}
|
||||||
@ -241,7 +241,7 @@ extension {{projectName}}API {
|
|||||||
@available(*, deprecated, message: "This operation is deprecated.")
|
@available(*, deprecated, message: "This operation is deprecated.")
|
||||||
{{/isDeprecated}}
|
{{/isDeprecated}}
|
||||||
@discardableResult
|
@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
|
return {{operationId}}WithRequestBuilder({{#allParams}}{{paramName}}: {{paramName}}{{^-last}}, {{/-last}}{{/allParams}}).execute(apiResponseQueue) { result in
|
||||||
switch result {
|
switch result {
|
||||||
{{#returnType}}
|
{{#returnType}}
|
||||||
|
@ -79,7 +79,7 @@ private var managerStore = SynchronizedDictionary<String, Alamofire.Session>()
|
|||||||
}
|
}
|
||||||
|
|
||||||
@discardableResult
|
@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
|
let managerId = UUID().uuidString
|
||||||
// Create a new manager for each request to customize its request header
|
// Create a new manager for each request to customize its request header
|
||||||
let manager = createAlamofireSession()
|
let manager = createAlamofireSession()
|
||||||
@ -114,6 +114,8 @@ private var managerStore = SynchronizedDictionary<String, Alamofire.Session>()
|
|||||||
mpForm.append(string.data(using: String.Encoding.utf8)!, withName: k)
|
mpForm.append(string.data(using: String.Encoding.utf8)!, withName: k)
|
||||||
case let number as NSNumber:
|
case let number as NSNumber:
|
||||||
mpForm.append(number.stringValue.data(using: String.Encoding.utf8)!, withName: k)
|
mpForm.append(number.stringValue.data(using: String.Encoding.utf8)!, withName: k)
|
||||||
|
case let data as Data:
|
||||||
|
mpForm.append(data, withName: k)
|
||||||
default:
|
default:
|
||||||
fatalError("Unprocessable value \(v) with key \(k)")
|
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)
|
self.processRequest(request: upload, managerId, apiResponseQueue, completion)
|
||||||
} else if contentType == "application/x-www-form-urlencoded" {
|
} else if contentType == "application/x-www-form-urlencoded" {
|
||||||
encoding = URLEncoding(destination: .httpBody)
|
encoding = URLEncoding(destination: .httpBody)
|
||||||
@ -142,10 +146,10 @@ private var managerStore = SynchronizedDictionary<String, Alamofire.Session>()
|
|||||||
onProgressReady(request.uploadProgress)
|
onProgressReady(request.uploadProgress)
|
||||||
}
|
}
|
||||||
processRequest(request: request, managerId, apiResponseQueue, completion)
|
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) {
|
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
|
@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()
|
let urlSession = createURLSession()
|
||||||
|
|
||||||
guard let xMethod = HTTPMethod(rawValue: method) else {
|
guard let xMethod = HTTPMethod(rawValue: method) else {
|
||||||
@ -172,14 +172,14 @@ private var credentialStore = SynchronizedDictionary<Int, URLCredential>()
|
|||||||
|
|
||||||
dataTask.resume()
|
dataTask.resume()
|
||||||
|
|
||||||
return dataTask
|
requestTask.set(task: dataTask)
|
||||||
} catch {
|
} catch {
|
||||||
apiResponseQueue.async {
|
apiResponseQueue.async {
|
||||||
completion(.failure(ErrorResponse.error(415, nil, nil, error)))
|
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) {
|
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:
|
default:
|
||||||
fatalError("Unprocessable value \(value) with key \(key)")
|
fatalError("Unprocessable value \(value) with key \(key)")
|
||||||
}
|
}
|
||||||
|
@ -3930,7 +3930,8 @@ public class DefaultCodegenTest {
|
|||||||
assertFalse(cr.primitiveType);
|
assertFalse(cr.primitiveType);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testParameterContent() {
|
@Test
|
||||||
|
public void testRequestParameterContent() {
|
||||||
DefaultCodegen codegen = new DefaultCodegen();
|
DefaultCodegen codegen = new DefaultCodegen();
|
||||||
final OpenAPI openAPI = TestUtils.parseFlattenSpec("src/test/resources/3_0/content-data.yaml");
|
final OpenAPI openAPI = TestUtils.parseFlattenSpec("src/test/resources/3_0/content-data.yaml");
|
||||||
codegen.setOpenAPI(openAPI);
|
codegen.setOpenAPI(openAPI);
|
||||||
@ -3948,6 +3949,7 @@ public class DefaultCodegenTest {
|
|||||||
CodegenProperty cp = mt.getSchema();
|
CodegenProperty cp = mt.getSchema();
|
||||||
assertTrue(cp.isMap);
|
assertTrue(cp.isMap);
|
||||||
assertEquals(cp.complexType, "object");
|
assertEquals(cp.complexType, "object");
|
||||||
|
assertEquals(cp.baseName, "SchemaForRequestParameterCoordinatesInlineSchemaApplicationJson");
|
||||||
|
|
||||||
CodegenParameter coordinatesReferencedSchema = co.queryParams.get(1);
|
CodegenParameter coordinatesReferencedSchema = co.queryParams.get(1);
|
||||||
content = coordinatesReferencedSchema.getContent();
|
content = coordinatesReferencedSchema.getContent();
|
||||||
@ -3956,6 +3958,7 @@ public class DefaultCodegenTest {
|
|||||||
cp = mt.getSchema();
|
cp = mt.getSchema();
|
||||||
assertFalse(cp.isMap); // because it is a referenced schema
|
assertFalse(cp.isMap); // because it is a referenced schema
|
||||||
assertEquals(cp.complexType, "coordinates");
|
assertEquals(cp.complexType, "coordinates");
|
||||||
|
assertEquals(cp.baseName, "SchemaForRequestParameterCoordinatesReferencedSchemaApplicationJson");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@ -3975,13 +3978,13 @@ public class DefaultCodegenTest {
|
|||||||
CodegenMediaType mt = content.get("application/json");
|
CodegenMediaType mt = content.get("application/json");
|
||||||
assertNull(mt.getEncoding());
|
assertNull(mt.getEncoding());
|
||||||
CodegenProperty cp = mt.getSchema();
|
CodegenProperty cp = mt.getSchema();
|
||||||
assertEquals(cp.baseName, "ApplicationJsonSchema");
|
assertEquals(cp.baseName, "SchemaForRequestBodyApplicationJson");
|
||||||
assertNotNull(cp);
|
assertNotNull(cp);
|
||||||
|
|
||||||
mt = content.get("text/plain");
|
mt = content.get("text/plain");
|
||||||
assertNull(mt.getEncoding());
|
assertNull(mt.getEncoding());
|
||||||
cp = mt.getSchema();
|
cp = mt.getSchema();
|
||||||
assertEquals(cp.baseName, "TextPlainSchema");
|
assertEquals(cp.baseName, "SchemaForRequestBodyTextPlain");
|
||||||
assertNotNull(cp);
|
assertNotNull(cp);
|
||||||
// Note: the inline model resolver has a bug for this use case; it extracts an inline request body into a component
|
// 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
|
// but the schema it references is not string type
|
||||||
@ -3995,13 +3998,72 @@ public class DefaultCodegenTest {
|
|||||||
mt = content.get("application/json");
|
mt = content.get("application/json");
|
||||||
assertNull(mt.getEncoding());
|
assertNull(mt.getEncoding());
|
||||||
cp = mt.getSchema();
|
cp = mt.getSchema();
|
||||||
assertEquals(cp.baseName, "ApplicationJsonSchema");
|
assertEquals(cp.baseName, "SchemaForRequestBodyApplicationJson");
|
||||||
assertEquals(cp.complexType, "coordinates");
|
assertEquals(cp.complexType, "coordinates");
|
||||||
|
|
||||||
mt = content.get("text/plain");
|
mt = content.get("text/plain");
|
||||||
assertNull(mt.getEncoding());
|
assertNull(mt.getEncoding());
|
||||||
cp = mt.getSchema();
|
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);
|
assertTrue(cp.isString);
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -26,9 +26,39 @@ paths:
|
|||||||
application/json:
|
application/json:
|
||||||
schema:
|
schema:
|
||||||
$ref: '#/components/schemas/coordinates'
|
$ref: '#/components/schemas/coordinates'
|
||||||
|
- name: stringWithMinLength
|
||||||
|
in: query
|
||||||
|
schema:
|
||||||
|
$ref: '#/components/schemas/stringWithMinLength'
|
||||||
responses:
|
responses:
|
||||||
'201':
|
'200':
|
||||||
description: 'OK'
|
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:
|
/inlineRequestBodySchemasDifferingByContentType:
|
||||||
post:
|
post:
|
||||||
requestBody:
|
requestBody:
|
||||||
|
@ -12,6 +12,16 @@ paths:
|
|||||||
application/json:
|
application/json:
|
||||||
schema:
|
schema:
|
||||||
$ref: '#/components/schemas/fruit'
|
$ref: '#/components/schemas/fruit'
|
||||||
|
put:
|
||||||
|
operationId: test
|
||||||
|
parameters: []
|
||||||
|
requestBody:
|
||||||
|
content:
|
||||||
|
application/json:
|
||||||
|
schema: {}
|
||||||
|
responses:
|
||||||
|
'204':
|
||||||
|
description: Success
|
||||||
components:
|
components:
|
||||||
schemas:
|
schemas:
|
||||||
fruit:
|
fruit:
|
||||||
|
2
pom.xml
2
pom.xml
@ -1148,9 +1148,7 @@
|
|||||||
<!-- comment out as it's not working as the moment
|
<!-- comment out as it's not working as the moment
|
||||||
<module>samples/client/petstore/c</module>
|
<module>samples/client/petstore/c</module>
|
||||||
-->
|
-->
|
||||||
<!--
|
|
||||||
<module>samples/client/petstore/cpp-qt</module>
|
<module>samples/client/petstore/cpp-qt</module>
|
||||||
-->
|
|
||||||
<module>samples/client/petstore/rust</module>
|
<module>samples/client/petstore/rust</module>
|
||||||
<module>samples/client/petstore/rust/reqwest/petstore</module>
|
<module>samples/client/petstore/rust/reqwest/petstore</module>
|
||||||
<module>samples/client/petstore/rust/reqwest/petstore-async</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.squareup.okhttp3" % "logging-interceptor" % "4.9.1",
|
||||||
"com.google.code.gson" % "gson" % "2.8.6",
|
"com.google.code.gson" % "gson" % "2.8.6",
|
||||||
"org.apache.commons" % "commons-lang3" % "3.10",
|
"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",
|
"org.threeten" % "threetenbp" % "1.4.3" % "compile",
|
||||||
"io.gsonfire" % "gson-fire" % "1.8.3" % "compile",
|
"io.gsonfire" % "gson-fire" % "1.8.3" % "compile",
|
||||||
"jakarta.annotation" % "jakarta.annotation-api" % "1.3.5" % "compile",
|
"jakarta.annotation" % "jakarta.annotation-api" % "1.3.5" % "compile",
|
||||||
|
@ -324,7 +324,7 @@
|
|||||||
<okhttp-version>4.9.2</okhttp-version>
|
<okhttp-version>4.9.2</okhttp-version>
|
||||||
<gson-version>2.8.8</gson-version>
|
<gson-version>2.8.8</gson-version>
|
||||||
<commons-lang3-version>3.12.0</commons-lang3-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>
|
<threetenbp-version>1.5.0</threetenbp-version>
|
||||||
<jakarta-annotation-version>1.3.5</jakarta-annotation-version>
|
<jakarta-annotation-version>1.3.5</jakarta-annotation-version>
|
||||||
<junit-version>4.13.2</junit-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(Qt5Core REQUIRED)
|
||||||
find_package(Qt5Network REQUIRED)
|
find_package(Qt5Network REQUIRED)
|
||||||
find_package(Qt5Test REQUIRED)
|
find_package(Qt5Test REQUIRED)
|
||||||
|
find_package(Qt5Gui REQUIRED)
|
||||||
|
|
||||||
include_directories(
|
include_directories(
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/client
|
${CMAKE_CURRENT_SOURCE_DIR}/client
|
||||||
@ -23,7 +24,7 @@ add_executable(${PROJECT_NAME}
|
|||||||
PetStore/UserApiTests.cpp
|
PetStore/UserApiTests.cpp
|
||||||
)
|
)
|
||||||
target_link_libraries(${PROJECT_NAME} PRIVATE client)
|
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 14)
|
||||||
set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD_REQUIRED ON)
|
set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD_REQUIRED ON)
|
||||||
set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_EXTENSIONS OFF)
|
set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_EXTENSIONS OFF)
|
||||||
|
@ -13,6 +13,7 @@ endif ()
|
|||||||
|
|
||||||
find_package(Qt5Core REQUIRED)
|
find_package(Qt5Core REQUIRED)
|
||||||
find_package(Qt5Network REQUIRED)
|
find_package(Qt5Network REQUIRED)
|
||||||
|
find_package(Qt5Gui REQUIRED)
|
||||||
|
|
||||||
add_library(${PROJECT_NAME}
|
add_library(${PROJECT_NAME}
|
||||||
PFXApiResponse.cpp
|
PFXApiResponse.cpp
|
||||||
@ -27,9 +28,9 @@ add_library(${PROJECT_NAME}
|
|||||||
PFXHelpers.cpp
|
PFXHelpers.cpp
|
||||||
PFXHttpRequest.cpp
|
PFXHttpRequest.cpp
|
||||||
PFXHttpFileElement.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)
|
if(NOT APPLE)
|
||||||
target_link_libraries(${PROJECT_NAME} PRIVATE ssl crypto)
|
target_link_libraries(${PROJECT_NAME} PRIVATE ssl crypto)
|
||||||
endif()
|
endif()
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
#include "PFXOauth.h"
|
#include "PFXOauth.h"
|
||||||
|
|
||||||
namespace OpenAPI {
|
namespace test_namespace {
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Base class to perform oauth2 flows
|
* Base class to perform oauth2 flows
|
||||||
@ -343,5 +343,4 @@ void ReplyServer::read()
|
|||||||
emit dataReceived(queryParams);
|
emit dataReceived(queryParams);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} // namespace test_namespace
|
||||||
}
|
|
||||||
|
@ -31,8 +31,7 @@
|
|||||||
#include <QUrl>
|
#include <QUrl>
|
||||||
#include <QUrlQuery>
|
#include <QUrlQuery>
|
||||||
#include <QDateTime>
|
#include <QDateTime>
|
||||||
|
#include <time.h>
|
||||||
|
|
||||||
|
|
||||||
namespace test_namespace {
|
namespace test_namespace {
|
||||||
|
|
||||||
@ -40,19 +39,19 @@ class oauthToken
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
oauthToken(QString token, int expiresIn, QString scope, QString tokenType) : m_token(token), m_scope(scope), m_type(tokenType){
|
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(){
|
oauthToken(){
|
||||||
m_validUntil = QDateTime::fromSecsSinceEpoch(QDateTime::currentSecsSinceEpoch() -1);
|
m_validUntil = time(0) - 1;
|
||||||
}
|
}
|
||||||
QString getToken(){return m_token;};
|
QString getToken(){return m_token;};
|
||||||
QString getScope(){return m_scope;};
|
QString getScope(){return m_scope;};
|
||||||
QString getType(){return m_type;};
|
QString getType(){return m_type;};
|
||||||
bool isValid(){return QDateTime::currentDateTime() < m_validUntil;};
|
bool isValid(){return time(0) < m_validUntil;};
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QString m_token;
|
QString m_token;
|
||||||
QDateTime m_validUntil;
|
time_t m_validUntil;
|
||||||
QString m_scope;
|
QString m_scope;
|
||||||
QString m_type;
|
QString m_type;
|
||||||
};
|
};
|
||||||
|
@ -18,6 +18,7 @@ import io.micronaut.http.client.annotation.Client;
|
|||||||
import org.openapitools.query.QueryParam;
|
import org.openapitools.query.QueryParam;
|
||||||
import io.micronaut.core.convert.format.Format;
|
import io.micronaut.core.convert.format.Format;
|
||||||
import reactor.core.publisher.Mono;
|
import reactor.core.publisher.Mono;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
import org.openapitools.model.User;
|
import org.openapitools.model.User;
|
||||||
import javax.annotation.Generated;
|
import javax.annotation.Generated;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
@ -116,7 +116,7 @@ ext {
|
|||||||
swagger_annotations_version = "1.5.22"
|
swagger_annotations_version = "1.5.22"
|
||||||
jackson_version = "2.12.1"
|
jackson_version = "2.12.1"
|
||||||
jackson_databind_version = "2.10.5.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"
|
jakarta_annotation_version = "1.3.5"
|
||||||
jackson_threetenbp_version = "2.9.10"
|
jackson_threetenbp_version = "2.9.10"
|
||||||
httpclient_version = "4.5.13"
|
httpclient_version = "4.5.13"
|
||||||
|
@ -20,6 +20,7 @@ import org.openapitools.client.Configuration;
|
|||||||
import org.openapitools.client.model.*;
|
import org.openapitools.client.model.*;
|
||||||
import org.openapitools.client.Pair;
|
import org.openapitools.client.Pair;
|
||||||
|
|
||||||
|
import org.threeten.bp.OffsetDateTime;
|
||||||
import org.openapitools.client.model.User;
|
import org.openapitools.client.model.User;
|
||||||
|
|
||||||
|
|
||||||
|
@ -4,6 +4,7 @@ import org.openapitools.client.ApiClient;
|
|||||||
import org.openapitools.client.EncodingUtils;
|
import org.openapitools.client.EncodingUtils;
|
||||||
import org.openapitools.client.model.ApiResponse;
|
import org.openapitools.client.model.ApiResponse;
|
||||||
|
|
||||||
|
import org.threeten.bp.OffsetDateTime;
|
||||||
import org.openapitools.client.model.User;
|
import org.openapitools.client.model.User;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
@ -104,7 +104,7 @@ ext {
|
|||||||
swagger_annotations_version = "1.5.24"
|
swagger_annotations_version = "1.5.24"
|
||||||
jackson_version = "2.10.3"
|
jackson_version = "2.10.3"
|
||||||
jackson_databind_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"
|
jakarta_annotation_version = "1.3.5"
|
||||||
jackson_threetenbp_version = "2.9.10"
|
jackson_threetenbp_version = "2.9.10"
|
||||||
feign_version = "10.11"
|
feign_version = "10.11"
|
||||||
|
@ -331,7 +331,7 @@
|
|||||||
<feign-version>10.11</feign-version>
|
<feign-version>10.11</feign-version>
|
||||||
<feign-form-version>3.8.0</feign-form-version>
|
<feign-form-version>3.8.0</feign-form-version>
|
||||||
<jackson-version>2.10.3</jackson-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-databind-version>2.10.3</jackson-databind-version>
|
||||||
<jackson-threetenbp-version>2.9.10</jackson-threetenbp-version>
|
<jackson-threetenbp-version>2.9.10</jackson-threetenbp-version>
|
||||||
<jakarta-annotation-version>1.3.5</jakarta-annotation-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.EncodingUtils;
|
||||||
import org.openapitools.client.model.ApiResponse;
|
import org.openapitools.client.model.ApiResponse;
|
||||||
|
|
||||||
|
import org.threeten.bp.OffsetDateTime;
|
||||||
import org.openapitools.client.model.User;
|
import org.openapitools.client.model.User;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
@ -97,12 +97,12 @@ if(hasProperty('target') && target == 'android') {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ext {
|
ext {
|
||||||
swagger_annotations_version = "1.5.22"
|
swagger_annotations_version = "1.6.3"
|
||||||
jackson_version = "2.12.1"
|
jackson_version = "2.12.5"
|
||||||
jackson_databind_version = "2.10.5.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"
|
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"
|
jersey_common_version = "2.25.1"
|
||||||
jodatime_version = "2.9.9"
|
jodatime_version = "2.9.9"
|
||||||
junit_version = "4.13.1"
|
junit_version = "4.13.1"
|
||||||
|
@ -266,11 +266,11 @@
|
|||||||
<properties>
|
<properties>
|
||||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
<swagger-annotations-version>1.5.22</swagger-annotations-version>
|
<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>
|
<jersey-common-version>2.25.1</jersey-common-version>
|
||||||
<jackson-version>2.12.1</jackson-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>
|
||||||
<jackson-databind-nullable-version>0.2.1</jackson-databind-nullable-version>
|
<jackson-databind-nullable-version>0.2.2</jackson-databind-nullable-version>
|
||||||
<jackson-threetenbp-version>2.9.10</jackson-threetenbp-version>
|
<jackson-threetenbp-version>2.9.10</jackson-threetenbp-version>
|
||||||
<jakarta-annotation-version>1.3.5</jakarta-annotation-version>
|
<jakarta-annotation-version>1.3.5</jakarta-annotation-version>
|
||||||
<maven-plugin-version>1.0.0</maven-plugin-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.openapitools.client.ApiClient;
|
||||||
|
|
||||||
|
import org.threeten.bp.OffsetDateTime;
|
||||||
import org.openapitools.client.model.User;
|
import org.openapitools.client.model.User;
|
||||||
|
|
||||||
import com.fasterxml.jackson.core.type.TypeReference;
|
import com.fasterxml.jackson.core.type.TypeReference;
|
||||||
|
@ -113,10 +113,10 @@ if(hasProperty('target') && target == 'android') {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ext {
|
ext {
|
||||||
swagger_annotations_version = "1.5.22"
|
swagger_annotations_version = "1.6.3"
|
||||||
jackson_version = "2.12.1"
|
jackson_version = "2.12.5"
|
||||||
jackson_databind_version = "2.10.5.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"
|
jakarta_annotation_version = "1.3.5"
|
||||||
jackson_threetenbp_version = "2.9.10"
|
jackson_threetenbp_version = "2.9.10"
|
||||||
jersey_version = "1.19.4"
|
jersey_version = "1.19.4"
|
||||||
|
@ -288,9 +288,9 @@
|
|||||||
</dependencies>
|
</dependencies>
|
||||||
<properties>
|
<properties>
|
||||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
<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>
|
<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>
|
<jackson-threetenbp-version>2.9.10</jackson-threetenbp-version>
|
||||||
<jakarta-annotation-version>1.3.5</jakarta-annotation-version>
|
<jakarta-annotation-version>1.3.5</jakarta-annotation-version>
|
||||||
<maven-plugin-version>1.0.0</maven-plugin-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.model.*;
|
||||||
import org.openapitools.client.Pair;
|
import org.openapitools.client.Pair;
|
||||||
|
|
||||||
|
import org.threeten.bp.OffsetDateTime;
|
||||||
import org.openapitools.client.model.User;
|
import org.openapitools.client.model.User;
|
||||||
|
|
||||||
|
|
||||||
|
@ -101,7 +101,7 @@ ext {
|
|||||||
swagger_annotations_version = "1.6.3"
|
swagger_annotations_version = "1.6.3"
|
||||||
jackson_version = "2.13.0"
|
jackson_version = "2.13.0"
|
||||||
jackson_databind_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"
|
jakarta_annotation_version = "1.3.5"
|
||||||
jersey_version = "2.35"
|
jersey_version = "2.35"
|
||||||
junit_version = "4.13.2"
|
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-annotations" % "2.13.0" % "compile",
|
||||||
"com.fasterxml.jackson.core" % "jackson-databind" % "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",
|
"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",
|
"com.github.scribejava" % "scribejava-apis" % "8.3.1" % "compile",
|
||||||
"jakarta.annotation" % "jakarta.annotation-api" % "1.3.5" % "compile",
|
"jakarta.annotation" % "jakarta.annotation-api" % "1.3.5" % "compile",
|
||||||
"junit" % "junit" % "4.13.2" % "test",
|
"junit" % "junit" % "4.13.2" % "test",
|
||||||
|
@ -342,7 +342,7 @@
|
|||||||
<jersey-version>2.35</jersey-version>
|
<jersey-version>2.35</jersey-version>
|
||||||
<jackson-version>2.13.0</jackson-version>
|
<jackson-version>2.13.0</jackson-version>
|
||||||
<jackson-databind-version>2.13.0</jackson-databind-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>
|
<jakarta-annotation-version>1.3.5</jakarta-annotation-version>
|
||||||
<junit-version>4.13.2</junit-version>
|
<junit-version>4.13.2</junit-version>
|
||||||
<scribejava-apis-version>8.3.1</scribejava-apis-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 javax.ws.rs.core.GenericType;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
import org.openapitools.client.model.User;
|
import org.openapitools.client.model.User;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
@ -101,7 +101,7 @@ ext {
|
|||||||
swagger_annotations_version = "1.6.3"
|
swagger_annotations_version = "1.6.3"
|
||||||
jackson_version = "2.13.0"
|
jackson_version = "2.13.0"
|
||||||
jackson_databind_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"
|
jakarta_annotation_version = "1.3.5"
|
||||||
jersey_version = "2.35"
|
jersey_version = "2.35"
|
||||||
junit_version = "4.13.2"
|
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-annotations" % "2.13.0" % "compile",
|
||||||
"com.fasterxml.jackson.core" % "jackson-databind" % "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",
|
"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",
|
"com.github.scribejava" % "scribejava-apis" % "8.3.1" % "compile",
|
||||||
"jakarta.annotation" % "jakarta.annotation-api" % "1.3.5" % "compile",
|
"jakarta.annotation" % "jakarta.annotation-api" % "1.3.5" % "compile",
|
||||||
"junit" % "junit" % "4.13.2" % "test",
|
"junit" % "junit" % "4.13.2" % "test",
|
||||||
|
@ -342,7 +342,7 @@
|
|||||||
<jersey-version>2.35</jersey-version>
|
<jersey-version>2.35</jersey-version>
|
||||||
<jackson-version>2.13.0</jackson-version>
|
<jackson-version>2.13.0</jackson-version>
|
||||||
<jackson-databind-version>2.13.0</jackson-databind-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>
|
<jakarta-annotation-version>1.3.5</jakarta-annotation-version>
|
||||||
<junit-version>4.13.2</junit-version>
|
<junit-version>4.13.2</junit-version>
|
||||||
<scribejava-apis-version>8.3.1</scribejava-apis-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 javax.ws.rs.core.GenericType;
|
||||||
|
|
||||||
|
import java.time.OffsetDateTime;
|
||||||
import org.openapitools.client.model.User;
|
import org.openapitools.client.model.User;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
@ -12,6 +12,7 @@
|
|||||||
|
|
||||||
package org.openapitools.client.api;
|
package org.openapitools.client.api;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
import org.openapitools.client.model.User;
|
import org.openapitools.client.model.User;
|
||||||
|
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
|
@ -215,7 +215,7 @@
|
|||||||
<maven.compiler.source>11</maven.compiler.source>
|
<maven.compiler.source>11</maven.compiler.source>
|
||||||
<maven.compiler.target>11</maven.compiler.target>
|
<maven.compiler.target>11</maven.compiler.target>
|
||||||
<jackson-version>2.10.4</jackson-version>
|
<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>
|
<jakarta-annotation-version>1.3.5</jakarta-annotation-version>
|
||||||
<junit-version>4.13.1</junit-version>
|
<junit-version>4.13.1</junit-version>
|
||||||
</properties>
|
</properties>
|
||||||
|
@ -17,6 +17,7 @@ import org.openapitools.client.ApiException;
|
|||||||
import org.openapitools.client.ApiResponse;
|
import org.openapitools.client.ApiResponse;
|
||||||
import org.openapitools.client.Pair;
|
import org.openapitools.client.Pair;
|
||||||
|
|
||||||
|
import java.time.OffsetDateTime;
|
||||||
import org.openapitools.client.model.User;
|
import org.openapitools.client.model.User;
|
||||||
|
|
||||||
import com.fasterxml.jackson.core.type.TypeReference;
|
import com.fasterxml.jackson.core.type.TypeReference;
|
||||||
|
@ -215,7 +215,7 @@
|
|||||||
<maven.compiler.source>11</maven.compiler.source>
|
<maven.compiler.source>11</maven.compiler.source>
|
||||||
<maven.compiler.target>11</maven.compiler.target>
|
<maven.compiler.target>11</maven.compiler.target>
|
||||||
<jackson-version>2.10.4</jackson-version>
|
<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>
|
<jakarta-annotation-version>1.3.5</jakarta-annotation-version>
|
||||||
<junit-version>4.13.1</junit-version>
|
<junit-version>4.13.1</junit-version>
|
||||||
</properties>
|
</properties>
|
||||||
|
@ -17,6 +17,7 @@ import org.openapitools.client.ApiException;
|
|||||||
import org.openapitools.client.ApiResponse;
|
import org.openapitools.client.ApiResponse;
|
||||||
import org.openapitools.client.Pair;
|
import org.openapitools.client.Pair;
|
||||||
|
|
||||||
|
import java.time.OffsetDateTime;
|
||||||
import org.openapitools.client.model.User;
|
import org.openapitools.client.model.User;
|
||||||
|
|
||||||
import com.fasterxml.jackson.core.type.TypeReference;
|
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.squareup.okhttp3" % "logging-interceptor" % "4.9.1",
|
||||||
"com.google.code.gson" % "gson" % "2.8.6",
|
"com.google.code.gson" % "gson" % "2.8.6",
|
||||||
"org.apache.commons" % "commons-lang3" % "3.10",
|
"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.apache.oltu.oauth2" % "org.apache.oltu.oauth2.client" % "1.0.1",
|
||||||
"org.threeten" % "threetenbp" % "1.4.3" % "compile",
|
"org.threeten" % "threetenbp" % "1.4.3" % "compile",
|
||||||
"io.swagger.parser.v3" % "swagger-parser-v3" "2.0.23" % "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