diff --git a/bin/configs/kotlin-misk-config.yaml b/bin/configs/kotlin-misk-config.yaml index 70ecde187aa4..6c9442faf960 100644 --- a/bin/configs/kotlin-misk-config.yaml +++ b/bin/configs/kotlin-misk-config.yaml @@ -1,6 +1,6 @@ generatorName: kotlin-misk outputDir: samples/server/petstore/kotlin-misk-config -inputSpec: modules/openapi-generator/src/test/resources/3_0/petstore.yaml +inputSpec: modules/openapi-generator/src/test/resources/3_0/kotlin/petstore-kotlin-misk.yaml templateDir: modules/openapi-generator/src/main/resources/kotlin-misk validateSpec: false useBeanValidation: true diff --git a/bin/configs/kotlin-misk.yaml b/bin/configs/kotlin-misk.yaml index 5593aad0b7a7..684448fae443 100644 --- a/bin/configs/kotlin-misk.yaml +++ b/bin/configs/kotlin-misk.yaml @@ -1,6 +1,6 @@ generatorName: kotlin-misk outputDir: samples/server/petstore/kotlin-misk -inputSpec: modules/openapi-generator/src/test/resources/3_0/petstore.yaml +inputSpec: modules/openapi-generator/src/test/resources/3_0/kotlin/petstore-kotlin-misk.yaml templateDir: modules/openapi-generator/src/main/resources/kotlin-misk additionalProperties: hideGenerationTimestamp: "true" diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenOperation.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenOperation.java index 47e09ea292d4..e8c89ac9b6fa 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenOperation.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenOperation.java @@ -33,7 +33,7 @@ public class CodegenOperation { hasErrorResponseObject; // if 4xx, 5xx responses have at least one error object defined public CodegenProperty returnProperty; public String path, operationId, returnType, returnFormat, httpMethod, returnBaseType, - returnContainer, summary, unescapedNotes, notes, baseName, defaultResponse; + returnContainer, summary, unescapedSummary, unescapedNotes, notes, baseName, defaultResponse; public CodegenDiscriminator discriminator; public List> consumes, produces, prioritizedContentTypes; public List servers = new ArrayList(); @@ -429,6 +429,7 @@ public String toString() { sb.append(", returnBaseType='").append(returnBaseType).append('\''); sb.append(", returnContainer='").append(returnContainer).append('\''); sb.append(", summary='").append(summary).append('\''); + sb.append(", unescapedSummary='").append(unescapedSummary).append('\''); sb.append(", unescapedNotes='").append(unescapedNotes).append('\''); sb.append(", notes='").append(notes).append('\''); sb.append(", baseName='").append(baseName).append('\''); @@ -502,6 +503,7 @@ public boolean equals(Object o) { Objects.equals(returnBaseType, that.returnBaseType) && Objects.equals(returnContainer, that.returnContainer) && Objects.equals(summary, that.summary) && + Objects.equals(unescapedSummary, that.unescapedSummary) && Objects.equals(unescapedNotes, that.unescapedNotes) && Objects.equals(notes, that.notes) && Objects.equals(baseName, that.baseName) && @@ -547,7 +549,7 @@ public int hashCode() { returnTypeIsPrimitive, returnSimpleType, subresourceOperation, isMap, isArray, isMultipart, isVoid, isResponseBinary, isResponseFile, isResponseOptional, hasReference, isDeprecated, isCallbackRequest, uniqueItems, path, operationId, returnType, httpMethod, - returnBaseType, returnContainer, summary, unescapedNotes, notes, baseName, defaultResponse, + returnBaseType, returnContainer, summary, unescapedSummary, unescapedNotes, notes, baseName, defaultResponse, discriminator, consumes, produces, prioritizedContentTypes, servers, bodyParam, allParams, bodyParams, pathParams, queryParams, headerParams, formParams, cookieParams, requiredParams, returnProperty, optionalParams, authMethods, tags, responses, callbacks, imports, examples, requestBodyExamples, externalDocs, diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenParameter.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenParameter.java index 90c4c66558c0..35933108c49a 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenParameter.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenParameter.java @@ -34,7 +34,7 @@ public class CodegenParameter implements IJsonSchemaValidationProperties { isCollectionFormatMulti, isPrimitiveType, isModel, isExplode, isDeepObject, isMatrix, isAllowEmptyValue, isFormStyle, isSpaceDelimited, isPipeDelimited; public String baseName, paramName, dataType, datatypeWithEnum, dataFormat, contentType, - collectionFormat, description, unescapedDescription, baseType, defaultValue, enumDefaultValue, enumName, style; + collectionFormat, description, unescapedDescription, baseType, defaultValue, unescapedDefaultValue, enumDefaultValue, enumName, style; public String nameInLowerCase; // property name in lower case public String nameInCamelCase; // property name in camel case (e.g. modifiedDate) @@ -182,6 +182,7 @@ public CodegenParameter copy() { output.multipleOf = this.multipleOf; output.jsonSchema = this.jsonSchema; output.defaultValue = this.defaultValue; + output.unescapedDefaultValue = this.unescapedDefaultValue; output.enumDefaultValue = this.enumDefaultValue; output.example = this.example; output.examples = this.examples; @@ -289,7 +290,7 @@ public int hashCode() { return Objects.hash(isFormParam, isQueryParam, isPathParam, isHeaderParam, isCookieParam, isBodyParam, isContainer, isCollectionFormatMulti, isPrimitiveType, isModel, isExplode, baseName, paramName, dataType, datatypeWithEnum, dataFormat, collectionFormat, description, - unescapedDescription, baseType, containerType, containerTypeMapped, defaultValue, + unescapedDescription, baseType, containerType, containerTypeMapped, defaultValue, unescapedDefaultValue, enumDefaultValue, enumName, style, isDeepObject, isMatrix, isAllowEmptyValue, example, examples, isFormStyle, isSpaceDelimited, isPipeDelimited, jsonSchema, isString, isNumeric, isInteger, isLong, isNumber, isFloat, isDouble, isDecimal, @@ -382,6 +383,7 @@ public boolean equals(Object o) { Objects.equals(containerType, that.containerType) && Objects.equals(containerTypeMapped, that.containerTypeMapped) && Objects.equals(defaultValue, that.defaultValue) && + Objects.equals(unescapedDefaultValue, that.unescapedDefaultValue) && Objects.equals(enumDefaultValue, that.enumDefaultValue) && Objects.equals(enumName, that.enumName) && Objects.equals(style, that.style) && @@ -450,6 +452,7 @@ public String toString() { sb.append(", containerType='").append(containerType).append('\''); sb.append(", containerTypeMapped='").append(containerTypeMapped).append('\''); sb.append(", defaultValue='").append(defaultValue).append('\''); + sb.append(", unescapedDefaultValue='").append(unescapedDefaultValue).append('\''); sb.append(", enumDefaultValue='").append(enumDefaultValue).append('\''); sb.append(", enumName='").append(enumName).append('\''); sb.append(", style='").append(style).append('\''); diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenProperty.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenProperty.java index c854389be7b2..a45c180869bf 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenProperty.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenProperty.java @@ -81,6 +81,14 @@ public class CodegenProperty implements Cloneable, IJsonSchemaValidationProperti @Getter @Setter public String unescapedDescription; + /** + * The default value string without escape characters; use this in string literal contexts + * (e.g. inside "..." or """...""") together with an appropriate escaping lambda. + * Unlike {@code defaultValue}, this is never passed through escapeText() or escapeUnsafeCharacters(). + */ + @Getter @Setter + public String unescapedDefaultValue; + /** * maxLength validation for strings, see http://json-schema.org/latest/json-schema-validation.html#rfc.section.5.2.1 */ @@ -992,6 +1000,7 @@ public String toString() { sb.append(", containerTypeMapped='").append(containerTypeMapped).append('\''); sb.append(", title='").append(title).append('\''); sb.append(", unescapedDescription='").append(unescapedDescription).append('\''); + sb.append(", unescapedDefaultValue='").append(unescapedDefaultValue).append('\''); sb.append(", maxLength=").append(maxLength); sb.append(", minLength=").append(minLength); sb.append(", pattern='").append(pattern).append('\''); @@ -1179,6 +1188,7 @@ public boolean equals(Object o) { Objects.equals(containerTypeMapped, that.containerTypeMapped) && Objects.equals(title, that.title) && Objects.equals(unescapedDescription, that.unescapedDescription) && + Objects.equals(unescapedDefaultValue, that.unescapedDefaultValue) && Objects.equals(maxLength, that.maxLength) && Objects.equals(minLength, that.minLength) && Objects.equals(pattern, that.pattern) && @@ -1212,7 +1222,7 @@ public int hashCode() { return Objects.hash(openApiType, baseName, complexType, getter, setter, description, dataType, datatypeWithEnum, dataFormat, name, min, max, defaultValue, - defaultValueWithParam, baseType, containerType, containerTypeMapped, title, unescapedDescription, + defaultValueWithParam, baseType, containerType, containerTypeMapped, title, unescapedDescription, unescapedDefaultValue, maxLength, minLength, pattern, example, jsonSchema, minimum, maximum, exclusiveMinimum, exclusiveMaximum, required, deprecated, isPrimitiveType, isModel, isContainer, isString, isNumeric, diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenResponse.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenResponse.java index 3298d80868f2..c9a426d7b9a1 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenResponse.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenResponse.java @@ -33,6 +33,7 @@ public class CodegenResponse implements IJsonSchemaValidationProperties { public boolean is4xx; public boolean is5xx; public String message; + public String unescapedMessage; public List> examples; public String dataType; public String baseType; @@ -109,7 +110,7 @@ public class CodegenResponse implements IJsonSchemaValidationProperties { @Override public int hashCode() { - return Objects.hash(headers, code, message, examples, dataType, baseType, containerType, containerTypeMapped, hasHeaders, + return Objects.hash(headers, code, message, unescapedMessage, examples, dataType, baseType, containerType, containerTypeMapped, hasHeaders, isString, isNumeric, isInteger, isLong, isNumber, isFloat, isDouble, isDecimal, isByteArray, isBoolean, isDate, isDateTime, isUuid, isEmail, isPassword, isModel, isFreeFormObject, isAnyType, isDefault, simpleType, primitiveType, isMap, isOptional, isArray, isBinary, isFile, schema, jsonSchema, vendorExtensions, items, additionalProperties, @@ -182,6 +183,7 @@ public boolean equals(Object o) { Objects.equals(headers, that.headers) && Objects.equals(code, that.code) && Objects.equals(message, that.message) && + Objects.equals(unescapedMessage, that.unescapedMessage) && Objects.equals(examples, that.examples) && Objects.equals(dataType, that.dataType) && Objects.equals(baseType, that.baseType) && @@ -582,6 +584,7 @@ public String toString() { sb.append(", is4xx='").append(is4xx).append('\''); sb.append(", is5xx='").append(is5xx).append('\''); sb.append(", message='").append(message).append('\''); + sb.append(", unescapedMessage='").append(unescapedMessage).append('\''); sb.append(", examples=").append(examples); sb.append(", dataType='").append(dataType).append('\''); sb.append(", baseType='").append(baseType).append('\''); diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultCodegen.java index 710f7838d72f..0429fc31e5d1 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultCodegen.java @@ -476,7 +476,24 @@ protected ImmutableMap.Builder addMustacheLambdas() { .put("trimLineBreaks", new TrimLineBreaksLambda()) .put("trimWhitespace", new TrimWhitespaceLambda()) .put("trimTrailingWithNewLine", new TrimTrailingWhiteSpaceLambda(true)) - .put("trimTrailing", new TrimTrailingWhiteSpaceLambda(false)); + .put("trimTrailing", new TrimTrailingWhiteSpaceLambda(false)) + // Escapes text for use inside a Markdown table cell or inline text. + // Order matters: \\ and & must be first to avoid double-escaping. + // $ is escaped to prevent LaTeX math mode ($...$) in renderers that support it. + .put("escapeMarkdown", (fragment, writer) -> writer.write(fragment.execute() + .replace("\\", "\\\\") + .replace("&", "&") + .replace("<", "<") + .replace(">", ">") + .replace("$", "\\$") + .replace("|", "\\|") + .replace("\r\n", " ") + .replace("\n", " ") + .replace("\r", " "))) + .put("collapseNewlines", (fragment, writer) -> writer.write(fragment.execute() + .replace("\r\n", " ") + .replace("\n", " ") + .replace("\r", " "))); } private void registerMustacheLambdas() { @@ -4315,6 +4332,7 @@ public CodegenProperty fromProperty(String name, Schema p, boolean required, boo // set the default value property.defaultValue = toDefaultValue(property, p); + property.unescapedDefaultValue = p.getDefault() != null ? String.valueOf(p.getDefault()) : null; property.defaultValueWithParam = toDefaultValueWithParam(name, p); LOGGER.debug("debugging from property return: {}", property); @@ -4738,6 +4756,7 @@ public CodegenOperation fromOperation(String path, } op.summary = escapeText(operation.getSummary()); + op.unescapedSummary = operation.getSummary(); op.unescapedNotes = operation.getDescription(); op.notes = escapeText(operation.getDescription()); op.hasConsumes = false; @@ -5092,6 +5111,7 @@ public CodegenResponse fromResponse(String responseCode, ApiResponse response) { } r.schema = responseSchema; r.message = escapeText(response.getDescription()); + r.unescapedMessage = response.getDescription(); // adding examples to API responses Map examples = ExamplesUtils.getExamplesFromResponse(openAPI, response); @@ -5641,6 +5661,7 @@ public CodegenParameter fromParameter(Parameter parameter, Set imports) // set default value codegenParameter.defaultValue = toDefaultParameterValue(codegenProperty, parameterSchema); + codegenParameter.unescapedDefaultValue = parameterSchema.getDefault() != null ? String.valueOf(parameterSchema.getDefault()) : null; finishUpdatingParameter(codegenParameter, parameter); return codegenParameter; @@ -7543,6 +7564,7 @@ public CodegenParameter fromFormProperty(String name, Schema propertySchema, Set // set default value codegenParameter.defaultValue = toDefaultParameterValue(codegenProperty, propertySchema); + codegenParameter.unescapedDefaultValue = propertySchema.getDefault() != null ? String.valueOf(propertySchema.getDefault()) : null; if (ModelUtils.isFileSchema(ps) && !ModelUtils.isStringSchema(ps)) { // swagger v2 only, type file @@ -8089,6 +8111,7 @@ public CodegenParameter fromRequestBody(RequestBody body, Set imports, S codegenParameter.baseName = "UNKNOWN_BASE_NAME"; codegenParameter.paramName = "UNKNOWN_PARAM_NAME"; codegenParameter.description = escapeText(body.getDescription()); + codegenParameter.unescapedDescription = body.getDescription(); codegenParameter.required = body.getRequired() != null ? body.getRequired() : Boolean.FALSE; codegenParameter.isBodyParam = Boolean.TRUE; if (body.getExtensions() != null) { diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractKotlinCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractKotlinCodegen.java index 4d9b8217d763..8aea9042b0e6 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractKotlinCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractKotlinCodegen.java @@ -1274,7 +1274,20 @@ protected void updateModelForObject(CodegenModel m, Schema schema) { @Override protected ImmutableMap.Builder addMustacheLambdas() { return super.addMustacheLambdas() - .put("escapeDollar", new EscapeChar("(? writer.write(fragment.execute() + .replace("\\", "\\\\") + .replace("$", "\\$") + .replace("\"", "\\\"") + .replace("\n", "\\n") + .replace("\r", "\\r") + .replace("\t", "\\t"))); } protected interface DataTypeAssigner { diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/KotlinSpringServerCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/KotlinSpringServerCodegen.java index 6d2a86061991..3b850904f9a3 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/KotlinSpringServerCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/KotlinSpringServerCodegen.java @@ -962,17 +962,13 @@ public void processOpts() { // spring uses the jackson lib, and we disallow configuration. additionalProperties.put("jackson", "true"); - // add lambda for mustache templates - additionalProperties.put("lambdaEscapeInNormalString", - (Mustache.Lambda) (fragment, writer) -> writer.write(fragment.execute().replaceAll("([$\"\\\\])", "\\\\$1"))); - additionalProperties.put("lambdaRemoveLineBreak", - (Mustache.Lambda) (fragment, writer) -> writer.write(fragment.execute().replaceAll("[\\r\\n]", ""))); } @Override protected ImmutableMap.Builder addMustacheLambdas() { return super.addMustacheLambdas() - .put("escapeDoubleQuote", new EscapeLambda("\"", "\\\"")); + .put("escapeDoubleQuote", new EscapeLambda("\"", "\\\"")) + .put("removeLineBreak", (fragment, writer) -> writer.write(fragment.execute().replaceAll("[\\r\\n]", ""))); } @Override @@ -1445,6 +1441,7 @@ private void markPropertyAsInherited(CodegenModel model, String baseName, String p.defaultValue = dataType + "." + toEnumVarName(discriminatorValue, dataType); } else { p.defaultValue = "\"" + escapeText(discriminatorValue) + "\""; + p.unescapedDefaultValue = discriminatorValue; } } }); diff --git a/modules/openapi-generator/src/main/resources/kotlin-client/api_doc.mustache b/modules/openapi-generator/src/main/resources/kotlin-client/api_doc.mustache index a997cafd1621..c11322d74117 100644 --- a/modules/openapi-generator/src/main/resources/kotlin-client/api_doc.mustache +++ b/modules/openapi-generator/src/main/resources/kotlin-client/api_doc.mustache @@ -1,22 +1,22 @@ # {{classname}}{{#description}} -{{.}}{{/description}} +{{#lambda.escapeMarkdown}}{{{.}}}{{/lambda.escapeMarkdown}}{{/description}} All URIs are relative to *{{basePath}}* | Method | HTTP request | Description | | ------------- | ------------- | ------------- | -{{#operations}}{{#operation}}| [**{{operationId}}**]({{classname}}.md#{{operationId}}) | **{{httpMethod}}** {{path}} | {{summary}} | +{{#operations}}{{#operation}}| [**{{operationId}}**]({{classname}}.md#{{operationId}}) | **{{httpMethod}}** {{path}} | {{#lambda.escapeMarkdown}}{{{unescapedSummary}}}{{/lambda.escapeMarkdown}} | {{/operation}}{{/operations}} {{#operations}} {{#operation}} # **{{operationId}}** -> {{#returnType}}{{.}}{{#nullableReturnType}}?{{/nullableReturnType}} {{/returnType}}{{operationId}}({{#allParams}}{{{paramName}}}{{^-last}}, {{/-last}}{{/allParams}}) +> {{#returnType}}{{#lambda.escapeMarkdown}}{{{.}}}{{/lambda.escapeMarkdown}}{{#nullableReturnType}}?{{/nullableReturnType}} {{/returnType}}{{operationId}}({{#allParams}}{{{paramName}}}{{^-last}}, {{/-last}}{{/allParams}}) -{{summary}}{{#notes}} +{{#lambda.escapeMarkdown}}{{{unescapedSummary}}}{{/lambda.escapeMarkdown}}{{#unescapedNotes}} -{{.}}{{/notes}} +{{#lambda.escapeMarkdown}}{{{unescapedNotes}}}{{/lambda.escapeMarkdown}}{{/unescapedNotes}} ### Example ```kotlin @@ -27,7 +27,7 @@ All URIs are relative to *{{basePath}}* {{! TODO: Auth method documentation examples}} val apiInstance = {{{classname}}}() {{#allParams}} -val {{{paramName}}} : {{{dataType}}} = {{{example}}} // {{{dataType}}} | {{{description}}} +val {{{paramName}}} : {{{dataType}}} = {{{example}}} // {{{dataType}}} | {{#lambda.collapseNewlines}}{{{unescapedDescription}}}{{/lambda.collapseNewlines}} {{/allParams}} try { {{#returnType}}val result : {{{returnType}}}{{#nullableReturnType}}?{{/nullableReturnType}} = {{/returnType}}apiInstance.{{{operationId}}}({{#allParams}}{{{paramName}}}{{^-last}}, {{/-last}}{{/allParams}}){{#returnType}} @@ -50,7 +50,7 @@ This endpoint does not need any parameter. | Name | Type | Description | Notes | | ------------- | ------------- | ------------- | ------------- | {{/-last}} -| **{{paramName}}** | {{#isPrimitiveType}}**{{dataType}}**{{/isPrimitiveType}}{{^isPrimitiveType}}{{#isFile}}**{{dataType}}**{{/isFile}}{{^isFile}}{{#generateModelDocs}}[**{{dataType}}**]({{baseType}}.md){{/generateModelDocs}}{{^generateModelDocs}}**{{dataType}}**{{/generateModelDocs}}{{/isFile}}{{/isPrimitiveType}}| {{description}} |{{^required}} [optional]{{/required}}{{#defaultValue}} [default to {{.}}]{{/defaultValue}}{{#allowableValues}} [enum: {{#values}}{{{.}}}{{^-last}}, {{/-last}}{{/values}}]{{/allowableValues}} | +| **{{paramName}}** | {{#isPrimitiveType}}**{{dataType}}**{{/isPrimitiveType}}{{^isPrimitiveType}}{{#isFile}}**{{dataType}}**{{/isFile}}{{^isFile}}{{#generateModelDocs}}[**{{dataType}}**]({{baseType}}.md){{/generateModelDocs}}{{^generateModelDocs}}**{{dataType}}**{{/generateModelDocs}}{{/isFile}}{{/isPrimitiveType}}| {{#lambda.escapeMarkdown}}{{{unescapedDescription}}}{{/lambda.escapeMarkdown}} |{{^required}} [optional]{{/required}}{{#defaultValue}} [default to {{#lambda.escapeMarkdown}}{{{.}}}{{/lambda.escapeMarkdown}}]{{/defaultValue}}{{#allowableValues}} [enum: {{#values}}{{#lambda.escapeMarkdown}}{{{.}}}{{/lambda.escapeMarkdown}}{{^-last}}, {{/-last}}{{/values}}]{{/allowableValues}} | {{/allParams}} ### Return type diff --git a/modules/openapi-generator/src/main/resources/kotlin-client/class_doc.mustache b/modules/openapi-generator/src/main/resources/kotlin-client/class_doc.mustache index 6ab282918f35..d5f934b50df9 100644 --- a/modules/openapi-generator/src/main/resources/kotlin-client/class_doc.mustache +++ b/modules/openapi-generator/src/main/resources/kotlin-client/class_doc.mustache @@ -3,7 +3,7 @@ ## Properties | Name | Type | Description | Notes | | ------------ | ------------- | ------------- | ------------- | -{{#vars}}| **{{name}}** | {{#isEnum}}[**inline**](#{{datatypeWithEnum}}){{/isEnum}}{{^isEnum}}{{#isPrimitiveType}}**{{dataType}}**{{/isPrimitiveType}}{{^isPrimitiveType}}[**{{dataType}}**]({{complexType}}.md){{/isPrimitiveType}}{{/isEnum}} | {{description}} | {{^required}} [optional]{{/required}}{{#isReadOnly}} [readonly]{{/isReadOnly}} | +{{#vars}}| **{{name}}** | {{#isEnum}}[**inline**](#{{datatypeWithEnum}}){{/isEnum}}{{^isEnum}}{{#isPrimitiveType}}**{{dataType}}**{{/isPrimitiveType}}{{^isPrimitiveType}}[**{{dataType}}**]({{complexType}}.md){{/isPrimitiveType}}{{/isEnum}} | {{#lambda.escapeMarkdown}}{{{unescapedDescription}}}{{/lambda.escapeMarkdown}} | {{^required}} [optional]{{/required}}{{#isReadOnly}} [readonly]{{/isReadOnly}} | {{/vars}} {{#vars}}{{#isEnum}} @@ -11,5 +11,5 @@ ## Enum: {{baseName}} | Name | Value | | ---- | ----- |{{#allowableValues}} -| {{name}} | {{#values}}{{.}}{{^-last}}, {{/-last}}{{/values}}{{/allowableValues}} | +| {{name}} | {{#values}}{{#lambda.escapeMarkdown}}{{{.}}}{{/lambda.escapeMarkdown}}{{^-last}}, {{/-last}}{{/values}}{{/allowableValues}} | {{/isEnum}}{{/vars}} diff --git a/modules/openapi-generator/src/main/resources/kotlin-client/data_class_opt_var.mustache b/modules/openapi-generator/src/main/resources/kotlin-client/data_class_opt_var.mustache index abaf53a3b30a..193b0f6b1ed3 100644 --- a/modules/openapi-generator/src/main/resources/kotlin-client/data_class_opt_var.mustache +++ b/modules/openapi-generator/src/main/resources/kotlin-client/data_class_opt_var.mustache @@ -9,7 +9,7 @@ @SerializedName("{{{vendorExtensions.x-base-name-literal}}}") {{/gson}} {{#jackson}} - @get:JsonProperty("{{{vendorExtensions.x-base-name-literal}}}") + @get:JsonProperty("{{#lambda.escapeInNormalString}}{{{baseName}}}{{/lambda.escapeInNormalString}}") {{/jackson}} {{#kotlinx_serialization}} {{^isEnum}}{{^isArray}}{{^isPrimitiveType}}{{^isModel}}@Contextual {{/isModel}}{{/isPrimitiveType}}{{/isArray}}{{/isEnum}}@SerialName(value = "{{{vendorExtensions.x-base-name-literal}}}") @@ -21,4 +21,4 @@ {{#deprecated}} @Deprecated(message = "This property is deprecated.") {{/deprecated}} - {{#multiplatform}}@SerialName(value = "{{{vendorExtensions.x-base-name-literal}}}") {{/multiplatform}}{{#isInherited}}override {{/isInherited}}{{>modelMutable}} {{{name}}}: {{#isArray}}{{#isList}}kotlin.collections.{{#modelMutable}}Mutable{{/modelMutable}}{{#uniqueItems}}Set{{/uniqueItems}}{{^uniqueItems}}List{{/uniqueItems}}{{/isList}}{{^isList}}kotlin.Array{{/isList}}<{{^items.isEnum}}{{^items.isPrimitiveType}}{{^items.isModel}}{{#kotlinx_serialization}}@Contextual {{/kotlinx_serialization}}{{/items.isModel}}{{/items.isPrimitiveType}}{{{items.dataType}}}{{/items.isEnum}}{{#items.isEnum}}{{classname}}.{{{nameInPascalCase}}}{{/items.isEnum}}>{{/isArray}}{{^isEnum}}{{^isArray}}{{{dataType}}}{{/isArray}}{{/isEnum}}{{#isEnum}}{{^isArray}}{{classname}}.{{{nameInPascalCase}}}{{/isArray}}{{/isEnum}}? = {{^defaultValue}}null{{/defaultValue}}{{#defaultValue}}{{^isNumber}}{{{defaultValue}}}{{/isNumber}}{{#isNumber}}{{^multiplatform}}{{{dataType}}}("{{{defaultValue}}}"){{/multiplatform}}{{#multiplatform}}({{{defaultValue}}}).toDouble(){{/multiplatform}}{{/isNumber}}{{/defaultValue}} \ No newline at end of file + {{#multiplatform}}@SerialName(value = "{{{vendorExtensions.x-base-name-literal}}}") {{/multiplatform}}{{#isInherited}}override {{/isInherited}}{{>modelMutable}} {{{name}}}: {{#isArray}}{{#isList}}kotlin.collections.{{#modelMutable}}Mutable{{/modelMutable}}{{#uniqueItems}}Set{{/uniqueItems}}{{^uniqueItems}}List{{/uniqueItems}}{{/isList}}{{^isList}}kotlin.Array{{/isList}}<{{^items.isEnum}}{{^items.isPrimitiveType}}{{^items.isModel}}{{#kotlinx_serialization}}@Contextual {{/kotlinx_serialization}}{{/items.isModel}}{{/items.isPrimitiveType}}{{{items.dataType}}}{{/items.isEnum}}{{#items.isEnum}}{{classname}}.{{{nameInPascalCase}}}{{/items.isEnum}}>{{/isArray}}{{^isEnum}}{{^isArray}}{{{dataType}}}{{/isArray}}{{/isEnum}}{{#isEnum}}{{^isArray}}{{classname}}.{{{nameInPascalCase}}}{{/isArray}}{{/isEnum}}? = {{^defaultValue}}null{{/defaultValue}}{{#defaultValue}}{{#isString}}{{^isEnum}}"{{#lambda.escapeInNormalString}}{{{unescapedDefaultValue}}}{{/lambda.escapeInNormalString}}"{{/isEnum}}{{#isEnum}}{{{defaultValue}}}{{/isEnum}}{{/isString}}{{^isString}}{{^isNumber}}{{{defaultValue}}}{{/isNumber}}{{#isNumber}}{{^multiplatform}}{{{dataType}}}("{{{defaultValue}}}"){{/multiplatform}}{{#multiplatform}}({{{defaultValue}}}).toDouble(){{/multiplatform}}{{/isNumber}}{{/isString}}{{/defaultValue}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/kotlin-client/data_class_req_var.mustache b/modules/openapi-generator/src/main/resources/kotlin-client/data_class_req_var.mustache index 0d9ec6067c5a..d64962ca840e 100644 --- a/modules/openapi-generator/src/main/resources/kotlin-client/data_class_req_var.mustache +++ b/modules/openapi-generator/src/main/resources/kotlin-client/data_class_req_var.mustache @@ -9,7 +9,7 @@ @SerializedName("{{{vendorExtensions.x-base-name-literal}}}") {{/gson}} {{#jackson}} - @get:JsonProperty("{{{vendorExtensions.x-base-name-literal}}}") + @get:JsonProperty("{{#lambda.escapeInNormalString}}{{{baseName}}}{{/lambda.escapeInNormalString}}") {{/jackson}} {{#kotlinx_serialization}} {{^isEnum}}{{^isArray}}{{^isPrimitiveType}}{{^isModel}}@Contextual {{/isModel}}{{/isPrimitiveType}}{{/isArray}}{{/isEnum}}@SerialName(value = "{{{vendorExtensions.x-base-name-literal}}}") @@ -21,4 +21,4 @@ {{#deprecated}} @Deprecated(message = "This property is deprecated.") {{/deprecated}} - {{#multiplatform}}@SerialName(value = "{{{vendorExtensions.x-base-name-literal}}}") @Required {{/multiplatform}}{{#isInherited}}override {{/isInherited}}{{>modelMutable}} {{{name}}}: {{#isArray}}{{#isList}}kotlin.collections.{{#modelMutable}}Mutable{{/modelMutable}}{{#uniqueItems}}Set{{/uniqueItems}}{{^uniqueItems}}List{{/uniqueItems}}{{/isList}}{{^isList}}kotlin.Array{{/isList}}<{{^items.isEnum}}{{^items.isPrimitiveType}}{{^items.isModel}}{{#kotlinx_serialization}}@Contextual {{/kotlinx_serialization}}{{/items.isModel}}{{/items.isPrimitiveType}}{{{items.dataType}}}{{/items.isEnum}}{{#items.isEnum}}{{classname}}.{{{nameInPascalCase}}}{{/items.isEnum}}>{{/isArray}}{{^isEnum}}{{^isArray}}{{{dataType}}}{{/isArray}}{{/isEnum}}{{#isEnum}}{{^isArray}}{{classname}}.{{{nameInPascalCase}}}{{/isArray}}{{/isEnum}}{{#isNullable}}?{{/isNullable}}{{#defaultValue}} = {{^isNumber}}{{{defaultValue}}}{{/isNumber}}{{#isNumber}}{{^multiplatform}}{{{dataType}}}("{{{defaultValue}}}"){{/multiplatform}}{{#multiplatform}}({{{defaultValue}}}).toDouble(){{/multiplatform}}{{/isNumber}}{{/defaultValue}} \ No newline at end of file + {{#multiplatform}}@SerialName(value = "{{{vendorExtensions.x-base-name-literal}}}") @Required {{/multiplatform}}{{#isInherited}}override {{/isInherited}}{{>modelMutable}} {{{name}}}: {{#isArray}}{{#isList}}kotlin.collections.{{#modelMutable}}Mutable{{/modelMutable}}{{#uniqueItems}}Set{{/uniqueItems}}{{^uniqueItems}}List{{/uniqueItems}}{{/isList}}{{^isList}}kotlin.Array{{/isList}}<{{^items.isEnum}}{{^items.isPrimitiveType}}{{^items.isModel}}{{#kotlinx_serialization}}@Contextual {{/kotlinx_serialization}}{{/items.isModel}}{{/items.isPrimitiveType}}{{{items.dataType}}}{{/items.isEnum}}{{#items.isEnum}}{{classname}}.{{{nameInPascalCase}}}{{/items.isEnum}}>{{/isArray}}{{^isEnum}}{{^isArray}}{{{dataType}}}{{/isArray}}{{/isEnum}}{{#isEnum}}{{^isArray}}{{classname}}.{{{nameInPascalCase}}}{{/isArray}}{{/isEnum}}{{#isNullable}}?{{/isNullable}}{{#defaultValue}} = {{#isString}}{{^isEnum}}"{{#lambda.escapeInNormalString}}{{{unescapedDefaultValue}}}{{/lambda.escapeInNormalString}}"{{/isEnum}}{{#isEnum}}{{{defaultValue}}}{{/isEnum}}{{/isString}}{{^isString}}{{^isNumber}}{{{defaultValue}}}{{/isNumber}}{{#isNumber}}{{^multiplatform}}{{{dataType}}}("{{{defaultValue}}}"){{/multiplatform}}{{#multiplatform}}({{{defaultValue}}}).toDouble(){{/multiplatform}}{{/isNumber}}{{/isString}}{{/defaultValue}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm-ktor/api.mustache b/modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm-ktor/api.mustache index 8b2dbf4a3cdd..14cd05ed1505 100644 --- a/modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm-ktor/api.mustache +++ b/modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm-ktor/api.mustache @@ -132,17 +132,17 @@ import com.fasterxml.jackson.databind.ObjectMapper val localVariableQuery = mutableMapOf>() {{#queryParams}} - {{{paramName}}}?.apply { localVariableQuery["{{baseName}}"] = {{#isContainer}}toMultiValue(this, "{{collectionFormat}}"){{/isContainer}}{{^isContainer}}listOf("${{{paramName}}}"){{/isContainer}} } + {{{paramName}}}?.apply { localVariableQuery["{{#lambda.escapeInNormalString}}{{baseName}}{{/lambda.escapeInNormalString}}"] = {{#isContainer}}toMultiValue(this, "{{collectionFormat}}"){{/isContainer}}{{^isContainer}}listOf("${{{paramName}}}"){{/isContainer}} } {{/queryParams}} val localVariableHeaders = mutableMapOf() {{#headerParams}} - {{{paramName}}}?.apply { localVariableHeaders["{{baseName}}"] = {{#isContainer}}this.joinToString(separator = collectionDelimiter("{{collectionFormat}}")){{/isContainer}}{{^isContainer}}this.toString(){{/isContainer}} } + {{{paramName}}}?.apply { localVariableHeaders["{{#lambda.escapeInNormalString}}{{baseName}}{{/lambda.escapeInNormalString}}"] = {{#isContainer}}this.joinToString(separator = collectionDelimiter("{{collectionFormat}}")){{/isContainer}}{{^isContainer}}this.toString(){{/isContainer}} } {{/headerParams}} val localVariableConfig = RequestConfig( RequestMethod.{{httpMethod}}, - "{{{path}}}"{{#pathParams}}.replace("{" + "{{baseName}}" + "}", "${{{paramName}}}"){{/pathParams}}, + "{{#lambda.escapeInNormalString}}{{{path}}}{{/lambda.escapeInNormalString}}"{{#pathParams}}.replace("{" + "{{#lambda.escapeInNormalString}}{{baseName}}{{/lambda.escapeInNormalString}}" + "}", "${{{paramName}}}"){{/pathParams}}, query = localVariableQuery, headers = localVariableHeaders, requiresAuthentication = {{#hasAuthMethods}}true{{/hasAuthMethods}}{{^hasAuthMethods}}false{{/hasAuthMethods}}, diff --git a/modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm-okhttp/api.mustache b/modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm-okhttp/api.mustache index 8727a9a79b6f..8dd766d85280 100644 --- a/modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm-okhttp/api.mustache +++ b/modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm-okhttp/api.mustache @@ -142,7 +142,7 @@ import {{packageName}}.infrastructure.Serializer {{#isDeprecated}} @Deprecated(message = "This operation is deprecated.") {{/isDeprecated}} - {{^nonPublicApi}}{{#explicitApi}}public {{/explicitApi}}{{/nonPublicApi}}{{^doNotUseRxAndCoroutines}}{{#useCoroutines}}suspend {{/useCoroutines}}{{/doNotUseRxAndCoroutines}}fun {{operationId}}({{#allParams}}{{{paramName}}}: {{#isEnum}}{{#isContainer}}kotlin.collections.List<{{enumName}}{{operationIdCamelCase}}>{{/isContainer}}{{^isContainer}}{{enumName}}{{operationIdCamelCase}}{{/isContainer}}{{/isEnum}}{{^isEnum}}{{{dataType}}}{{/isEnum}}{{#required}}{{#defaultValue}} = {{^isNumber}}{{#isEnum}}{{enumName}}{{operationIdCamelCase}}.{{&enumDefaultValue}}{{/isEnum}}{{^isEnum}}{{{defaultValue}}}{{/isEnum}}{{/isNumber}}{{#isNumber}}{{{dataType}}}("{{{defaultValue}}}"){{/isNumber}}{{/defaultValue}}{{/required}}{{^required}}?{{#defaultValue}} = {{^isNumber}}{{#isEnum}}{{enumName}}{{operationIdCamelCase}}.{{&enumDefaultValue}}{{/isEnum}}{{^isEnum}}{{{defaultValue}}}{{/isEnum}}{{/isNumber}}{{#isNumber}}{{{dataType}}}("{{{defaultValue}}}"){{/isNumber}}{{/defaultValue}}{{^defaultValue}} = null{{/defaultValue}}{{/required}}{{^-last}}, {{/-last}}{{/allParams}}) : {{#returnType}}{{{returnType}}}{{#nullableReturnType}}?{{/nullableReturnType}}{{/returnType}}{{^returnType}}Unit{{/returnType}}{{^doNotUseRxAndCoroutines}}{{#useCoroutines}} = withContext(Dispatchers.IO){{/useCoroutines}}{{/doNotUseRxAndCoroutines}} { + {{^nonPublicApi}}{{#explicitApi}}public {{/explicitApi}}{{/nonPublicApi}}{{^doNotUseRxAndCoroutines}}{{#useCoroutines}}suspend {{/useCoroutines}}{{/doNotUseRxAndCoroutines}}fun {{operationId}}({{#allParams}}{{{paramName}}}: {{#isEnum}}{{#isContainer}}kotlin.collections.List<{{enumName}}{{operationIdCamelCase}}>{{/isContainer}}{{^isContainer}}{{enumName}}{{operationIdCamelCase}}{{/isContainer}}{{/isEnum}}{{^isEnum}}{{{dataType}}}{{/isEnum}}{{#required}}{{#defaultValue}} = {{^isNumber}}{{#isEnum}}{{enumName}}{{operationIdCamelCase}}.{{&enumDefaultValue}}{{/isEnum}}{{^isEnum}}{{#isString}}"{{#lambda.escapeInNormalString}}{{{unescapedDefaultValue}}}{{/lambda.escapeInNormalString}}"{{/isString}}{{^isString}}{{{defaultValue}}}{{/isString}}{{/isEnum}}{{/isNumber}}{{#isNumber}}{{{dataType}}}("{{{defaultValue}}}"){{/isNumber}}{{/defaultValue}}{{/required}}{{^required}}?{{#defaultValue}} = {{^isNumber}}{{#isEnum}}{{enumName}}{{operationIdCamelCase}}.{{&enumDefaultValue}}{{/isEnum}}{{^isEnum}}{{#isString}}"{{#lambda.escapeInNormalString}}{{{unescapedDefaultValue}}}{{/lambda.escapeInNormalString}}"{{/isString}}{{^isString}}{{{defaultValue}}}{{/isString}}{{/isEnum}}{{/isNumber}}{{#isNumber}}{{{dataType}}}("{{{defaultValue}}}"){{/isNumber}}{{/defaultValue}}{{^defaultValue}} = null{{/defaultValue}}{{/required}}{{^-last}}, {{/-last}}{{/allParams}}) : {{#returnType}}{{{returnType}}}{{#nullableReturnType}}?{{/nullableReturnType}}{{/returnType}}{{^returnType}}Unit{{/returnType}}{{^doNotUseRxAndCoroutines}}{{#useCoroutines}} = withContext(Dispatchers.IO){{/useCoroutines}}{{/doNotUseRxAndCoroutines}} { {{#isDeprecated}} @Suppress("DEPRECATION") {{/isDeprecated}} @@ -264,7 +264,7 @@ import {{packageName}}.infrastructure.Serializer return RequestConfig( method = RequestMethod.{{httpMethod}}, - path = "{{{path}}}"{{#pathParams}}.replace("{"+"{{#lambda.escapeDollar}}{{baseName}}{{/lambda.escapeDollar}}"+"}", encodeURIComponent({{#isContainer}}{{paramName}}.joinToString(","){{/isContainer}}{{^isContainer}}{{{paramName}}}{{#isEnum}}{{^required}}?{{/required}}.value{{/isEnum}}.toString(){{/isContainer}})){{/pathParams}}, + path = "{{#lambda.escapeInNormalString}}{{{path}}}{{/lambda.escapeInNormalString}}"{{#pathParams}}.replace("{"+"{{#lambda.escapeDollar}}{{baseName}}{{/lambda.escapeDollar}}"+"}", encodeURIComponent({{#isContainer}}{{paramName}}.joinToString(","){{/isContainer}}{{^isContainer}}{{{paramName}}}{{#isEnum}}{{^required}}?{{/required}}.value{{/isEnum}}.toString(){{/isContainer}})){{/pathParams}}, query = localVariableQuery, headers = localVariableHeaders, requiresAuthentication = {{#hasAuthMethods}}true{{/hasAuthMethods}}{{^hasAuthMethods}}false{{/hasAuthMethods}}, diff --git a/modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm-retrofit2/api.mustache b/modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm-retrofit2/api.mustache index 9cd7ef3fea02..614d09fe1884 100644 --- a/modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm-retrofit2/api.mustache +++ b/modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm-retrofit2/api.mustache @@ -155,7 +155,7 @@ import okhttp3.MultipartBody {{/-first}} {{/prioritizedContentTypes}} {{/formParams}} - @{{httpMethod}}("{{{path}}}") + @{{httpMethod}}("{{#lambda.escapeInNormalString}}{{{path}}}{{/lambda.escapeInNormalString}}") {{^nonPublicApi}}{{#explicitApi}}public {{/explicitApi}}{{/nonPublicApi}}{{^doNotUseRxAndCoroutines}}{{#useCoroutines}}suspend {{/useCoroutines}}{{/doNotUseRxAndCoroutines}}fun {{operationId}}({{^allParams}}){{/allParams}}{{#allParams}}{{>queryParams}}{{>pathParams}}{{>headerParams}}{{>bodyParams}}{{>formParams}}{{^-last}}, {{/-last}}{{#-last}}){{/-last}}{{/allParams}}{{#returnType}}: {{/returnType}}{{^returnType}}{{#useResponseAsReturnType}}: {{/useResponseAsReturnType}}{{/returnType}}{{^doNotUseRxAndCoroutines}}{{#useRxJava}}Observable<{{#isResponseFile}}ResponseBody{{/isResponseFile}}{{^isResponseFile}}{{{returnType}}}{{^returnType}}Unit{{/returnType}}{{/isResponseFile}}>{{/useRxJava}}{{#useRxJava2}}{{#returnType}}Single<{{#isResponseFile}}ResponseBody{{/isResponseFile}}{{^isResponseFile}}{{{returnType}}}{{/isResponseFile}}>{{/returnType}}{{^returnType}}Completable{{/returnType}}{{/useRxJava2}}{{#useRxJava3}}{{#returnType}}Single<{{#isResponseFile}}ResponseBody{{/isResponseFile}}{{^isResponseFile}}{{{returnType}}}{{/isResponseFile}}>{{/returnType}}{{^returnType}}Completable{{/returnType}}{{/useRxJava3}}{{#useCoroutines}}{{#useResponseAsReturnType}}Response<{{/useResponseAsReturnType}}{{#isResponseFile}}ResponseBody{{/isResponseFile}}{{^isResponseFile}}{{{returnType}}}{{^returnType}}{{#useResponseAsReturnType}}Unit{{/useResponseAsReturnType}}{{/returnType}}{{/isResponseFile}}{{#useResponseAsReturnType}}>{{/useResponseAsReturnType}}{{/useCoroutines}}{{/doNotUseRxAndCoroutines}}{{#doNotUseRxAndCoroutines}}Call<{{#isResponseFile}}ResponseBody{{/isResponseFile}}{{^isResponseFile}}{{{returnType}}}{{^returnType}}Unit{{/returnType}}{{/isResponseFile}}>{{/doNotUseRxAndCoroutines}} {{/operation}} diff --git a/modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm-retrofit2/api_doc.mustache b/modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm-retrofit2/api_doc.mustache index f764206df126..0b76cfe90b66 100644 --- a/modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm-retrofit2/api_doc.mustache +++ b/modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm-retrofit2/api_doc.mustache @@ -1,19 +1,19 @@ # {{classname}}{{#description}} -{{.}}{{/description}} +{{#lambda.escapeMarkdown}}{{{.}}}{{/lambda.escapeMarkdown}}{{/description}} All URIs are relative to *{{basePath}}* | Method | HTTP request | Description | | ------------- | ------------- | ------------- | -{{#operations}}{{#operation}}| [**{{operationId}}**]({{classname}}.md#{{operationId}}) | **{{httpMethod}}** {{path}} | {{summary}} | +{{#operations}}{{#operation}}| [**{{operationId}}**]({{classname}}.md#{{operationId}}) | **{{httpMethod}}** {{path}} | {{#lambda.escapeMarkdown}}{{{unescapedSummary}}}{{/lambda.escapeMarkdown}} | {{/operation}}{{/operations}} {{#operations}} {{#operation}} -{{summary}}{{#notes}} +{{#lambda.escapeMarkdown}}{{{unescapedSummary}}}{{/lambda.escapeMarkdown}}{{#unescapedNotes}} -{{.}}{{/notes}} +{{#lambda.escapeMarkdown}}{{{unescapedNotes}}}{{/lambda.escapeMarkdown}}{{/unescapedNotes}} ### Example ```kotlin @@ -35,7 +35,7 @@ apiClient.setBearerToken("TOKEN") {{/authMethods}} val webService = apiClient.createWebservice({{{classname}}}::class.java) {{#allParams}} -val {{{paramName}}} : {{{dataType}}} = {{{example}}} // {{{dataType}}} | {{{description}}} +val {{{paramName}}} : {{{dataType}}} = {{{example}}} // {{{dataType}}} | {{#lambda.collapseNewlines}}{{{unescapedDescription}}}{{/lambda.collapseNewlines}} {{/allParams}} {{#useCoroutines}} @@ -56,7 +56,7 @@ This endpoint does not need any parameter. | Name | Type | Description | Notes | | ------------- | ------------- | ------------- | ------------- | {{/-last}} -| **{{paramName}}** | {{#isPrimitiveType}}**{{dataType}}**{{/isPrimitiveType}}{{^isPrimitiveType}}{{#isFile}}**{{dataType}}**{{/isFile}}{{^isFile}}{{#generateModelDocs}}[**{{dataType}}**]({{baseType}}.md){{/generateModelDocs}}{{^generateModelDocs}}**{{dataType}}**{{/generateModelDocs}}{{/isFile}}{{/isPrimitiveType}}| {{description}} |{{^required}} [optional]{{/required}}{{#defaultValue}} [default to {{.}}]{{/defaultValue}}{{#allowableValues}} [enum: {{#values}}{{{.}}}{{^-last}}, {{/-last}}{{/values}}]{{/allowableValues}} | +| **{{paramName}}** | {{#isPrimitiveType}}**{{dataType}}**{{/isPrimitiveType}}{{^isPrimitiveType}}{{#isFile}}**{{dataType}}**{{/isFile}}{{^isFile}}{{#generateModelDocs}}[**{{dataType}}**]({{baseType}}.md){{/generateModelDocs}}{{^generateModelDocs}}**{{dataType}}**{{/generateModelDocs}}{{/isFile}}{{/isPrimitiveType}}| {{#lambda.escapeMarkdown}}{{{unescapedDescription}}}{{/lambda.escapeMarkdown}} |{{^required}} [optional]{{/required}}{{#defaultValue}} [default to {{#lambda.escapeMarkdown}}{{{.}}}{{/lambda.escapeMarkdown}}]{{/defaultValue}}{{#allowableValues}} [enum: {{#values}}{{#lambda.escapeMarkdown}}{{{.}}}{{/lambda.escapeMarkdown}}{{^-last}}, {{/-last}}{{/values}}]{{/allowableValues}} | {{/allParams}} ### Return type diff --git a/modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm-retrofit2/explodedQueryParam.mustache b/modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm-retrofit2/explodedQueryParam.mustache index 3aaa4e67fbf4..1a266486f8aa 100644 --- a/modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm-retrofit2/explodedQueryParam.mustache +++ b/modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm-retrofit2/explodedQueryParam.mustache @@ -1 +1 @@ -@Query("{{baseName}}") {{{baseName}}}: {{#collectionFormat}}{{#isCollectionFormatMulti}}{{{dataType}}}{{/isCollectionFormatMulti}}{{^isCollectionFormatMulti}}{{{collectionFormat.toUpperCase}}}Params{{/isCollectionFormatMulti}}{{/collectionFormat}}{{^collectionFormat}}{{{dataType}}}{{/collectionFormat}}{{#required}}{{#defaultValue}} = {{^isNumber}}{{{defaultValue}}}{{/isNumber}}{{#isNumber}}{{{dataType}}}("{{{defaultValue}}}"){{/isNumber}}{{/defaultValue}}{{/required}}{{^required}}?{{#defaultValue}} = {{^isNumber}}{{{defaultValue}}}{{/isNumber}}{{#isNumber}}{{{dataType}}}("{{{defaultValue}}}"){{/isNumber}}{{/defaultValue}}{{^defaultValue}} = null{{/defaultValue}}{{/required}} \ No newline at end of file +@Query("{{#lambda.escapeInNormalString}}{{baseName}}{{/lambda.escapeInNormalString}}") {{{baseName}}}: {{#collectionFormat}}{{#isCollectionFormatMulti}}{{{dataType}}}{{/isCollectionFormatMulti}}{{^isCollectionFormatMulti}}{{{collectionFormat.toUpperCase}}}Params{{/isCollectionFormatMulti}}{{/collectionFormat}}{{^collectionFormat}}{{{dataType}}}{{/collectionFormat}}{{#required}}{{#defaultValue}} = {{^isNumber}}{{{defaultValue}}}{{/isNumber}}{{#isNumber}}{{{dataType}}}("{{{defaultValue}}}"){{/isNumber}}{{/defaultValue}}{{/required}}{{^required}}?{{#defaultValue}} = {{^isNumber}}{{{defaultValue}}}{{/isNumber}}{{#isNumber}}{{{dataType}}}("{{{defaultValue}}}"){{/isNumber}}{{/defaultValue}}{{^defaultValue}} = null{{/defaultValue}}{{/required}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm-retrofit2/formParams.mustache b/modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm-retrofit2/formParams.mustache index fe5c9db69053..bb12b0dd5116 100644 --- a/modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm-retrofit2/formParams.mustache +++ b/modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm-retrofit2/formParams.mustache @@ -1 +1 @@ -{{#isFormParam}}{{^isFile}}{{#isMultipart}}@Part{{/isMultipart}}{{^isMultipart}}@Field{{/isMultipart}}("{{baseName}}") {{{paramName}}}: {{{dataType}}}{{#required}}{{#defaultValue}} = {{^isNumber}}{{{defaultValue}}}{{/isNumber}}{{#isNumber}}{{{dataType}}}("{{{defaultValue}}}"){{/isNumber}}{{/defaultValue}}{{/required}}{{^required}}?{{#defaultValue}} = {{^isNumber}}{{{defaultValue}}}{{/isNumber}}{{#isNumber}}{{{dataType}}}("{{{defaultValue}}}"){{/isNumber}}{{/defaultValue}}{{^defaultValue}} = null{{/defaultValue}}{{/required}}{{/isFile}}{{#isFile}}{{#isMultipart}}@Part{{/isMultipart}}{{^isMultipart}}@Field("{{baseName}}"){{/isMultipart}} {{{paramName}}}: {{#isCollectionFormatMulti}}List<{{/isCollectionFormatMulti}}MultipartBody.Part{{#isCollectionFormatMulti}}>{{/isCollectionFormatMulti}}{{^required}}? = null{{/required}}{{/isFile}}{{/isFormParam}} \ No newline at end of file +{{#isFormParam}}{{^isFile}}{{#isMultipart}}@Part{{/isMultipart}}{{^isMultipart}}@Field{{/isMultipart}}("{{#lambda.escapeInNormalString}}{{baseName}}{{/lambda.escapeInNormalString}}") {{{paramName}}}: {{{dataType}}}{{#required}}{{#defaultValue}} = {{^isNumber}}{{#isString}}{{^allowableValues}}"{{#lambda.escapeInNormalString}}{{{unescapedDefaultValue}}}{{/lambda.escapeInNormalString}}"{{/allowableValues}}{{#allowableValues}}{{{defaultValue}}}{{/allowableValues}}{{/isString}}{{^isString}}{{{defaultValue}}}{{/isString}}{{/isNumber}}{{#isNumber}}{{{dataType}}}("{{{defaultValue}}}"){{/isNumber}}{{/defaultValue}}{{/required}}{{^required}}?{{#defaultValue}} = {{^isNumber}}{{#isString}}{{^allowableValues}}"{{#lambda.escapeInNormalString}}{{{unescapedDefaultValue}}}{{/lambda.escapeInNormalString}}"{{/allowableValues}}{{#allowableValues}}{{{defaultValue}}}{{/allowableValues}}{{/isString}}{{^isString}}{{{defaultValue}}}{{/isString}}{{/isNumber}}{{#isNumber}}{{{dataType}}}("{{{defaultValue}}}"){{/isNumber}}{{/defaultValue}}{{^defaultValue}} = null{{/defaultValue}}{{/required}}{{/isFile}}{{#isFile}}{{#isMultipart}}@Part{{/isMultipart}}{{^isMultipart}}@Field("{{#lambda.escapeInNormalString}}{{baseName}}{{/lambda.escapeInNormalString}}"){{/isMultipart}} {{{paramName}}}: {{#isCollectionFormatMulti}}List<{{/isCollectionFormatMulti}}MultipartBody.Part{{#isCollectionFormatMulti}}>{{/isCollectionFormatMulti}}{{^required}}? = null{{/required}}{{/isFile}}{{/isFormParam}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm-retrofit2/headerParams.mustache b/modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm-retrofit2/headerParams.mustache index eaf1e7c3bf60..3e10dde21134 100644 --- a/modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm-retrofit2/headerParams.mustache +++ b/modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm-retrofit2/headerParams.mustache @@ -1 +1 @@ -{{#isHeaderParam}}@Header("{{baseName}}") {{{paramName}}}: {{#isEnum}}{{enumName}}{{operationIdCamelCase}}{{/isEnum}}{{^isEnum}}{{{dataType}}}{{/isEnum}}{{#required}}{{#defaultValue}} = {{^isNumber}}{{#isEnum}}{{enumName}}{{operationIdCamelCase}}.{{&enumDefaultValue}}{{/isEnum}}{{^isEnum}}{{{defaultValue}}}{{/isEnum}}{{/isNumber}}{{#isNumber}}{{{dataType}}}("{{{defaultValue}}}"){{/isNumber}}{{/defaultValue}}{{/required}}{{^required}}?{{#defaultValue}} = {{^isNumber}}{{#isEnum}}{{enumName}}{{operationIdCamelCase}}.{{&enumDefaultValue}}{{/isEnum}}{{^isEnum}}{{{defaultValue}}}{{/isEnum}}{{/isNumber}}{{#isNumber}}{{{dataType}}}("{{{defaultValue}}}"){{/isNumber}}{{/defaultValue}}{{^defaultValue}} = null{{/defaultValue}}{{/required}}{{/isHeaderParam}} \ No newline at end of file +{{#isHeaderParam}}@Header("{{#lambda.escapeInNormalString}}{{baseName}}{{/lambda.escapeInNormalString}}") {{{paramName}}}: {{#isEnum}}{{enumName}}{{operationIdCamelCase}}{{/isEnum}}{{^isEnum}}{{{dataType}}}{{/isEnum}}{{#required}}{{#defaultValue}} = {{^isNumber}}{{#isEnum}}{{enumName}}{{operationIdCamelCase}}.{{&enumDefaultValue}}{{/isEnum}}{{^isEnum}}{{#isString}}{{^allowableValues}}"{{#lambda.escapeInNormalString}}{{{unescapedDefaultValue}}}{{/lambda.escapeInNormalString}}"{{/allowableValues}}{{#allowableValues}}{{{defaultValue}}}{{/allowableValues}}{{/isString}}{{^isString}}{{{defaultValue}}}{{/isString}}{{/isEnum}}{{/isNumber}}{{#isNumber}}{{{dataType}}}("{{{defaultValue}}}"){{/isNumber}}{{/defaultValue}}{{/required}}{{^required}}?{{#defaultValue}} = {{^isNumber}}{{#isEnum}}{{enumName}}{{operationIdCamelCase}}.{{&enumDefaultValue}}{{/isEnum}}{{^isEnum}}{{#isString}}{{^allowableValues}}"{{#lambda.escapeInNormalString}}{{{unescapedDefaultValue}}}{{/lambda.escapeInNormalString}}"{{/allowableValues}}{{#allowableValues}}{{{defaultValue}}}{{/allowableValues}}{{/isString}}{{^isString}}{{{defaultValue}}}{{/isString}}{{/isEnum}}{{/isNumber}}{{#isNumber}}{{{dataType}}}("{{{defaultValue}}}"){{/isNumber}}{{/defaultValue}}{{^defaultValue}} = null{{/defaultValue}}{{/required}}{{/isHeaderParam}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm-retrofit2/paramJavadoc.mustache b/modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm-retrofit2/paramJavadoc.mustache index fe821c41b4df..24146e3603a4 100644 --- a/modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm-retrofit2/paramJavadoc.mustache +++ b/modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm-retrofit2/paramJavadoc.mustache @@ -1,5 +1,5 @@ {{#allParams}}{{#isDeepObject}} - * @param {{{paramName}}} {{description}}{{^required}} (optional{{#defaultValue}}, default to {{{.}}}{{/defaultValue}}){{/required}}{{#required}}{{#defaultValue}} (default to {{{.}}}){{/defaultValue}}{{/required}}{{/isDeepObject}}{{^isDeepObject}}{{#isExplode}}{{#hasVars}}{{#vars}} - * @param {{{baseName}}} {{description}}{{^required}} (optional{{#defaultValue}}, default to {{{.}}}{{/defaultValue}}){{/required}}{{#required}}{{#defaultValue}} (default to {{{.}}}){{/defaultValue}}{{/required}}{{/vars}}{{/hasVars}}{{^hasVars}} - * @param {{{paramName}}} {{description}}{{^required}} (optional{{#defaultValue}}, default to {{{.}}}{{/defaultValue}}){{/required}}{{#required}}{{#defaultValue}} (default to {{{.}}}){{/defaultValue}}{{/required}}{{/hasVars}}{{/isExplode}}{{^isExplode}} - * @param {{{paramName}}} {{description}}{{^required}} (optional{{#defaultValue}}, default to {{{.}}}{{/defaultValue}}){{/required}}{{#required}}{{#defaultValue}} (default to {{{.}}}){{/defaultValue}}{{/required}}{{/isExplode}}{{/isDeepObject}}{{/allParams}} \ No newline at end of file + * @param {{{paramName}}} {{description}}{{^required}} (optional{{#defaultValue}}, default to {{#lambda.escapeMarkdown}}{{{.}}}{{/lambda.escapeMarkdown}}{{/defaultValue}}){{/required}}{{#required}}{{#defaultValue}} (default to {{#lambda.escapeMarkdown}}{{{.}}}{{/lambda.escapeMarkdown}}){{/defaultValue}}{{/required}}{{/isDeepObject}}{{^isDeepObject}}{{#isExplode}}{{#hasVars}}{{#vars}} + * @param {{{baseName}}} {{description}}{{^required}} (optional{{#defaultValue}}, default to {{#lambda.escapeMarkdown}}{{{.}}}{{/lambda.escapeMarkdown}}{{/defaultValue}}){{/required}}{{#required}}{{#defaultValue}} (default to {{#lambda.escapeMarkdown}}{{{.}}}{{/lambda.escapeMarkdown}}){{/defaultValue}}{{/required}}{{/vars}}{{/hasVars}}{{^hasVars}} + * @param {{{paramName}}} {{description}}{{^required}} (optional{{#defaultValue}}, default to {{#lambda.escapeMarkdown}}{{{.}}}{{/lambda.escapeMarkdown}}{{/defaultValue}}){{/required}}{{#required}}{{#defaultValue}} (default to {{#lambda.escapeMarkdown}}{{{.}}}{{/lambda.escapeMarkdown}}){{/defaultValue}}{{/required}}{{/hasVars}}{{/isExplode}}{{^isExplode}} + * @param {{{paramName}}} {{description}}{{^required}} (optional{{#defaultValue}}, default to {{#lambda.escapeMarkdown}}{{{.}}}{{/lambda.escapeMarkdown}}{{/defaultValue}}){{/required}}{{#required}}{{#defaultValue}} (default to {{#lambda.escapeMarkdown}}{{{.}}}{{/lambda.escapeMarkdown}}){{/defaultValue}}{{/required}}{{/isExplode}}{{/isDeepObject}}{{/allParams}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm-retrofit2/pathParams.mustache b/modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm-retrofit2/pathParams.mustache index 685c514e6a90..5fa650b7934c 100644 --- a/modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm-retrofit2/pathParams.mustache +++ b/modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm-retrofit2/pathParams.mustache @@ -1 +1 @@ -{{#isPathParam}}@Path("{{baseName}}") {{{paramName}}}: {{{dataType}}}{{#required}}{{#defaultValue}} = {{^isNumber}}{{{defaultValue}}}{{/isNumber}}{{#isNumber}}{{{dataType}}}("{{{defaultValue}}}"){{/isNumber}}{{/defaultValue}}{{/required}}{{^required}}?{{#defaultValue}} = {{^isNumber}}{{{defaultValue}}}{{/isNumber}}{{#isNumber}}{{{dataType}}}("{{{defaultValue}}}"){{/isNumber}}{{/defaultValue}}{{^defaultValue}} = null{{/defaultValue}}{{/required}}{{/isPathParam}} \ No newline at end of file +{{#isPathParam}}@Path("{{#lambda.escapeInNormalString}}{{baseName}}{{/lambda.escapeInNormalString}}") {{{paramName}}}: {{{dataType}}}{{#required}}{{#defaultValue}} = {{^isNumber}}{{#isString}}{{^allowableValues}}"{{#lambda.escapeInNormalString}}{{{unescapedDefaultValue}}}{{/lambda.escapeInNormalString}}"{{/allowableValues}}{{#allowableValues}}{{{defaultValue}}}{{/allowableValues}}{{/isString}}{{^isString}}{{{defaultValue}}}{{/isString}}{{/isNumber}}{{#isNumber}}{{{dataType}}}("{{{defaultValue}}}"){{/isNumber}}{{/defaultValue}}{{/required}}{{^required}}?{{#defaultValue}} = {{^isNumber}}{{#isString}}{{^allowableValues}}"{{#lambda.escapeInNormalString}}{{{unescapedDefaultValue}}}{{/lambda.escapeInNormalString}}"{{/allowableValues}}{{#allowableValues}}{{{defaultValue}}}{{/allowableValues}}{{/isString}}{{^isString}}{{{defaultValue}}}{{/isString}}{{/isNumber}}{{#isNumber}}{{{dataType}}}("{{{defaultValue}}}"){{/isNumber}}{{/defaultValue}}{{^defaultValue}} = null{{/defaultValue}}{{/required}}{{/isPathParam}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm-retrofit2/queryParam.mustache b/modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm-retrofit2/queryParam.mustache index e5c9833fb8d5..1d3edfd936c1 100644 --- a/modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm-retrofit2/queryParam.mustache +++ b/modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm-retrofit2/queryParam.mustache @@ -1 +1 @@ -@Query("{{baseName}}") {{{paramName}}}: {{#collectionFormat}}{{#isCollectionFormatMulti}}@JvmSuppressWildcards {{{dataType}}}{{/isCollectionFormatMulti}}{{^isCollectionFormatMulti}}{{{collectionFormat.toUpperCase}}}Params{{/isCollectionFormatMulti}}{{/collectionFormat}}{{^collectionFormat}}{{#isEnum}}{{enumName}}{{operationIdCamelCase}}{{/isEnum}}{{^isEnum}}{{{dataType}}}{{/isEnum}}{{/collectionFormat}}{{#required}}{{#defaultValue}} = {{^isNumber}}{{#isEnum}}{{enumName}}{{operationIdCamelCase}}.{{&enumDefaultValue}}{{/isEnum}}{{^isEnum}}{{{defaultValue}}}{{/isEnum}}{{/isNumber}}{{#isNumber}}{{{dataType}}}("{{{defaultValue}}}"){{/isNumber}}{{/defaultValue}}{{/required}}{{^required}}?{{#defaultValue}} = {{^isNumber}}{{#isEnum}}{{enumName}}{{operationIdCamelCase}}.{{&enumDefaultValue}}{{/isEnum}}{{^isEnum}}{{{defaultValue}}}{{/isEnum}}{{/isNumber}}{{#isNumber}}{{{dataType}}}("{{{defaultValue}}}"){{/isNumber}}{{/defaultValue}}{{^defaultValue}} = null{{/defaultValue}}{{/required}} \ No newline at end of file +@Query("{{#lambda.escapeInNormalString}}{{baseName}}{{/lambda.escapeInNormalString}}") {{{paramName}}}: {{#collectionFormat}}{{#isCollectionFormatMulti}}@JvmSuppressWildcards {{{dataType}}}{{/isCollectionFormatMulti}}{{^isCollectionFormatMulti}}{{{collectionFormat.toUpperCase}}}Params{{/isCollectionFormatMulti}}{{/collectionFormat}}{{^collectionFormat}}{{#isEnum}}{{enumName}}{{operationIdCamelCase}}{{/isEnum}}{{^isEnum}}{{{dataType}}}{{/isEnum}}{{/collectionFormat}}{{#required}}{{#defaultValue}} = {{^isNumber}}{{#isEnum}}{{enumName}}{{operationIdCamelCase}}.{{&enumDefaultValue}}{{/isEnum}}{{^isEnum}}{{#isString}}{{^allowableValues}}"{{#lambda.escapeInNormalString}}{{{unescapedDefaultValue}}}{{/lambda.escapeInNormalString}}"{{/allowableValues}}{{#allowableValues}}{{{defaultValue}}}{{/allowableValues}}{{/isString}}{{^isString}}{{{defaultValue}}}{{/isString}}{{/isEnum}}{{/isNumber}}{{#isNumber}}{{{dataType}}}("{{{defaultValue}}}"){{/isNumber}}{{/defaultValue}}{{/required}}{{^required}}?{{#defaultValue}} = {{^isNumber}}{{#isEnum}}{{enumName}}{{operationIdCamelCase}}.{{&enumDefaultValue}}{{/isEnum}}{{^isEnum}}{{#isString}}{{^allowableValues}}"{{#lambda.escapeInNormalString}}{{{unescapedDefaultValue}}}{{/lambda.escapeInNormalString}}"{{/allowableValues}}{{#allowableValues}}{{{defaultValue}}}{{/allowableValues}}{{/isString}}{{^isString}}{{{defaultValue}}}{{/isString}}{{/isEnum}}{{/isNumber}}{{#isNumber}}{{{dataType}}}("{{{defaultValue}}}"){{/isNumber}}{{/defaultValue}}{{^defaultValue}} = null{{/defaultValue}}{{/required}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm-spring-restclient/api.mustache b/modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm-spring-restclient/api.mustache index dc90d004dbdc..c2b25ca3cd0a 100644 --- a/modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm-spring-restclient/api.mustache +++ b/modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm-spring-restclient/api.mustache @@ -101,17 +101,17 @@ import {{packageName}}.infrastructure.* {{#queryParams}} {{^required}} if ({{{paramName}}} != null) { - put("{{baseName}}", {{#isContainer}}toMultiValue({{{paramName}}}.toList(), "{{collectionFormat}}"){{/isContainer}}{{^isContainer}}listOf({{#isDateTime}}parseDateToQueryString<{{{dataType}}}>({{{paramName}}}){{/isDateTime}}{{#isDate}}parseDateToQueryString<{{{dataType}}}>({{{paramName}}}){{/isDate}}{{^isDateTime}}{{^isDate}}{{{paramName}}}.toString(){{/isDate}}{{/isDateTime}}){{/isContainer}}) + put("{{#lambda.escapeInNormalString}}{{baseName}}{{/lambda.escapeInNormalString}}", {{#isContainer}}toMultiValue({{{paramName}}}.toList(), "{{collectionFormat}}"){{/isContainer}}{{^isContainer}}listOf({{#isDateTime}}parseDateToQueryString<{{{dataType}}}>({{{paramName}}}){{/isDateTime}}{{#isDate}}parseDateToQueryString<{{{dataType}}}>({{{paramName}}}){{/isDate}}{{^isDateTime}}{{^isDate}}{{{paramName}}}.toString(){{/isDate}}{{/isDateTime}}){{/isContainer}}) } {{/required}} {{#required}} {{#isNullable}} if ({{{paramName}}} != null) { - put("{{baseName}}", {{#isContainer}}toMultiValue({{{paramName}}}.toList(), "{{collectionFormat}}"){{/isContainer}}{{^isContainer}}listOf({{#isDateTime}}parseDateToQueryString<{{{dataType}}}>({{{paramName}}}){{/isDateTime}}{{#isDate}}parseDateToQueryString<{{{dataType}}}>({{{paramName}}}){{/isDate}}{{^isDateTime}}{{^isDate}}{{{paramName}}}.toString(){{/isDate}}{{/isDateTime}}){{/isContainer}}) + put("{{#lambda.escapeInNormalString}}{{baseName}}{{/lambda.escapeInNormalString}}", {{#isContainer}}toMultiValue({{{paramName}}}.toList(), "{{collectionFormat}}"){{/isContainer}}{{^isContainer}}listOf({{#isDateTime}}parseDateToQueryString<{{{dataType}}}>({{{paramName}}}){{/isDateTime}}{{#isDate}}parseDateToQueryString<{{{dataType}}}>({{{paramName}}}){{/isDate}}{{^isDateTime}}{{^isDate}}{{{paramName}}}.toString(){{/isDate}}{{/isDateTime}}){{/isContainer}}) } {{/isNullable}} {{^isNullable}} - put("{{baseName}}", {{#isContainer}}toMultiValue({{{paramName}}}.toList(), "{{collectionFormat}}"){{/isContainer}}{{^isContainer}}listOf({{#isDateTime}}parseDateToQueryString<{{{dataType}}}>({{{paramName}}}){{/isDateTime}}{{#isDate}}parseDateToQueryString<{{{dataType}}}>({{{paramName}}}){{/isDate}}{{^isDateTime}}{{^isDate}}{{{paramName}}}.toString(){{/isDate}}{{/isDateTime}}){{/isContainer}}) + put("{{#lambda.escapeInNormalString}}{{baseName}}{{/lambda.escapeInNormalString}}", {{#isContainer}}toMultiValue({{{paramName}}}.toList(), "{{collectionFormat}}"){{/isContainer}}{{^isContainer}}listOf({{#isDateTime}}parseDateToQueryString<{{{dataType}}}>({{{paramName}}}){{/isDateTime}}{{#isDate}}parseDateToQueryString<{{{dataType}}}>({{{paramName}}}){{/isDate}}{{^isDateTime}}{{^isDate}}{{{paramName}}}.toString(){{/isDate}}{{/isDateTime}}){{/isContainer}}) {{/isNullable}} {{/required}} {{/queryParams}} @@ -119,7 +119,7 @@ import {{packageName}}.infrastructure.* {{/hasQueryParams}} val localVariableHeaders: MutableMap = mutableMapOf({{#hasFormParams}}"Content-Type" to {{^consumes}}"multipart/form-data"{{/consumes}}{{#consumes.0}}"{{{mediaType}}}"{{/consumes.0}}{{/hasFormParams}}) {{#headerParams}} - {{{paramName}}}{{^required}}?{{/required}}.apply { localVariableHeaders["{{baseName}}"] = {{#isContainer}}this.joinToString(separator = collectionDelimiter("{{collectionFormat}}")){{/isContainer}}{{^isContainer}}this.toString(){{/isContainer}} } + {{{paramName}}}{{^required}}?{{/required}}.apply { localVariableHeaders["{{#lambda.escapeInNormalString}}{{baseName}}{{/lambda.escapeInNormalString}}"] = {{#isContainer}}this.joinToString(separator = collectionDelimiter("{{collectionFormat}}")){{/isContainer}}{{^isContainer}}this.toString(){{/isContainer}} } {{/headerParams}} {{^hasFormParams}}{{#hasConsumes}}{{#consumes}}localVariableHeaders["Content-Type"] = "{{{mediaType}}}" {{/consumes}}{{/hasConsumes}}{{/hasFormParams}}{{#hasProduces}}localVariableHeaders["Accept"] = "{{#produces}}{{{mediaType}}}{{^-last}}, {{/-last}}{{/produces}}" @@ -127,13 +127,13 @@ import {{packageName}}.infrastructure.* val params = mutableMapOf( {{#pathParams}} - "{{baseName}}" to {{#isContainer}}{{paramName}}.joinToString(","){{/isContainer}}{{^isContainer}}{{{paramName}}}{{#isEnum}}{{^required}}?{{/required}}.value{{/isEnum}}{{/isContainer}}, + "{{#lambda.escapeInNormalString}}{{baseName}}{{/lambda.escapeInNormalString}}" to {{#isContainer}}{{paramName}}.joinToString(","){{/isContainer}}{{^isContainer}}{{{paramName}}}{{#isEnum}}{{^required}}?{{/required}}.value{{/isEnum}}{{/isContainer}}, {{/pathParams}} ) return RequestConfig( method = RequestMethod.{{httpMethod}}, - path = "{{{path}}}", + path = "{{#lambda.escapeInNormalString}}{{{path}}}{{/lambda.escapeInNormalString}}", params = params, query = localVariableQuery, headers = localVariableHeaders, diff --git a/modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm-spring-webclient/api.mustache b/modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm-spring-webclient/api.mustache index 6e30787d5042..77d9f45277af 100644 --- a/modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm-spring-webclient/api.mustache +++ b/modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm-spring-webclient/api.mustache @@ -103,17 +103,17 @@ import {{packageName}}.infrastructure.* {{#queryParams}} {{^required}} if ({{{paramName}}} != null) { - put("{{baseName}}", {{#isContainer}}toMultiValue({{{paramName}}}.toList(), "{{collectionFormat}}"){{/isContainer}}{{^isContainer}}listOf({{#isDateTime}}parseDateToQueryString<{{{dataType}}}>({{{paramName}}}){{/isDateTime}}{{#isDate}}parseDateToQueryString<{{{dataType}}}>({{{paramName}}}){{/isDate}}{{^isDateTime}}{{^isDate}}{{{paramName}}}.toString(){{/isDate}}{{/isDateTime}}){{/isContainer}}) + put("{{#lambda.escapeInNormalString}}{{baseName}}{{/lambda.escapeInNormalString}}", {{#isContainer}}toMultiValue({{{paramName}}}.toList(), "{{collectionFormat}}"){{/isContainer}}{{^isContainer}}listOf({{#isDateTime}}parseDateToQueryString<{{{dataType}}}>({{{paramName}}}){{/isDateTime}}{{#isDate}}parseDateToQueryString<{{{dataType}}}>({{{paramName}}}){{/isDate}}{{^isDateTime}}{{^isDate}}{{{paramName}}}.toString(){{/isDate}}{{/isDateTime}}){{/isContainer}}) } {{/required}} {{#required}} {{#isNullable}} if ({{{paramName}}} != null) { - put("{{baseName}}", {{#isContainer}}toMultiValue({{{paramName}}}.toList(), "{{collectionFormat}}"){{/isContainer}}{{^isContainer}}listOf({{#isDateTime}}parseDateToQueryString<{{{dataType}}}>({{{paramName}}}){{/isDateTime}}{{#isDate}}parseDateToQueryString<{{{dataType}}}>({{{paramName}}}){{/isDate}}{{^isDateTime}}{{^isDate}}{{{paramName}}}.toString(){{/isDate}}{{/isDateTime}}){{/isContainer}}) + put("{{#lambda.escapeInNormalString}}{{baseName}}{{/lambda.escapeInNormalString}}", {{#isContainer}}toMultiValue({{{paramName}}}.toList(), "{{collectionFormat}}"){{/isContainer}}{{^isContainer}}listOf({{#isDateTime}}parseDateToQueryString<{{{dataType}}}>({{{paramName}}}){{/isDateTime}}{{#isDate}}parseDateToQueryString<{{{dataType}}}>({{{paramName}}}){{/isDate}}{{^isDateTime}}{{^isDate}}{{{paramName}}}.toString(){{/isDate}}{{/isDateTime}}){{/isContainer}}) } {{/isNullable}} {{^isNullable}} - put("{{baseName}}", {{#isContainer}}toMultiValue({{{paramName}}}.toList(), "{{collectionFormat}}"){{/isContainer}}{{^isContainer}}listOf({{#isDateTime}}parseDateToQueryString<{{{dataType}}}>({{{paramName}}}){{/isDateTime}}{{#isDate}}parseDateToQueryString<{{{dataType}}}>({{{paramName}}}){{/isDate}}{{^isDateTime}}{{^isDate}}{{{paramName}}}.toString(){{/isDate}}{{/isDateTime}}){{/isContainer}}) + put("{{#lambda.escapeInNormalString}}{{baseName}}{{/lambda.escapeInNormalString}}", {{#isContainer}}toMultiValue({{{paramName}}}.toList(), "{{collectionFormat}}"){{/isContainer}}{{^isContainer}}listOf({{#isDateTime}}parseDateToQueryString<{{{dataType}}}>({{{paramName}}}){{/isDateTime}}{{#isDate}}parseDateToQueryString<{{{dataType}}}>({{{paramName}}}){{/isDate}}{{^isDateTime}}{{^isDate}}{{{paramName}}}.toString(){{/isDate}}{{/isDateTime}}){{/isContainer}}) {{/isNullable}} {{/required}} {{/queryParams}} @@ -121,7 +121,7 @@ import {{packageName}}.infrastructure.* {{/hasQueryParams}} val localVariableHeaders: MutableMap = mutableMapOf({{#hasFormParams}}"Content-Type" to {{^consumes}}"multipart/form-data"{{/consumes}}{{#consumes.0}}"{{{mediaType}}}"{{/consumes.0}}{{/hasFormParams}}) {{#headerParams}} - {{{paramName}}}{{^required}}?{{/required}}.apply { localVariableHeaders["{{baseName}}"] = {{#isContainer}}this.joinToString(separator = collectionDelimiter("{{collectionFormat}}")){{/isContainer}}{{^isContainer}}this.toString(){{/isContainer}} } + {{{paramName}}}{{^required}}?{{/required}}.apply { localVariableHeaders["{{#lambda.escapeInNormalString}}{{baseName}}{{/lambda.escapeInNormalString}}"] = {{#isContainer}}this.joinToString(separator = collectionDelimiter("{{collectionFormat}}")){{/isContainer}}{{^isContainer}}this.toString(){{/isContainer}} } {{/headerParams}} {{^hasFormParams}}{{#hasConsumes}}{{#consumes}}localVariableHeaders["Content-Type"] = "{{{mediaType}}}" {{/consumes}}{{/hasConsumes}}{{/hasFormParams}}{{#hasProduces}}localVariableHeaders["Accept"] = "{{#produces}}{{{mediaType}}}{{^-last}}, {{/-last}}{{/produces}}" @@ -129,13 +129,13 @@ import {{packageName}}.infrastructure.* val params = mutableMapOf( {{#pathParams}} - "{{baseName}}" to {{#isContainer}}{{paramName}}.joinToString(","){{/isContainer}}{{^isContainer}}{{{paramName}}}{{#isEnum}}{{^required}}?{{/required}}.value{{/isEnum}}{{/isContainer}}, + "{{#lambda.escapeInNormalString}}{{baseName}}{{/lambda.escapeInNormalString}}" to {{#isContainer}}{{paramName}}.joinToString(","){{/isContainer}}{{^isContainer}}{{{paramName}}}{{#isEnum}}{{^required}}?{{/required}}.value{{/isEnum}}{{/isContainer}}, {{/pathParams}} ) return RequestConfig( method = RequestMethod.{{httpMethod}}, - path = "{{{path}}}", + path = "{{#lambda.escapeInNormalString}}{{{path}}}{{/lambda.escapeInNormalString}}", params = params, query = localVariableQuery, headers = localVariableHeaders, diff --git a/modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm-vertx/api.mustache b/modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm-vertx/api.mustache index a82b32cbfb7a..dec3078745b2 100644 --- a/modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm-vertx/api.mustache +++ b/modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm-vertx/api.mustache @@ -104,7 +104,7 @@ import {{packageName}}.infrastructure.* {{#isDeprecated}} @Deprecated(message = "This operation is deprecated.") {{/isDeprecated}} - {{^nonPublicApi}}{{#explicitApi}}public {{/explicitApi}}{{/nonPublicApi}}{{#useCoroutines}}suspend {{/useCoroutines}}fun {{operationId}}({{#allParams}}{{{paramName}}}: {{#isEnum}}{{#isContainer}}kotlin.collections.List<{{enumName}}{{operationIdCamelCase}}>{{/isContainer}}{{^isContainer}}{{enumName}}{{operationIdCamelCase}}{{/isContainer}}{{/isEnum}}{{^isEnum}}{{{dataType}}}{{/isEnum}}{{#required}}{{#defaultValue}} = {{^isNumber}}{{#isEnum}}{{enumName}}{{operationIdCamelCase}}.{{&enumDefaultValue}}{{/isEnum}}{{^isEnum}}{{{defaultValue}}}{{/isEnum}}{{/isNumber}}{{#isNumber}}{{{dataType}}}("{{{defaultValue}}}"){{/isNumber}}{{/defaultValue}}{{/required}}{{^required}}?{{#defaultValue}} = {{^isNumber}}{{#isEnum}}{{enumName}}{{operationIdCamelCase}}.{{&enumDefaultValue}}{{/isEnum}}{{^isEnum}}{{{defaultValue}}}{{/isEnum}}{{/isNumber}}{{#isNumber}}{{{dataType}}}("{{{defaultValue}}}"){{/isNumber}}{{/defaultValue}}{{^defaultValue}} = null{{/defaultValue}}{{/required}}{{^-last}}, {{/-last}}{{/allParams}}) : {{^useCoroutines}}Future<{{/useCoroutines}}{{#returnType}}{{{returnType}}}{{#nullableReturnType}}{{^isResponseOptional}}?{{/isResponseOptional}}{{/nullableReturnType}}{{#isResponseOptional}}?{{/isResponseOptional}}{{/returnType}}{{^returnType}}Unit{{/returnType}}{{^useCoroutines}}>{{/useCoroutines}} { + {{^nonPublicApi}}{{#explicitApi}}public {{/explicitApi}}{{/nonPublicApi}}{{#useCoroutines}}suspend {{/useCoroutines}}fun {{operationId}}({{#allParams}}{{{paramName}}}: {{#isEnum}}{{#isContainer}}kotlin.collections.List<{{enumName}}{{operationIdCamelCase}}>{{/isContainer}}{{^isContainer}}{{enumName}}{{operationIdCamelCase}}{{/isContainer}}{{/isEnum}}{{^isEnum}}{{{dataType}}}{{/isEnum}}{{#required}}{{#defaultValue}} = {{^isNumber}}{{#isEnum}}{{enumName}}{{operationIdCamelCase}}.{{&enumDefaultValue}}{{/isEnum}}{{^isEnum}}{{#isString}}{{^allowableValues}}"{{#lambda.escapeInNormalString}}{{{unescapedDefaultValue}}}{{/lambda.escapeInNormalString}}"{{/allowableValues}}{{#allowableValues}}{{{defaultValue}}}{{/allowableValues}}{{/isString}}{{^isString}}{{{defaultValue}}}{{/isString}}{{/isEnum}}{{/isNumber}}{{#isNumber}}{{{dataType}}}("{{{defaultValue}}}"){{/isNumber}}{{/defaultValue}}{{/required}}{{^required}}?{{#defaultValue}} = {{^isNumber}}{{#isEnum}}{{enumName}}{{operationIdCamelCase}}.{{&enumDefaultValue}}{{/isEnum}}{{^isEnum}}{{#isString}}{{^allowableValues}}"{{#lambda.escapeInNormalString}}{{{unescapedDefaultValue}}}{{/lambda.escapeInNormalString}}"{{/allowableValues}}{{#allowableValues}}{{{defaultValue}}}{{/allowableValues}}{{/isString}}{{^isString}}{{{defaultValue}}}{{/isString}}{{/isEnum}}{{/isNumber}}{{#isNumber}}{{{dataType}}}("{{{defaultValue}}}"){{/isNumber}}{{/defaultValue}}{{^defaultValue}} = null{{/defaultValue}}{{/required}}{{^-last}}, {{/-last}}{{/allParams}}) : {{^useCoroutines}}Future<{{/useCoroutines}}{{#returnType}}{{{returnType}}}{{#nullableReturnType}}{{^isResponseOptional}}?{{/isResponseOptional}}{{/nullableReturnType}}{{#isResponseOptional}}?{{/isResponseOptional}}{{/returnType}}{{^returnType}}Unit{{/returnType}}{{^useCoroutines}}>{{/useCoroutines}} { return {{operationId}}WithHttpInfo({{#allParams}}{{{paramName}}} = {{{paramName}}}{{^-last}}, {{/-last}}{{/allParams}}).map { localVarResponse -> when (localVarResponse.responseType) { ResponseType.Success -> {{#returnType}}(localVarResponse as Success<*>).data as {{{returnType}}}{{#nullableReturnType}}{{^isResponseOptional}}?{{/isResponseOptional}}{{/nullableReturnType}}{{#isResponseOptional}}?{{/isResponseOptional}}{{/returnType}}{{^returnType}}Unit{{/returnType}} @@ -138,10 +138,10 @@ import {{packageName}}.infrastructure.* {{/isDeprecated}} {{^nonPublicApi}}{{#explicitApi}}public {{/explicitApi}}{{/nonPublicApi}}fun {{operationId}}WithHttpInfo({{#allParams}}{{{paramName}}}: {{#isEnum}}{{#isContainer}}kotlin.collections.List<{{enumName}}{{operationIdCamelCase}}>{{/isContainer}}{{^isContainer}}{{enumName}}{{operationIdCamelCase}}{{/isContainer}}{{/isEnum}}{{^isEnum}}{{{dataType}}}{{/isEnum}}{{^required}}?{{/required}}{{^-last}}, {{/-last}}{{/allParams}}) : Future> { val vertxClient = WebClient.create(vertx) - val request = vertxClient.requestAbs(HttpMethod.{{httpMethod}}, UriTemplate.of("$basePath{{{path}}}"{{#pathParams}}.replace("{"+"{{baseName}}"+"}", encodeURIComponent({{#isContainer}}{{paramName}}.joinToString(","){{/isContainer}}{{^isContainer}}{{{paramName}}}{{#isEnum}}{{^required}}?{{/required}}.value{{/isEnum}}.toString(){{/isContainer}})){{/pathParams}})) + val request = vertxClient.requestAbs(HttpMethod.{{httpMethod}}, UriTemplate.of("$basePath{{#lambda.escapeInNormalString}}{{{path}}}{{/lambda.escapeInNormalString}}"{{#pathParams}}.replace("{"+"{{#lambda.escapeInNormalString}}{{baseName}}{{/lambda.escapeInNormalString}}"+"}", encodeURIComponent({{#isContainer}}{{paramName}}.joinToString(","){{/isContainer}}{{^isContainer}}{{{paramName}}}{{#isEnum}}{{^required}}?{{/required}}.value{{/isEnum}}.toString(){{/isContainer}})){{/pathParams}})) {{#hasFormParams}}request.putHeader("Content-Type", {{^consumes}}"multipart/form-data"{{/consumes}}{{#consumes.0}}"{{{mediaType}}}"{{/consumes.0}}){{/hasFormParams}} - {{#headerParams}}{{{paramName}}}{{^required}}?{{/required}}.apply { request.putHeader("{{baseName}}", {{#isContainer}}this.joinToString(separator = collectionDelimiter("{{collectionFormat}}")){{/isContainer}}{{^isContainer}}this.toString(){{/isContainer}})}{{/headerParams}} + {{#headerParams}}{{{paramName}}}{{^required}}?{{/required}}.apply { request.putHeader("{{#lambda.escapeInNormalString}}{{baseName}}{{/lambda.escapeInNormalString}}", {{#isContainer}}this.joinToString(separator = collectionDelimiter("{{collectionFormat}}")){{/isContainer}}{{^isContainer}}this.toString(){{/isContainer}})}{{/headerParams}} {{^hasFormParams}}{{#hasConsumes}} {{#consumes}} request.putHeader("Content-Type", "{{{mediaType}}}") @@ -158,7 +158,7 @@ import {{packageName}}.infrastructure.* {{#hasQueryParams}} {{#queryParams}} - {{{paramName}}}{{^required}}?{{/required}}.let { request.queryParams().add("{{baseName}}", {{#isContainer}}toMultiValue(it.toList(), "{{collectionFormat}}"){{/isContainer}}{{^isContainer}}listOf({{#isDateTime}}parseDateToQueryString<{{{dataType}}}>(it){{/isDateTime}}{{#isDate}}parseDateToQueryString<{{{dataType}}}>(it){{/isDate}}{{^isDateTime}}{{^isDate}}it.toString(){{/isDate}}{{/isDateTime}}){{/isContainer}}) } + {{{paramName}}}{{^required}}?{{/required}}.let { request.queryParams().add("{{#lambda.escapeInNormalString}}{{baseName}}{{/lambda.escapeInNormalString}}", {{#isContainer}}toMultiValue(it.toList(), "{{collectionFormat}}"){{/isContainer}}{{^isContainer}}listOf({{#isDateTime}}parseDateToQueryString<{{{dataType}}}>(it){{/isDateTime}}{{#isDate}}parseDateToQueryString<{{{dataType}}}>(it){{/isDate}}{{^isDateTime}}{{^isDate}}it.toString(){{/isDate}}{{/isDateTime}}){{/isContainer}}) } {{/queryParams}} {{/hasQueryParams}} diff --git a/modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm-volley/api.mustache b/modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm-volley/api.mustache index 246b5e73d169..6911da4884ce 100644 --- a/modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm-volley/api.mustache +++ b/modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm-volley/api.mustache @@ -63,10 +63,10 @@ import {{packageName}}.infrastructure.CollectionFormats.* // to make it easy to override with your own. // create path and map variables - val path = "{{{path}}}"{{#pathParams}}.replace("{" + "{{baseName}}" + "}", {{#isContainer}}{{paramName}}.joinToString(","){{/isContainer}}{{^isContainer}}IRequestFactory.escapeString({{{paramName}}}.toString()){{/isContainer}}){{/pathParams}} + val path = "{{#lambda.escapeInNormalString}}{{{path}}}{{/lambda.escapeInNormalString}}"{{#pathParams}}.replace("{" + "{{#lambda.escapeInNormalString}}{{baseName}}{{/lambda.escapeInNormalString}}" + "}", {{#isContainer}}{{paramName}}.joinToString(","){{/isContainer}}{{^isContainer}}IRequestFactory.escapeString({{{paramName}}}.toString()){{/isContainer}}){{/pathParams}} val formParams = mapOf({{^formParams}}){{/formParams}}{{#formParams}} - "{{baseName}}" to IRequestFactory.parameterToString({{paramName}}){{^-last}},{{/-last}}{{#-last}} + "{{#lambda.escapeInNormalString}}{{baseName}}{{/lambda.escapeInNormalString}}" to IRequestFactory.parameterToString({{paramName}}){{^-last}},{{/-last}}{{#-last}} ){{/-last}}{{/formParams}} @@ -74,12 +74,12 @@ import {{packageName}}.infrastructure.CollectionFormats.* // TODO, if its apikey auth, then add the header names here and the hardcoded auth key // Only support hard coded apikey in query param auth for when we do this first path val queryParams = mapOf({{^queryParams}}){{/queryParams}}{{#queryParams}} - "{{baseName}}" to IRequestFactory.parameterToString({{paramName}}){{^-last}},{{/-last}}{{#-last}} + "{{#lambda.escapeInNormalString}}{{baseName}}{{/lambda.escapeInNormalString}}" to IRequestFactory.parameterToString({{paramName}}){{^-last}},{{/-last}}{{#-last}} ){{/-last}}{{/queryParams}} .filter { it.value.isNotEmpty() } val headerParams: Map = mapOf({{^headerParams}}){{/headerParams}}{{#headerParams}} - "{{baseName}}" to IRequestFactory.parameterToString({{paramName}}){{^-last}},{{/-last}}{{#-last}} + "{{#lambda.escapeInNormalString}}{{baseName}}{{/lambda.escapeInNormalString}}" to IRequestFactory.parameterToString({{paramName}}){{^-last}},{{/-last}}{{#-last}} ){{/-last}}{{/headerParams}} return suspendCoroutine { continuation -> diff --git a/modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm-volley/api_doc.mustache b/modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm-volley/api_doc.mustache index f7bf73ae31d0..17913fd3b466 100644 --- a/modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm-volley/api_doc.mustache +++ b/modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm-volley/api_doc.mustache @@ -5,15 +5,15 @@ All URIs are relative to *{{basePath}}* Method | HTTP request | Description ------------- | ------------- | ------------- -{{#operations}}{{#operation}}[**{{operationId}}**]({{classname}}.md#{{operationId}}) | **{{httpMethod}}** {{path}} | {{#summary}}{{summary}}{{/summary}} +{{#operations}}{{#operation}}[**{{operationId}}**]({{classname}}.md#{{operationId}}) | **{{httpMethod}}** {{path}} | {{#summary}}{{#lambda.escapeMarkdown}}{{{unescapedSummary}}}{{/lambda.escapeMarkdown}}{{/summary}} {{/operation}}{{/operations}} {{#operations}} {{#operation}} -{{summary}}{{#notes}} +{{#lambda.escapeMarkdown}}{{{unescapedSummary}}}{{/lambda.escapeMarkdown}}{{#unescapedNotes}} -{{notes}}{{/notes}} +{{#lambda.escapeMarkdown}}{{{unescapedNotes}}}{{/lambda.escapeMarkdown}}{{/unescapedNotes}} ### Example ```kotlin @@ -35,7 +35,7 @@ apiClient.setBearerToken("TOKEN") {{/authMethods}} val webService = apiClient.createWebservice({{{classname}}}::class.java) {{#allParams}} -val {{{paramName}}} : {{{dataType}}} = {{{example}}} // {{{dataType}}} | {{{description}}} +val {{{paramName}}} : {{{dataType}}} = {{{example}}} // {{{dataType}}} | {{#lambda.collapseNewlines}}{{{unescapedDescription}}}{{/lambda.collapseNewlines}} {{/allParams}} {{#useCoroutines}} @@ -51,7 +51,7 @@ launch(Dispatchers.IO) { {{^allParams}}This endpoint does not need any parameter.{{/allParams}}{{#allParams}}{{#-last}} Name | Type | Description | Notes ------------- | ------------- | ------------- | -------------{{/-last}}{{/allParams}} -{{#allParams}} **{{paramName}}** | {{#isPrimitiveType}}**{{dataType}}**{{/isPrimitiveType}}{{^isPrimitiveType}}{{#isFile}}**{{dataType}}**{{/isFile}}{{^isFile}}{{#generateModelDocs}}[**{{dataType}}**]({{baseType}}.md){{/generateModelDocs}}{{^generateModelDocs}}**{{dataType}}**{{/generateModelDocs}}{{/isFile}}{{/isPrimitiveType}}| {{description}} |{{^required}} [optional]{{/required}}{{#defaultValue}} [default to {{defaultValue}}]{{/defaultValue}}{{#allowableValues}} [enum: {{#values}}{{{.}}}{{^-last}}, {{/-last}}{{/values}}]{{/allowableValues}} +{{#allParams}} **{{paramName}}** | {{#isPrimitiveType}}**{{dataType}}**{{/isPrimitiveType}}{{^isPrimitiveType}}{{#isFile}}**{{dataType}}**{{/isFile}}{{^isFile}}{{#generateModelDocs}}[**{{dataType}}**]({{baseType}}.md){{/generateModelDocs}}{{^generateModelDocs}}**{{dataType}}**{{/generateModelDocs}}{{/isFile}}{{/isPrimitiveType}}| {{#lambda.escapeMarkdown}}{{{unescapedDescription}}}{{/lambda.escapeMarkdown}} |{{^required}} [optional]{{/required}}{{#defaultValue}} [default to {{{defaultValue}}}]{{/defaultValue}}{{#allowableValues}} [enum: {{#values}}{{#lambda.escapeMarkdown}}{{{.}}}{{/lambda.escapeMarkdown}}{{^-last}}, {{/-last}}{{/values}}]{{/allowableValues}} {{/allParams}} ### Return type diff --git a/modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm-volley/formParams.mustache b/modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm-volley/formParams.mustache index 98427cd4817c..49200a17ef2e 100644 --- a/modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm-volley/formParams.mustache +++ b/modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm-volley/formParams.mustache @@ -1 +1 @@ -{{#isFormParam}}{{{paramName}}}: {{{dataType}}}{{#required}}{{#defaultValue}} = {{^isNumber}}{{{defaultValue}}}{{/isNumber}}{{#isNumber}}{{{dataType}}}("{{{defaultValue}}}"){{/isNumber}}{{/defaultValue}}{{/required}}{{^required}}?{{#defaultValue}} = {{^isNumber}}{{{defaultValue}}}{{/isNumber}}{{#isNumber}}{{{dataType}}}("{{{defaultValue}}}"){{/isNumber}}{{/defaultValue}}{{^defaultValue}} = null{{/defaultValue}}{{/required}}{{/isFormParam}} \ No newline at end of file +{{#isFormParam}}{{{paramName}}}: {{{dataType}}}{{#required}}{{#defaultValue}} = {{^isNumber}}{{#isString}}{{^allowableValues}}"{{#lambda.escapeInNormalString}}{{{unescapedDefaultValue}}}{{/lambda.escapeInNormalString}}"{{/allowableValues}}{{#allowableValues}}{{{defaultValue}}}{{/allowableValues}}{{/isString}}{{^isString}}{{{defaultValue}}}{{/isString}}{{/isNumber}}{{#isNumber}}{{{dataType}}}("{{{defaultValue}}}"){{/isNumber}}{{/defaultValue}}{{/required}}{{^required}}?{{#defaultValue}} = {{^isNumber}}{{#isString}}{{^allowableValues}}"{{#lambda.escapeInNormalString}}{{{unescapedDefaultValue}}}{{/lambda.escapeInNormalString}}"{{/allowableValues}}{{#allowableValues}}{{{defaultValue}}}{{/allowableValues}}{{/isString}}{{^isString}}{{{defaultValue}}}{{/isString}}{{/isNumber}}{{#isNumber}}{{{dataType}}}("{{{defaultValue}}}"){{/isNumber}}{{/defaultValue}}{{^defaultValue}} = null{{/defaultValue}}{{/required}}{{/isFormParam}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm-volley/headerParams.mustache b/modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm-volley/headerParams.mustache index 3e5c64b2cd8e..f88388a5dfd8 100644 --- a/modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm-volley/headerParams.mustache +++ b/modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm-volley/headerParams.mustache @@ -1 +1 @@ -{{#isHeaderParam}}{{{paramName}}}: {{{dataType}}}{{#required}}{{#defaultValue}} = {{^isNumber}}{{{defaultValue}}}{{/isNumber}}{{#isNumber}}{{{dataType}}}("{{{defaultValue}}}"){{/isNumber}}{{/defaultValue}}{{/required}}{{^required}}?{{#defaultValue}} = {{^isNumber}}{{{defaultValue}}}{{/isNumber}}{{#isNumber}}{{{dataType}}}("{{{defaultValue}}}"){{/isNumber}}{{/defaultValue}}{{^defaultValue}} = null{{/defaultValue}}{{/required}}{{/isHeaderParam}} \ No newline at end of file +{{#isHeaderParam}}{{{paramName}}}: {{{dataType}}}{{#required}}{{#defaultValue}} = {{^isNumber}}{{#isString}}{{^allowableValues}}"{{#lambda.escapeInNormalString}}{{{unescapedDefaultValue}}}{{/lambda.escapeInNormalString}}"{{/allowableValues}}{{#allowableValues}}{{{defaultValue}}}{{/allowableValues}}{{/isString}}{{^isString}}{{{defaultValue}}}{{/isString}}{{/isNumber}}{{#isNumber}}{{{dataType}}}("{{{defaultValue}}}"){{/isNumber}}{{/defaultValue}}{{/required}}{{^required}}?{{#defaultValue}} = {{^isNumber}}{{#isString}}{{^allowableValues}}"{{#lambda.escapeInNormalString}}{{{unescapedDefaultValue}}}{{/lambda.escapeInNormalString}}"{{/allowableValues}}{{#allowableValues}}{{{defaultValue}}}{{/allowableValues}}{{/isString}}{{^isString}}{{{defaultValue}}}{{/isString}}{{/isNumber}}{{#isNumber}}{{{dataType}}}("{{{defaultValue}}}"){{/isNumber}}{{/defaultValue}}{{^defaultValue}} = null{{/defaultValue}}{{/required}}{{/isHeaderParam}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm-volley/pathParams.mustache b/modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm-volley/pathParams.mustache index 4cc7de2240bd..3d7d5d145855 100644 --- a/modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm-volley/pathParams.mustache +++ b/modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm-volley/pathParams.mustache @@ -1 +1 @@ -{{#isPathParam}}{{{paramName}}}: {{{dataType}}}{{#required}}{{#defaultValue}} = {{^isNumber}}{{{defaultValue}}}{{/isNumber}}{{#isNumber}}{{{dataType}}}("{{{defaultValue}}}"){{/isNumber}}{{/defaultValue}}{{/required}}{{^required}}?{{#defaultValue}} = {{^isNumber}}{{{defaultValue}}}{{/isNumber}}{{#isNumber}}{{{dataType}}}("{{{defaultValue}}}"){{/isNumber}}{{/defaultValue}}{{^defaultValue}} = null{{/defaultValue}}{{/required}}{{/isPathParam}} \ No newline at end of file +{{#isPathParam}}{{{paramName}}}: {{{dataType}}}{{#required}}{{#defaultValue}} = {{^isNumber}}{{#isString}}{{^allowableValues}}"{{#lambda.escapeInNormalString}}{{{unescapedDefaultValue}}}{{/lambda.escapeInNormalString}}"{{/allowableValues}}{{#allowableValues}}{{{defaultValue}}}{{/allowableValues}}{{/isString}}{{^isString}}{{{defaultValue}}}{{/isString}}{{/isNumber}}{{#isNumber}}{{{dataType}}}("{{{defaultValue}}}"){{/isNumber}}{{/defaultValue}}{{/required}}{{^required}}?{{#defaultValue}} = {{^isNumber}}{{#isString}}{{^allowableValues}}"{{#lambda.escapeInNormalString}}{{{unescapedDefaultValue}}}{{/lambda.escapeInNormalString}}"{{/allowableValues}}{{#allowableValues}}{{{defaultValue}}}{{/allowableValues}}{{/isString}}{{^isString}}{{{defaultValue}}}{{/isString}}{{/isNumber}}{{#isNumber}}{{{dataType}}}("{{{defaultValue}}}"){{/isNumber}}{{/defaultValue}}{{^defaultValue}} = null{{/defaultValue}}{{/required}}{{/isPathParam}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm-volley/queryParams.mustache b/modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm-volley/queryParams.mustache index da0a0c0930ac..2cbe779502bb 100644 --- a/modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm-volley/queryParams.mustache +++ b/modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm-volley/queryParams.mustache @@ -1 +1 @@ -{{#isQueryParam}}{{{paramName}}}: {{#collectionFormat}}{{#isCollectionFormatMulti}}{{{dataType}}}{{/isCollectionFormatMulti}}{{^isCollectionFormatMulti}}{{{collectionFormat.toUpperCase}}}Params{{/isCollectionFormatMulti}}{{/collectionFormat}}{{^collectionFormat}}{{{dataType}}}{{/collectionFormat}}{{#required}}{{#defaultValue}} = {{^isNumber}}{{{defaultValue}}}{{/isNumber}}{{#isNumber}}{{{dataType}}}("{{{defaultValue}}}"){{/isNumber}}{{/defaultValue}}{{/required}}{{^required}}?{{#defaultValue}} = {{^isNumber}}{{{defaultValue}}}{{/isNumber}}{{#isNumber}}{{{dataType}}}("{{{defaultValue}}}"){{/isNumber}}{{/defaultValue}}{{^defaultValue}} = null{{/defaultValue}}{{/required}}{{/isQueryParam}} \ No newline at end of file +{{#isQueryParam}}{{{paramName}}}: {{#collectionFormat}}{{#isCollectionFormatMulti}}{{{dataType}}}{{/isCollectionFormatMulti}}{{^isCollectionFormatMulti}}{{{collectionFormat.toUpperCase}}}Params{{/isCollectionFormatMulti}}{{/collectionFormat}}{{^collectionFormat}}{{{dataType}}}{{/collectionFormat}}{{#required}}{{#defaultValue}} = {{^isNumber}}{{#isString}}{{^allowableValues}}"{{#lambda.escapeInNormalString}}{{{unescapedDefaultValue}}}{{/lambda.escapeInNormalString}}"{{/allowableValues}}{{#allowableValues}}{{{defaultValue}}}{{/allowableValues}}{{/isString}}{{^isString}}{{{defaultValue}}}{{/isString}}{{/isNumber}}{{#isNumber}}{{{dataType}}}("{{{defaultValue}}}"){{/isNumber}}{{/defaultValue}}{{/required}}{{^required}}?{{#defaultValue}} = {{^isNumber}}{{#isString}}{{^allowableValues}}"{{#lambda.escapeInNormalString}}{{{unescapedDefaultValue}}}{{/lambda.escapeInNormalString}}"{{/allowableValues}}{{#allowableValues}}{{{defaultValue}}}{{/allowableValues}}{{/isString}}{{^isString}}{{{defaultValue}}}{{/isString}}{{/isNumber}}{{#isNumber}}{{{dataType}}}("{{{defaultValue}}}"){{/isNumber}}{{/defaultValue}}{{^defaultValue}} = null{{/defaultValue}}{{/required}}{{/isQueryParam}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/kotlin-client/libraries/multiplatform/api.mustache b/modules/openapi-generator/src/main/resources/kotlin-client/libraries/multiplatform/api.mustache index cf5a4fe733e7..ba8348755c44 100644 --- a/modules/openapi-generator/src/main/resources/kotlin-client/libraries/multiplatform/api.mustache +++ b/modules/openapi-generator/src/main/resources/kotlin-client/libraries/multiplatform/api.mustache @@ -68,7 +68,7 @@ import kotlinx.serialization.encoding.* {{#returnType}} @Suppress("UNCHECKED_CAST") {{/returnType}} - {{^nonPublicApi}}{{#explicitApi}}public {{/explicitApi}}{{/nonPublicApi}}open suspend fun {{operationId}}({{#allParams}}{{{paramName}}}: {{#isEnum}}{{#isContainer}}kotlin.collections.List<{{enumName}}{{operationIdCamelCase}}>{{/isContainer}}{{^isContainer}}{{enumName}}{{operationIdCamelCase}}{{/isContainer}}{{/isEnum}}{{^isEnum}}{{{dataType}}}{{/isEnum}}{{#required}}{{#defaultValue}} = {{^isNumber}}{{#isEnum}}{{enumName}}{{operationIdCamelCase}}.{{&enumDefaultValue}}{{/isEnum}}{{^isEnum}}{{{defaultValue}}}{{/isEnum}}{{/isNumber}}{{#isNumber}}{{{defaultValue}}}.toDouble(){{/isNumber}}{{/defaultValue}}{{/required}}{{^required}}?{{#defaultValue}} = {{^isNumber}}{{#isEnum}}{{enumName}}{{operationIdCamelCase}}.{{&enumDefaultValue}}{{/isEnum}}{{^isEnum}}{{{defaultValue}}}{{/isEnum}}{{/isNumber}}{{#isNumber}}{{{defaultValue}}}.toDouble(){{/isNumber}}{{/defaultValue}}{{^defaultValue}} = null{{/defaultValue}}{{/required}}{{^-last}}, {{/-last}}{{/allParams}}): HttpResponse<{{{returnType}}}{{^returnType}}Unit{{/returnType}}> { + {{^nonPublicApi}}{{#explicitApi}}public {{/explicitApi}}{{/nonPublicApi}}open suspend fun {{operationId}}({{#allParams}}{{{paramName}}}: {{#isEnum}}{{#isContainer}}kotlin.collections.List<{{enumName}}{{operationIdCamelCase}}>{{/isContainer}}{{^isContainer}}{{enumName}}{{operationIdCamelCase}}{{/isContainer}}{{/isEnum}}{{^isEnum}}{{{dataType}}}{{/isEnum}}{{#required}}{{#defaultValue}} = {{^isNumber}}{{#isEnum}}{{enumName}}{{operationIdCamelCase}}.{{&enumDefaultValue}}{{/isEnum}}{{^isEnum}}{{#isString}}{{^allowableValues}}"{{#lambda.escapeInNormalString}}{{{unescapedDefaultValue}}}{{/lambda.escapeInNormalString}}"{{/allowableValues}}{{#allowableValues}}{{{defaultValue}}}{{/allowableValues}}{{/isString}}{{^isString}}{{{defaultValue}}}{{/isString}}{{/isEnum}}{{/isNumber}}{{#isNumber}}{{{defaultValue}}}.toDouble(){{/isNumber}}{{/defaultValue}}{{/required}}{{^required}}?{{#defaultValue}} = {{^isNumber}}{{#isEnum}}{{enumName}}{{operationIdCamelCase}}.{{&enumDefaultValue}}{{/isEnum}}{{^isEnum}}{{#isString}}{{^allowableValues}}"{{#lambda.escapeInNormalString}}{{{unescapedDefaultValue}}}{{/lambda.escapeInNormalString}}"{{/allowableValues}}{{#allowableValues}}{{{defaultValue}}}{{/allowableValues}}{{/isString}}{{^isString}}{{{defaultValue}}}{{/isString}}{{/isEnum}}{{/isNumber}}{{#isNumber}}{{{defaultValue}}}.toDouble(){{/isNumber}}{{/defaultValue}}{{^defaultValue}} = null{{/defaultValue}}{{/required}}{{^-last}}, {{/-last}}{{/allParams}}): HttpResponse<{{{returnType}}}{{^returnType}}Unit{{/returnType}}> { val localVariableAuthNames = listOf({{#authMethods}}"{{name}}"{{^-last}}, {{/-last}}{{/authMethods}}) @@ -123,13 +123,13 @@ import kotlinx.serialization.encoding.* {{/hasBodyParam}} val localVariableQuery = mutableMapOf>(){{#queryParams}} - {{{paramName}}}?.apply { localVariableQuery["{{baseName}}"] = {{#isContainer}}toMultiValue(this, "{{collectionFormat}}"){{/isContainer}}{{^isContainer}}listOf({{^isEnumOrRef}}"${{{paramName}}}"{{/isEnumOrRef}}{{#isEnumOrRef}}"${ {{paramName}}.value }"{{/isEnumOrRef}}){{/isContainer}} }{{/queryParams}} + {{{paramName}}}?.apply { localVariableQuery["{{#lambda.escapeInNormalString}}{{baseName}}{{/lambda.escapeInNormalString}}"] = {{#isContainer}}toMultiValue(this, "{{collectionFormat}}"){{/isContainer}}{{^isContainer}}listOf({{^isEnumOrRef}}"${{{paramName}}}"{{/isEnumOrRef}}{{#isEnumOrRef}}"${ {{paramName}}.value }"{{/isEnumOrRef}}){{/isContainer}} }{{/queryParams}} val localVariableHeaders = mutableMapOf(){{#headerParams}} - {{{paramName}}}?.apply { localVariableHeaders["{{baseName}}"] = {{#isContainer}}this.joinToString(separator = collectionDelimiter("{{collectionFormat}}")){{/isContainer}}{{^isContainer}}this.toString(){{/isContainer}} }{{/headerParams}} + {{{paramName}}}?.apply { localVariableHeaders["{{#lambda.escapeInNormalString}}{{baseName}}{{/lambda.escapeInNormalString}}"] = {{#isContainer}}this.joinToString(separator = collectionDelimiter("{{collectionFormat}}")){{/isContainer}}{{^isContainer}}this.toString(){{/isContainer}} }{{/headerParams}} val localVariableConfig = RequestConfig( RequestMethod.{{httpMethod}}, - "{{{path}}}"{{#pathParams}}.replace("{" + "{{baseName}}" + "}", {{#isContainer}}{{paramName}}.joinToString(","){{/isContainer}}{{^isContainer}}{{^isEnumOrRef}}"${{{paramName}}}"{{/isEnumOrRef}}{{#isEnumOrRef}}"${ {{paramName}}.value }"{{/isEnumOrRef}}{{/isContainer}}){{/pathParams}}, + "{{#lambda.escapeInNormalString}}{{{path}}}{{/lambda.escapeInNormalString}}"{{#pathParams}}.replace("{" + "{{#lambda.escapeInNormalString}}{{baseName}}{{/lambda.escapeInNormalString}}" + "}", {{#isContainer}}{{paramName}}.joinToString(","){{/isContainer}}{{^isContainer}}{{^isEnumOrRef}}"${{{paramName}}}"{{/isEnumOrRef}}{{#isEnumOrRef}}"${ {{paramName}}.value }"{{/isEnumOrRef}}{{/isContainer}}){{/pathParams}}, query = localVariableQuery, headers = localVariableHeaders, requiresAuthentication = {{#hasAuthMethods}}true{{/hasAuthMethods}}{{^hasAuthMethods}}false{{/hasAuthMethods}}, diff --git a/modules/openapi-generator/src/main/resources/kotlin-client/param_default_value.mustache b/modules/openapi-generator/src/main/resources/kotlin-client/param_default_value.mustache index cb392335071d..2818c5ebcb26 100644 --- a/modules/openapi-generator/src/main/resources/kotlin-client/param_default_value.mustache +++ b/modules/openapi-generator/src/main/resources/kotlin-client/param_default_value.mustache @@ -1 +1 @@ -{{^isNumber}}{{#isEnum}}{{#enumDefaultValue}}{{enumName}}{{operationIdCamelCase}}.{{&.}}{{/enumDefaultValue}}{{^enumDefaultValue}}null{{/enumDefaultValue}}{{/isEnum}}{{^isEnum}}{{{defaultValue}}}{{/isEnum}}{{/isNumber}}{{#isNumber}}{{{defaultValue}}}.toDouble(){{/isNumber}} \ No newline at end of file +{{^isNumber}}{{#isEnum}}{{#enumDefaultValue}}{{enumName}}{{operationIdCamelCase}}.{{&.}}{{/enumDefaultValue}}{{^enumDefaultValue}}null{{/enumDefaultValue}}{{/isEnum}}{{^isEnum}}{{#isString}}{{^allowableValues}}"{{#lambda.escapeInNormalString}}{{{unescapedDefaultValue}}}{{/lambda.escapeInNormalString}}"{{/allowableValues}}{{#allowableValues}}{{{defaultValue}}}{{/allowableValues}}{{/isString}}{{^isString}}{{{defaultValue}}}{{/isString}}{{/isEnum}}{{/isNumber}}{{#isNumber}}{{{defaultValue}}}.toDouble(){{/isNumber}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/kotlin-misk/apiAction.mustache b/modules/openapi-generator/src/main/resources/kotlin-misk/apiAction.mustache index 9d9f929aeed6..9871eb7bae0d 100644 --- a/modules/openapi-generator/src/main/resources/kotlin-misk/apiAction.mustache +++ b/modules/openapi-generator/src/main/resources/kotlin-misk/apiAction.mustache @@ -45,7 +45,7 @@ class {{classname}}Action @Inject constructor( {{#operation}} @{{httpMethod}}("{{{actionPathPrefix}}}{{path}}") - @Description("{{{summary}}}"){{#hasConsumes}} + @Description("{{#lambda.escapeInNormalString}}{{{unescapedSummary}}}{{/lambda.escapeInNormalString}}"){{#hasConsumes}} {{{actionRequestContentType}}}({{#consumes}}{{{actionRequestContentTypePrefix}}}.{{{mediaType}}}{{^-last}}, {{/-last}}{{/consumes}}){{/hasConsumes}}{{#hasProduces}} @ResponseContentType({{#produces}}MediaTypes.{{{mediaType}}}{{^-last}}, {{/-last}}{{/produces}}){{/hasProduces}} {{#actionAnnotations}} diff --git a/modules/openapi-generator/src/main/resources/kotlin-misk/api_doc.mustache b/modules/openapi-generator/src/main/resources/kotlin-misk/api_doc.mustache index 6553762ac7cf..9352bf7b0696 100644 --- a/modules/openapi-generator/src/main/resources/kotlin-misk/api_doc.mustache +++ b/modules/openapi-generator/src/main/resources/kotlin-misk/api_doc.mustache @@ -1,22 +1,22 @@ # {{classname}}{{#description}} -{{.}}{{/description}} +{{#lambda.escapeMarkdown}}{{{.}}}{{/lambda.escapeMarkdown}}{{/description}} All URIs are relative to *{{basePath}}* Method | HTTP request | Description ------------- | ------------- | ------------- -{{#operations}}{{#operation}}[**{{operationId}}**]({{classname}}.md#{{operationId}}) | **{{httpMethod}}** {{path}} | {{summary}} +{{#operations}}{{#operation}}[**{{operationId}}**]({{classname}}.md#{{operationId}}) | **{{httpMethod}}** {{path}} | {{#lambda.escapeMarkdown}}{{{unescapedSummary}}}{{/lambda.escapeMarkdown}} {{/operation}}{{/operations}} {{#operations}} {{#operation}} # **{{operationId}}** -> {{#returnType}}{{.}} {{/returnType}}{{operationId}}({{#allParams}}{{{paramName}}}{{^-last}}, {{/-last}}{{/allParams}}) +> {{#returnType}}{{#lambda.escapeMarkdown}}{{{.}}}{{/lambda.escapeMarkdown}} {{/returnType}}{{operationId}}({{#allParams}}{{{paramName}}}{{^-last}}, {{/-last}}{{/allParams}}) -{{summary}}{{#notes}} +{{#lambda.escapeMarkdown}}{{{unescapedSummary}}}{{/lambda.escapeMarkdown}}{{#unescapedNotes}} -{{.}}{{/notes}} +{{#lambda.escapeMarkdown}}{{{unescapedNotes}}}{{/lambda.escapeMarkdown}}{{/unescapedNotes}} ### Example ```kotlin @@ -27,10 +27,10 @@ Method | HTTP request | Description {{! TODO: Auth method documentation examples}} val apiInstance = {{{classname}}}() {{#allParams}} -val {{{paramName}}} : {{{dataType}}} = {{{example}}} // {{{dataType}}} | {{{description}}} +val {{{paramName}}} : {{{dataType}}} = {{{example}}} // {{{dataType}}} | {{#lambda.collapseNewlines}}{{{unescapedDescription}}}{{/lambda.collapseNewlines}} {{/allParams}} try { - {{#returnType}}val result : {{{.}}} = {{/returnType}}apiInstance.{{{operationId}}}({{#allParams}}{{{paramName}}}{{^-last}}, {{/-last}}{{/allParams}}){{#returnType}} + {{#returnType}}val result : {{{returnType}}} = {{/returnType}}apiInstance.{{{operationId}}}({{#allParams}}{{{paramName}}}{{^-last}}, {{/-last}}{{/allParams}}){{#returnType}} println(result){{/returnType}} } catch (e: ClientException) { println("4xx response calling {{{classname}}}#{{{operationId}}}") @@ -45,7 +45,7 @@ try { {{^allParams}}This endpoint does not need any parameter.{{/allParams}}{{#allParams}}{{#-last}} Name | Type | Description | Notes ------------- | ------------- | ------------- | -------------{{/-last}}{{/allParams}} -{{#allParams}} **{{paramName}}** | {{#isPrimitiveType}}**{{dataType}}**{{/isPrimitiveType}}{{^isPrimitiveType}}{{#isFile}}**{{dataType}}**{{/isFile}}{{^isFile}}{{#generateModelDocs}}[**{{dataType}}**]({{baseType}}.md){{/generateModelDocs}}{{^generateModelDocs}}**{{dataType}}**{{/generateModelDocs}}{{/isFile}}{{/isPrimitiveType}}| {{description}} |{{^required}} [optional]{{/required}}{{#defaultValue}} [default to {{.}}]{{/defaultValue}}{{#allowableValues}} [enum: {{#values}}{{{.}}}{{^-last}}, {{/-last}}{{/values}}]{{/allowableValues}} +{{#allParams}} **{{paramName}}** | {{#isPrimitiveType}}**{{dataType}}**{{/isPrimitiveType}}{{^isPrimitiveType}}{{#isFile}}**{{dataType}}**{{/isFile}}{{^isFile}}{{#generateModelDocs}}[**{{dataType}}**]({{baseType}}.md){{/generateModelDocs}}{{^generateModelDocs}}**{{dataType}}**{{/generateModelDocs}}{{/isFile}}{{/isPrimitiveType}}| {{#lambda.escapeMarkdown}}{{{unescapedDescription}}}{{/lambda.escapeMarkdown}} |{{^required}} [optional]{{/required}}{{#defaultValue}} [default to {{#lambda.escapeMarkdown}}{{{.}}}{{/lambda.escapeMarkdown}}]{{/defaultValue}}{{#allowableValues}} [enum: {{#values}}{{#lambda.escapeMarkdown}}{{{.}}}{{/lambda.escapeMarkdown}}{{^-last}}, {{/-last}}{{/values}}]{{/allowableValues}} {{/allParams}} ### Return type diff --git a/modules/openapi-generator/src/main/resources/kotlin-misk/class_doc.mustache b/modules/openapi-generator/src/main/resources/kotlin-misk/class_doc.mustache index b6b482afb78b..01d22ac87c05 100644 --- a/modules/openapi-generator/src/main/resources/kotlin-misk/class_doc.mustache +++ b/modules/openapi-generator/src/main/resources/kotlin-misk/class_doc.mustache @@ -3,7 +3,7 @@ ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -{{#vars}}**{{name}}** | {{#isEnum}}[**inline**](#{{datatypeWithEnum}}){{/isEnum}}{{^isEnum}}{{#isPrimitiveType}}**{{dataType}}**{{/isPrimitiveType}}{{^isPrimitiveType}}[**{{dataType}}**]({{complexType}}.md){{/isPrimitiveType}}{{/isEnum}} | {{description}} | {{^required}} [optional]{{/required}}{{#isReadOnly}} [readonly]{{/isReadOnly}} +{{#vars}}**{{name}}** | {{#isEnum}}[**inline**](#{{datatypeWithEnum}}){{/isEnum}}{{^isEnum}}{{#isPrimitiveType}}**{{dataType}}**{{/isPrimitiveType}}{{^isPrimitiveType}}[**{{dataType}}**]({{complexType}}.md){{/isPrimitiveType}}{{/isEnum}} | {{#lambda.escapeMarkdown}}{{{unescapedDescription}}}{{/lambda.escapeMarkdown}} | {{^required}} [optional]{{/required}}{{#isReadOnly}} [readonly]{{/isReadOnly}} {{/vars}} {{#vars}}{{#isEnum}} @@ -11,5 +11,5 @@ Name | Type | Description | Notes ## Enum: {{baseName}} Name | Value ---- | -----{{#allowableValues}} -{{name}} | {{#values}}{{.}}{{^-last}}, {{/-last}}{{/values}}{{/allowableValues}} +{{name}} | {{#values}}{{#lambda.escapeMarkdown}}{{{.}}}{{/lambda.escapeMarkdown}}{{^-last}}, {{/-last}}{{/values}}{{/allowableValues}} {{/isEnum}}{{/vars}} diff --git a/modules/openapi-generator/src/main/resources/kotlin-misk/cookieParams.mustache b/modules/openapi-generator/src/main/resources/kotlin-misk/cookieParams.mustache index 028264a18bcf..1f225337dc10 100644 --- a/modules/openapi-generator/src/main/resources/kotlin-misk/cookieParams.mustache +++ b/modules/openapi-generator/src/main/resources/kotlin-misk/cookieParams.mustache @@ -1 +1 @@ -{{#isCookieParam}}{{#useBeanValidation}}{{>beanValidationQueryParams}}{{/useBeanValidation}}@CookieValue(name = "{{baseName}}"{{^required}}, required = false{{/required}}{{#defaultValue}}, defaultValue = "{{{.}}}"{{/defaultValue}}) {{{paramName}}}: {{>optionalDataType}}{{/isCookieParam}} \ No newline at end of file +{{#isCookieParam}}{{#useBeanValidation}}{{>beanValidationQueryParams}}{{/useBeanValidation}}@CookieValue(name = "{{baseName}}"{{^required}}, required = false{{/required}}{{#defaultValue}}, defaultValue = "{{#isString}}{{^isEnum}}{{#lambda.escapeInNormalString}}{{{unescapedDefaultValue}}}{{/lambda.escapeInNormalString}}{{/isEnum}}{{#isEnum}}{{{defaultValue}}}{{/isEnum}}{{/isString}}{{^isString}}{{{defaultValue}}}{{/isString}}"{{/defaultValue}}) {{{paramName}}}: {{>optionalDataType}}{{/isCookieParam}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/kotlin-misk/model.mustache b/modules/openapi-generator/src/main/resources/kotlin-misk/model.mustache index 88970ebaba28..60c855812169 100644 --- a/modules/openapi-generator/src/main/resources/kotlin-misk/model.mustache +++ b/modules/openapi-generator/src/main/resources/kotlin-misk/model.mustache @@ -23,7 +23,7 @@ data class {{classname}}( {{#description}} /** {{description}} */ {{/description}} - val {{{name}}}: {{{dataType}}}{{^required}}?{{/required}}{{#defaultValue}}{{#isNumber}} = {{{dataType}}}("{{{defaultValue}}}"){{/isNumber}}{{^isNumber}} = {{{defaultValue}}}{{/isNumber}}{{/defaultValue}}{{^defaultValue}}{{^required}} = null{{/required}}{{/defaultValue}}{{^-last}},{{/-last}} + val {{{name}}}: {{{dataType}}}{{^required}}?{{/required}}{{#defaultValue}}{{#isString}}{{^isEnum}} = "{{#lambda.escapeInNormalString}}{{{unescapedDefaultValue}}}{{/lambda.escapeInNormalString}}"{{/isEnum}}{{#isEnum}} = {{{defaultValue}}}{{/isEnum}}{{/isString}}{{^isString}}{{#isNumber}} = {{{dataType}}}("{{{defaultValue}}}"){{/isNumber}}{{^isNumber}} = {{{defaultValue}}}{{/isNumber}}{{/isString}}{{/defaultValue}}{{^defaultValue}}{{^required}} = null{{/required}}{{/defaultValue}}{{^-last}},{{/-last}} {{/vars}} ) {{/isEnum}} diff --git a/modules/openapi-generator/src/main/resources/kotlin-server/api_doc.mustache b/modules/openapi-generator/src/main/resources/kotlin-server/api_doc.mustache index 6553762ac7cf..9352bf7b0696 100644 --- a/modules/openapi-generator/src/main/resources/kotlin-server/api_doc.mustache +++ b/modules/openapi-generator/src/main/resources/kotlin-server/api_doc.mustache @@ -1,22 +1,22 @@ # {{classname}}{{#description}} -{{.}}{{/description}} +{{#lambda.escapeMarkdown}}{{{.}}}{{/lambda.escapeMarkdown}}{{/description}} All URIs are relative to *{{basePath}}* Method | HTTP request | Description ------------- | ------------- | ------------- -{{#operations}}{{#operation}}[**{{operationId}}**]({{classname}}.md#{{operationId}}) | **{{httpMethod}}** {{path}} | {{summary}} +{{#operations}}{{#operation}}[**{{operationId}}**]({{classname}}.md#{{operationId}}) | **{{httpMethod}}** {{path}} | {{#lambda.escapeMarkdown}}{{{unescapedSummary}}}{{/lambda.escapeMarkdown}} {{/operation}}{{/operations}} {{#operations}} {{#operation}} # **{{operationId}}** -> {{#returnType}}{{.}} {{/returnType}}{{operationId}}({{#allParams}}{{{paramName}}}{{^-last}}, {{/-last}}{{/allParams}}) +> {{#returnType}}{{#lambda.escapeMarkdown}}{{{.}}}{{/lambda.escapeMarkdown}} {{/returnType}}{{operationId}}({{#allParams}}{{{paramName}}}{{^-last}}, {{/-last}}{{/allParams}}) -{{summary}}{{#notes}} +{{#lambda.escapeMarkdown}}{{{unescapedSummary}}}{{/lambda.escapeMarkdown}}{{#unescapedNotes}} -{{.}}{{/notes}} +{{#lambda.escapeMarkdown}}{{{unescapedNotes}}}{{/lambda.escapeMarkdown}}{{/unescapedNotes}} ### Example ```kotlin @@ -27,10 +27,10 @@ Method | HTTP request | Description {{! TODO: Auth method documentation examples}} val apiInstance = {{{classname}}}() {{#allParams}} -val {{{paramName}}} : {{{dataType}}} = {{{example}}} // {{{dataType}}} | {{{description}}} +val {{{paramName}}} : {{{dataType}}} = {{{example}}} // {{{dataType}}} | {{#lambda.collapseNewlines}}{{{unescapedDescription}}}{{/lambda.collapseNewlines}} {{/allParams}} try { - {{#returnType}}val result : {{{.}}} = {{/returnType}}apiInstance.{{{operationId}}}({{#allParams}}{{{paramName}}}{{^-last}}, {{/-last}}{{/allParams}}){{#returnType}} + {{#returnType}}val result : {{{returnType}}} = {{/returnType}}apiInstance.{{{operationId}}}({{#allParams}}{{{paramName}}}{{^-last}}, {{/-last}}{{/allParams}}){{#returnType}} println(result){{/returnType}} } catch (e: ClientException) { println("4xx response calling {{{classname}}}#{{{operationId}}}") @@ -45,7 +45,7 @@ try { {{^allParams}}This endpoint does not need any parameter.{{/allParams}}{{#allParams}}{{#-last}} Name | Type | Description | Notes ------------- | ------------- | ------------- | -------------{{/-last}}{{/allParams}} -{{#allParams}} **{{paramName}}** | {{#isPrimitiveType}}**{{dataType}}**{{/isPrimitiveType}}{{^isPrimitiveType}}{{#isFile}}**{{dataType}}**{{/isFile}}{{^isFile}}{{#generateModelDocs}}[**{{dataType}}**]({{baseType}}.md){{/generateModelDocs}}{{^generateModelDocs}}**{{dataType}}**{{/generateModelDocs}}{{/isFile}}{{/isPrimitiveType}}| {{description}} |{{^required}} [optional]{{/required}}{{#defaultValue}} [default to {{.}}]{{/defaultValue}}{{#allowableValues}} [enum: {{#values}}{{{.}}}{{^-last}}, {{/-last}}{{/values}}]{{/allowableValues}} +{{#allParams}} **{{paramName}}** | {{#isPrimitiveType}}**{{dataType}}**{{/isPrimitiveType}}{{^isPrimitiveType}}{{#isFile}}**{{dataType}}**{{/isFile}}{{^isFile}}{{#generateModelDocs}}[**{{dataType}}**]({{baseType}}.md){{/generateModelDocs}}{{^generateModelDocs}}**{{dataType}}**{{/generateModelDocs}}{{/isFile}}{{/isPrimitiveType}}| {{#lambda.escapeMarkdown}}{{{unescapedDescription}}}{{/lambda.escapeMarkdown}} |{{^required}} [optional]{{/required}}{{#defaultValue}} [default to {{#lambda.escapeMarkdown}}{{{.}}}{{/lambda.escapeMarkdown}}]{{/defaultValue}}{{#allowableValues}} [enum: {{#values}}{{#lambda.escapeMarkdown}}{{{.}}}{{/lambda.escapeMarkdown}}{{^-last}}, {{/-last}}{{/values}}]{{/allowableValues}} {{/allParams}} ### Return type diff --git a/modules/openapi-generator/src/main/resources/kotlin-server/class_doc.mustache b/modules/openapi-generator/src/main/resources/kotlin-server/class_doc.mustache index b6b482afb78b..01d22ac87c05 100644 --- a/modules/openapi-generator/src/main/resources/kotlin-server/class_doc.mustache +++ b/modules/openapi-generator/src/main/resources/kotlin-server/class_doc.mustache @@ -3,7 +3,7 @@ ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -{{#vars}}**{{name}}** | {{#isEnum}}[**inline**](#{{datatypeWithEnum}}){{/isEnum}}{{^isEnum}}{{#isPrimitiveType}}**{{dataType}}**{{/isPrimitiveType}}{{^isPrimitiveType}}[**{{dataType}}**]({{complexType}}.md){{/isPrimitiveType}}{{/isEnum}} | {{description}} | {{^required}} [optional]{{/required}}{{#isReadOnly}} [readonly]{{/isReadOnly}} +{{#vars}}**{{name}}** | {{#isEnum}}[**inline**](#{{datatypeWithEnum}}){{/isEnum}}{{^isEnum}}{{#isPrimitiveType}}**{{dataType}}**{{/isPrimitiveType}}{{^isPrimitiveType}}[**{{dataType}}**]({{complexType}}.md){{/isPrimitiveType}}{{/isEnum}} | {{#lambda.escapeMarkdown}}{{{unescapedDescription}}}{{/lambda.escapeMarkdown}} | {{^required}} [optional]{{/required}}{{#isReadOnly}} [readonly]{{/isReadOnly}} {{/vars}} {{#vars}}{{#isEnum}} @@ -11,5 +11,5 @@ Name | Type | Description | Notes ## Enum: {{baseName}} Name | Value ---- | -----{{#allowableValues}} -{{name}} | {{#values}}{{.}}{{^-last}}, {{/-last}}{{/values}}{{/allowableValues}} +{{name}} | {{#values}}{{#lambda.escapeMarkdown}}{{{.}}}{{/lambda.escapeMarkdown}}{{^-last}}, {{/-last}}{{/values}}{{/allowableValues}} {{/isEnum}}{{/vars}} diff --git a/modules/openapi-generator/src/main/resources/kotlin-server/data_class_opt_var.mustache b/modules/openapi-generator/src/main/resources/kotlin-server/data_class_opt_var.mustache index a5885bca9b72..de2dd38d6779 100644 --- a/modules/openapi-generator/src/main/resources/kotlin-server/data_class_opt_var.mustache +++ b/modules/openapi-generator/src/main/resources/kotlin-server/data_class_opt_var.mustache @@ -1,4 +1,4 @@ {{#description}} /* {{{.}}} */ {{/description}} - {{>modelMutable}} {{{name}}}: {{#isEnum}}{{{classname}}}.{{{nameInPascalCase}}}{{/isEnum}}{{^isEnum}}{{{dataType}}}{{/isEnum}}? = {{{defaultValue}}}{{^defaultValue}}null{{/defaultValue}} \ No newline at end of file + {{>modelMutable}} {{{name}}}: {{#isEnum}}{{{classname}}}.{{{nameInPascalCase}}}{{/isEnum}}{{^isEnum}}{{{dataType}}}{{/isEnum}}? = {{^defaultValue}}null{{/defaultValue}}{{#defaultValue}}{{#isString}}{{^isEnum}}"{{#lambda.escapeInNormalString}}{{{unescapedDefaultValue}}}{{/lambda.escapeInNormalString}}"{{/isEnum}}{{#isEnum}}{{{defaultValue}}}{{/isEnum}}{{/isString}}{{^isString}}{{{defaultValue}}}{{/isString}}{{/defaultValue}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/kotlin-server/data_class_req_var.mustache b/modules/openapi-generator/src/main/resources/kotlin-server/data_class_req_var.mustache index 4adcedf78cba..c35b69a40798 100644 --- a/modules/openapi-generator/src/main/resources/kotlin-server/data_class_req_var.mustache +++ b/modules/openapi-generator/src/main/resources/kotlin-server/data_class_req_var.mustache @@ -2,4 +2,4 @@ /* {{{.}}} */ {{/description}} {{! Note that required properties may be nullable according to the OpenAPI specification. }} - {{>modelMutable}} {{{name}}}: {{#isEnum}}{{{classname}}}.{{{nameInPascalCase}}}{{/isEnum}}{{^isEnum}}{{{dataType}}}{{/isEnum}}{{#isNullable}}?{{/isNullable}}{{#defaultValue}} = {{^isNumber}}{{{defaultValue}}}{{/isNumber}}{{#isNumber}}{{{dataType}}}("{{{defaultValue}}}"){{/isNumber}}{{/defaultValue}} \ No newline at end of file + {{>modelMutable}} {{{name}}}: {{#isEnum}}{{{classname}}}.{{{nameInPascalCase}}}{{/isEnum}}{{^isEnum}}{{{dataType}}}{{/isEnum}}{{#isNullable}}?{{/isNullable}}{{#defaultValue}} = {{#isString}}{{^isEnum}}"{{#lambda.escapeInNormalString}}{{{unescapedDefaultValue}}}{{/lambda.escapeInNormalString}}"{{/isEnum}}{{#isEnum}}{{{defaultValue}}}{{/isEnum}}{{/isString}}{{^isString}}{{^isNumber}}{{{defaultValue}}}{{/isNumber}}{{#isNumber}}{{{dataType}}}("{{{defaultValue}}}"){{/isNumber}}{{/isString}}{{/defaultValue}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/kotlin-server/libraries/javalin5/data_class_opt_var.mustache b/modules/openapi-generator/src/main/resources/kotlin-server/libraries/javalin5/data_class_opt_var.mustache index 684077c31410..8b2cf1411e5a 100644 --- a/modules/openapi-generator/src/main/resources/kotlin-server/libraries/javalin5/data_class_opt_var.mustache +++ b/modules/openapi-generator/src/main/resources/kotlin-server/libraries/javalin5/data_class_opt_var.mustache @@ -3,4 +3,4 @@ {{/description}} {{#useBeanValidation}}{{>beanValidation}}{{>beanValidationModel}}{{/useBeanValidation}} @field:com.fasterxml.jackson.annotation.JsonProperty("{{#lambda.escapeDollar}}{{baseName}}{{/lambda.escapeDollar}}") - {{#isInherited}}override {{/isInherited}}{{>modelMutable}} {{{name}}}: {{#isEnum}}{{{classname}}}.{{{nameInPascalCase}}}{{/isEnum}}{{^isEnum}}{{{dataType}}}{{/isEnum}}? = {{{defaultValue}}}{{^defaultValue}}null{{/defaultValue}} \ No newline at end of file + {{#isInherited}}override {{/isInherited}}{{>modelMutable}} {{{name}}}: {{#isEnum}}{{{classname}}}.{{{nameInPascalCase}}}{{/isEnum}}{{^isEnum}}{{{dataType}}}{{/isEnum}}? = {{^defaultValue}}null{{/defaultValue}}{{#defaultValue}}{{#isString}}{{^isEnum}}"{{#lambda.escapeInNormalString}}{{{unescapedDefaultValue}}}{{/lambda.escapeInNormalString}}"{{/isEnum}}{{#isEnum}}{{{defaultValue}}}{{/isEnum}}{{/isString}}{{^isString}}{{{defaultValue}}}{{/isString}}{{/defaultValue}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/kotlin-server/libraries/javalin5/data_class_req_var.mustache b/modules/openapi-generator/src/main/resources/kotlin-server/libraries/javalin5/data_class_req_var.mustache index f8c518ff8c05..b595d5f22725 100644 --- a/modules/openapi-generator/src/main/resources/kotlin-server/libraries/javalin5/data_class_req_var.mustache +++ b/modules/openapi-generator/src/main/resources/kotlin-server/libraries/javalin5/data_class_req_var.mustache @@ -3,4 +3,4 @@ {{/description}} {{#useBeanValidation}}{{>beanValidation}}{{>beanValidationModel}}{{/useBeanValidation}} @field:com.fasterxml.jackson.annotation.JsonProperty("{{#lambda.escapeDollar}}{{baseName}}{{/lambda.escapeDollar}}") - {{#isInherited}}override {{/isInherited}}{{>modelMutable}} {{{name}}}: {{#isEnum}}{{{classname}}}.{{{nameInPascalCase}}}{{/isEnum}}{{^isEnum}}{{{dataType}}}{{/isEnum}}{{#isNullable}}?{{/isNullable}}{{#defaultValue}} = {{^isNumber}}{{{defaultValue}}}{{/isNumber}}{{#isNumber}}{{{dataType}}}("{{{defaultValue}}}"){{/isNumber}}{{/defaultValue}} \ No newline at end of file + {{#isInherited}}override {{/isInherited}}{{>modelMutable}} {{{name}}}: {{#isEnum}}{{{classname}}}.{{{nameInPascalCase}}}{{/isEnum}}{{^isEnum}}{{{dataType}}}{{/isEnum}}{{#isNullable}}?{{/isNullable}}{{#defaultValue}} = {{#isString}}{{^isEnum}}"{{#lambda.escapeInNormalString}}{{{unescapedDefaultValue}}}{{/lambda.escapeInNormalString}}"{{/isEnum}}{{#isEnum}}{{{defaultValue}}}{{/isEnum}}{{/isString}}{{^isString}}{{^isNumber}}{{{defaultValue}}}{{/isNumber}}{{#isNumber}}{{{dataType}}}("{{{defaultValue}}}"){{/isNumber}}{{/isString}}{{/defaultValue}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/kotlin-server/libraries/javalin5/paramDefault.mustache b/modules/openapi-generator/src/main/resources/kotlin-server/libraries/javalin5/paramDefault.mustache index dd5fc214c553..71530aa445e8 100644 --- a/modules/openapi-generator/src/main/resources/kotlin-server/libraries/javalin5/paramDefault.mustache +++ b/modules/openapi-generator/src/main/resources/kotlin-server/libraries/javalin5/paramDefault.mustache @@ -1,2 +1,2 @@ -{{#defaultValue}} ?:{{#isInteger}}{{{defaultValue}}}{{/isInteger}}{{#isLong}}{{{defaultValue}}}L{{/isLong}}{{#isShort}}{{{defaultValue}}}.toShort(){{/isShort}}{{#isDouble}}{{{defaultValue}}}.toDouble(){{/isDouble}}{{#isFloat}}{{{defaultValue}}}f{{/isFloat}}{{#isEnum}}{{{dataType}}}.valueOf("{{{defaultValue}}}"){{/isEnum}}{{#isBoolean}}{{{defaultValue}}}{{/isBoolean}}{{#isString}}"{{{defaultValue}}}"{{/isString}}{{#isUuid}}"UUID.fromString({{{defaultValue}}})"{{/isUuid}}{{#isUuid}}"UUID.fromString({{{defaultValue}}})"{{/isUuid}} +{{#defaultValue}} ?:{{#isInteger}}{{{defaultValue}}}{{/isInteger}}{{#isLong}}{{{defaultValue}}}L{{/isLong}}{{#isShort}}{{{defaultValue}}}.toShort(){{/isShort}}{{#isDouble}}{{{defaultValue}}}.toDouble(){{/isDouble}}{{#isFloat}}{{{defaultValue}}}f{{/isFloat}}{{#isEnum}}{{{dataType}}}.valueOf("{{{defaultValue}}}"){{/isEnum}}{{#isBoolean}}{{{defaultValue}}}{{/isBoolean}}{{#isString}}"{{#lambda.escapeInNormalString}}{{{unescapedDefaultValue}}}{{/lambda.escapeInNormalString}}"{{/isString}}{{#isUuid}}"UUID.fromString({{{defaultValue}}})"{{/isUuid}} {{/defaultValue}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/kotlin-server/libraries/javalin6/data_class_opt_var.mustache b/modules/openapi-generator/src/main/resources/kotlin-server/libraries/javalin6/data_class_opt_var.mustache index 684077c31410..8b2cf1411e5a 100644 --- a/modules/openapi-generator/src/main/resources/kotlin-server/libraries/javalin6/data_class_opt_var.mustache +++ b/modules/openapi-generator/src/main/resources/kotlin-server/libraries/javalin6/data_class_opt_var.mustache @@ -3,4 +3,4 @@ {{/description}} {{#useBeanValidation}}{{>beanValidation}}{{>beanValidationModel}}{{/useBeanValidation}} @field:com.fasterxml.jackson.annotation.JsonProperty("{{#lambda.escapeDollar}}{{baseName}}{{/lambda.escapeDollar}}") - {{#isInherited}}override {{/isInherited}}{{>modelMutable}} {{{name}}}: {{#isEnum}}{{{classname}}}.{{{nameInPascalCase}}}{{/isEnum}}{{^isEnum}}{{{dataType}}}{{/isEnum}}? = {{{defaultValue}}}{{^defaultValue}}null{{/defaultValue}} \ No newline at end of file + {{#isInherited}}override {{/isInherited}}{{>modelMutable}} {{{name}}}: {{#isEnum}}{{{classname}}}.{{{nameInPascalCase}}}{{/isEnum}}{{^isEnum}}{{{dataType}}}{{/isEnum}}? = {{^defaultValue}}null{{/defaultValue}}{{#defaultValue}}{{#isString}}{{^isEnum}}"{{#lambda.escapeInNormalString}}{{{unescapedDefaultValue}}}{{/lambda.escapeInNormalString}}"{{/isEnum}}{{#isEnum}}{{{defaultValue}}}{{/isEnum}}{{/isString}}{{^isString}}{{{defaultValue}}}{{/isString}}{{/defaultValue}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/kotlin-server/libraries/javalin6/data_class_req_var.mustache b/modules/openapi-generator/src/main/resources/kotlin-server/libraries/javalin6/data_class_req_var.mustache index f8c518ff8c05..b595d5f22725 100644 --- a/modules/openapi-generator/src/main/resources/kotlin-server/libraries/javalin6/data_class_req_var.mustache +++ b/modules/openapi-generator/src/main/resources/kotlin-server/libraries/javalin6/data_class_req_var.mustache @@ -3,4 +3,4 @@ {{/description}} {{#useBeanValidation}}{{>beanValidation}}{{>beanValidationModel}}{{/useBeanValidation}} @field:com.fasterxml.jackson.annotation.JsonProperty("{{#lambda.escapeDollar}}{{baseName}}{{/lambda.escapeDollar}}") - {{#isInherited}}override {{/isInherited}}{{>modelMutable}} {{{name}}}: {{#isEnum}}{{{classname}}}.{{{nameInPascalCase}}}{{/isEnum}}{{^isEnum}}{{{dataType}}}{{/isEnum}}{{#isNullable}}?{{/isNullable}}{{#defaultValue}} = {{^isNumber}}{{{defaultValue}}}{{/isNumber}}{{#isNumber}}{{{dataType}}}("{{{defaultValue}}}"){{/isNumber}}{{/defaultValue}} \ No newline at end of file + {{#isInherited}}override {{/isInherited}}{{>modelMutable}} {{{name}}}: {{#isEnum}}{{{classname}}}.{{{nameInPascalCase}}}{{/isEnum}}{{^isEnum}}{{{dataType}}}{{/isEnum}}{{#isNullable}}?{{/isNullable}}{{#defaultValue}} = {{#isString}}{{^isEnum}}"{{#lambda.escapeInNormalString}}{{{unescapedDefaultValue}}}{{/lambda.escapeInNormalString}}"{{/isEnum}}{{#isEnum}}{{{defaultValue}}}{{/isEnum}}{{/isString}}{{^isString}}{{^isNumber}}{{{defaultValue}}}{{/isNumber}}{{#isNumber}}{{{dataType}}}("{{{defaultValue}}}"){{/isNumber}}{{/isString}}{{/defaultValue}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/kotlin-server/libraries/javalin6/paramDefault.mustache b/modules/openapi-generator/src/main/resources/kotlin-server/libraries/javalin6/paramDefault.mustache index dd5fc214c553..71530aa445e8 100644 --- a/modules/openapi-generator/src/main/resources/kotlin-server/libraries/javalin6/paramDefault.mustache +++ b/modules/openapi-generator/src/main/resources/kotlin-server/libraries/javalin6/paramDefault.mustache @@ -1,2 +1,2 @@ -{{#defaultValue}} ?:{{#isInteger}}{{{defaultValue}}}{{/isInteger}}{{#isLong}}{{{defaultValue}}}L{{/isLong}}{{#isShort}}{{{defaultValue}}}.toShort(){{/isShort}}{{#isDouble}}{{{defaultValue}}}.toDouble(){{/isDouble}}{{#isFloat}}{{{defaultValue}}}f{{/isFloat}}{{#isEnum}}{{{dataType}}}.valueOf("{{{defaultValue}}}"){{/isEnum}}{{#isBoolean}}{{{defaultValue}}}{{/isBoolean}}{{#isString}}"{{{defaultValue}}}"{{/isString}}{{#isUuid}}"UUID.fromString({{{defaultValue}}})"{{/isUuid}}{{#isUuid}}"UUID.fromString({{{defaultValue}}})"{{/isUuid}} +{{#defaultValue}} ?:{{#isInteger}}{{{defaultValue}}}{{/isInteger}}{{#isLong}}{{{defaultValue}}}L{{/isLong}}{{#isShort}}{{{defaultValue}}}.toShort(){{/isShort}}{{#isDouble}}{{{defaultValue}}}.toDouble(){{/isDouble}}{{#isFloat}}{{{defaultValue}}}f{{/isFloat}}{{#isEnum}}{{{dataType}}}.valueOf("{{{defaultValue}}}"){{/isEnum}}{{#isBoolean}}{{{defaultValue}}}{{/isBoolean}}{{#isString}}"{{#lambda.escapeInNormalString}}{{{unescapedDefaultValue}}}{{/lambda.escapeInNormalString}}"{{/isString}}{{#isUuid}}"UUID.fromString({{{defaultValue}}})"{{/isUuid}} {{/defaultValue}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/kotlin-server/libraries/jaxrs-spec/cookieParams.mustache b/modules/openapi-generator/src/main/resources/kotlin-server/libraries/jaxrs-spec/cookieParams.mustache index 929a3218703d..e651554834ed 100644 --- a/modules/openapi-generator/src/main/resources/kotlin-server/libraries/jaxrs-spec/cookieParams.mustache +++ b/modules/openapi-generator/src/main/resources/kotlin-server/libraries/jaxrs-spec/cookieParams.mustache @@ -1 +1 @@ -{{#isCookieParam}}@CookieParam("{{#lambda.escapeDollar}}{{baseName}}{{/lambda.escapeDollar}}"){{#useBeanValidation}}{{>beanValidationQueryParams}}{{/useBeanValidation}}{{^isContainer}}{{#defaultValue}} @DefaultValue({{#lambda.doublequote}}{{{.}}}{{/lambda.doublequote}}){{/defaultValue}}{{/isContainer}} {{paramName}}: {{{dataType}}}{{#isNullable}}?{{/isNullable}}{{^isNullable}}{{^defaultValue}}{{^required}}?{{/required}}{{/defaultValue}}{{/isNullable}}{{/isCookieParam}} \ No newline at end of file +{{#isCookieParam}}@CookieParam("{{#lambda.escapeDollar}}{{baseName}}{{/lambda.escapeDollar}}"){{#useBeanValidation}}{{>beanValidationQueryParams}}{{/useBeanValidation}}{{^isContainer}}{{#defaultValue}} @DefaultValue({{#lambda.doublequote}}{{#isString}}{{^isEnum}}{{#lambda.escapeInNormalString}}{{{unescapedDefaultValue}}}{{/lambda.escapeInNormalString}}{{/isEnum}}{{#isEnum}}{{{defaultValue}}}{{/isEnum}}{{/isString}}{{^isString}}{{{defaultValue}}}{{/isString}}{{/lambda.doublequote}}){{/defaultValue}}{{/isContainer}} {{paramName}}: {{{dataType}}}{{#isNullable}}?{{/isNullable}}{{^isNullable}}{{^defaultValue}}{{^required}}?{{/required}}{{/defaultValue}}{{/isNullable}}{{/isCookieParam}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/kotlin-server/libraries/jaxrs-spec/data_class_opt_var.mustache b/modules/openapi-generator/src/main/resources/kotlin-server/libraries/jaxrs-spec/data_class_opt_var.mustache index f277f71da441..059feb846954 100644 --- a/modules/openapi-generator/src/main/resources/kotlin-server/libraries/jaxrs-spec/data_class_opt_var.mustache +++ b/modules/openapi-generator/src/main/resources/kotlin-server/libraries/jaxrs-spec/data_class_opt_var.mustache @@ -3,4 +3,4 @@ {{/description}} @JsonProperty("{{#lambda.escapeDollar}}{{baseName}}{{/lambda.escapeDollar}}") -{{#useBeanValidation}}{{>beanValidation}}{{>beanValidationModel}}{{/useBeanValidation}} {{>modelMutable}} {{{name}}}: {{#isEnum}}{{classname}}.{{nameInPascalCase}}{{/isEnum}}{{^isEnum}}{{{dataType}}}{{/isEnum}}? = {{{defaultValue}}}{{^defaultValue}}null{{/defaultValue}} \ No newline at end of file +{{#useBeanValidation}}{{>beanValidation}}{{>beanValidationModel}}{{/useBeanValidation}} {{>modelMutable}} {{{name}}}: {{#isEnum}}{{classname}}.{{nameInPascalCase}}{{/isEnum}}{{^isEnum}}{{{dataType}}}{{/isEnum}}? = {{^defaultValue}}null{{/defaultValue}}{{#defaultValue}}{{#isString}}{{^isEnum}}"{{#lambda.escapeInNormalString}}{{{unescapedDefaultValue}}}{{/lambda.escapeInNormalString}}"{{/isEnum}}{{#isEnum}}{{{defaultValue}}}{{/isEnum}}{{/isString}}{{^isString}}{{{defaultValue}}}{{/isString}}{{/defaultValue}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/kotlin-server/libraries/jaxrs-spec/headerParams.mustache b/modules/openapi-generator/src/main/resources/kotlin-server/libraries/jaxrs-spec/headerParams.mustache index cc1ce2f3ea90..335afdafb0b6 100644 --- a/modules/openapi-generator/src/main/resources/kotlin-server/libraries/jaxrs-spec/headerParams.mustache +++ b/modules/openapi-generator/src/main/resources/kotlin-server/libraries/jaxrs-spec/headerParams.mustache @@ -1 +1 @@ -{{#isHeaderParam}}@HeaderParam("{{baseName}}"){{#useBeanValidation}}{{>beanValidationHeaderParams}}{{/useBeanValidation}} {{#defaultValue}} @DefaultValue({{#lambda.doublequote}}{{{.}}}{{/lambda.doublequote}}){{/defaultValue}} {{paramName}}: {{{dataType}}}{{#isNullable}}?{{/isNullable}}{{^isNullable}}{{^defaultValue}}{{^required}}?{{/required}}{{/defaultValue}}{{/isNullable}}{{/isHeaderParam}} \ No newline at end of file +{{#isHeaderParam}}@HeaderParam("{{baseName}}"){{#useBeanValidation}}{{>beanValidationHeaderParams}}{{/useBeanValidation}} {{#defaultValue}} @DefaultValue({{#lambda.doublequote}}{{#isString}}{{^isEnum}}{{#lambda.escapeInNormalString}}{{{unescapedDefaultValue}}}{{/lambda.escapeInNormalString}}{{/isEnum}}{{#isEnum}}{{{defaultValue}}}{{/isEnum}}{{/isString}}{{^isString}}{{{defaultValue}}}{{/isString}}{{/lambda.doublequote}}){{/defaultValue}} {{paramName}}: {{{dataType}}}{{#isNullable}}?{{/isNullable}}{{^isNullable}}{{^defaultValue}}{{^required}}?{{/required}}{{/defaultValue}}{{/isNullable}}{{/isHeaderParam}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/kotlin-server/libraries/jaxrs-spec/queryParams.mustache b/modules/openapi-generator/src/main/resources/kotlin-server/libraries/jaxrs-spec/queryParams.mustache index a0155cf4b59d..07ef848c8fc0 100644 --- a/modules/openapi-generator/src/main/resources/kotlin-server/libraries/jaxrs-spec/queryParams.mustache +++ b/modules/openapi-generator/src/main/resources/kotlin-server/libraries/jaxrs-spec/queryParams.mustache @@ -1 +1 @@ -{{#isQueryParam}}@QueryParam("{{#lambda.escapeDollar}}{{baseName}}{{/lambda.escapeDollar}}"){{#useBeanValidation}}{{>beanValidationQueryParams}}{{/useBeanValidation}}{{^isContainer}}{{#defaultValue}} @DefaultValue({{#lambda.doublequote}}{{{.}}}{{/lambda.doublequote}}){{/defaultValue}}{{/isContainer}} {{paramName}}: {{{dataType}}}{{#isNullable}}?{{/isNullable}}{{^isNullable}}{{^defaultValue}}{{^required}}?{{/required}}{{/defaultValue}}{{/isNullable}}{{/isQueryParam}} \ No newline at end of file +{{#isQueryParam}}@QueryParam("{{#lambda.escapeDollar}}{{baseName}}{{/lambda.escapeDollar}}"){{#useBeanValidation}}{{>beanValidationQueryParams}}{{/useBeanValidation}}{{^isContainer}}{{#defaultValue}} @DefaultValue({{#lambda.doublequote}}{{#isString}}{{^isEnum}}{{#lambda.escapeInNormalString}}{{{unescapedDefaultValue}}}{{/lambda.escapeInNormalString}}{{/isEnum}}{{#isEnum}}{{{defaultValue}}}{{/isEnum}}{{/isString}}{{^isString}}{{{defaultValue}}}{{/isString}}{{/lambda.doublequote}}){{/defaultValue}}{{/isContainer}} {{paramName}}: {{{dataType}}}{{#isNullable}}?{{/isNullable}}{{^isNullable}}{{^defaultValue}}{{^required}}?{{/required}}{{/defaultValue}}{{/isNullable}}{{/isQueryParam}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/kotlin-server/libraries/ktor2/data_class_opt_var.mustache b/modules/openapi-generator/src/main/resources/kotlin-server/libraries/ktor2/data_class_opt_var.mustache index a5885bca9b72..de2dd38d6779 100644 --- a/modules/openapi-generator/src/main/resources/kotlin-server/libraries/ktor2/data_class_opt_var.mustache +++ b/modules/openapi-generator/src/main/resources/kotlin-server/libraries/ktor2/data_class_opt_var.mustache @@ -1,4 +1,4 @@ {{#description}} /* {{{.}}} */ {{/description}} - {{>modelMutable}} {{{name}}}: {{#isEnum}}{{{classname}}}.{{{nameInPascalCase}}}{{/isEnum}}{{^isEnum}}{{{dataType}}}{{/isEnum}}? = {{{defaultValue}}}{{^defaultValue}}null{{/defaultValue}} \ No newline at end of file + {{>modelMutable}} {{{name}}}: {{#isEnum}}{{{classname}}}.{{{nameInPascalCase}}}{{/isEnum}}{{^isEnum}}{{{dataType}}}{{/isEnum}}? = {{^defaultValue}}null{{/defaultValue}}{{#defaultValue}}{{#isString}}{{^isEnum}}"{{#lambda.escapeInNormalString}}{{{unescapedDefaultValue}}}{{/lambda.escapeInNormalString}}"{{/isEnum}}{{#isEnum}}{{{defaultValue}}}{{/isEnum}}{{/isString}}{{^isString}}{{{defaultValue}}}{{/isString}}{{/defaultValue}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/kotlin-server/libraries/ktor2/data_class_req_var.mustache b/modules/openapi-generator/src/main/resources/kotlin-server/libraries/ktor2/data_class_req_var.mustache index 4adcedf78cba..c35b69a40798 100644 --- a/modules/openapi-generator/src/main/resources/kotlin-server/libraries/ktor2/data_class_req_var.mustache +++ b/modules/openapi-generator/src/main/resources/kotlin-server/libraries/ktor2/data_class_req_var.mustache @@ -2,4 +2,4 @@ /* {{{.}}} */ {{/description}} {{! Note that required properties may be nullable according to the OpenAPI specification. }} - {{>modelMutable}} {{{name}}}: {{#isEnum}}{{{classname}}}.{{{nameInPascalCase}}}{{/isEnum}}{{^isEnum}}{{{dataType}}}{{/isEnum}}{{#isNullable}}?{{/isNullable}}{{#defaultValue}} = {{^isNumber}}{{{defaultValue}}}{{/isNumber}}{{#isNumber}}{{{dataType}}}("{{{defaultValue}}}"){{/isNumber}}{{/defaultValue}} \ No newline at end of file + {{>modelMutable}} {{{name}}}: {{#isEnum}}{{{classname}}}.{{{nameInPascalCase}}}{{/isEnum}}{{^isEnum}}{{{dataType}}}{{/isEnum}}{{#isNullable}}?{{/isNullable}}{{#defaultValue}} = {{#isString}}{{^isEnum}}"{{#lambda.escapeInNormalString}}{{{unescapedDefaultValue}}}{{/lambda.escapeInNormalString}}"{{/isEnum}}{{#isEnum}}{{{defaultValue}}}{{/isEnum}}{{/isString}}{{^isString}}{{^isNumber}}{{{defaultValue}}}{{/isNumber}}{{#isNumber}}{{{dataType}}}("{{{defaultValue}}}"){{/isNumber}}{{/isString}}{{/defaultValue}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/kotlin-spring/api.mustache b/modules/openapi-generator/src/main/resources/kotlin-spring/api.mustache index 033d044fb28e..822bfab3f4bc 100644 --- a/modules/openapi-generator/src/main/resources/kotlin-spring/api.mustache +++ b/modules/openapi-generator/src/main/resources/kotlin-spring/api.mustache @@ -72,22 +72,22 @@ class {{classname}}Controller({{#serviceInterface}}@Autowired(required = true) v }}{{/useResponseEntity}}{{! }}{{#swagger2AnnotationLibrary}}{{! }} @Operation( - summary = "{{{summary}}}", + summary = "{{#lambda.escapeInNormalString}}{{{unescapedSummary}}}{{/lambda.escapeInNormalString}}", operationId = "{{{operationId}}}", - description = """{{{unescapedNotes}}}""", + description = """{{#lambda.escapeDollarInMultiline}}{{{unescapedNotes}}}{{/lambda.escapeDollarInMultiline}}""", responses = [{{#responses}} - ApiResponse(responseCode = "{{{code}}}", description = "{{{message}}}"{{#baseType}}, content = [Content({{#isArray}}array = ArraySchema({{/isArray}}schema = Schema(implementation = {{{baseType}}}::class)){{#isArray}}){{/isArray}}]{{/baseType}}){{^-last}},{{/-last}}{{/responses}} ]{{#hasAuthMethods}}, + ApiResponse(responseCode = "{{{code}}}", description = "{{#lambda.escapeInNormalString}}{{{unescapedMessage}}}{{/lambda.escapeInNormalString}}"{{#baseType}}, content = [Content({{#isArray}}array = ArraySchema({{/isArray}}schema = Schema(implementation = {{{baseType}}}::class)){{#isArray}}){{/isArray}}]{{/baseType}}){{^-last}},{{/-last}}{{/responses}} ]{{#hasAuthMethods}}, security = [ {{#authMethods}}SecurityRequirement(name = "{{name}}"{{#isOAuth}}, scopes = [ {{#scopes}}"{{scope}}"{{^-last}}, {{/-last}}{{/scopes}} ]{{/isOAuth}}){{^-last}},{{/-last}}{{/authMethods}} ]{{/hasAuthMethods}} ){{/swagger2AnnotationLibrary}}{{#swagger1AnnotationLibrary}} @ApiOperation( - value = "{{{summary}}}", + value = "{{#lambda.escapeInNormalString}}{{{unescapedSummary}}}{{/lambda.escapeInNormalString}}", nickname = "{{{operationId}}}", - notes = "{{{notes}}}"{{#returnBaseType}}, + notes = "{{#lambda.escapeInNormalString}}{{{unescapedNotes}}}{{/lambda.escapeInNormalString}}"{{#returnBaseType}}, response = {{{.}}}::class{{/returnBaseType}}{{#returnContainer}}, responseContainer = "{{{.}}}"{{/returnContainer}}{{#hasAuthMethods}}, authorizations = [{{#authMethods}}Authorization(value = "{{name}}"{{#isOAuth}}, scopes = [{{#scopes}}AuthorizationScope(scope = "{{scope}}", description = "{{description}}"){{^-last}}, {{/-last}}{{/scopes}}]{{/isOAuth}}){{^-last}}, {{/-last}}{{/authMethods}}]{{/hasAuthMethods}}) @ApiResponses( - value = [{{#responses}}ApiResponse(code = {{{code}}}, message = "{{{message}}}"{{#baseType}}, response = {{{.}}}::class{{/baseType}}{{#containerType}}, responseContainer = "{{{.}}}"{{/containerType}}){{^-last}},{{/-last}}{{/responses}}]){{/swagger1AnnotationLibrary}} + value = [{{#responses}}ApiResponse(code = {{{code}}}, message = "{{#lambda.escapeInNormalString}}{{{unescapedMessage}}}{{/lambda.escapeInNormalString}}"{{#baseType}}, response = {{{.}}}::class{{/baseType}}{{#containerType}}, responseContainer = "{{{.}}}"{{/containerType}}){{^-last}},{{/-last}}{{/responses}}]){{/swagger1AnnotationLibrary}} {{#implicitHeadersParams.0}} {{>implicitHeaders}} {{/implicitHeadersParams.0}} @@ -99,7 +99,7 @@ class {{classname}}Controller({{#serviceInterface}}@Autowired(required = true) v {{/isDeprecated}} @RequestMapping( method = [RequestMethod.{{httpMethod}}], - // "{{#lambdaEscapeInNormalString}}{{{path}}}{{/lambdaEscapeInNormalString}}" + // "{{#lambda.escapeInNormalString}}{{{path}}}{{/lambda.escapeInNormalString}}" value = [PATH_{{#lambda.uppercase}}{{#lambda.snakecase}}{{{operationId}}}{{/lambda.snakecase}}{{/lambda.uppercase}}]{{#singleContentTypes}}{{#hasProduces}}, produces = [{{#vendorExtensions.x-accepts}}"{{{.}}}"{{^-last}}, {{/-last}}{{/vendorExtensions.x-accepts}}]{{/hasProduces}}{{#hasConsumes}}, consumes = "{{{vendorExtensions.x-content-type}}}"{{/hasConsumes}}{{/singleContentTypes}}{{^singleContentTypes}}{{#hasProduces}}, @@ -122,7 +122,7 @@ class {{classname}}Controller({{#serviceInterface}}@Autowired(required = true) v const val BASE_PATH: String = "{{=<% %>=}}<%contextPath%><%={{ }}=%>" {{/useRequestMappingOnController}} {{#operation}} - const val PATH_{{#lambda.uppercase}}{{#lambda.snakecase}}{{{operationId}}}{{/lambda.snakecase}}{{/lambda.uppercase}}: String = "{{{path}}}" + const val PATH_{{#lambda.uppercase}}{{#lambda.snakecase}}{{{operationId}}}{{/lambda.snakecase}}{{/lambda.uppercase}}: String = "{{#lambda.escapeInNormalString}}{{{path}}}{{/lambda.escapeInNormalString}}" {{/operation}} } } diff --git a/modules/openapi-generator/src/main/resources/kotlin-spring/apiInterface.mustache b/modules/openapi-generator/src/main/resources/kotlin-spring/apiInterface.mustache index 795070dde368..d1ac16e26efc 100644 --- a/modules/openapi-generator/src/main/resources/kotlin-spring/apiInterface.mustache +++ b/modules/openapi-generator/src/main/resources/kotlin-spring/apiInterface.mustache @@ -84,24 +84,24 @@ interface {{classname}} { }}{{#swagger2AnnotationLibrary}}{{! }} @Operation( tags = [{{#tags}}"{{{name}}}",{{/tags}}], - summary = "{{{summary}}}", + summary = "{{#lambda.escapeInNormalString}}{{{unescapedSummary}}}{{/lambda.escapeInNormalString}}", operationId = "{{{operationId}}}", - description = """{{{unescapedNotes}}}""", + description = """{{#lambda.escapeDollarInMultiline}}{{{unescapedNotes}}}{{/lambda.escapeDollarInMultiline}}""", responses = [{{#responses}} - ApiResponse(responseCode = "{{{code}}}", description = "{{{message}}}"{{#baseType}}, content = [Content({{#isArray}}array = ArraySchema({{/isArray}}schema = Schema(implementation = {{{baseType}}}::class)){{#isArray}}){{/isArray}}]{{/baseType}}){{^-last}},{{/-last}}{{/responses}} + ApiResponse(responseCode = "{{{code}}}", description = "{{#lambda.escapeInNormalString}}{{{unescapedMessage}}}{{/lambda.escapeInNormalString}}"{{#baseType}}, content = [Content({{#isArray}}array = ArraySchema({{/isArray}}schema = Schema(implementation = {{{baseType}}}::class)){{#isArray}}){{/isArray}}]{{/baseType}}){{^-last}},{{/-last}}{{/responses}} ]{{#hasAuthMethods}}, security = [ {{#authMethods}}SecurityRequirement(name = "{{name}}"{{#isOAuth}}, scopes = [ {{#scopes}}"{{scope}}"{{^-last}}, {{/-last}}{{/scopes}} ]{{/isOAuth}}){{^-last}},{{/-last}}{{/authMethods}} ]{{/hasAuthMethods}} ){{/swagger2AnnotationLibrary}}{{#swagger1AnnotationLibrary}} @ApiOperation( - value = "{{{summary}}}", + value = "{{#lambda.escapeInNormalString}}{{{unescapedSummary}}}{{/lambda.escapeInNormalString}}", nickname = "{{{operationId}}}", - notes = "{{{notes}}}"{{#returnBaseType}}, + notes = "{{#lambda.escapeInNormalString}}{{{unescapedNotes}}}{{/lambda.escapeInNormalString}}"{{#returnBaseType}}, response = {{{.}}}::class{{/returnBaseType}}{{#returnContainer}}, responseContainer = "{{{.}}}"{{/returnContainer}}{{#hasAuthMethods}}, authorizations = [{{#authMethods}}Authorization(value = "{{name}}"{{#isOAuth}}, scopes = [{{#scopes}}AuthorizationScope(scope = "{{scope}}", description = "{{description}}"){{^-last}}, {{/-last}}{{/scopes}}]{{/isOAuth}}){{^-last}}, {{/-last}}{{/authMethods}}]{{/hasAuthMethods}} ) @ApiResponses( - value = [{{#responses}}ApiResponse(code = {{{code}}}, message = "{{{message}}}"{{#baseType}}, response = {{{.}}}::class{{/baseType}}{{#containerType}}, responseContainer = "{{{.}}}"{{/containerType}}){{^-last}}, {{/-last}}{{/responses}}] + value = [{{#responses}}ApiResponse(code = {{{code}}}, message = "{{#lambda.escapeInNormalString}}{{{unescapedMessage}}}{{/lambda.escapeInNormalString}}"{{#baseType}}, response = {{{.}}}::class{{/baseType}}{{#containerType}}, responseContainer = "{{{.}}}"{{/containerType}}){{^-last}}, {{/-last}}{{/responses}}] ){{/swagger1AnnotationLibrary}} {{#implicitHeadersParams.0}} {{>implicitHeaders}} @@ -114,7 +114,7 @@ interface {{classname}} { {{/isDeprecated}} @RequestMapping( method = [RequestMethod.{{httpMethod}}], - // "{{#lambdaEscapeInNormalString}}{{{path}}}{{/lambdaEscapeInNormalString}}" + // "{{#lambda.escapeInNormalString}}{{{path}}}{{/lambda.escapeInNormalString}}" value = [PATH_{{#lambda.uppercase}}{{#lambda.snakecase}}{{{operationId}}}{{/lambda.snakecase}}{{/lambda.uppercase}}]{{#singleContentTypes}}{{#hasProduces}}, produces = [{{#vendorExtensions.x-accepts}}"{{{.}}}"{{^-last}}, {{/-last}}{{/vendorExtensions.x-accepts}}]{{/hasProduces}}{{#hasConsumes}}, consumes = "{{{vendorExtensions.x-content-type}}}"{{/hasConsumes}}{{/singleContentTypes}}{{^singleContentTypes}}{{#hasProduces}}, @@ -142,7 +142,7 @@ interface {{classname}} { const val BASE_PATH: String = "{{=<% %>=}}<%contextPath%><%={{ }}=%>" {{/useRequestMappingOnInterface}} {{#operation}} - const val PATH_{{#lambda.uppercase}}{{#lambda.snakecase}}{{{operationId}}}{{/lambda.snakecase}}{{/lambda.uppercase}}: String = "{{{path}}}" + const val PATH_{{#lambda.uppercase}}{{#lambda.snakecase}}{{{operationId}}}{{/lambda.snakecase}}{{/lambda.uppercase}}: String = "{{#lambda.escapeInNormalString}}{{{path}}}{{/lambda.escapeInNormalString}}" {{/operation}} } } diff --git a/modules/openapi-generator/src/main/resources/kotlin-spring/bodyParams.mustache b/modules/openapi-generator/src/main/resources/kotlin-spring/bodyParams.mustache index b4f03475cd0b..528774332746 100644 --- a/modules/openapi-generator/src/main/resources/kotlin-spring/bodyParams.mustache +++ b/modules/openapi-generator/src/main/resources/kotlin-spring/bodyParams.mustache @@ -1 +1 @@ -{{#isBodyParam}}{{#swagger2AnnotationLibrary}}@Parameter(description = "{{{description}}}"{{#required}}, required = true{{/required}}{{^isContainer}}{{#allowableValues}}{{#defaultValue}}, schema = Schema(allowableValues = ["{{{allowableValues}}}"], defaultValue = {{^isString}}"{{/isString}}{{#isString}}{{#isEnum}}"{{/isEnum}}{{/isString}}{{{defaultValue}}}{{^isString}}"{{/isString}}{{#isString}}{{#isEnum}}"{{/isEnum}}{{/isString}}){{/defaultValue}}{{/allowableValues}}{{^allowableValues}}{{#defaultValue}}, schema = Schema(defaultValue = {{^isString}}"{{/isString}}{{#isString}}{{#isEnum}}"{{/isEnum}}{{/isString}}{{{defaultValue}}}{{^isString}}"{{/isString}}{{#isString}}{{#isEnum}}"{{/isEnum}}{{/isString}}){{/defaultValue}}{{/allowableValues}}{{#allowableValues}}{{^defaultValue}}, schema = Schema(allowableValues = ["{{{allowableValues}}}"]){{/defaultValue}}{{/allowableValues}}{{/isContainer}}) {{/swagger2AnnotationLibrary}}{{#swagger1AnnotationLibrary}}@ApiParam(value = "{{{description}}}"{{#required}}, required = true{{/required}}{{^isContainer}}{{#allowableValues}}, allowableValues = "{{{.}}}"{{/allowableValues}}{{/isContainer}}{{#defaultValue}}, defaultValue = "{{{.}}}"{{/defaultValue}}) {{/swagger1AnnotationLibrary}}{{#useBeanValidation}}@Valid{{>beanValidationBodyParams}}{{/useBeanValidation}} @RequestBody{{^required}}(required = false){{/required}} {{{paramName}}}: {{^reactive}}{{>optionalDataType}}{{/reactive}}{{#reactive}}{{^isArray}}{{>optionalDataType}}{{/isArray}}{{#isArray}}Flow<{{{baseType}}}>{{/isArray}}{{/reactive}}{{/isBodyParam}} \ No newline at end of file +{{#isBodyParam}}{{#swagger2AnnotationLibrary}}@Parameter(description = "{{#lambda.escapeInNormalString}}{{{unescapedDescription}}}{{/lambda.escapeInNormalString}}"{{#required}}, required = true{{/required}}{{^isContainer}}{{#allowableValues}}{{#defaultValue}}, schema = Schema(allowableValues = ["{{{allowableValues}}}"], defaultValue = "{{#isString}}{{^isEnum}}{{#lambda.escapeInNormalString}}{{{unescapedDefaultValue}}}{{/lambda.escapeInNormalString}}{{/isEnum}}{{#isEnum}}{{{defaultValue}}}{{/isEnum}}{{/isString}}{{^isString}}{{{defaultValue}}}{{/isString}}"){{/defaultValue}}{{/allowableValues}}{{^allowableValues}}{{#defaultValue}}, schema = Schema(defaultValue = "{{#isString}}{{^isEnum}}{{#lambda.escapeInNormalString}}{{{unescapedDefaultValue}}}{{/lambda.escapeInNormalString}}{{/isEnum}}{{#isEnum}}{{{defaultValue}}}{{/isEnum}}{{/isString}}{{^isString}}{{{defaultValue}}}{{/isString}}"){{/defaultValue}}{{/allowableValues}}{{#allowableValues}}{{^defaultValue}}, schema = Schema(allowableValues = ["{{{allowableValues}}}"]){{/defaultValue}}{{/allowableValues}}{{/isContainer}}) {{/swagger2AnnotationLibrary}}{{#swagger1AnnotationLibrary}}@ApiParam(value = "{{#lambda.escapeInNormalString}}{{{unescapedDescription}}}{{/lambda.escapeInNormalString}}"{{#required}}, required = true{{/required}}{{^isContainer}}{{#allowableValues}}, allowableValues = "{{{.}}}"{{/allowableValues}}{{/isContainer}}{{#defaultValue}}, defaultValue = "{{#isString}}{{^isEnum}}{{#lambda.escapeInNormalString}}{{{unescapedDefaultValue}}}{{/lambda.escapeInNormalString}}{{/isEnum}}{{#isEnum}}{{{defaultValue}}}{{/isEnum}}{{/isString}}{{^isString}}{{{defaultValue}}}{{/isString}}"{{/defaultValue}}) {{/swagger1AnnotationLibrary}}{{#useBeanValidation}}@Valid{{>beanValidationBodyParams}}{{/useBeanValidation}} @RequestBody{{^required}}(required = false){{/required}} {{{paramName}}}: {{^reactive}}{{>optionalDataType}}{{/reactive}}{{#reactive}}{{^isArray}}{{>optionalDataType}}{{/isArray}}{{#isArray}}Flow<{{{baseType}}}>{{/isArray}}{{/reactive}}{{/isBodyParam}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/kotlin-spring/cookieParams.mustache b/modules/openapi-generator/src/main/resources/kotlin-spring/cookieParams.mustache index 028264a18bcf..1f225337dc10 100644 --- a/modules/openapi-generator/src/main/resources/kotlin-spring/cookieParams.mustache +++ b/modules/openapi-generator/src/main/resources/kotlin-spring/cookieParams.mustache @@ -1 +1 @@ -{{#isCookieParam}}{{#useBeanValidation}}{{>beanValidationQueryParams}}{{/useBeanValidation}}@CookieValue(name = "{{baseName}}"{{^required}}, required = false{{/required}}{{#defaultValue}}, defaultValue = "{{{.}}}"{{/defaultValue}}) {{{paramName}}}: {{>optionalDataType}}{{/isCookieParam}} \ No newline at end of file +{{#isCookieParam}}{{#useBeanValidation}}{{>beanValidationQueryParams}}{{/useBeanValidation}}@CookieValue(name = "{{baseName}}"{{^required}}, required = false{{/required}}{{#defaultValue}}, defaultValue = "{{#isString}}{{^isEnum}}{{#lambda.escapeInNormalString}}{{{unescapedDefaultValue}}}{{/lambda.escapeInNormalString}}{{/isEnum}}{{#isEnum}}{{{defaultValue}}}{{/isEnum}}{{/isString}}{{^isString}}{{{defaultValue}}}{{/isString}}"{{/defaultValue}}) {{{paramName}}}: {{>optionalDataType}}{{/isCookieParam}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/kotlin-spring/dataClassOptVar.mustache b/modules/openapi-generator/src/main/resources/kotlin-spring/dataClassOptVar.mustache index ab575d4bf9d3..a480199012b5 100644 --- a/modules/openapi-generator/src/main/resources/kotlin-spring/dataClassOptVar.mustache +++ b/modules/openapi-generator/src/main/resources/kotlin-spring/dataClassOptVar.mustache @@ -1,6 +1,6 @@ {{#useBeanValidation}}{{>beanValidation}}{{>beanValidationModel}}{{/useBeanValidation}}{{#swagger2AnnotationLibrary}} - @Schema({{#example}}example = "{{#lambdaRemoveLineBreak}}{{#lambdaEscapeInNormalString}}{{{.}}}{{/lambdaEscapeInNormalString}}{{/lambdaRemoveLineBreak}}", {{/example}}{{#isReadOnly}}readOnly = {{{isReadOnly}}}, {{/isReadOnly}}description = "{{{description}}}"){{/swagger2AnnotationLibrary}}{{#swagger1AnnotationLibrary}} - @ApiModelProperty({{#example}}example = "{{#lambdaRemoveLineBreak}}{{#lambdaEscapeInNormalString}}{{{.}}}{{/lambdaEscapeInNormalString}}{{/lambdaRemoveLineBreak}}", {{/example}}{{#isReadOnly}}readOnly = {{{isReadOnly}}}, {{/isReadOnly}}value = "{{{description}}}"){{/swagger1AnnotationLibrary}}{{#deprecated}} + @Schema({{#example}}example = "{{#lambda.escapeInNormalString}}{{{.}}}{{/lambda.escapeInNormalString}}", {{/example}}{{#isReadOnly}}readOnly = {{{isReadOnly}}}, {{/isReadOnly}}description = "{{#lambda.escapeInNormalString}}{{{unescapedDescription}}}{{/lambda.escapeInNormalString}}"){{/swagger2AnnotationLibrary}}{{#swagger1AnnotationLibrary}} + @ApiModelProperty({{#example}}example = "{{#lambda.escapeInNormalString}}{{{.}}}{{/lambda.escapeInNormalString}}", {{/example}}{{#isReadOnly}}readOnly = {{{isReadOnly}}}, {{/isReadOnly}}value = "{{#lambda.escapeInNormalString}}{{{unescapedDescription}}}{{/lambda.escapeInNormalString}}"){{/swagger1AnnotationLibrary}}{{#deprecated}} @Deprecated(message = ""){{/deprecated}}{{#vendorExtensions.x-field-extra-annotation}} {{{.}}}{{/vendorExtensions.x-field-extra-annotation}} - @get:JsonProperty("{{{baseName}}}"){{#isInherited}} override{{/isInherited}} {{>modelMutable}} {{{name}}}: {{#isEnum}}{{#isArray}}{{baseType}}<{{/isArray}}{{classname}}.{{{nameInPascalCase}}}{{#isArray}}>{{/isArray}}{{/isEnum}}{{^isEnum}}{{{dataType}}}{{/isEnum}}? = {{^defaultValue}}null{{/defaultValue}}{{#defaultValue}}{{^isNumber}}{{{defaultValue}}}{{/isNumber}}{{#isNumber}}{{{dataType}}}("{{{defaultValue}}}"){{/isNumber}}{{/defaultValue}} \ No newline at end of file + @get:JsonProperty("{{#lambda.escapeInNormalString}}{{{baseName}}}{{/lambda.escapeInNormalString}}"){{#isInherited}} override{{/isInherited}} {{>modelMutable}} {{{name}}}: {{#isEnum}}{{#isArray}}{{baseType}}<{{/isArray}}{{classname}}.{{{nameInPascalCase}}}{{#isArray}}>{{/isArray}}{{/isEnum}}{{^isEnum}}{{{dataType}}}{{/isEnum}}? = {{^defaultValue}}null{{/defaultValue}}{{#defaultValue}}{{#isString}}{{^isEnum}}"{{#lambda.escapeInNormalString}}{{{unescapedDefaultValue}}}{{/lambda.escapeInNormalString}}"{{/isEnum}}{{#isEnum}}{{{defaultValue}}}{{/isEnum}}{{/isString}}{{^isString}}{{^isNumber}}{{{defaultValue}}}{{/isNumber}}{{#isNumber}}{{{dataType}}}("{{{defaultValue}}}"){{/isNumber}}{{/isString}}{{/defaultValue}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/kotlin-spring/dataClassReqVar.mustache b/modules/openapi-generator/src/main/resources/kotlin-spring/dataClassReqVar.mustache index 92e2875ac08a..b7c20a085acd 100644 --- a/modules/openapi-generator/src/main/resources/kotlin-spring/dataClassReqVar.mustache +++ b/modules/openapi-generator/src/main/resources/kotlin-spring/dataClassReqVar.mustache @@ -1,5 +1,5 @@ {{#useBeanValidation}}{{>beanValidation}}{{>beanValidationModel}}{{/useBeanValidation}}{{#swagger2AnnotationLibrary}} - @Schema({{#example}}example = "{{#lambdaRemoveLineBreak}}{{#lambdaEscapeInNormalString}}{{{.}}}{{/lambdaEscapeInNormalString}}{{/lambdaRemoveLineBreak}}", {{/example}}required = true, {{#isReadOnly}}readOnly = {{{isReadOnly}}}, {{/isReadOnly}}description = "{{{description}}}"){{/swagger2AnnotationLibrary}}{{#swagger1AnnotationLibrary}} - @ApiModelProperty({{#example}}example = "{{#lambdaRemoveLineBreak}}{{#lambdaEscapeInNormalString}}{{{.}}}{{/lambdaEscapeInNormalString}}{{/lambdaRemoveLineBreak}}", {{/example}}required = true, {{#isReadOnly}}readOnly = {{{isReadOnly}}}, {{/isReadOnly}}value = "{{{description}}}"){{/swagger1AnnotationLibrary}}{{#vendorExtensions.x-field-extra-annotation}} + @Schema({{#example}}example = "{{#lambda.escapeInNormalString}}{{{.}}}{{/lambda.escapeInNormalString}}", {{/example}}required = true, {{#isReadOnly}}readOnly = {{{isReadOnly}}}, {{/isReadOnly}}description = "{{#lambda.escapeInNormalString}}{{{unescapedDescription}}}{{/lambda.escapeInNormalString}}"){{/swagger2AnnotationLibrary}}{{#swagger1AnnotationLibrary}} + @ApiModelProperty({{#example}}example = "{{#lambda.escapeInNormalString}}{{{.}}}{{/lambda.escapeInNormalString}}", {{/example}}required = true, {{#isReadOnly}}readOnly = {{{isReadOnly}}}, {{/isReadOnly}}value = "{{#lambda.escapeInNormalString}}{{{unescapedDescription}}}{{/lambda.escapeInNormalString}}"){{/swagger1AnnotationLibrary}}{{#vendorExtensions.x-field-extra-annotation}} {{{.}}}{{/vendorExtensions.x-field-extra-annotation}} - @get:JsonProperty("{{{baseName}}}", required = true){{#isInherited}} override{{/isInherited}} {{>modelMutable}} {{{name}}}: {{#isEnum}}{{#isArray}}{{baseType}}<{{/isArray}}{{classname}}.{{{nameInPascalCase}}}{{#isArray}}>{{/isArray}}{{/isEnum}}{{^isEnum}}{{{dataType}}}{{/isEnum}}{{#isNullable}}?{{/isNullable}}{{#defaultValue}} = {{^isNumber}}{{{defaultValue}}}{{/isNumber}}{{#isNumber}}{{{dataType}}}("{{{defaultValue}}}"){{/isNumber}}{{/defaultValue}} \ No newline at end of file + @get:JsonProperty("{{#lambda.escapeInNormalString}}{{{baseName}}}{{/lambda.escapeInNormalString}}", required = true){{#isInherited}} override{{/isInherited}} {{>modelMutable}} {{{name}}}: {{#isEnum}}{{#isArray}}{{baseType}}<{{/isArray}}{{classname}}.{{{nameInPascalCase}}}{{#isArray}}>{{/isArray}}{{/isEnum}}{{^isEnum}}{{{dataType}}}{{/isEnum}}{{#isNullable}}?{{/isNullable}}{{#defaultValue}} = {{#isString}}{{^isEnum}}"{{#lambda.escapeInNormalString}}{{{unescapedDefaultValue}}}{{/lambda.escapeInNormalString}}"{{/isEnum}}{{#isEnum}}{{{defaultValue}}}{{/isEnum}}{{/isString}}{{^isString}}{{^isNumber}}{{{defaultValue}}}{{/isNumber}}{{#isNumber}}{{{dataType}}}("{{{defaultValue}}}"){{/isNumber}}{{/isString}}{{/defaultValue}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/kotlin-spring/formParams.mustache b/modules/openapi-generator/src/main/resources/kotlin-spring/formParams.mustache index 456af893718f..41b695aff458 100644 --- a/modules/openapi-generator/src/main/resources/kotlin-spring/formParams.mustache +++ b/modules/openapi-generator/src/main/resources/kotlin-spring/formParams.mustache @@ -1 +1 @@ -{{#isFormParam}}{{^isFile}}{{#swagger2AnnotationLibrary}}@Parameter(description = "{{{description}}}"{{#required}}, required = true{{/required}}{{#allowableValues}}{{#defaultValue}}, schema = Schema(allowableValues = [{{#values}}"{{{.}}}"{{^-last}}, {{/-last}}{{/values}}]{{^isContainer}}, defaultValue = {{^isString}}"{{/isString}}{{#isString}}{{#isEnum}}"{{/isEnum}}{{/isString}}{{{defaultValue}}}{{^isString}}"{{/isString}}{{#isString}}{{#isEnum}}"{{/isEnum}}{{/isString}}{{/isContainer}}){{/defaultValue}}{{/allowableValues}}{{#allowableValues}}{{^defaultValue}}, schema = Schema(allowableValues = [{{#values}}"{{{.}}}"{{^-last}}, {{/-last}}{{/values}}]){{/defaultValue}}{{/allowableValues}}{{^allowableValues}}{{#defaultValue}}{{^isContainer}}, schema = Schema(defaultValue = {{^isString}}"{{/isString}}{{#isString}}{{#isEnum}}"{{/isEnum}}{{/isString}}{{{defaultValue}}}{{^isString}}"{{/isString}}{{#isString}}{{#isEnum}}"{{/isEnum}}{{/isString}}){{/isContainer}}{{/defaultValue}}{{/allowableValues}}) {{/swagger2AnnotationLibrary}}{{#swagger1AnnotationLibrary}}@ApiParam(value = "{{{description}}}"{{#required}}, required = true{{/required}}{{#allowableValues}}, allowableValues = "{{#values}}{{{.}}}{{^-last}}, {{/-last}}{{/values}}"{{/allowableValues}}{{#defaultValue}}, defaultValue = "{{{.}}}"{{/defaultValue}}) {{/swagger1AnnotationLibrary}}{{#useBeanValidation}}@Valid {{/useBeanValidation}}{{#isModel}}@RequestPart{{/isModel}}{{^isModel}}@RequestParam{{/isModel}}(value = "{{baseName}}"{{#required}}, required = true{{/required}}{{^required}}, required = false{{/required}}) {{{paramName}}}: {{>optionalDataType}}{{/isFile}}{{#isFile}}{{#swagger2AnnotationLibrary}}@Parameter(description = "{{{description}}}") {{/swagger2AnnotationLibrary}}{{#swagger1AnnotationLibrary}}@ApiParam(value = "file detail") {{/swagger1AnnotationLibrary}}{{#useBeanValidation}}@Valid{{/useBeanValidation}} @RequestPart("{{baseName}}"{{#required}}, required = true{{/required}}{{^required}}, required = false{{/required}}) {{{paramName}}}: {{>optionalDataType}}{{/isFile}}{{/isFormParam}} \ No newline at end of file +{{#isFormParam}}{{^isFile}}{{#swagger2AnnotationLibrary}}@Parameter(description = "{{#lambda.escapeInNormalString}}{{{unescapedDescription}}}{{/lambda.escapeInNormalString}}"{{#required}}, required = true{{/required}}{{#allowableValues}}{{#defaultValue}}, schema = Schema(allowableValues = [{{#values}}"{{{.}}}"{{^-last}}, {{/-last}}{{/values}}]{{^isContainer}}, defaultValue = "{{#isString}}{{^isEnum}}{{#lambda.escapeInNormalString}}{{{unescapedDefaultValue}}}{{/lambda.escapeInNormalString}}{{/isEnum}}{{#isEnum}}{{{defaultValue}}}{{/isEnum}}{{/isString}}{{^isString}}{{{defaultValue}}}{{/isString}}"{{/isContainer}}){{/defaultValue}}{{/allowableValues}}{{#allowableValues}}{{^defaultValue}}, schema = Schema(allowableValues = [{{#values}}"{{{.}}}"{{^-last}}, {{/-last}}{{/values}}]){{/defaultValue}}{{/allowableValues}}{{^allowableValues}}{{#defaultValue}}{{^isContainer}}, schema = Schema(defaultValue = "{{#isString}}{{^isEnum}}{{#lambda.escapeInNormalString}}{{{unescapedDefaultValue}}}{{/lambda.escapeInNormalString}}{{/isEnum}}{{#isEnum}}{{{defaultValue}}}{{/isEnum}}{{/isString}}{{^isString}}{{{defaultValue}}}{{/isString}}"){{/isContainer}}{{/defaultValue}}{{/allowableValues}}) {{/swagger2AnnotationLibrary}}{{#swagger1AnnotationLibrary}}@ApiParam(value = "{{#lambda.escapeInNormalString}}{{{unescapedDescription}}}{{/lambda.escapeInNormalString}}"{{#required}}, required = true{{/required}}{{#allowableValues}}, allowableValues = "{{#values}}{{{.}}}{{^-last}}, {{/-last}}{{/values}}"{{/allowableValues}}{{#defaultValue}}, defaultValue = "{{#isString}}{{^isEnum}}{{#lambda.escapeInNormalString}}{{{unescapedDefaultValue}}}{{/lambda.escapeInNormalString}}{{/isEnum}}{{#isEnum}}{{{defaultValue}}}{{/isEnum}}{{/isString}}{{^isString}}{{{defaultValue}}}{{/isString}}"{{/defaultValue}}) {{/swagger1AnnotationLibrary}}{{#useBeanValidation}}@Valid {{/useBeanValidation}}{{#isModel}}@RequestPart{{/isModel}}{{^isModel}}@RequestParam{{/isModel}}(value = "{{baseName}}"{{#required}}, required = true{{/required}}{{^required}}, required = false{{/required}}) {{{paramName}}}: {{>optionalDataType}}{{/isFile}}{{#isFile}}{{#swagger2AnnotationLibrary}}@Parameter(description = "{{#lambda.escapeInNormalString}}{{{unescapedDescription}}}{{/lambda.escapeInNormalString}}") {{/swagger2AnnotationLibrary}}{{#swagger1AnnotationLibrary}}@ApiParam(value = "file detail") {{/swagger1AnnotationLibrary}}{{#useBeanValidation}}@Valid{{/useBeanValidation}} @RequestPart("{{baseName}}"{{#required}}, required = true{{/required}}{{^required}}, required = false{{/required}}) {{{paramName}}}: {{>optionalDataType}}{{/isFile}}{{/isFormParam}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/kotlin-spring/headerParams.mustache b/modules/openapi-generator/src/main/resources/kotlin-spring/headerParams.mustache index 0c2678f1bf67..8287a7c95dfc 100644 --- a/modules/openapi-generator/src/main/resources/kotlin-spring/headerParams.mustache +++ b/modules/openapi-generator/src/main/resources/kotlin-spring/headerParams.mustache @@ -1 +1 @@ -{{#isHeaderParam}}{{#useBeanValidation}}{{>beanValidationCore}}{{/useBeanValidation}}{{#swagger2AnnotationLibrary}}@Parameter(description = "{{{description}}}", `in` = ParameterIn.HEADER{{#required}}, required = true{{/required}}{{#allowableValues}}{{#defaultValue}}, schema = Schema(allowableValues = [{{#values}}"{{{.}}}"{{^-last}}, {{/-last}}{{/values}}]{{^isContainer}}, defaultValue = {{^isString}}"{{/isString}}{{#isString}}{{#isEnum}}"{{/isEnum}}{{/isString}}{{{defaultValue}}}{{^isString}}"{{/isString}}{{#isString}}{{#isEnum}}"{{/isEnum}}{{/isString}}{{/isContainer}}){{/defaultValue}}{{/allowableValues}}{{#allowableValues}}{{^defaultValue}}, schema = Schema(allowableValues = [{{#values}}"{{{.}}}"{{^-last}}, {{/-last}}{{/values}}]){{/defaultValue}}{{/allowableValues}}{{^allowableValues}}{{#defaultValue}}{{^isContainer}}, schema = Schema(defaultValue = {{^isString}}"{{/isString}}{{#isString}}{{#isEnum}}"{{/isEnum}}{{/isString}}{{{defaultValue}}}{{^isString}}"{{/isString}}{{#isString}}{{#isEnum}}"{{/isEnum}}{{/isString}}){{/isContainer}}{{/defaultValue}}{{/allowableValues}}) {{/swagger2AnnotationLibrary}}{{#swagger1AnnotationLibrary}}@ApiParam(value = "{{{description}}}"{{#required}}, required = true{{/required}}{{#allowableValues}}, allowableValues = "{{#values}}{{{.}}}{{^-last}}, {{/-last}}{{/values}}"{{/allowableValues}}{{#defaultValue}}, defaultValue = "{{{.}}}"{{/defaultValue}}) {{/swagger1AnnotationLibrary}}@RequestHeader(value = "{{baseName}}", required = {{#required}}true{{/required}}{{^required}}false{{/required}}{{#defaultValue}}, defaultValue = {{^isString}}"{{{.}}}"{{/isString}}{{#isString}}{{#isEnum}}"{{{.}}}"{{/isEnum}}{{^isEnum}}{{{.}}}{{/isEnum}}{{/isString}}{{/defaultValue}}) {{{paramName}}}: {{>optionalDataType}}{{/isHeaderParam}} \ No newline at end of file +{{#isHeaderParam}}{{#useBeanValidation}}{{>beanValidationCore}}{{/useBeanValidation}}{{#swagger2AnnotationLibrary}}@Parameter(description = "{{#lambda.escapeInNormalString}}{{{unescapedDescription}}}{{/lambda.escapeInNormalString}}", `in` = ParameterIn.HEADER{{#required}}, required = true{{/required}}{{#allowableValues}}{{#defaultValue}}, schema = Schema(allowableValues = [{{#values}}"{{{.}}}"{{^-last}}, {{/-last}}{{/values}}]{{^isContainer}}, defaultValue = "{{#isString}}{{^isEnum}}{{#lambda.escapeInNormalString}}{{{unescapedDefaultValue}}}{{/lambda.escapeInNormalString}}{{/isEnum}}{{#isEnum}}{{{defaultValue}}}{{/isEnum}}{{/isString}}{{^isString}}{{{defaultValue}}}{{/isString}}"{{/isContainer}}){{/defaultValue}}{{/allowableValues}}{{#allowableValues}}{{^defaultValue}}, schema = Schema(allowableValues = [{{#values}}"{{{.}}}"{{^-last}}, {{/-last}}{{/values}}]){{/defaultValue}}{{/allowableValues}}{{^allowableValues}}{{#defaultValue}}{{^isContainer}}, schema = Schema(defaultValue = "{{#isString}}{{^isEnum}}{{#lambda.escapeInNormalString}}{{{unescapedDefaultValue}}}{{/lambda.escapeInNormalString}}{{/isEnum}}{{#isEnum}}{{{defaultValue}}}{{/isEnum}}{{/isString}}{{^isString}}{{{defaultValue}}}{{/isString}}"){{/isContainer}}{{/defaultValue}}{{/allowableValues}}) {{/swagger2AnnotationLibrary}}{{#swagger1AnnotationLibrary}}@ApiParam(value = "{{#lambda.escapeInNormalString}}{{{unescapedDescription}}}{{/lambda.escapeInNormalString}}"{{#required}}, required = true{{/required}}{{#allowableValues}}, allowableValues = "{{#values}}{{{.}}}{{^-last}}, {{/-last}}{{/values}}"{{/allowableValues}}{{#defaultValue}}, defaultValue = "{{{.}}}"{{/defaultValue}}) {{/swagger1AnnotationLibrary}}@RequestHeader(value = "{{#lambda.escapeInNormalString}}{{baseName}}{{/lambda.escapeInNormalString}}", required = {{#required}}true{{/required}}{{^required}}false{{/required}}{{#defaultValue}}, defaultValue = "{{#isString}}{{^isEnum}}{{#lambda.escapeInNormalString}}{{{unescapedDefaultValue}}}{{/lambda.escapeInNormalString}}{{/isEnum}}{{#isEnum}}{{{defaultValue}}}{{/isEnum}}{{/isString}}{{^isString}}{{{defaultValue}}}{{/isString}}"{{/defaultValue}}) {{{paramName}}}: {{>optionalDataType}}{{/isHeaderParam}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/kotlin-spring/implicitHeaders.mustache b/modules/openapi-generator/src/main/resources/kotlin-spring/implicitHeaders.mustache index c7b37059e2d9..6ac7bc679eba 100644 --- a/modules/openapi-generator/src/main/resources/kotlin-spring/implicitHeaders.mustache +++ b/modules/openapi-generator/src/main/resources/kotlin-spring/implicitHeaders.mustache @@ -1,14 +1,14 @@ {{#swagger2AnnotationLibrary}} @Parameters(value = [ {{#implicitHeadersParams}} - Parameter(name = "{{{baseName}}}"{{#isDeprecated}}, deprecated = true{{/isDeprecated}}, description = "{{{description}}}"{{#required}}, required = true{{/required}}, `in` = ParameterIn.HEADER){{^-last}},{{/-last}} + Parameter(name = "{{#lambda.escapeInNormalString}}{{{baseName}}}{{/lambda.escapeInNormalString}}"{{#isDeprecated}}, deprecated = true{{/isDeprecated}}, description = "{{#lambda.escapeInNormalString}}{{{unescapedDescription}}}{{/lambda.escapeInNormalString}}"{{#required}}, required = true{{/required}}, `in` = ParameterIn.HEADER){{^-last}},{{/-last}} {{/implicitHeadersParams}} ]) {{/swagger2AnnotationLibrary}} {{#swagger1AnnotationLibrary}} @ApiImplicitParams(value = [ {{#implicitHeadersParams}} - ApiImplicitParam(name = "{{{baseName}}}", value = "{{{description}}}", {{#required}}required = true,{{/required}} dataType = "{{{dataType}}}", paramType = "header"){{^-last}},{{/-last}} + ApiImplicitParam(name = "{{#lambda.escapeInNormalString}}{{{baseName}}}{{/lambda.escapeInNormalString}}", value = "{{#lambda.escapeInNormalString}}{{{unescapedDescription}}}{{/lambda.escapeInNormalString}}", {{#required}}required = true,{{/required}} dataType = "{{{dataType}}}", paramType = "header"){{^-last}},{{/-last}} {{/implicitHeadersParams}} ]) {{/swagger1AnnotationLibrary}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/kotlin-spring/interfaceOptVar.mustache b/modules/openapi-generator/src/main/resources/kotlin-spring/interfaceOptVar.mustache index 3fa63ad64876..222949e2d42c 100644 --- a/modules/openapi-generator/src/main/resources/kotlin-spring/interfaceOptVar.mustache +++ b/modules/openapi-generator/src/main/resources/kotlin-spring/interfaceOptVar.mustache @@ -1,5 +1,5 @@ {{#swagger2AnnotationLibrary}} - @get:Schema({{#example}}example = "{{{.}}}", {{/example}}{{#required}}requiredMode = Schema.RequiredMode.REQUIRED, {{/required}}{{#isReadOnly}}readOnly = {{{isReadOnly}}}, {{/isReadOnly}}description = "{{{description}}}"){{/swagger2AnnotationLibrary}}{{#swagger1AnnotationLibrary}} - @get:ApiModelProperty({{#example}}example = "{{{.}}}", {{/example}}{{#required}}required = {{required}}, {{/required}}{{#isReadOnly}}readOnly = {{{isReadOnly}}}, {{/isReadOnly}}value = "{{{description}}}"){{/swagger1AnnotationLibrary}}{{#vendorExtensions.x-field-extra-annotation}} + @get:Schema({{#example}}example = "{{#lambda.escapeInNormalString}}{{{.}}}{{/lambda.escapeInNormalString}}", {{/example}}{{#required}}requiredMode = Schema.RequiredMode.REQUIRED, {{/required}}{{#isReadOnly}}readOnly = {{{isReadOnly}}}, {{/isReadOnly}}description = "{{#lambda.escapeInNormalString}}{{{unescapedDescription}}}{{/lambda.escapeInNormalString}}"){{/swagger2AnnotationLibrary}}{{#swagger1AnnotationLibrary}} + @get:ApiModelProperty({{#example}}example = "{{#lambda.escapeInNormalString}}{{{.}}}{{/lambda.escapeInNormalString}}", {{/example}}{{#required}}required = {{required}}, {{/required}}{{#isReadOnly}}readOnly = {{{isReadOnly}}}, {{/isReadOnly}}value = "{{#lambda.escapeInNormalString}}{{{unescapedDescription}}}{{/lambda.escapeInNormalString}}"){{/swagger1AnnotationLibrary}}{{#vendorExtensions.x-field-extra-annotation}} {{{.}}}{{/vendorExtensions.x-field-extra-annotation}} - {{#isInherited}}override {{/isInherited}}{{>modelMutable}} {{{name}}}: {{#isEnum}}{{classname}}.{{nameInPascalCase}}{{/isEnum}}{{^isEnum}}{{{dataType}}}{{/isEnum}}? {{^discriminator}}= {{{defaultValue}}}{{^defaultValue}}null{{/defaultValue}}{{/discriminator}} + {{#isInherited}}override {{/isInherited}}{{>modelMutable}} {{{name}}}: {{#isEnum}}{{classname}}.{{nameInPascalCase}}{{/isEnum}}{{^isEnum}}{{{dataType}}}{{/isEnum}}? {{^discriminator}}= {{^defaultValue}}null{{/defaultValue}}{{#defaultValue}}{{#isString}}{{^isEnum}}"{{#lambda.escapeInNormalString}}{{{unescapedDefaultValue}}}{{/lambda.escapeInNormalString}}"{{/isEnum}}{{#isEnum}}{{{defaultValue}}}{{/isEnum}}{{/isString}}{{^isString}}{{{defaultValue}}}{{/isString}}{{/defaultValue}}{{/discriminator}} diff --git a/modules/openapi-generator/src/main/resources/kotlin-spring/interfaceReqVar.mustache b/modules/openapi-generator/src/main/resources/kotlin-spring/interfaceReqVar.mustache index 8f0fb71ba319..fc9af6228d44 100644 --- a/modules/openapi-generator/src/main/resources/kotlin-spring/interfaceReqVar.mustache +++ b/modules/openapi-generator/src/main/resources/kotlin-spring/interfaceReqVar.mustache @@ -1,5 +1,5 @@ {{#swagger2AnnotationLibrary}} - @get:Schema({{#example}}example = "{{{.}}}", {{/example}}{{#required}}requiredMode = Schema.RequiredMode.REQUIRED, {{/required}}{{#isReadOnly}}readOnly = {{{isReadOnly}}}, {{/isReadOnly}}description = "{{{description}}}"){{/swagger2AnnotationLibrary}}{{#swagger1AnnotationLibrary}} - @get:ApiModelProperty({{#example}}example = "{{{.}}}", {{/example}}{{#required}}required = {{required}}, {{/required}}{{#isReadOnly}}readOnly = {{{isReadOnly}}}, {{/isReadOnly}}value = "{{{description}}}"){{/swagger1AnnotationLibrary}}{{#vendorExtensions.x-field-extra-annotation}} + @get:Schema({{#example}}example = "{{#lambda.escapeInNormalString}}{{{.}}}{{/lambda.escapeInNormalString}}", {{/example}}{{#required}}requiredMode = Schema.RequiredMode.REQUIRED, {{/required}}{{#isReadOnly}}readOnly = {{{isReadOnly}}}, {{/isReadOnly}}description = "{{#lambda.escapeInNormalString}}{{{unescapedDescription}}}{{/lambda.escapeInNormalString}}"){{/swagger2AnnotationLibrary}}{{#swagger1AnnotationLibrary}} + @get:ApiModelProperty({{#example}}example = "{{#lambda.escapeInNormalString}}{{{.}}}{{/lambda.escapeInNormalString}}", {{/example}}{{#required}}required = {{required}}, {{/required}}{{#isReadOnly}}readOnly = {{{isReadOnly}}}, {{/isReadOnly}}value = "{{#lambda.escapeInNormalString}}{{{unescapedDescription}}}{{/lambda.escapeInNormalString}}"){{/swagger1AnnotationLibrary}}{{#vendorExtensions.x-field-extra-annotation}} {{{.}}}{{/vendorExtensions.x-field-extra-annotation}} {{#isInherited}}override {{/isInherited}}{{>modelMutable}} {{{name}}}: {{#isEnum}}{{classname}}.{{nameInPascalCase}}{{/isEnum}}{{^isEnum}}{{{dataType}}}{{/isEnum}} diff --git a/modules/openapi-generator/src/main/resources/kotlin-spring/libraries/spring-declarative-http-interface/apiInterface.mustache b/modules/openapi-generator/src/main/resources/kotlin-spring/libraries/spring-declarative-http-interface/apiInterface.mustache index 53ce2730aa8b..de44538b18d7 100644 --- a/modules/openapi-generator/src/main/resources/kotlin-spring/libraries/spring-declarative-http-interface/apiInterface.mustache +++ b/modules/openapi-generator/src/main/resources/kotlin-spring/libraries/spring-declarative-http-interface/apiInterface.mustache @@ -63,7 +63,7 @@ interface {{classname}} { }}{{^useResponseEntity}} @ResponseStatus({{#springHttpStatus}}{{#responses.0}}{{{code}}}{{/responses.0}}{{/springHttpStatus}}) {{/useResponseEntity}}{{! }}{{#httpMethod}} @HttpExchange( - // "{{#lambdaEscapeInNormalString}}{{{path}}}{{/lambdaEscapeInNormalString}}" + // "{{#lambda.escapeInNormalString}}{{{path}}}{{/lambda.escapeInNormalString}}" url = PATH_{{#lambda.uppercase}}{{#lambda.snakecase}}{{{operationId}}}{{/lambda.snakecase}}{{/lambda.uppercase}}, method = "{{httpMethod}}" ) diff --git a/modules/openapi-generator/src/main/resources/kotlin-spring/libraries/spring-declarative-http-interface/httpInterfaceBodyParams.mustache b/modules/openapi-generator/src/main/resources/kotlin-spring/libraries/spring-declarative-http-interface/httpInterfaceBodyParams.mustache index e884046f7d6d..cd6e83f9680c 100644 --- a/modules/openapi-generator/src/main/resources/kotlin-spring/libraries/spring-declarative-http-interface/httpInterfaceBodyParams.mustache +++ b/modules/openapi-generator/src/main/resources/kotlin-spring/libraries/spring-declarative-http-interface/httpInterfaceBodyParams.mustache @@ -1 +1 @@ -{{#isBodyParam}}{{#swagger2AnnotationLibrary}}@Parameter(description = "{{{description}}}"{{#required}}, required = true{{/required}}{{^isContainer}}{{#allowableValues}}{{#defaultValue}}, schema = Schema(allowableValues = ["{{{allowableValues}}}"], defaultValue = {{^isString}}"{{/isString}}{{#isString}}{{#isEnum}}"{{/isEnum}}{{/isString}}{{{defaultValue}}}{{^isString}}"{{/isString}}{{#isString}}{{#isEnum}}"{{/isEnum}}{{/isString}}){{/defaultValue}}{{/allowableValues}}{{^allowableValues}}{{#defaultValue}}, schema = Schema(defaultValue = {{^isString}}"{{/isString}}{{#isString}}{{#isEnum}}"{{/isEnum}}{{/isString}}{{{defaultValue}}}{{^isString}}"{{/isString}}{{#isString}}{{#isEnum}}"{{/isEnum}}{{/isString}}){{/defaultValue}}{{/allowableValues}}{{#allowableValues}}{{^defaultValue}}, schema = Schema(allowableValues = ["{{{allowableValues}}}"]){{/defaultValue}}{{/allowableValues}}{{/isContainer}}) {{/swagger2AnnotationLibrary}}{{#swagger1AnnotationLibrary}}@ApiParam(value = "{{{description}}}"{{#required}}, required = true{{/required}}{{^isContainer}}{{#allowableValues}}, allowableValues = "{{{.}}}"{{/allowableValues}}{{/isContainer}}{{#defaultValue}}, defaultValue = "{{{.}}}"{{/defaultValue}}) {{/swagger1AnnotationLibrary}}{{#useBeanValidation}}@Valid{{>beanValidationBodyParams}}{{/useBeanValidation}} @RequestBody{{^required}}(required = false){{/required}} {{{paramName}}}: {{>optionalDataType}}{{/isBodyParam}} \ No newline at end of file +{{#isBodyParam}}{{#swagger2AnnotationLibrary}}@Parameter(description = "{{#lambda.escapeInNormalString}}{{{unescapedDescription}}}{{/lambda.escapeInNormalString}}"{{#required}}, required = true{{/required}}{{^isContainer}}{{#allowableValues}}{{#defaultValue}}, schema = Schema(allowableValues = ["{{{allowableValues}}}"], defaultValue = "{{#lambda.escapeInNormalString}}{{{unescapedDefaultValue}}}{{/lambda.escapeInNormalString}}"){{/defaultValue}}{{/allowableValues}}{{^allowableValues}}{{#defaultValue}}, schema = Schema(defaultValue = "{{#lambda.escapeInNormalString}}{{{unescapedDefaultValue}}}{{/lambda.escapeInNormalString}}"){{/defaultValue}}{{/allowableValues}}{{#allowableValues}}{{^defaultValue}}, schema = Schema(allowableValues = ["{{{allowableValues}}}"]){{/defaultValue}}{{/allowableValues}}{{/isContainer}}) {{/swagger2AnnotationLibrary}}{{#swagger1AnnotationLibrary}}@ApiParam(value = "{{#lambda.escapeInNormalString}}{{{unescapedDescription}}}{{/lambda.escapeInNormalString}}"{{#required}}, required = true{{/required}}{{^isContainer}}{{#allowableValues}}, allowableValues = "{{{.}}}"{{/allowableValues}}{{/isContainer}}{{#defaultValue}}, defaultValue = "{{#lambda.escapeInNormalString}}{{{unescapedDefaultValue}}}{{/lambda.escapeInNormalString}}"{{/defaultValue}}) {{/swagger1AnnotationLibrary}}{{#useBeanValidation}}@Valid{{>beanValidationBodyParams}}{{/useBeanValidation}} @RequestBody{{^required}}(required = false){{/required}} {{{paramName}}}: {{>optionalDataType}}{{/isBodyParam}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/kotlin-spring/methodBody.mustache b/modules/openapi-generator/src/main/resources/kotlin-spring/methodBody.mustache index 0a6660b342a8..73cb1e15d498 100644 --- a/modules/openapi-generator/src/main/resources/kotlin-spring/methodBody.mustache +++ b/modules/openapi-generator/src/main/resources/kotlin-spring/methodBody.mustache @@ -5,7 +5,7 @@ getRequest().ifPresent { request -> for (mediaType in MediaType.parseMediaTypes(request.getHeader("Accept"))) { {{/-first}} if (mediaType.isCompatibleWith(MediaType.valueOf("{{{contentType}}}"))) { - ApiUtil.setExampleResponse(request, "{{{contentType}}}", "{{#lambdaRemoveLineBreak}}{{#lambdaEscapeInNormalString}}{{{example}}}{{/lambdaEscapeInNormalString}}{{/lambdaRemoveLineBreak}}") + ApiUtil.setExampleResponse(request, "{{{contentType}}}", "{{#lambda.escapeInNormalString}}{{{example}}}{{/lambda.escapeInNormalString}}") break } {{#-last}} diff --git a/modules/openapi-generator/src/main/resources/kotlin-spring/pathParams.mustache b/modules/openapi-generator/src/main/resources/kotlin-spring/pathParams.mustache index 2e28d18c78fa..f3189ef2c381 100644 --- a/modules/openapi-generator/src/main/resources/kotlin-spring/pathParams.mustache +++ b/modules/openapi-generator/src/main/resources/kotlin-spring/pathParams.mustache @@ -1 +1 @@ -{{#isPathParam}}{{#useBeanValidation}}{{>beanValidationPathParams}}{{/useBeanValidation}}{{#swagger2AnnotationLibrary}}@Parameter(description = "{{{description}}}"{{#required}}, required = true{{/required}}{{#allowableValues}}{{#defaultValue}}, schema = Schema(allowableValues = [{{#values}}"{{{.}}}"{{^-last}}, {{/-last}}{{/values}}]{{^isContainer}}, defaultValue = {{^isString}}"{{/isString}}{{#isString}}{{#isEnum}}"{{/isEnum}}{{/isString}}{{{defaultValue}}}{{^isString}}"{{/isString}}{{#isString}}{{#isEnum}}"{{/isEnum}}{{/isString}}{{/isContainer}}){{/defaultValue}}{{/allowableValues}}{{#allowableValues}}{{^defaultValue}}, schema = Schema(allowableValues = [{{#values}}"{{{.}}}"{{^-last}}, {{/-last}}{{/values}}]){{/defaultValue}}{{/allowableValues}}{{^allowableValues}}{{#defaultValue}}{{^isContainer}}, schema = Schema(defaultValue = {{^isString}}"{{/isString}}{{#isString}}{{#isEnum}}"{{/isEnum}}{{/isString}}{{{defaultValue}}}{{^isString}}"{{/isString}}{{#isString}}{{#isEnum}}"{{/isEnum}}{{/isString}}){{/isContainer}}{{/defaultValue}}{{/allowableValues}}) {{/swagger2AnnotationLibrary}}{{#swagger1AnnotationLibrary}}@ApiParam(value = "{{{description}}}"{{#required}}, required = true{{/required}}{{#allowableValues}}, allowableValues = "{{#values}}{{{.}}}{{^-last}}, {{/-last}}{{/values}}"{{/allowableValues}}{{#defaultValue}}, defaultValue = "{{{.}}}"{{/defaultValue}}) {{/swagger1AnnotationLibrary}}@PathVariable("{{baseName}}") {{{paramName}}}: {{>optionalDataType}}{{/isPathParam}} \ No newline at end of file +{{#isPathParam}}{{#useBeanValidation}}{{>beanValidationPathParams}}{{/useBeanValidation}}{{#swagger2AnnotationLibrary}}@Parameter(description = "{{#lambda.escapeInNormalString}}{{{unescapedDescription}}}{{/lambda.escapeInNormalString}}"{{#required}}, required = true{{/required}}{{#allowableValues}}{{#defaultValue}}, schema = Schema(allowableValues = [{{#values}}"{{{.}}}"{{^-last}}, {{/-last}}{{/values}}]{{^isContainer}}, defaultValue = "{{#isString}}{{^isEnum}}{{#lambda.escapeInNormalString}}{{{unescapedDefaultValue}}}{{/lambda.escapeInNormalString}}{{/isEnum}}{{#isEnum}}{{{defaultValue}}}{{/isEnum}}{{/isString}}{{^isString}}{{{defaultValue}}}{{/isString}}"{{/isContainer}}){{/defaultValue}}{{/allowableValues}}{{#allowableValues}}{{^defaultValue}}, schema = Schema(allowableValues = [{{#values}}"{{{.}}}"{{^-last}}, {{/-last}}{{/values}}]){{/defaultValue}}{{/allowableValues}}{{^allowableValues}}{{#defaultValue}}{{^isContainer}}, schema = Schema(defaultValue = "{{#isString}}{{^isEnum}}{{#lambda.escapeInNormalString}}{{{unescapedDefaultValue}}}{{/lambda.escapeInNormalString}}{{/isEnum}}{{#isEnum}}{{{defaultValue}}}{{/isEnum}}{{/isString}}{{^isString}}{{{defaultValue}}}{{/isString}}"){{/isContainer}}{{/defaultValue}}{{/allowableValues}}) {{/swagger2AnnotationLibrary}}{{#swagger1AnnotationLibrary}}@ApiParam(value = "{{#lambda.escapeInNormalString}}{{{unescapedDescription}}}{{/lambda.escapeInNormalString}}"{{#required}}, required = true{{/required}}{{#allowableValues}}, allowableValues = "{{#values}}{{{.}}}{{^-last}}, {{/-last}}{{/values}}"{{/allowableValues}}{{#defaultValue}}, defaultValue = "{{{.}}}"{{/defaultValue}}) {{/swagger1AnnotationLibrary}}@PathVariable("{{baseName}}") {{{paramName}}}: {{>optionalDataType}}{{/isPathParam}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/kotlin-spring/queryParams.mustache b/modules/openapi-generator/src/main/resources/kotlin-spring/queryParams.mustache index 27d7e286bb33..ca0a9c62d12a 100644 --- a/modules/openapi-generator/src/main/resources/kotlin-spring/queryParams.mustache +++ b/modules/openapi-generator/src/main/resources/kotlin-spring/queryParams.mustache @@ -1 +1 @@ -{{#isQueryParam}}{{#useBeanValidation}}{{>beanValidationQueryParams}}{{/useBeanValidation}}{{#swagger2AnnotationLibrary}}@Parameter(description = "{{{description}}}"{{#required}}, required = true{{/required}}{{#allowableValues}}{{#defaultValue}}, schema = Schema(allowableValues = [{{#values}}"{{{.}}}"{{^-last}}, {{/-last}}{{/values}}]{{^isContainer}}, defaultValue = {{^isString}}"{{/isString}}{{#isString}}{{#isEnum}}"{{/isEnum}}{{/isString}}{{{defaultValue}}}{{^isString}}"{{/isString}}{{#isString}}{{#isEnum}}"{{/isEnum}}{{/isString}}{{/isContainer}}){{/defaultValue}}{{/allowableValues}}{{#allowableValues}}{{^defaultValue}}, schema = Schema(allowableValues = [{{#values}}"{{{.}}}"{{^-last}}, {{/-last}}{{/values}}]){{/defaultValue}}{{/allowableValues}}{{^allowableValues}}{{#defaultValue}}{{^isContainer}}, schema = Schema(defaultValue = {{^isString}}"{{/isString}}{{#isString}}{{#isEnum}}"{{/isEnum}}{{/isString}}{{{defaultValue}}}{{^isString}}"{{/isString}}{{#isString}}{{#isEnum}}"{{/isEnum}}{{/isString}}){{/isContainer}}{{/defaultValue}}{{/allowableValues}}) {{/swagger2AnnotationLibrary}}{{#swagger1AnnotationLibrary}}@ApiParam(value = "{{{description}}}"{{#required}}, required = true{{/required}}{{#allowableValues}}, allowableValues = "{{#values}}{{{.}}}{{^-last}}, {{/-last}}{{/values}}"{{/allowableValues}}{{^isContainer}}{{#defaultValue}}, defaultValue = {{^isString}}"{{/isString}}{{#isString}}{{#isEnum}}"{{/isEnum}}{{/isString}}{{{defaultValue}}}{{^isString}}"{{/isString}}{{#isString}}{{#isEnum}}"{{/isEnum}}{{/isString}}{{/defaultValue}}{{/isContainer}}) {{/swagger1AnnotationLibrary}}{{#useBeanValidation}}@Valid{{/useBeanValidation}}{{^isModel}} @RequestParam(value = "{{baseName}}"{{#required}}, required = true{{/required}}{{^required}}, required = false{{/required}}{{^isContainer}}{{#defaultValue}}, defaultValue = {{^isString}}"{{/isString}}{{#isString}}{{#isEnum}}"{{/isEnum}}{{/isString}}{{{defaultValue}}}{{^isString}}"{{/isString}}{{#isString}}{{#isEnum}}"{{/isEnum}}{{/isString}}{{/defaultValue}}{{/isContainer}}){{/isModel}}{{#isDate}} @org.springframework.format.annotation.DateTimeFormat(iso = org.springframework.format.annotation.DateTimeFormat.ISO.DATE){{/isDate}}{{#isDateTime}} @org.springframework.format.annotation.DateTimeFormat(iso = org.springframework.format.annotation.DateTimeFormat.ISO.DATE_TIME){{/isDateTime}} {{{paramName}}}: {{>optionalDataType}}{{/isQueryParam}} \ No newline at end of file +{{#isQueryParam}}{{#useBeanValidation}}{{>beanValidationQueryParams}}{{/useBeanValidation}}{{#swagger2AnnotationLibrary}}@Parameter(description = "{{#lambda.escapeInNormalString}}{{{unescapedDescription}}}{{/lambda.escapeInNormalString}}"{{#required}}, required = true{{/required}}{{#allowableValues}}{{#defaultValue}}, schema = Schema(allowableValues = [{{#values}}"{{{.}}}"{{^-last}}, {{/-last}}{{/values}}]{{^isContainer}}, defaultValue = "{{#isString}}{{^isEnum}}{{#lambda.escapeInNormalString}}{{{unescapedDefaultValue}}}{{/lambda.escapeInNormalString}}{{/isEnum}}{{#isEnum}}{{{defaultValue}}}{{/isEnum}}{{/isString}}{{^isString}}{{{defaultValue}}}{{/isString}}"{{/isContainer}}){{/defaultValue}}{{/allowableValues}}{{#allowableValues}}{{^defaultValue}}, schema = Schema(allowableValues = [{{#values}}"{{{.}}}"{{^-last}}, {{/-last}}{{/values}}]){{/defaultValue}}{{/allowableValues}}{{^allowableValues}}{{#defaultValue}}{{^isContainer}}, schema = Schema(defaultValue = "{{#isString}}{{^isEnum}}{{#lambda.escapeInNormalString}}{{{unescapedDefaultValue}}}{{/lambda.escapeInNormalString}}{{/isEnum}}{{#isEnum}}{{{defaultValue}}}{{/isEnum}}{{/isString}}{{^isString}}{{{defaultValue}}}{{/isString}}"){{/isContainer}}{{/defaultValue}}{{/allowableValues}}) {{/swagger2AnnotationLibrary}}{{#swagger1AnnotationLibrary}}@ApiParam(value = "{{#lambda.escapeInNormalString}}{{{unescapedDescription}}}{{/lambda.escapeInNormalString}}"{{#required}}, required = true{{/required}}{{#allowableValues}}, allowableValues = "{{#values}}{{{.}}}{{^-last}}, {{/-last}}{{/values}}"{{/allowableValues}}{{^isContainer}}{{#defaultValue}}, defaultValue = "{{#isString}}{{^isEnum}}{{#lambda.escapeInNormalString}}{{{unescapedDefaultValue}}}{{/lambda.escapeInNormalString}}{{/isEnum}}{{#isEnum}}{{{defaultValue}}}{{/isEnum}}{{/isString}}{{^isString}}{{{defaultValue}}}{{/isString}}"{{/defaultValue}}{{/isContainer}}) {{/swagger1AnnotationLibrary}}{{#useBeanValidation}}@Valid{{/useBeanValidation}}{{^isModel}} @RequestParam(value = "{{#lambda.escapeInNormalString}}{{baseName}}{{/lambda.escapeInNormalString}}"{{#required}}, required = true{{/required}}{{^required}}, required = false{{/required}}{{^isContainer}}{{#defaultValue}}, defaultValue = "{{#isString}}{{^isEnum}}{{#lambda.escapeInNormalString}}{{{unescapedDefaultValue}}}{{/lambda.escapeInNormalString}}{{/isEnum}}{{#isEnum}}{{{defaultValue}}}{{/isEnum}}{{/isString}}{{^isString}}{{{defaultValue}}}{{/isString}}"{{/defaultValue}}{{/isContainer}}){{/isModel}}{{#isDate}} @org.springframework.format.annotation.DateTimeFormat(iso = org.springframework.format.annotation.DateTimeFormat.ISO.DATE){{/isDate}}{{#isDateTime}} @org.springframework.format.annotation.DateTimeFormat(iso = org.springframework.format.annotation.DateTimeFormat.ISO.DATE_TIME){{/isDateTime}} {{{paramName}}}: {{>optionalDataType}}{{/isQueryParam}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/kotlin-vertx-server/api_doc.mustache b/modules/openapi-generator/src/main/resources/kotlin-vertx-server/api_doc.mustache index 31dee489e67c..425dd3db6ce6 100644 --- a/modules/openapi-generator/src/main/resources/kotlin-vertx-server/api_doc.mustache +++ b/modules/openapi-generator/src/main/resources/kotlin-vertx-server/api_doc.mustache @@ -1,28 +1,28 @@ # {{classname}}{{#description}} -{{.}}{{/description}} +{{#lambda.escapeMarkdown}}{{{.}}}{{/lambda.escapeMarkdown}}{{/description}} All URIs are relative to *{{basePath}}* Method | HTTP request | Description ------------- | ------------- | ------------- -{{#operations}}{{#operation}}[**{{operationId}}**]({{classname}}.md#{{operationId}}) | **{{httpMethod}}** {{path}} | {{summary}} +{{#operations}}{{#operation}}[**{{operationId}}**]({{classname}}.md#{{operationId}}) | **{{httpMethod}}** {{path}} | {{#lambda.escapeMarkdown}}{{{unescapedSummary}}}{{/lambda.escapeMarkdown}} {{/operation}}{{/operations}} {{#operations}} {{#operation}} # **{{operationId}}** -> {{#returnType}}{{.}} {{/returnType}}{{operationId}}({{#allParams}}{{{paramName}}}{{^-last}}, {{/-last}}{{/allParams}}) +> {{#returnType}}{{#lambda.escapeMarkdown}}{{{.}}}{{/lambda.escapeMarkdown}} {{/returnType}}{{operationId}}({{#allParams}}{{{paramName}}}{{^-last}}, {{/-last}}{{/allParams}}) -{{summary}}{{#notes}} +{{#lambda.escapeMarkdown}}{{{unescapedSummary}}}{{/lambda.escapeMarkdown}}{{#unescapedNotes}} -{{.}}{{/notes}} +{{#lambda.escapeMarkdown}}{{{unescapedNotes}}}{{/lambda.escapeMarkdown}}{{/unescapedNotes}} ### Parameters {{^allParams}}This endpoint does not need any parameter.{{/allParams}}{{#allParams}}{{#-last}} Name | Type | Description | Notes ------------- | ------------- | ------------- | -------------{{/-last}}{{/allParams}} -{{#allParams}} **{{paramName}}** | {{#isPrimitiveType}}**{{dataType}}**{{/isPrimitiveType}}{{^isPrimitiveType}}{{#isFile}}**{{dataType}}**{{/isFile}}{{^isFile}}{{#generateModelDocs}}[**{{dataType}}**]({{baseType}}.md){{/generateModelDocs}}{{^generateModelDocs}}**{{dataType}}**{{/generateModelDocs}}{{/isFile}}{{/isPrimitiveType}}| {{description}} |{{^required}} [optional]{{/required}}{{#defaultValue}} [default to {{.}}]{{/defaultValue}}{{#allowableValues}} [enum: {{#values}}{{{.}}}{{^-last}}, {{/-last}}{{/values}}]{{/allowableValues}} +{{#allParams}} **{{paramName}}** | {{#isPrimitiveType}}**{{dataType}}**{{/isPrimitiveType}}{{^isPrimitiveType}}{{#isFile}}**{{dataType}}**{{/isFile}}{{^isFile}}{{#generateModelDocs}}[**{{dataType}}**]({{baseType}}.md){{/generateModelDocs}}{{^generateModelDocs}}**{{dataType}}**{{/generateModelDocs}}{{/isFile}}{{/isPrimitiveType}}| {{#lambda.escapeMarkdown}}{{{unescapedDescription}}}{{/lambda.escapeMarkdown}} |{{^required}} [optional]{{/required}}{{#defaultValue}} [default to {{#lambda.escapeMarkdown}}{{{.}}}{{/lambda.escapeMarkdown}}]{{/defaultValue}}{{#allowableValues}} [enum: {{#values}}{{#lambda.escapeMarkdown}}{{{.}}}{{/lambda.escapeMarkdown}}{{^-last}}, {{/-last}}{{/values}}]{{/allowableValues}} {{/allParams}} ### Return type diff --git a/modules/openapi-generator/src/main/resources/kotlin-vertx-server/class_doc.mustache b/modules/openapi-generator/src/main/resources/kotlin-vertx-server/class_doc.mustache index b6b482afb78b..01d22ac87c05 100644 --- a/modules/openapi-generator/src/main/resources/kotlin-vertx-server/class_doc.mustache +++ b/modules/openapi-generator/src/main/resources/kotlin-vertx-server/class_doc.mustache @@ -3,7 +3,7 @@ ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -{{#vars}}**{{name}}** | {{#isEnum}}[**inline**](#{{datatypeWithEnum}}){{/isEnum}}{{^isEnum}}{{#isPrimitiveType}}**{{dataType}}**{{/isPrimitiveType}}{{^isPrimitiveType}}[**{{dataType}}**]({{complexType}}.md){{/isPrimitiveType}}{{/isEnum}} | {{description}} | {{^required}} [optional]{{/required}}{{#isReadOnly}} [readonly]{{/isReadOnly}} +{{#vars}}**{{name}}** | {{#isEnum}}[**inline**](#{{datatypeWithEnum}}){{/isEnum}}{{^isEnum}}{{#isPrimitiveType}}**{{dataType}}**{{/isPrimitiveType}}{{^isPrimitiveType}}[**{{dataType}}**]({{complexType}}.md){{/isPrimitiveType}}{{/isEnum}} | {{#lambda.escapeMarkdown}}{{{unescapedDescription}}}{{/lambda.escapeMarkdown}} | {{^required}} [optional]{{/required}}{{#isReadOnly}} [readonly]{{/isReadOnly}} {{/vars}} {{#vars}}{{#isEnum}} @@ -11,5 +11,5 @@ Name | Type | Description | Notes ## Enum: {{baseName}} Name | Value ---- | -----{{#allowableValues}} -{{name}} | {{#values}}{{.}}{{^-last}}, {{/-last}}{{/values}}{{/allowableValues}} +{{name}} | {{#values}}{{#lambda.escapeMarkdown}}{{{.}}}{{/lambda.escapeMarkdown}}{{^-last}}, {{/-last}}{{/values}}{{/allowableValues}} {{/isEnum}}{{/vars}} diff --git a/modules/openapi-generator/src/main/resources/kotlin-wiremock/api-stub.mustache b/modules/openapi-generator/src/main/resources/kotlin-wiremock/api-stub.mustache index d3b79befcf3a..3ca7701c1702 100644 --- a/modules/openapi-generator/src/main/resources/kotlin-wiremock/api-stub.mustache +++ b/modules/openapi-generator/src/main/resources/kotlin-wiremock/api-stub.mustache @@ -33,12 +33,12 @@ open class {{classname}}Stubs(private val objectMapper: ObjectMapper) { * @return A [{{operationIdCamelCase}}StubBuilder] to configure the response, and the final [MappingBuilder]. */ fun {{operationId}}({{#pathParams}}{{paramName}}: StringValuePattern, {{/pathParams}}{{#queryParams}}{{paramName}}: StringValuePattern? = null, {{/queryParams}}configurer: MappingBuilder.() -> MappingBuilder = { this }): {{operationIdCamelCase}}StubBuilder = - {{operationIdCamelCase}}StubBuilder(objectMapper, {{#lambda.lowercase}}{{httpMethod}}{{/lambda.lowercase}}(urlPathTemplate("{{{path}}}")) + {{operationIdCamelCase}}StubBuilder(objectMapper, {{#lambda.lowercase}}{{httpMethod}}{{/lambda.lowercase}}(urlPathTemplate("{{#lambda.escapeInNormalString}}{{{path}}}{{/lambda.escapeInNormalString}}")) {{#pathParams}} - .withPathParam("{{baseName}}", {{paramName}}) + .withPathParam("{{#lambda.escapeInNormalString}}{{baseName}}{{/lambda.escapeInNormalString}}", {{paramName}}) {{/pathParams}} {{#queryParams}} - .apply { {{paramName}}?.let { withQueryParam("{{baseName}}", it) } } + .apply { {{paramName}}?.let { withQueryParam("{{#lambda.escapeInNormalString}}{{baseName}}{{/lambda.escapeInNormalString}}", it) } } {{/queryParams}} .configurer() ) diff --git a/modules/openapi-generator/src/main/resources/kotlin-wiremock/model.mustache b/modules/openapi-generator/src/main/resources/kotlin-wiremock/model.mustache index c060ec50935c..79dc87577c0c 100644 --- a/modules/openapi-generator/src/main/resources/kotlin-wiremock/model.mustache +++ b/modules/openapi-generator/src/main/resources/kotlin-wiremock/model.mustache @@ -21,10 +21,10 @@ enum class {{classname}} { {{^isEnum}} data class {{classname}}( {{#allVars}} - @field:JsonProperty("{{{vendorExtensions.x-base-name-literal}}}") + @field:JsonProperty("{{#lambda.escapeInNormalString}}{{{vendorExtensions.x-base-name-literal}}}{{/lambda.escapeInNormalString}}") val {{{name}}}: {{{dataType}}}{{^required}}?{{/required}}{{! - !}}{{^required}} = {{^defaultValue}}null{{/defaultValue}}{{#defaultValue}}{{{.}}}{{/defaultValue}}{{/required}}{{! - }}{{#required}}{{#defaultValue}} = {{{.}}}{{/defaultValue}}{{/required}}, + !}}{{^required}} = {{^defaultValue}}null{{/defaultValue}}{{#defaultValue}}{{#isString}}{{^isEnum}}"{{#lambda.escapeInNormalString}}{{{unescapedDefaultValue}}}{{/lambda.escapeInNormalString}}"{{/isEnum}}{{#isEnum}}{{{defaultValue}}}{{/isEnum}}{{/isString}}{{^isString}}{{{defaultValue}}}{{/isString}}{{/defaultValue}}{{/required}}{{! + }}{{#required}}{{#defaultValue}} = {{#isString}}{{^isEnum}}"{{#lambda.escapeInNormalString}}{{{unescapedDefaultValue}}}{{/lambda.escapeInNormalString}}"{{/isEnum}}{{#isEnum}}{{{defaultValue}}}{{/isEnum}}{{/isString}}{{^isString}}{{{defaultValue}}}{{/isString}}{{/defaultValue}}{{/required}}, {{/allVars}} ) diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/kotlin/KotlinClientCodegenModelTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/kotlin/KotlinClientCodegenModelTest.java index 23f98e3c443e..4d1607a6ce65 100644 --- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/kotlin/KotlinClientCodegenModelTest.java +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/kotlin/KotlinClientCodegenModelTest.java @@ -923,6 +923,35 @@ public void testCompanionObjectGeneratesCompanionInModel() throws IOException { TestUtils.assertFileContains(petModel, "companion object { }"); } + /** + * Issue 20502: $ in property baseName must be escaped to \$ in @get:JsonProperty strings + * when using jackson serialization library (uses escapeInNormalString lambda). + */ + @Test + public void issue20502_dollarInBaseNameEscapedInJsonProperty() throws IOException { + File output = Files.createTempDirectory("test").toFile(); + output.deleteOnExit(); + + KotlinClientCodegen codegen = new KotlinClientCodegen(); + codegen.setOutputDir(output.getAbsolutePath()); + codegen.additionalProperties().put(CodegenConstants.SERIALIZATION_LIBRARY, "jackson"); + codegen.processOpts(); + + new DefaultGenerator() + .opts(new ClientOptInput() + .openAPI(TestUtils.parseSpec("src/test/resources/3_0/kotlin/issue20502-kotlin-string-escaping.yaml")) + .config(codegen)) + .generate(); + + Path modelFile = Paths.get(output + "/src/main/kotlin/org/openapitools/client/models/ItemWithAllEscapingEdgeCases.kt"); + // baseName "$id" must be escaped to "\$id" inside @get:JsonProperty + TestUtils.assertFileContains(modelFile, "@get:JsonProperty(\"\\$id\")"); + // baseName "name$Value" must be escaped to "name\$Value" + TestUtils.assertFileContains(modelFile, "@get:JsonProperty(\"name\\$Value\")"); + // plain baseName without $ must appear verbatim (verifies lambda resolves {{{baseName}}} at all) + TestUtils.assertFileContains(modelFile, "@get:JsonProperty(\"commentCloseValue\")"); + } + private static class ModelNameTest { private final String expectedName; private final String expectedClassName; diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/kotlin/spring/KotlinSpringServerCodegenTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/kotlin/spring/KotlinSpringServerCodegenTest.java index a23966701868..23e5ac148491 100644 --- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/kotlin/spring/KotlinSpringServerCodegenTest.java +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/kotlin/spring/KotlinSpringServerCodegenTest.java @@ -5946,4 +5946,87 @@ public void testOneOfRefEnumDiscriminatorResolvesType() throws IOException { "override val vehicleType: VehicleType = VehicleType.TRUCK" ); } + + + // ── Issue 20502: string-escaping fixes ───────────────────────────────────────────────────────── + + /** + * Issue 1: path parameters containing {@code $} (e.g. {@code {item$Id}}) were emitted as-is into + * Kotlin {@code const val} string literals, triggering Kotlin string interpolation and causing a + * compile error. The path must be rendered with {@code $} escaped to {@code \$}. + */ + @Test(description = "Issue 20502 #1: $ in path param names must be escaped to \\$ in PATH const val") + public void issue20502_dollarEscapedInPathConstVal() throws IOException { + File output = Files.createTempDirectory("test").toFile().getCanonicalFile(); + output.deleteOnExit(); + + KotlinSpringServerCodegen codegen = new KotlinSpringServerCodegen(); + codegen.setOutputDir(output.getAbsolutePath()); + + new DefaultGenerator() + .opts(new ClientOptInput() + .openAPI(TestUtils.parseSpec("src/test/resources/3_0/kotlin/issue20502-kotlin-string-escaping.yaml")) + .config(codegen)) + .generate(); + + Path apiFile = Paths.get(output + "/src/main/kotlin/org/openapitools/api/ItemsApiController.kt"); + // The path "/items/{item$Id}/sub/{item$SubId}" must have $ escaped as \$ in the const val + assertFileContains(apiFile, "\"/items/{item\\$Id}/sub/{item\\$SubId}\""); + } + + /** + * Issue 2: {@code $}, {@code "}, and {@code \} in operation summaries, descriptions, response + * messages, and parameter descriptions were not properly escaped when placed inside Kotlin + * annotation double-quoted strings, producing invalid Kotlin code. + */ + @Test(description = "Issue 20502 #2: $, \", \\ in annotation strings must be properly escaped") + public void issue20502_specialCharsEscapedInAnnotationStrings() throws IOException { + File output = Files.createTempDirectory("test").toFile().getCanonicalFile(); + output.deleteOnExit(); + + KotlinSpringServerCodegen codegen = new KotlinSpringServerCodegen(); + codegen.setOutputDir(output.getAbsolutePath()); + + new DefaultGenerator() + .opts(new ClientOptInput() + .openAPI(TestUtils.parseSpec("src/test/resources/3_0/kotlin/issue20502-kotlin-string-escaping.yaml")) + .config(codegen)) + .generate(); + + Path apiFile = Paths.get(output + "/src/main/kotlin/org/openapitools/api/ItemsApiController.kt"); + // Summary/message annotation strings must have $ escaped to \$ + assertFileContains(apiFile, "\\$some"); + // Notes/description uses triple-quoted strings: $ becomes ${'$'} + assertFileContains(apiFile, "${'$'}some"); + } + + /** + * Issue 3: {@code toDefaultValue()} previously called {@code escapeText()} which internally + * calls {@code escapeUnsafeCharacters()}, corrupting star-slash to star-underscore-slash inside + * Kotlin string literals. Default values must be emitted verbatim (modulo string-literal + * escaping). + */ + @Test(description = "Issue 20502 #3: */ in string defaults must not be corrupted to *_/") + public void issue20502_starSlashNotCorruptedInModelDefaults() throws IOException { + File output = Files.createTempDirectory("test").toFile().getCanonicalFile(); + output.deleteOnExit(); + + KotlinSpringServerCodegen codegen = new KotlinSpringServerCodegen(); + codegen.setOutputDir(output.getAbsolutePath()); + + new DefaultGenerator() + .opts(new ClientOptInput() + .openAPI(TestUtils.parseSpec("src/test/resources/3_0/kotlin/issue20502-kotlin-string-escaping.yaml")) + .config(codegen)) + .generate(); + + Path modelFile = Paths.get(output + "/src/main/kotlin/org/openapitools/model/ItemWithAllEscapingEdgeCases.kt"); + // The default "starts /* comment and ends */" must not be mangled to *_/ + assertFileContains(modelFile, "\"starts /* comment and ends */\""); + // $ in string defaults must be escaped to \$ (not left raw, which would cause interpolation) + assertFileContains(modelFile, "\"\\$one"); + // baseName with $ must be escaped in @get:JsonProperty (verifies lambda resolves baseName correctly) + assertFileContains(modelFile, "@get:JsonProperty(\"\\$id\")"); + assertFileContains(modelFile, "@get:JsonProperty(\"name\\$Value\")"); + } } diff --git a/modules/openapi-generator/src/test/resources/3_0/issue_10865_default_values.yaml b/modules/openapi-generator/src/test/resources/3_0/issue_10865_default_values.yaml index c7fd7668cb4a..e43be3e1815c 100644 --- a/modules/openapi-generator/src/test/resources/3_0/issue_10865_default_values.yaml +++ b/modules/openapi-generator/src/test/resources/3_0/issue_10865_default_values.yaml @@ -154,6 +154,12 @@ paths: default: - item0 + - name: qs0 + in: query + required: false + type: string + default: "hello $world, backslash=\\, quote=\", end */" + description: "String with $dollar, backslash, quote, comment-close in default" responses: "200": @@ -178,3 +184,7 @@ definitions: n1: type: number default: 68 + s0: + type: string + default: "hello $world, backslash=\\, quote=\", end */" + description: "String property with $dollar, backslash, quote, comment-close in default" diff --git a/modules/openapi-generator/src/test/resources/3_0/kotlin/echo_api.yaml b/modules/openapi-generator/src/test/resources/3_0/kotlin/echo_api.yaml index 940803b93b92..dbe0e43539e8 100644 --- a/modules/openapi-generator/src/test/resources/3_0/kotlin/echo_api.yaml +++ b/modules/openapi-generator/src/test/resources/3_0/kotlin/echo_api.yaml @@ -602,6 +602,34 @@ paths: text/plain: schema: type: string + # To test string escaping edge cases in Kotlin (Issue 20502) + /echo/string-escaping/{$paramName}: + get: + tags: + - echo + summary: "Test $-in-path-param escaping" + description: "Tests that path params with $dollar, backslash \\ and quote \" are properly escaped" + operationId: "tests/echo/string-escaping/{$paramName}" + parameters: + - in: path + name: "$paramName" + required: true + schema: + type: string + - in: query + name: "filter$Type" + required: false + description: "Filter with $dollar in description and comment-close */" + schema: + type: string + default: "default$Value with \\ and \"" + responses: + '200': + description: "ok" + content: + text/plain: + schema: + type: string components: securitySchemes: http_auth: @@ -810,3 +838,14 @@ components: format: double minimum: 0.8 maximum: 50.2 + StringEscapingEdgeCases: + type: object + description: "Model to test: $dollar, backslash \\, quote \", comment-close */" + properties: + dollarDefault: + type: string + description: "A string whose default has $dollar, backslash \\, quote \" and comment-close */" + default: "hello $world, backslash=\\, quote=\", end */" + regularProp: + type: string + description: "Regular property for baseline comparison" diff --git a/modules/openapi-generator/src/test/resources/3_0/kotlin/issue20502-kotlin-string-escaping.yaml b/modules/openapi-generator/src/test/resources/3_0/kotlin/issue20502-kotlin-string-escaping.yaml new file mode 100644 index 000000000000..6050d433a8f2 --- /dev/null +++ b/modules/openapi-generator/src/test/resources/3_0/kotlin/issue20502-kotlin-string-escaping.yaml @@ -0,0 +1,225 @@ +openapi: 3.0.0 +info: + title: "Kotlin string-escaping worst-case: SQ=\"; SBS=\\; DBS=\\\\; SD=$some; CC=*/; TQ=\"\"\"" + description: | + Multi-line description with every problematic sequence: + double-quote: " + single-backslash: \ + double-backslash: \\ + dollar: $interpolated + comment-close: */ + comment-open: /* + triple-quote: """ + all combined: SQ="; SBS=\; DBS=\\; SD=$some; CC=*/; TQ=""" + version: "1.0.0" + +servers: + - url: 'http://localhost/v1' + +# External path-level docs to show externalDocs on an operation +externalDocs: + description: "SQ=\"; SBS=\\; DBS=\\\\; SD=$some" + url: 'http://example.com/docs' + +paths: + + # ── Issue 1: $ in path parameter names ──────────────────────────────────── + /items/{item$Id}/sub/{item$SubId}: + get: + operationId: getItemWithDollarPathParams + summary: "SQ=\"; SBS=\\; DBS=\\\\; SD=$some; CC=*/; TQ=\"\"\"" + description: "SQ=\"; SBS=\\; DBS=\\\\; SD=$some; CC=*/; TQ=\"\"\"" + externalDocs: + description: "SQ=\"; SBS=\\; DBS=\\\\; SD=$some" + url: 'http://example.com/ops/getItem' + parameters: + # $ in path param name — double-quote YAML form + - name: "item$Id" + in: path + required: true + description: "SQ=\"; SBS=\\; DBS=\\\\; SD=$some; CC=*/; TQ=\"\"\"" + schema: + type: string + example: "SQ=\"; SBS=\\; DBS=\\\\; SD=$some; CC=*/; TQ=\"\"\"" + + # $ in path param name — single-quote YAML form + - name: "item$SubId" + in: path + required: true + description: 'SQ="; SBS=\; DBS=\\; SD=$some; CC=*/; TQ="""' + schema: + type: string + example: 'SQ="; SBS=\; DBS=\\; SD=$some; CC=*/; TQ="""' + + # $ in query param name, with default + - name: "filter$Type" + in: query + required: false + description: "SQ=\"; SBS=\\; DBS=\\\\; SD=$some; CC=*/; TQ=\"\"\"" + schema: + type: string + example: "SQ=\"; SBS=\\; DBS=\\\\; SD=$some; CC=*/; TQ=\"\"\"" + default: "SQ=\"; SBS=\\; DBS=\\\\; SD=$some; CC=*/; TQ=\"\"\"" + + # deprecated query param + - name: "filter$SubType" + in: query + required: false + deprecated: true + description: 'SQ="; SBS=\; DBS=\\; SD=$some; CC=*/; TQ="""' + schema: + type: string + example: 'SQ="; SBS=\; DBS=\\; SD=$some; CC=*/; TQ="""' + default: 'SQ="; SBS=\; DBS=\\; SD=$some; CC=*/; TQ="""' + + # $ in header param name + - name: "X-Custom$Header" + in: header + required: false + description: "SQ=\"; SBS=\\; DBS=\\\\; SD=$some; CC=*/; TQ=\"\"\"" + schema: + type: string + example: "SQ=\"; SBS=\\; DBS=\\\\; SD=$some; CC=*/; TQ=\"\"\"" + + # $ in cookie param name + - name: "session$Token" + in: cookie + required: false + description: "SQ=\"; SBS=\\; DBS=\\\\; SD=$some; CC=*/; TQ=\"\"\"" + schema: + type: string + example: "SQ=\"; SBS=\\; DBS=\\\\; SD=$some; CC=*/; TQ=\"\"\"" + + responses: + '200': + description: "SQ=\"; SBS=\\; DBS=\\\\; SD=$some; CC=*/; TQ=\"\"\"" + content: + application/json: + schema: + $ref: '#/components/schemas/ItemWithAllEscapingEdgeCases' + + # ── Issue 2: $ / " / \ in form body ─────────────────────────────────────── + /items: + post: + operationId: createItemWithDollarFormParams + summary: "SQ=\"; SBS=\\; DBS=\\\\; SD=$some; CC=*/; TQ=\"\"\"" + description: | + Multi-line description: + double-quote: " + single-backslash: \ + double-backslash: \\ + dollar-interpolation: $some + comment-closer: */ + comment-opener: /* + triple-quote: """ + requestBody: + required: true + content: + application/x-www-form-urlencoded: + schema: + type: object + properties: + form$Name: + type: string + description: "SQ=\"; SBS=\\; DBS=\\\\; SD=$some; CC=*/; TQ=\"\"\"" + example: "SQ=\"; SBS=\\; DBS=\\\\; SD=$some; CC=*/; TQ=\"\"\"" + form$Value: + type: string + description: "SQ=\"; SBS=\\; DBS=\\\\; SD=$some; CC=*/; TQ=\"\"\"" + example: "SQ=\"; SBS=\\; DBS=\\\\; SD=$some; CC=*/; TQ=\"\"\"" + default: "SQ=\"; SBS=\\; DBS=\\\\; SD=$some; CC=*/; TQ=\"\"\"" + responses: + '201': + description: "SQ=\"; SBS=\\; DBS=\\\\; SD=$some; CC=*/; TQ=\"\"\"" + content: + application/json: + schema: + $ref: '#/components/schemas/ItemWithAllEscapingEdgeCases' + +components: + schemas: + + # ── Issue 3: $ / " / \ in property names, descriptions, defaults, examples + ItemWithAllEscapingEdgeCases: + type: object + description: "SQ=\"; SBS=\\; DBS=\\\\; SD=$some; CC=*/; TQ=\"\"\"" + properties: + + # property name starts with $ + $id: + type: string + description: "SQ=\"; SBS=\\; DBS=\\\\; SD=$some; CC=*/; TQ=\"\"\"" + example: "SQ=\"; SBS=\\; DBS=\\\\; SD=$some; CC=*/; TQ=\"\"\"" + default: "SQ=\"; SBS=\\; DBS=\\\\; SD=$some; CC=*/; TQ=\"\"\"" + + # property name has $ in middle + name$Value: + type: string + description: 'SQ="; SBS=\; DBS=\\; SD=$some; CC=*/; TQ="""' + example: 'SQ="; SBS=\; DBS=\\; SD=$some; CC=*/; TQ="""' + default: 'SQ="; SBS=\; DBS=\\; SD=$some; CC=*/; TQ="""' + + # just backslashes (edge case: odd vs even number) + backslashValue: + type: string + description: "one-bs: \\; two-bs: \\\\" + example: "one-bs: \\; two-bs: \\\\" + default: "one-bs: \\; two-bs: \\\\" + + # just dollar signs + dollarValue: + type: string + description: "$one $$two $$$three" + example: "$one $$two $$$three" + default: "$one $$two $$$three" + + # comment-closing sequence (the escapeUnsafeCharacters bug) + commentCloseValue: + type: string + description: "starts /* comment and ends */" + example: "starts /* comment and ends */" + default: "starts /* comment and ends */" + + # triple-quote sequence (would break """ Kotlin strings) + tripleQuoteValue: + type: string + description: 'contains """ triple quotes' + example: 'contains """ triple quotes' + default: 'contains """ triple quotes' + + # multiline description (YAML literal block) + multilineDescription: + type: string + description: | + Line one with $dollar and "quote" and \backslash + Line two with */ comment-close and /* comment-open + Line three with """ triple-quote + example: "single line example" + + # integer with default (should not be quoted in output) + intWithDefault: + type: integer + format: int32 + description: "integer property, default should not be quoted" + default: 42 + + # boolean with default + boolWithDefault: + type: boolean + description: "boolean property" + default: false + + # nested object with $ properties + details$Info: + type: object + description: "SQ=\"; SBS=\\; DBS=\\\\; SD=$some; CC=*/; TQ=\"\"\"" + properties: + detail$One: + type: string + description: "SQ=\"; SBS=\\; DBS=\\\\; SD=$some; CC=*/; TQ=\"\"\"" + example: "SQ=\"; SBS=\\; DBS=\\\\; SD=$some; CC=*/; TQ=\"\"\"" + default: "SQ=\"; SBS=\\; DBS=\\\\; SD=$some; CC=*/; TQ=\"\"\"" + detail$Two: + type: integer + description: "SQ=\"; SBS=\\; DBS=\\\\; SD=$some" + example: 42 diff --git a/modules/openapi-generator/src/test/resources/3_0/kotlin/petstore-kotlin-misk.yaml b/modules/openapi-generator/src/test/resources/3_0/kotlin/petstore-kotlin-misk.yaml new file mode 100644 index 000000000000..68a446b31aba --- /dev/null +++ b/modules/openapi-generator/src/test/resources/3_0/kotlin/petstore-kotlin-misk.yaml @@ -0,0 +1,766 @@ +openapi: 3.0.0 +servers: + - url: 'http://petstore.swagger.io/v2' +info: + description: >- + This is a sample server Petstore server. For this sample, you can use the api key + `special-key` to test the authorization filters. + version: 1.0.0 + title: OpenAPI Petstore + license: + name: Apache-2.0 + url: 'https://www.apache.org/licenses/LICENSE-2.0.html' +tags: + - name: pet + description: Everything about your Pets + - name: store + description: Access to Petstore orders + - name: user + description: Operations about user +paths: + /pet: + post: + tags: + - pet + summary: Add a new pet to the store + description: '' + operationId: addPet + responses: + '200': + description: successful operation + content: + application/xml: + schema: + $ref: '#/components/schemas/Pet' + application/json: + schema: + $ref: '#/components/schemas/Pet' + '405': + description: Invalid input + security: + - petstore_auth: + - 'write:pets' + - 'read:pets' + requestBody: + $ref: '#/components/requestBodies/Pet' + put: + tags: + - pet + summary: Update an existing pet + description: '' + operationId: updatePet + externalDocs: + url: "http://petstore.swagger.io/v2/doc/updatePet" + description: "API documentation for the updatePet operation" + responses: + '200': + description: successful operation + content: + application/xml: + schema: + $ref: '#/components/schemas/Pet' + application/json: + schema: + $ref: '#/components/schemas/Pet' + '400': + description: Invalid ID supplied + '404': + description: Pet not found + '405': + description: Validation exception + security: + - petstore_auth: + - 'write:pets' + - 'read:pets' + requestBody: + $ref: '#/components/requestBodies/Pet' + /pet/findByStatus: + get: + tags: + - pet + summary: Finds Pets by status + description: Multiple status values can be provided with comma separated strings + operationId: findPetsByStatus + parameters: + - name: status + in: query + description: Status values that need to be considered for filter + required: true + style: form + explode: false + deprecated: true + schema: + type: array + items: + type: string + enum: + - available + - pending + - sold + default: available + responses: + '200': + description: successful operation + content: + application/xml: + schema: + type: array + items: + $ref: '#/components/schemas/Pet' + application/json: + schema: + type: array + items: + $ref: '#/components/schemas/Pet' + '400': + description: Invalid status value + security: + - petstore_auth: + - 'read:pets' + /pet/findByTags: + get: + tags: + - pet + summary: Finds Pets by tags + description: >- + Multiple tags can be provided with comma separated strings. Use tag1, + tag2, tag3 for testing. + operationId: findPetsByTags + parameters: + - name: tags + in: query + description: Tags to filter by + required: true + style: form + explode: false + schema: + type: array + items: + type: string + responses: + '200': + description: successful operation + content: + application/xml: + schema: + type: array + items: + $ref: '#/components/schemas/Pet' + application/json: + schema: + type: array + items: + $ref: '#/components/schemas/Pet' + '400': + description: Invalid tag value + security: + - petstore_auth: + - 'read:pets' + deprecated: true + '/pet/{petId}': + get: + tags: + - pet + summary: Find pet by ID + description: Returns a single pet + operationId: getPetById + parameters: + - name: petId + in: path + description: ID of pet to return + required: true + schema: + type: integer + format: int64 + responses: + '200': + description: successful operation + content: + application/xml: + schema: + $ref: '#/components/schemas/Pet' + application/json: + schema: + $ref: '#/components/schemas/Pet' + '400': + description: Invalid ID supplied + '404': + description: Pet not found + security: + - api_key: [] + post: + tags: + - pet + summary: Updates a pet in the store with form data + description: '' + operationId: updatePetWithForm + parameters: + - name: petId + in: path + description: ID of pet that needs to be updated + required: true + schema: + type: integer + format: int64 + responses: + '405': + description: Invalid input + security: + - petstore_auth: + - 'write:pets' + - 'read:pets' + requestBody: + content: + application/x-www-form-urlencoded: + schema: + type: object + properties: + name: + description: Updated name of the pet + type: string + status: + description: Updated status of the pet + type: string + delete: + tags: + - pet + summary: Deletes a pet + description: '' + operationId: deletePet + parameters: + - name: api_key + in: header + required: false + schema: + type: string + - name: petId + in: path + description: Pet id to delete + required: true + schema: + type: integer + format: int64 + responses: + '400': + description: Invalid pet value + security: + - petstore_auth: + - 'write:pets' + - 'read:pets' + '/pet/{petId}/uploadImage': + post: + tags: + - pet + summary: uploads an image + description: '' + operationId: uploadFile + parameters: + - name: petId + in: path + description: ID of pet to update + required: true + schema: + type: integer + format: int64 + responses: + '200': + description: successful operation + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + security: + - petstore_auth: + - 'write:pets' + - 'read:pets' + requestBody: + content: + multipart/form-data: + schema: + type: object + properties: + additionalMetadata: + description: Additional data to pass to server + type: string + file: + description: file to upload + type: string + format: binary + /pet/escaping: + get: + tags: + - pet + operationId: getEscapingEdgeCases + summary: "Test escaping: $dollar, backslash \\ and quote \"" + description: "Retrieves edge-cases for escaping: $var, \\, \", */" + responses: + '200': + description: "Response with $dollar in message and backslash \\" + content: + application/json: + schema: + $ref: '#/components/schemas/EscapingEdgeCases' + /store/inventory: + get: + tags: + - store + summary: Returns pet inventories by status + description: Returns a map of status codes to quantities + operationId: getInventory + responses: + '200': + description: successful operation + content: + application/json: + schema: + type: object + additionalProperties: + type: integer + format: int32 + security: + - api_key: [] + /store/order: + post: + tags: + - store + summary: Place an order for a pet + description: '' + operationId: placeOrder + responses: + '200': + description: successful operation + content: + application/xml: + schema: + $ref: '#/components/schemas/Order' + application/json: + schema: + $ref: '#/components/schemas/Order' + '400': + description: Invalid Order + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/Order' + description: order placed for purchasing the pet + required: true + '/store/order/{orderId}': + get: + tags: + - store + summary: Find purchase order by ID + description: >- + For valid response try integer IDs with value <= 5 or > 10. Other values + will generate exceptions + operationId: getOrderById + parameters: + - name: orderId + in: path + description: ID of pet that needs to be fetched + required: true + schema: + type: integer + format: int64 + minimum: 1 + maximum: 5 + responses: + '200': + description: successful operation + content: + application/xml: + schema: + $ref: '#/components/schemas/Order' + application/json: + schema: + $ref: '#/components/schemas/Order' + '400': + description: Invalid ID supplied + '404': + description: Order not found + delete: + tags: + - store + summary: Delete purchase order by ID + description: >- + For valid response try integer IDs with value < 1000. Anything above + 1000 or nonintegers will generate API errors + operationId: deleteOrder + parameters: + - name: orderId + in: path + description: ID of the order that needs to be deleted + required: true + schema: + type: string + responses: + '400': + description: Invalid ID supplied + '404': + description: Order not found + /user: + post: + tags: + - user + summary: Create user + description: This can only be done by the logged in user. + operationId: createUser + responses: + default: + description: successful operation + security: + - api_key: [] + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/User' + description: Created user object + required: true + /user/createWithArray: + post: + tags: + - user + summary: Creates list of users with given input array + description: '' + operationId: createUsersWithArrayInput + responses: + default: + description: successful operation + security: + - api_key: [] + requestBody: + $ref: '#/components/requestBodies/UserArray' + /user/createWithList: + post: + tags: + - user + summary: Creates list of users with given input array + description: '' + operationId: createUsersWithListInput + responses: + default: + description: successful operation + security: + - api_key: [] + requestBody: + $ref: '#/components/requestBodies/UserArray' + /user/login: + get: + tags: + - user + summary: Logs user into the system + description: '' + operationId: loginUser + parameters: + - name: username + in: query + description: The user name for login + required: true + schema: + type: string + pattern: '^[a-zA-Z0-9]+[a-zA-Z0-9\.\-_]*[a-zA-Z0-9]+$' + - name: password + in: query + description: The password for login in clear text + required: true + schema: + type: string + responses: + '200': + description: successful operation + headers: + Set-Cookie: + description: >- + Cookie authentication key for use with the `api_key` + apiKey authentication. + schema: + type: string + example: AUTH_KEY=abcde12345; Path=/; HttpOnly + X-Rate-Limit: + description: calls per hour allowed by the user + schema: + type: integer + format: int32 + X-Expires-After: + description: date in UTC when token expires + schema: + type: string + format: date-time + content: + application/xml: + schema: + type: string + application/json: + schema: + type: string + '400': + description: Invalid username/password supplied + /user/logout: + get: + tags: + - user + summary: Logs out current logged in user session + description: '' + operationId: logoutUser + responses: + default: + description: successful operation + security: + - api_key: [] + '/user/{username}': + get: + tags: + - user + summary: Get user by user name + description: '' + operationId: getUserByName + parameters: + - name: username + in: path + description: The name that needs to be fetched. Use user1 for testing. + required: true + schema: + type: string + responses: + '200': + description: successful operation + content: + application/xml: + schema: + $ref: '#/components/schemas/User' + application/json: + schema: + $ref: '#/components/schemas/User' + '400': + description: Invalid username supplied + '404': + description: User not found + put: + tags: + - user + summary: Updated user + description: This can only be done by the logged in user. + operationId: updateUser + parameters: + - name: username + in: path + description: name that need to be deleted + required: true + schema: + type: string + responses: + '400': + description: Invalid user supplied + '404': + description: User not found + security: + - api_key: [] + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/User' + description: Updated user object + required: true + delete: + tags: + - user + summary: Delete user + description: This can only be done by the logged in user. + operationId: deleteUser + parameters: + - name: username + in: path + description: The name that needs to be deleted + required: true + schema: + type: string + responses: + '400': + description: Invalid username supplied + '404': + description: User not found + security: + - api_key: [] +externalDocs: + description: Find out more about Swagger + url: 'http://swagger.io' +components: + requestBodies: + UserArray: + content: + application/json: + schema: + type: array + items: + $ref: '#/components/schemas/User' + description: List of user object + required: true + Pet: + content: + application/json: + schema: + $ref: '#/components/schemas/Pet' + application/xml: + schema: + $ref: '#/components/schemas/Pet' + description: Pet object that needs to be added to the store + required: true + securitySchemes: + petstore_auth: + type: oauth2 + flows: + implicit: + authorizationUrl: 'http://petstore.swagger.io/api/oauth/dialog' + scopes: + 'write:pets': modify pets in your account + 'read:pets': read your pets + api_key: + type: apiKey + name: api_key + in: header + schemas: + Order: + title: Pet Order + description: An order for a pets from the pet store + type: object + properties: + id: + type: integer + format: int64 + petId: + type: integer + format: int64 + quantity: + type: integer + format: int32 + shipDate: + type: string + format: date-time + status: + type: string + description: Order Status + enum: + - placed + - approved + - delivered + complete: + type: boolean + default: false + xml: + name: Order + Category: + title: Pet category + description: A category for a pet + type: object + properties: + id: + type: integer + format: int64 + name: + type: string + pattern: '^[a-zA-Z0-9]+[a-zA-Z0-9\.\-_]*[a-zA-Z0-9]+$' + xml: + name: Category + User: + title: a User + description: A User who is purchasing from the pet store + type: object + properties: + id: + type: integer + format: int64 + username: + type: string + firstName: + type: string + lastName: + type: string + email: + type: string + password: + type: string + phone: + type: string + userStatus: + type: integer + format: int32 + description: User Status + xml: + name: User + Tag: + title: Pet Tag + description: A tag for a pet + type: object + properties: + id: + type: integer + format: int64 + name: + type: string + xml: + name: Tag + Pet: + title: a Pet + description: A pet for sale in the pet store + type: object + required: + - name + - photoUrls + properties: + id: + type: integer + format: int64 + category: + $ref: '#/components/schemas/Category' + name: + type: string + example: doggie + photoUrls: + type: array + xml: + name: photoUrl + wrapped: true + items: + type: string + tags: + type: array + xml: + name: tag + wrapped: true + items: + $ref: '#/components/schemas/Tag' + status: + type: string + description: pet status in the store + deprecated: true + enum: + - available + - pending + - sold + xml: + name: Pet + ApiResponse: + title: An uploaded response + description: Describes the result of uploading an image resource + type: object + properties: + code: + type: integer + format: int32 + type: + type: string + message: + type: string + EscapingEdgeCases: + type: object + description: "Schema to test: $dollar, backslash \\, quote \", comment-close */" + properties: + dollarDefault: + type: string + description: "A string whose default has $dollar, backslash \\, quote \" and comment-close */" + default: "hello $world, backslash=\\, quote=\", end */" + regularProp: + type: string + description: "Regular property for baseline comparison" \ No newline at end of file diff --git a/modules/openapi-generator/src/test/resources/3_0/kotlin/petstore.yaml b/modules/openapi-generator/src/test/resources/3_0/kotlin/petstore.yaml index a3800e235c08..0fefaba8954b 100644 --- a/modules/openapi-generator/src/test/resources/3_0/kotlin/petstore.yaml +++ b/modules/openapi-generator/src/test/resources/3_0/kotlin/petstore.yaml @@ -822,3 +822,14 @@ components: - type: array items: type: string + PetWithSpecialProps: + type: object + description: "Model with $-prefixed property names for escaping tests (Issue 20502)" + properties: + $id: + type: string + description: "Property with $-prefix in name; default has $dollar and backslash \\" + default: "hello $world" + name$Suffix: + type: string + description: "Property with $ mid-name; description has backslash \\ and quote \"" diff --git a/samples/client/echo_api/kotlin-jvm-okhttp/.openapi-generator/FILES b/samples/client/echo_api/kotlin-jvm-okhttp/.openapi-generator/FILES index f94d2fba7db1..4280f869c94e 100644 --- a/samples/client/echo_api/kotlin-jvm-okhttp/.openapi-generator/FILES +++ b/samples/client/echo_api/kotlin-jvm-okhttp/.openapi-generator/FILES @@ -5,6 +5,7 @@ docs/Bird.md docs/BodyApi.md docs/Category.md docs/DefaultValue.md +docs/EchoApi.md docs/FormApi.md docs/HeaderApi.md docs/NumberPropertiesOnly.md @@ -13,6 +14,7 @@ docs/Pet.md docs/Query.md docs/QueryApi.md docs/StringEnumRef.md +docs/StringEscapingEdgeCases.md docs/Tag.md docs/TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter.md gradle/wrapper/gradle-wrapper.jar @@ -22,6 +24,7 @@ gradlew.bat settings.gradle src/main/kotlin/org/openapitools/client/apis/AuthApi.kt src/main/kotlin/org/openapitools/client/apis/BodyApi.kt +src/main/kotlin/org/openapitools/client/apis/EchoApi.kt src/main/kotlin/org/openapitools/client/apis/FormApi.kt src/main/kotlin/org/openapitools/client/apis/HeaderApi.kt src/main/kotlin/org/openapitools/client/apis/PathApi.kt @@ -50,5 +53,6 @@ src/main/kotlin/org/openapitools/client/models/ApiNumberPropertiesOnly.kt src/main/kotlin/org/openapitools/client/models/ApiPet.kt src/main/kotlin/org/openapitools/client/models/ApiQuery.kt src/main/kotlin/org/openapitools/client/models/ApiStringEnumRef.kt +src/main/kotlin/org/openapitools/client/models/ApiStringEscapingEdgeCases.kt src/main/kotlin/org/openapitools/client/models/ApiTag.kt src/main/kotlin/org/openapitools/client/models/ApiTestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter.kt diff --git a/samples/client/echo_api/kotlin-jvm-okhttp/README.md b/samples/client/echo_api/kotlin-jvm-okhttp/README.md index 120fbfc20d02..f8ba319319cf 100644 --- a/samples/client/echo_api/kotlin-jvm-okhttp/README.md +++ b/samples/client/echo_api/kotlin-jvm-okhttp/README.md @@ -55,6 +55,7 @@ All URIs are relative to *http://localhost:3000* | *BodyApi* | [**testEchoBodyPet**](docs/BodyApi.md#testechobodypet) | **POST** /echo/body/Pet | Test body parameter(s) | | *BodyApi* | [**testEchoBodyPetResponseString**](docs/BodyApi.md#testechobodypetresponsestring) | **POST** /echo/body/Pet/response_string | Test empty response body | | *BodyApi* | [**testEchoBodyTagResponseString**](docs/BodyApi.md#testechobodytagresponsestring) | **POST** /echo/body/Tag/response_string | Test empty json (request body) | +| *EchoApi* | [**testsEchoStringEscapingParamName**](docs/EchoApi.md#testsechostringescapingparamname) | **GET** /echo/string-escaping/{$paramName} | Test $-in-path-param escaping | | *FormApi* | [**testFormIntegerBooleanString**](docs/FormApi.md#testformintegerbooleanstring) | **POST** /form/integer/boolean/string | Test form parameter(s) | | *FormApi* | [**testFormOneof**](docs/FormApi.md#testformoneof) | **POST** /form/oneof | Test form parameter(s) for oneOf schema | | *HeaderApi* | [**testHeaderIntegerBooleanStringEnums**](docs/HeaderApi.md#testheaderintegerbooleanstringenums) | **GET** /header/integer/boolean/string/enums | Test header parameter(s) | @@ -77,6 +78,7 @@ All URIs are relative to *http://localhost:3000* - [org.openapitools.client.models.ApiPet](docs/ApiPet.md) - [org.openapitools.client.models.ApiQuery](docs/ApiQuery.md) - [org.openapitools.client.models.ApiStringEnumRef](docs/ApiStringEnumRef.md) + - [org.openapitools.client.models.ApiStringEscapingEdgeCases](docs/ApiStringEscapingEdgeCases.md) - [org.openapitools.client.models.ApiTag](docs/ApiTag.md) - [org.openapitools.client.models.ApiTestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter](docs/ApiTestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter.md) diff --git a/samples/client/echo_api/kotlin-jvm-okhttp/docs/EchoApi.md b/samples/client/echo_api/kotlin-jvm-okhttp/docs/EchoApi.md new file mode 100644 index 000000000000..9e1e3f20d7a9 --- /dev/null +++ b/samples/client/echo_api/kotlin-jvm-okhttp/docs/EchoApi.md @@ -0,0 +1,57 @@ +# EchoApi + +All URIs are relative to *http://localhost:3000* + +| Method | HTTP request | Description | +| ------------- | ------------- | ------------- | +| [**testsEchoStringEscapingParamName**](EchoApi.md#testsEchoStringEscapingParamName) | **GET** /echo/string-escaping/{$paramName} | Test \$-in-path-param escaping | + + + +# **testsEchoStringEscapingParamName** +> kotlin.String testsEchoStringEscapingParamName(dollarParamName, filterDollarType) + +Test \$-in-path-param escaping + +Tests that path params with \$dollar, backslash \\ and quote " are properly escaped + +### Example +```kotlin +// Import classes: +//import org.openapitools.client.infrastructure.* +//import org.openapitools.client.models.* + +val apiInstance = EchoApi() +val dollarParamName : kotlin.String = dollarParamName_example // kotlin.String | +val filterDollarType : kotlin.String = filterDollarType_example // kotlin.String | Filter with $dollar in description and comment-close */ +try { + val result : kotlin.String = apiInstance.testsEchoStringEscapingParamName(dollarParamName, filterDollarType) + println(result) +} catch (e: ClientException) { + println("4xx response calling EchoApi#testsEchoStringEscapingParamName") + e.printStackTrace() +} catch (e: ServerException) { + println("5xx response calling EchoApi#testsEchoStringEscapingParamName") + e.printStackTrace() +} +``` + +### Parameters +| **dollarParamName** | **kotlin.String**| | | +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **filterDollarType** | **kotlin.String**| Filter with \$dollar in description and comment-close */ | [optional] [default to "default\$Value with \\\\ and \\""] | + +### Return type + +**kotlin.String** + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: text/plain + diff --git a/samples/client/echo_api/kotlin-jvm-okhttp/docs/StringEscapingEdgeCases.md b/samples/client/echo_api/kotlin-jvm-okhttp/docs/StringEscapingEdgeCases.md new file mode 100644 index 000000000000..e49f8e50da00 --- /dev/null +++ b/samples/client/echo_api/kotlin-jvm-okhttp/docs/StringEscapingEdgeCases.md @@ -0,0 +1,11 @@ + +# ApiStringEscapingEdgeCases + +## Properties +| Name | Type | Description | Notes | +| ------------ | ------------- | ------------- | ------------- | +| **dollarDefault** | **kotlin.String** | A string whose default has \$dollar, backslash \\, quote " and comment-close */ | [optional] | +| **regularProp** | **kotlin.String** | Regular property for baseline comparison | [optional] | + + + diff --git a/samples/client/echo_api/kotlin-jvm-okhttp/src/main/kotlin/org/openapitools/client/apis/EchoApi.kt b/samples/client/echo_api/kotlin-jvm-okhttp/src/main/kotlin/org/openapitools/client/apis/EchoApi.kt new file mode 100644 index 000000000000..5058e0f5ca7f --- /dev/null +++ b/samples/client/echo_api/kotlin-jvm-okhttp/src/main/kotlin/org/openapitools/client/apis/EchoApi.kt @@ -0,0 +1,139 @@ +/** + * + * Please note: + * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * Do not edit this file manually. + * + */ + +@file:Suppress( + "ArrayInDataClass", + "DuplicatedCode", + "EnumEntryName", + "RemoveRedundantQualifierName", + "RemoveRedundantCallsOfConversionMethods", + "REDUNDANT_CALL_OF_CONVERSION_METHOD", + "RedundantUnitReturnType", + "RemoveEmptyClassBody", + "UnnecessaryVariable", + "UnusedImport", + "UnnecessaryVariable", + "unused" +) + +package org.openapitools.client.apis + +import java.io.IOException +import okhttp3.Call +import okhttp3.HttpUrl + + +import com.squareup.moshi.Json + +import org.openapitools.client.infrastructure.ApiClient +import org.openapitools.client.infrastructure.ApiResponse +import org.openapitools.client.infrastructure.ClientException +import org.openapitools.client.infrastructure.ClientError +import org.openapitools.client.infrastructure.ServerException +import org.openapitools.client.infrastructure.ServerError +import org.openapitools.client.infrastructure.MultiValueMap +import org.openapitools.client.infrastructure.PartConfig +import org.openapitools.client.infrastructure.RequestConfig +import org.openapitools.client.infrastructure.RequestMethod +import org.openapitools.client.infrastructure.ResponseType +import org.openapitools.client.infrastructure.Success +import org.openapitools.client.infrastructure.toMultiValue + +open class EchoApi(basePath: kotlin.String = defaultBasePath, client: Call.Factory = ApiClient.defaultClient) : ApiClient(basePath, client) { + companion object { + @JvmStatic + val defaultBasePath: String by lazy { + System.getProperties().getProperty(ApiClient.BASE_URL_KEY, "http://localhost:3000") + } + } + + /** + * GET /echo/string-escaping/{$paramName} + * Test $-in-path-param escaping + * Tests that path params with $dollar, backslash \\ and quote \" are properly escaped + * @param dollarParamName + * @param filterDollarType Filter with $dollar in description and comment-close *_/ (optional, default to "default$Value with \\ and \"") + * @return kotlin.String + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception + * @throws UnsupportedOperationException If the API returns an informational or redirection response + * @throws ClientException If the API returns a client error response + * @throws ServerException If the API returns a server error response + */ + @Suppress("UNCHECKED_CAST") + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) + fun testsEchoStringEscapingParamName(dollarParamName: kotlin.String, filterDollarType: kotlin.String? = "default\$Value with \\ and \"") : kotlin.String { + val localVarResponse = testsEchoStringEscapingParamNameWithHttpInfo(dollarParamName = dollarParamName, filterDollarType = filterDollarType) + + return when (localVarResponse.responseType) { + ResponseType.Success -> (localVarResponse as Success<*>).data as kotlin.String + ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") + ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") + ResponseType.ClientError -> { + val localVarError = localVarResponse as ClientError<*> + throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) + } + ResponseType.ServerError -> { + val localVarError = localVarResponse as ServerError<*> + throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()} ${localVarError.body}", localVarError.statusCode, localVarResponse) + } + } + } + + /** + * GET /echo/string-escaping/{$paramName} + * Test $-in-path-param escaping + * Tests that path params with $dollar, backslash \\ and quote \" are properly escaped + * @param dollarParamName + * @param filterDollarType Filter with $dollar in description and comment-close *_/ (optional, default to "default$Value with \\ and \"") + * @return ApiResponse + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception + */ + @Suppress("UNCHECKED_CAST") + @Throws(IllegalStateException::class, IOException::class) + fun testsEchoStringEscapingParamNameWithHttpInfo(dollarParamName: kotlin.String, filterDollarType: kotlin.String?) : ApiResponse { + val localVariableConfig = testsEchoStringEscapingParamNameRequestConfig(dollarParamName = dollarParamName, filterDollarType = filterDollarType) + + return request( + localVariableConfig + ) + } + + /** + * To obtain the request config of the operation testsEchoStringEscapingParamName + * + * @param dollarParamName + * @param filterDollarType Filter with $dollar in description and comment-close *_/ (optional, default to "default$Value with \\ and \"") + * @return RequestConfig + */ + fun testsEchoStringEscapingParamNameRequestConfig(dollarParamName: kotlin.String, filterDollarType: kotlin.String?) : RequestConfig { + val localVariableBody = null + val localVariableQuery: MultiValueMap = mutableMapOf>() + .apply { + if (filterDollarType != null) { + put("filter\$Type", listOf(filterDollarType.toString())) + } + } + val localVariableHeaders: MutableMap = mutableMapOf() + localVariableHeaders["Accept"] = "text/plain" + + return RequestConfig( + method = RequestMethod.GET, + path = "/echo/string-escaping/{\$paramName}".replace("{"+"\$paramName"+"}", encodeURIComponent(dollarParamName.toString())), + query = localVariableQuery, + headers = localVariableHeaders, + requiresAuthentication = false, + body = localVariableBody + ) + } + + + private fun encodeURIComponent(uriComponent: kotlin.String): kotlin.String = + HttpUrl.Builder().scheme("http").host("localhost").addPathSegment(uriComponent).build().encodedPathSegments[0] +} diff --git a/samples/client/echo_api/kotlin-jvm-okhttp/src/main/kotlin/org/openapitools/client/models/ApiStringEscapingEdgeCases.kt b/samples/client/echo_api/kotlin-jvm-okhttp/src/main/kotlin/org/openapitools/client/models/ApiStringEscapingEdgeCases.kt new file mode 100644 index 000000000000..5709b8170d2a --- /dev/null +++ b/samples/client/echo_api/kotlin-jvm-okhttp/src/main/kotlin/org/openapitools/client/models/ApiStringEscapingEdgeCases.kt @@ -0,0 +1,52 @@ +/** + * + * Please note: + * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * Do not edit this file manually. + * + */ + +@file:Suppress( + "ArrayInDataClass", + "DuplicatedCode", + "EnumEntryName", + "RemoveRedundantQualifierName", + "RemoveRedundantCallsOfConversionMethods", + "REDUNDANT_CALL_OF_CONVERSION_METHOD", + "RedundantUnitReturnType", + "RemoveEmptyClassBody", + "UnnecessaryVariable", + "UnusedImport", + "UnnecessaryVariable", + "unused" +) + +package org.openapitools.client.models + + +import com.squareup.moshi.Json +import com.squareup.moshi.JsonClass + +/** + * Model to test: $dollar, backslash \\, quote \", comment-close *_/ + * + * @param dollarDefault A string whose default has $dollar, backslash \\, quote \" and comment-close *_/ + * @param regularProp Regular property for baseline comparison + */ + + +data class ApiStringEscapingEdgeCases ( + + /* A string whose default has $dollar, backslash \\, quote \" and comment-close *_/ */ + @Json(name = "dollarDefault") + val dollarDefault: kotlin.String? = "hello \$world, backslash=\\, quote=\", end */", + + /* Regular property for baseline comparison */ + @Json(name = "regularProp") + val regularProp: kotlin.String? = null + +) { + + +} + diff --git a/samples/client/echo_api/kotlin-jvm-okhttp/src/test/kotlin/org/openapitools/client/apis/EchoApiTest.kt b/samples/client/echo_api/kotlin-jvm-okhttp/src/test/kotlin/org/openapitools/client/apis/EchoApiTest.kt new file mode 100644 index 000000000000..f0f08d55a94b --- /dev/null +++ b/samples/client/echo_api/kotlin-jvm-okhttp/src/test/kotlin/org/openapitools/client/apis/EchoApiTest.kt @@ -0,0 +1,46 @@ +/** + * + * Please note: + * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * Do not edit this file manually. + * + */ + +@file:Suppress( + "ArrayInDataClass", + "DuplicatedCode", + "EnumEntryName", + "RemoveRedundantQualifierName", + "RemoveRedundantCallsOfConversionMethods", + "REDUNDANT_CALL_OF_CONVERSION_METHOD", + "RedundantUnitReturnType", + "RemoveEmptyClassBody", + "UnnecessaryVariable", + "UnusedImport", + "UnnecessaryVariable", + "unused" +) + +package org.openapitools.client.apis + +import io.kotlintest.shouldBe +import io.kotlintest.specs.ShouldSpec + +import org.openapitools.client.apis.EchoApi + +class EchoApiTest : ShouldSpec() { + init { + // uncomment below to create an instance of EchoApi + //val apiInstance = EchoApi() + + // to test testsEchoStringEscapingParamName + should("test testsEchoStringEscapingParamName") { + // uncomment below to test testsEchoStringEscapingParamName + //val dollarParamName : kotlin.String = dollarParamName_example // kotlin.String | + //val filterDollarType : kotlin.String = filterDollarType_example // kotlin.String | Filter with $dollar in description and comment-close *_/ + //val result : kotlin.String = apiInstance.testsEchoStringEscapingParamName(dollarParamName, filterDollarType) + //result shouldBe ("TODO") + } + + } +} diff --git a/samples/client/echo_api/kotlin-jvm-okhttp/src/test/kotlin/org/openapitools/client/models/StringEscapingEdgeCasesTest.kt b/samples/client/echo_api/kotlin-jvm-okhttp/src/test/kotlin/org/openapitools/client/models/StringEscapingEdgeCasesTest.kt new file mode 100644 index 000000000000..6cfaf10ce897 --- /dev/null +++ b/samples/client/echo_api/kotlin-jvm-okhttp/src/test/kotlin/org/openapitools/client/models/StringEscapingEdgeCasesTest.kt @@ -0,0 +1,49 @@ +/** + * + * Please note: + * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * Do not edit this file manually. + * + */ + +@file:Suppress( + "ArrayInDataClass", + "DuplicatedCode", + "EnumEntryName", + "RemoveRedundantQualifierName", + "RemoveRedundantCallsOfConversionMethods", + "REDUNDANT_CALL_OF_CONVERSION_METHOD", + "RedundantUnitReturnType", + "RemoveEmptyClassBody", + "UnnecessaryVariable", + "UnusedImport", + "UnnecessaryVariable", + "unused" +) + +package org.openapitools.client.models + +import io.kotlintest.shouldBe +import io.kotlintest.specs.ShouldSpec + +import org.openapitools.client.models.ApiStringEscapingEdgeCases + +class ApiStringEscapingEdgeCasesTest : ShouldSpec() { + init { + // uncomment below to create an instance of ApiStringEscapingEdgeCases + //val modelInstance = ApiStringEscapingEdgeCases() + + // to test the property `dollarDefault` - A string whose default has $dollar, backslash \\, quote \" and comment-close *_/ + should("test dollarDefault") { + // uncomment below to test the property + //modelInstance.dollarDefault shouldBe ("TODO") + } + + // to test the property `regularProp` - Regular property for baseline comparison + should("test regularProp") { + // uncomment below to test the property + //modelInstance.regularProp shouldBe ("TODO") + } + + } +} diff --git a/samples/client/echo_api/kotlin-jvm-spring-3-restclient/.openapi-generator/FILES b/samples/client/echo_api/kotlin-jvm-spring-3-restclient/.openapi-generator/FILES index 4d6a5844ccea..6df32f7ebb42 100644 --- a/samples/client/echo_api/kotlin-jvm-spring-3-restclient/.openapi-generator/FILES +++ b/samples/client/echo_api/kotlin-jvm-spring-3-restclient/.openapi-generator/FILES @@ -5,6 +5,7 @@ docs/Bird.md docs/BodyApi.md docs/Category.md docs/DefaultValue.md +docs/EchoApi.md docs/FormApi.md docs/HeaderApi.md docs/NumberPropertiesOnly.md @@ -13,6 +14,7 @@ docs/Pet.md docs/Query.md docs/QueryApi.md docs/StringEnumRef.md +docs/StringEscapingEdgeCases.md docs/Tag.md docs/TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter.md gradle/wrapper/gradle-wrapper.jar @@ -22,6 +24,7 @@ gradlew.bat settings.gradle src/main/kotlin/org/openapitools/client/apis/AuthApi.kt src/main/kotlin/org/openapitools/client/apis/BodyApi.kt +src/main/kotlin/org/openapitools/client/apis/EchoApi.kt src/main/kotlin/org/openapitools/client/apis/FormApi.kt src/main/kotlin/org/openapitools/client/apis/HeaderApi.kt src/main/kotlin/org/openapitools/client/apis/PathApi.kt @@ -39,5 +42,6 @@ src/main/kotlin/org/openapitools/client/models/NumberPropertiesOnly.kt src/main/kotlin/org/openapitools/client/models/Pet.kt src/main/kotlin/org/openapitools/client/models/Query.kt src/main/kotlin/org/openapitools/client/models/StringEnumRef.kt +src/main/kotlin/org/openapitools/client/models/StringEscapingEdgeCases.kt src/main/kotlin/org/openapitools/client/models/Tag.kt src/main/kotlin/org/openapitools/client/models/TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter.kt diff --git a/samples/client/echo_api/kotlin-jvm-spring-3-restclient/README.md b/samples/client/echo_api/kotlin-jvm-spring-3-restclient/README.md index dbe1ebbb396e..3ce32e0b880e 100644 --- a/samples/client/echo_api/kotlin-jvm-spring-3-restclient/README.md +++ b/samples/client/echo_api/kotlin-jvm-spring-3-restclient/README.md @@ -55,6 +55,7 @@ All URIs are relative to *http://localhost:3000* | *BodyApi* | [**testEchoBodyPet**](docs/BodyApi.md#testechobodypet) | **POST** /echo/body/Pet | Test body parameter(s) | | *BodyApi* | [**testEchoBodyPetResponseString**](docs/BodyApi.md#testechobodypetresponsestring) | **POST** /echo/body/Pet/response_string | Test empty response body | | *BodyApi* | [**testEchoBodyTagResponseString**](docs/BodyApi.md#testechobodytagresponsestring) | **POST** /echo/body/Tag/response_string | Test empty json (request body) | +| *EchoApi* | [**testsEchoStringEscapingParamName**](docs/EchoApi.md#testsechostringescapingparamname) | **GET** /echo/string-escaping/{$paramName} | Test $-in-path-param escaping | | *FormApi* | [**testFormIntegerBooleanString**](docs/FormApi.md#testformintegerbooleanstring) | **POST** /form/integer/boolean/string | Test form parameter(s) | | *FormApi* | [**testFormOneof**](docs/FormApi.md#testformoneof) | **POST** /form/oneof | Test form parameter(s) for oneOf schema | | *HeaderApi* | [**testHeaderIntegerBooleanStringEnums**](docs/HeaderApi.md#testheaderintegerbooleanstringenums) | **GET** /header/integer/boolean/string/enums | Test header parameter(s) | @@ -77,6 +78,7 @@ All URIs are relative to *http://localhost:3000* - [org.openapitools.client.models.Pet](docs/Pet.md) - [org.openapitools.client.models.Query](docs/Query.md) - [org.openapitools.client.models.StringEnumRef](docs/StringEnumRef.md) + - [org.openapitools.client.models.StringEscapingEdgeCases](docs/StringEscapingEdgeCases.md) - [org.openapitools.client.models.Tag](docs/Tag.md) - [org.openapitools.client.models.TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter](docs/TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter.md) diff --git a/samples/client/echo_api/kotlin-jvm-spring-3-restclient/docs/EchoApi.md b/samples/client/echo_api/kotlin-jvm-spring-3-restclient/docs/EchoApi.md new file mode 100644 index 000000000000..9e1e3f20d7a9 --- /dev/null +++ b/samples/client/echo_api/kotlin-jvm-spring-3-restclient/docs/EchoApi.md @@ -0,0 +1,57 @@ +# EchoApi + +All URIs are relative to *http://localhost:3000* + +| Method | HTTP request | Description | +| ------------- | ------------- | ------------- | +| [**testsEchoStringEscapingParamName**](EchoApi.md#testsEchoStringEscapingParamName) | **GET** /echo/string-escaping/{$paramName} | Test \$-in-path-param escaping | + + + +# **testsEchoStringEscapingParamName** +> kotlin.String testsEchoStringEscapingParamName(dollarParamName, filterDollarType) + +Test \$-in-path-param escaping + +Tests that path params with \$dollar, backslash \\ and quote " are properly escaped + +### Example +```kotlin +// Import classes: +//import org.openapitools.client.infrastructure.* +//import org.openapitools.client.models.* + +val apiInstance = EchoApi() +val dollarParamName : kotlin.String = dollarParamName_example // kotlin.String | +val filterDollarType : kotlin.String = filterDollarType_example // kotlin.String | Filter with $dollar in description and comment-close */ +try { + val result : kotlin.String = apiInstance.testsEchoStringEscapingParamName(dollarParamName, filterDollarType) + println(result) +} catch (e: ClientException) { + println("4xx response calling EchoApi#testsEchoStringEscapingParamName") + e.printStackTrace() +} catch (e: ServerException) { + println("5xx response calling EchoApi#testsEchoStringEscapingParamName") + e.printStackTrace() +} +``` + +### Parameters +| **dollarParamName** | **kotlin.String**| | | +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **filterDollarType** | **kotlin.String**| Filter with \$dollar in description and comment-close */ | [optional] [default to "default\$Value with \\\\ and \\""] | + +### Return type + +**kotlin.String** + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: text/plain + diff --git a/samples/client/echo_api/kotlin-jvm-spring-3-restclient/docs/StringEscapingEdgeCases.md b/samples/client/echo_api/kotlin-jvm-spring-3-restclient/docs/StringEscapingEdgeCases.md new file mode 100644 index 000000000000..b65c95da692d --- /dev/null +++ b/samples/client/echo_api/kotlin-jvm-spring-3-restclient/docs/StringEscapingEdgeCases.md @@ -0,0 +1,11 @@ + +# StringEscapingEdgeCases + +## Properties +| Name | Type | Description | Notes | +| ------------ | ------------- | ------------- | ------------- | +| **dollarDefault** | **kotlin.String** | A string whose default has \$dollar, backslash \\, quote " and comment-close */ | [optional] | +| **regularProp** | **kotlin.String** | Regular property for baseline comparison | [optional] | + + + diff --git a/samples/client/echo_api/kotlin-jvm-spring-3-restclient/src/main/kotlin/org/openapitools/client/apis/EchoApi.kt b/samples/client/echo_api/kotlin-jvm-spring-3-restclient/src/main/kotlin/org/openapitools/client/apis/EchoApi.kt new file mode 100644 index 000000000000..0cb8df76916d --- /dev/null +++ b/samples/client/echo_api/kotlin-jvm-spring-3-restclient/src/main/kotlin/org/openapitools/client/apis/EchoApi.kt @@ -0,0 +1,87 @@ +/** + * + * Please note: + * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * Do not edit this file manually. + * + */ + +@file:Suppress( + "ArrayInDataClass", + "DuplicatedCode", + "EnumEntryName", + "RemoveRedundantQualifierName", + "RemoveRedundantCallsOfConversionMethods", + "REDUNDANT_CALL_OF_CONVERSION_METHOD", + "RedundantUnitReturnType", + "RemoveEmptyClassBody", + "UnnecessaryVariable", + "UnusedImport", + "UnnecessaryVariable", + "unused" +) + +package org.openapitools.client.apis + +import com.fasterxml.jackson.annotation.JsonProperty + +import org.springframework.web.client.RestClient +import org.springframework.web.client.RestClientResponseException + +import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter +import org.springframework.http.ResponseEntity +import org.springframework.http.MediaType + + +import org.openapitools.client.infrastructure.* + +open class EchoApi(client: RestClient) : ApiClient(client) { + + constructor(baseUrl: String) : this(RestClient.builder() + .baseUrl(baseUrl) + .messageConverters { it.add(MappingJackson2HttpMessageConverter()) } + .build() + ) + + + @Throws(RestClientResponseException::class) + fun testsEchoStringEscapingParamName(dollarParamName: kotlin.String, filterDollarType: kotlin.String? = "default\$Value with \\ and \""): kotlin.String { + val result = testsEchoStringEscapingParamNameWithHttpInfo(dollarParamName = dollarParamName, filterDollarType = filterDollarType) + return result.body!! + } + + @Throws(RestClientResponseException::class) + fun testsEchoStringEscapingParamNameWithHttpInfo(dollarParamName: kotlin.String, filterDollarType: kotlin.String? = "default\$Value with \\ and \""): ResponseEntity { + val localVariableConfig = testsEchoStringEscapingParamNameRequestConfig(dollarParamName = dollarParamName, filterDollarType = filterDollarType) + return request( + localVariableConfig + ) + } + + fun testsEchoStringEscapingParamNameRequestConfig(dollarParamName: kotlin.String, filterDollarType: kotlin.String? = "default\$Value with \\ and \"") : RequestConfig { + val localVariableBody = null + val localVariableQuery = mutableMapOf>() + .apply { + if (filterDollarType != null) { + put("filter\$Type", listOf(filterDollarType.toString())) + } + } + val localVariableHeaders: MutableMap = mutableMapOf() + localVariableHeaders["Accept"] = "text/plain" + + val params = mutableMapOf( + "\$paramName" to dollarParamName, + ) + + return RequestConfig( + method = RequestMethod.GET, + path = "/echo/string-escaping/{\$paramName}", + params = params, + query = localVariableQuery, + headers = localVariableHeaders, + requiresAuthentication = false, + body = localVariableBody + ) + } + +} diff --git a/samples/client/echo_api/kotlin-jvm-spring-3-restclient/src/main/kotlin/org/openapitools/client/models/StringEscapingEdgeCases.kt b/samples/client/echo_api/kotlin-jvm-spring-3-restclient/src/main/kotlin/org/openapitools/client/models/StringEscapingEdgeCases.kt new file mode 100644 index 000000000000..05ee371d5913 --- /dev/null +++ b/samples/client/echo_api/kotlin-jvm-spring-3-restclient/src/main/kotlin/org/openapitools/client/models/StringEscapingEdgeCases.kt @@ -0,0 +1,52 @@ +/** + * + * Please note: + * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * Do not edit this file manually. + * + */ + +@file:Suppress( + "ArrayInDataClass", + "DuplicatedCode", + "EnumEntryName", + "RemoveRedundantQualifierName", + "RemoveRedundantCallsOfConversionMethods", + "REDUNDANT_CALL_OF_CONVERSION_METHOD", + "RedundantUnitReturnType", + "RemoveEmptyClassBody", + "UnnecessaryVariable", + "UnusedImport", + "UnnecessaryVariable", + "unused" +) + +package org.openapitools.client.models + + +import com.fasterxml.jackson.annotation.JsonEnumDefaultValue +import com.fasterxml.jackson.annotation.JsonProperty + +/** + * Model to test: $dollar, backslash \\, quote \", comment-close *_/ + * + * @param dollarDefault A string whose default has $dollar, backslash \\, quote \" and comment-close *_/ + * @param regularProp Regular property for baseline comparison + */ + + +data class StringEscapingEdgeCases ( + + /* A string whose default has $dollar, backslash \\, quote \" and comment-close *_/ */ + @get:JsonProperty("dollarDefault") + val dollarDefault: kotlin.String? = "hello \$world, backslash=\\, quote=\", end */", + + /* Regular property for baseline comparison */ + @get:JsonProperty("regularProp") + val regularProp: kotlin.String? = null + +) { + + +} + diff --git a/samples/client/echo_api/kotlin-jvm-spring-3-restclient/src/test/kotlin/org/openapitools/client/apis/EchoApiTest.kt b/samples/client/echo_api/kotlin-jvm-spring-3-restclient/src/test/kotlin/org/openapitools/client/apis/EchoApiTest.kt new file mode 100644 index 000000000000..f0f08d55a94b --- /dev/null +++ b/samples/client/echo_api/kotlin-jvm-spring-3-restclient/src/test/kotlin/org/openapitools/client/apis/EchoApiTest.kt @@ -0,0 +1,46 @@ +/** + * + * Please note: + * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * Do not edit this file manually. + * + */ + +@file:Suppress( + "ArrayInDataClass", + "DuplicatedCode", + "EnumEntryName", + "RemoveRedundantQualifierName", + "RemoveRedundantCallsOfConversionMethods", + "REDUNDANT_CALL_OF_CONVERSION_METHOD", + "RedundantUnitReturnType", + "RemoveEmptyClassBody", + "UnnecessaryVariable", + "UnusedImport", + "UnnecessaryVariable", + "unused" +) + +package org.openapitools.client.apis + +import io.kotlintest.shouldBe +import io.kotlintest.specs.ShouldSpec + +import org.openapitools.client.apis.EchoApi + +class EchoApiTest : ShouldSpec() { + init { + // uncomment below to create an instance of EchoApi + //val apiInstance = EchoApi() + + // to test testsEchoStringEscapingParamName + should("test testsEchoStringEscapingParamName") { + // uncomment below to test testsEchoStringEscapingParamName + //val dollarParamName : kotlin.String = dollarParamName_example // kotlin.String | + //val filterDollarType : kotlin.String = filterDollarType_example // kotlin.String | Filter with $dollar in description and comment-close *_/ + //val result : kotlin.String = apiInstance.testsEchoStringEscapingParamName(dollarParamName, filterDollarType) + //result shouldBe ("TODO") + } + + } +} diff --git a/samples/client/echo_api/kotlin-jvm-spring-3-restclient/src/test/kotlin/org/openapitools/client/models/StringEscapingEdgeCasesTest.kt b/samples/client/echo_api/kotlin-jvm-spring-3-restclient/src/test/kotlin/org/openapitools/client/models/StringEscapingEdgeCasesTest.kt new file mode 100644 index 000000000000..40a3db7282e1 --- /dev/null +++ b/samples/client/echo_api/kotlin-jvm-spring-3-restclient/src/test/kotlin/org/openapitools/client/models/StringEscapingEdgeCasesTest.kt @@ -0,0 +1,49 @@ +/** + * + * Please note: + * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * Do not edit this file manually. + * + */ + +@file:Suppress( + "ArrayInDataClass", + "DuplicatedCode", + "EnumEntryName", + "RemoveRedundantQualifierName", + "RemoveRedundantCallsOfConversionMethods", + "REDUNDANT_CALL_OF_CONVERSION_METHOD", + "RedundantUnitReturnType", + "RemoveEmptyClassBody", + "UnnecessaryVariable", + "UnusedImport", + "UnnecessaryVariable", + "unused" +) + +package org.openapitools.client.models + +import io.kotlintest.shouldBe +import io.kotlintest.specs.ShouldSpec + +import org.openapitools.client.models.StringEscapingEdgeCases + +class StringEscapingEdgeCasesTest : ShouldSpec() { + init { + // uncomment below to create an instance of StringEscapingEdgeCases + //val modelInstance = StringEscapingEdgeCases() + + // to test the property `dollarDefault` - A string whose default has $dollar, backslash \\, quote \" and comment-close *_/ + should("test dollarDefault") { + // uncomment below to test the property + //modelInstance.dollarDefault shouldBe ("TODO") + } + + // to test the property `regularProp` - Regular property for baseline comparison + should("test regularProp") { + // uncomment below to test the property + //modelInstance.regularProp shouldBe ("TODO") + } + + } +} diff --git a/samples/client/echo_api/kotlin-jvm-spring-3-webclient/.openapi-generator/FILES b/samples/client/echo_api/kotlin-jvm-spring-3-webclient/.openapi-generator/FILES index 4d6a5844ccea..6df32f7ebb42 100644 --- a/samples/client/echo_api/kotlin-jvm-spring-3-webclient/.openapi-generator/FILES +++ b/samples/client/echo_api/kotlin-jvm-spring-3-webclient/.openapi-generator/FILES @@ -5,6 +5,7 @@ docs/Bird.md docs/BodyApi.md docs/Category.md docs/DefaultValue.md +docs/EchoApi.md docs/FormApi.md docs/HeaderApi.md docs/NumberPropertiesOnly.md @@ -13,6 +14,7 @@ docs/Pet.md docs/Query.md docs/QueryApi.md docs/StringEnumRef.md +docs/StringEscapingEdgeCases.md docs/Tag.md docs/TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter.md gradle/wrapper/gradle-wrapper.jar @@ -22,6 +24,7 @@ gradlew.bat settings.gradle src/main/kotlin/org/openapitools/client/apis/AuthApi.kt src/main/kotlin/org/openapitools/client/apis/BodyApi.kt +src/main/kotlin/org/openapitools/client/apis/EchoApi.kt src/main/kotlin/org/openapitools/client/apis/FormApi.kt src/main/kotlin/org/openapitools/client/apis/HeaderApi.kt src/main/kotlin/org/openapitools/client/apis/PathApi.kt @@ -39,5 +42,6 @@ src/main/kotlin/org/openapitools/client/models/NumberPropertiesOnly.kt src/main/kotlin/org/openapitools/client/models/Pet.kt src/main/kotlin/org/openapitools/client/models/Query.kt src/main/kotlin/org/openapitools/client/models/StringEnumRef.kt +src/main/kotlin/org/openapitools/client/models/StringEscapingEdgeCases.kt src/main/kotlin/org/openapitools/client/models/Tag.kt src/main/kotlin/org/openapitools/client/models/TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter.kt diff --git a/samples/client/echo_api/kotlin-jvm-spring-3-webclient/README.md b/samples/client/echo_api/kotlin-jvm-spring-3-webclient/README.md index dbe1ebbb396e..3ce32e0b880e 100644 --- a/samples/client/echo_api/kotlin-jvm-spring-3-webclient/README.md +++ b/samples/client/echo_api/kotlin-jvm-spring-3-webclient/README.md @@ -55,6 +55,7 @@ All URIs are relative to *http://localhost:3000* | *BodyApi* | [**testEchoBodyPet**](docs/BodyApi.md#testechobodypet) | **POST** /echo/body/Pet | Test body parameter(s) | | *BodyApi* | [**testEchoBodyPetResponseString**](docs/BodyApi.md#testechobodypetresponsestring) | **POST** /echo/body/Pet/response_string | Test empty response body | | *BodyApi* | [**testEchoBodyTagResponseString**](docs/BodyApi.md#testechobodytagresponsestring) | **POST** /echo/body/Tag/response_string | Test empty json (request body) | +| *EchoApi* | [**testsEchoStringEscapingParamName**](docs/EchoApi.md#testsechostringescapingparamname) | **GET** /echo/string-escaping/{$paramName} | Test $-in-path-param escaping | | *FormApi* | [**testFormIntegerBooleanString**](docs/FormApi.md#testformintegerbooleanstring) | **POST** /form/integer/boolean/string | Test form parameter(s) | | *FormApi* | [**testFormOneof**](docs/FormApi.md#testformoneof) | **POST** /form/oneof | Test form parameter(s) for oneOf schema | | *HeaderApi* | [**testHeaderIntegerBooleanStringEnums**](docs/HeaderApi.md#testheaderintegerbooleanstringenums) | **GET** /header/integer/boolean/string/enums | Test header parameter(s) | @@ -77,6 +78,7 @@ All URIs are relative to *http://localhost:3000* - [org.openapitools.client.models.Pet](docs/Pet.md) - [org.openapitools.client.models.Query](docs/Query.md) - [org.openapitools.client.models.StringEnumRef](docs/StringEnumRef.md) + - [org.openapitools.client.models.StringEscapingEdgeCases](docs/StringEscapingEdgeCases.md) - [org.openapitools.client.models.Tag](docs/Tag.md) - [org.openapitools.client.models.TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter](docs/TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter.md) diff --git a/samples/client/echo_api/kotlin-jvm-spring-3-webclient/docs/EchoApi.md b/samples/client/echo_api/kotlin-jvm-spring-3-webclient/docs/EchoApi.md new file mode 100644 index 000000000000..9e1e3f20d7a9 --- /dev/null +++ b/samples/client/echo_api/kotlin-jvm-spring-3-webclient/docs/EchoApi.md @@ -0,0 +1,57 @@ +# EchoApi + +All URIs are relative to *http://localhost:3000* + +| Method | HTTP request | Description | +| ------------- | ------------- | ------------- | +| [**testsEchoStringEscapingParamName**](EchoApi.md#testsEchoStringEscapingParamName) | **GET** /echo/string-escaping/{$paramName} | Test \$-in-path-param escaping | + + + +# **testsEchoStringEscapingParamName** +> kotlin.String testsEchoStringEscapingParamName(dollarParamName, filterDollarType) + +Test \$-in-path-param escaping + +Tests that path params with \$dollar, backslash \\ and quote " are properly escaped + +### Example +```kotlin +// Import classes: +//import org.openapitools.client.infrastructure.* +//import org.openapitools.client.models.* + +val apiInstance = EchoApi() +val dollarParamName : kotlin.String = dollarParamName_example // kotlin.String | +val filterDollarType : kotlin.String = filterDollarType_example // kotlin.String | Filter with $dollar in description and comment-close */ +try { + val result : kotlin.String = apiInstance.testsEchoStringEscapingParamName(dollarParamName, filterDollarType) + println(result) +} catch (e: ClientException) { + println("4xx response calling EchoApi#testsEchoStringEscapingParamName") + e.printStackTrace() +} catch (e: ServerException) { + println("5xx response calling EchoApi#testsEchoStringEscapingParamName") + e.printStackTrace() +} +``` + +### Parameters +| **dollarParamName** | **kotlin.String**| | | +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **filterDollarType** | **kotlin.String**| Filter with \$dollar in description and comment-close */ | [optional] [default to "default\$Value with \\\\ and \\""] | + +### Return type + +**kotlin.String** + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: text/plain + diff --git a/samples/client/echo_api/kotlin-jvm-spring-3-webclient/docs/StringEscapingEdgeCases.md b/samples/client/echo_api/kotlin-jvm-spring-3-webclient/docs/StringEscapingEdgeCases.md new file mode 100644 index 000000000000..b65c95da692d --- /dev/null +++ b/samples/client/echo_api/kotlin-jvm-spring-3-webclient/docs/StringEscapingEdgeCases.md @@ -0,0 +1,11 @@ + +# StringEscapingEdgeCases + +## Properties +| Name | Type | Description | Notes | +| ------------ | ------------- | ------------- | ------------- | +| **dollarDefault** | **kotlin.String** | A string whose default has \$dollar, backslash \\, quote " and comment-close */ | [optional] | +| **regularProp** | **kotlin.String** | Regular property for baseline comparison | [optional] | + + + diff --git a/samples/client/echo_api/kotlin-jvm-spring-3-webclient/src/main/kotlin/org/openapitools/client/apis/EchoApi.kt b/samples/client/echo_api/kotlin-jvm-spring-3-webclient/src/main/kotlin/org/openapitools/client/apis/EchoApi.kt new file mode 100644 index 000000000000..18ef83e11f13 --- /dev/null +++ b/samples/client/echo_api/kotlin-jvm-spring-3-webclient/src/main/kotlin/org/openapitools/client/apis/EchoApi.kt @@ -0,0 +1,91 @@ +/** + * + * Please note: + * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * Do not edit this file manually. + * + */ + +@file:Suppress( + "ArrayInDataClass", + "DuplicatedCode", + "EnumEntryName", + "RemoveRedundantQualifierName", + "RemoveRedundantCallsOfConversionMethods", + "REDUNDANT_CALL_OF_CONVERSION_METHOD", + "RedundantUnitReturnType", + "RemoveEmptyClassBody", + "UnnecessaryVariable", + "UnusedImport", + "UnnecessaryVariable", + "unused" +) + +package org.openapitools.client.apis + +import com.fasterxml.jackson.annotation.JsonProperty + +import org.springframework.web.reactive.function.client.WebClient +import org.springframework.web.reactive.function.client.WebClientResponseException +import org.springframework.http.codec.json.Jackson2JsonDecoder +import org.springframework.http.codec.json.Jackson2JsonEncoder +import org.springframework.http.ResponseEntity +import org.springframework.http.MediaType +import reactor.core.publisher.Mono +import org.springframework.util.LinkedMultiValueMap + +import org.openapitools.client.infrastructure.* + +open class EchoApi(client: WebClient) : ApiClient(client) { + + constructor(baseUrl: String) : this(WebClient.builder() + .baseUrl(baseUrl) + .codecs { + it.defaultCodecs().jackson2JsonEncoder(Jackson2JsonEncoder(Serializer.jacksonObjectMapper, MediaType.APPLICATION_JSON)) + it.defaultCodecs().jackson2JsonDecoder(Jackson2JsonDecoder(Serializer.jacksonObjectMapper, MediaType.APPLICATION_JSON)) + } + .build() + ) + + + @Throws(WebClientResponseException::class) + fun testsEchoStringEscapingParamName(dollarParamName: kotlin.String, filterDollarType: kotlin.String? = "default\$Value with \\ and \""): Mono { + return testsEchoStringEscapingParamNameWithHttpInfo(dollarParamName = dollarParamName, filterDollarType = filterDollarType) + .map { it.body!! } + } + + @Throws(WebClientResponseException::class) + fun testsEchoStringEscapingParamNameWithHttpInfo(dollarParamName: kotlin.String, filterDollarType: kotlin.String? = "default\$Value with \\ and \""): Mono> { + val localVariableConfig = testsEchoStringEscapingParamNameRequestConfig(dollarParamName = dollarParamName, filterDollarType = filterDollarType) + return request( + localVariableConfig + ) + } + + fun testsEchoStringEscapingParamNameRequestConfig(dollarParamName: kotlin.String, filterDollarType: kotlin.String? = "default\$Value with \\ and \"") : RequestConfig { + val localVariableBody = null + val localVariableQuery = mutableMapOf>() + .apply { + if (filterDollarType != null) { + put("filter\$Type", listOf(filterDollarType.toString())) + } + } + val localVariableHeaders: MutableMap = mutableMapOf() + localVariableHeaders["Accept"] = "text/plain" + + val params = mutableMapOf( + "\$paramName" to dollarParamName, + ) + + return RequestConfig( + method = RequestMethod.GET, + path = "/echo/string-escaping/{\$paramName}", + params = params, + query = localVariableQuery, + headers = localVariableHeaders, + requiresAuthentication = false, + body = localVariableBody + ) + } + +} diff --git a/samples/client/echo_api/kotlin-jvm-spring-3-webclient/src/main/kotlin/org/openapitools/client/models/StringEscapingEdgeCases.kt b/samples/client/echo_api/kotlin-jvm-spring-3-webclient/src/main/kotlin/org/openapitools/client/models/StringEscapingEdgeCases.kt new file mode 100644 index 000000000000..05ee371d5913 --- /dev/null +++ b/samples/client/echo_api/kotlin-jvm-spring-3-webclient/src/main/kotlin/org/openapitools/client/models/StringEscapingEdgeCases.kt @@ -0,0 +1,52 @@ +/** + * + * Please note: + * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * Do not edit this file manually. + * + */ + +@file:Suppress( + "ArrayInDataClass", + "DuplicatedCode", + "EnumEntryName", + "RemoveRedundantQualifierName", + "RemoveRedundantCallsOfConversionMethods", + "REDUNDANT_CALL_OF_CONVERSION_METHOD", + "RedundantUnitReturnType", + "RemoveEmptyClassBody", + "UnnecessaryVariable", + "UnusedImport", + "UnnecessaryVariable", + "unused" +) + +package org.openapitools.client.models + + +import com.fasterxml.jackson.annotation.JsonEnumDefaultValue +import com.fasterxml.jackson.annotation.JsonProperty + +/** + * Model to test: $dollar, backslash \\, quote \", comment-close *_/ + * + * @param dollarDefault A string whose default has $dollar, backslash \\, quote \" and comment-close *_/ + * @param regularProp Regular property for baseline comparison + */ + + +data class StringEscapingEdgeCases ( + + /* A string whose default has $dollar, backslash \\, quote \" and comment-close *_/ */ + @get:JsonProperty("dollarDefault") + val dollarDefault: kotlin.String? = "hello \$world, backslash=\\, quote=\", end */", + + /* Regular property for baseline comparison */ + @get:JsonProperty("regularProp") + val regularProp: kotlin.String? = null + +) { + + +} + diff --git a/samples/client/echo_api/kotlin-jvm-spring-3-webclient/src/test/kotlin/org/openapitools/client/apis/EchoApiTest.kt b/samples/client/echo_api/kotlin-jvm-spring-3-webclient/src/test/kotlin/org/openapitools/client/apis/EchoApiTest.kt new file mode 100644 index 000000000000..f0f08d55a94b --- /dev/null +++ b/samples/client/echo_api/kotlin-jvm-spring-3-webclient/src/test/kotlin/org/openapitools/client/apis/EchoApiTest.kt @@ -0,0 +1,46 @@ +/** + * + * Please note: + * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * Do not edit this file manually. + * + */ + +@file:Suppress( + "ArrayInDataClass", + "DuplicatedCode", + "EnumEntryName", + "RemoveRedundantQualifierName", + "RemoveRedundantCallsOfConversionMethods", + "REDUNDANT_CALL_OF_CONVERSION_METHOD", + "RedundantUnitReturnType", + "RemoveEmptyClassBody", + "UnnecessaryVariable", + "UnusedImport", + "UnnecessaryVariable", + "unused" +) + +package org.openapitools.client.apis + +import io.kotlintest.shouldBe +import io.kotlintest.specs.ShouldSpec + +import org.openapitools.client.apis.EchoApi + +class EchoApiTest : ShouldSpec() { + init { + // uncomment below to create an instance of EchoApi + //val apiInstance = EchoApi() + + // to test testsEchoStringEscapingParamName + should("test testsEchoStringEscapingParamName") { + // uncomment below to test testsEchoStringEscapingParamName + //val dollarParamName : kotlin.String = dollarParamName_example // kotlin.String | + //val filterDollarType : kotlin.String = filterDollarType_example // kotlin.String | Filter with $dollar in description and comment-close *_/ + //val result : kotlin.String = apiInstance.testsEchoStringEscapingParamName(dollarParamName, filterDollarType) + //result shouldBe ("TODO") + } + + } +} diff --git a/samples/client/echo_api/kotlin-jvm-spring-3-webclient/src/test/kotlin/org/openapitools/client/models/StringEscapingEdgeCasesTest.kt b/samples/client/echo_api/kotlin-jvm-spring-3-webclient/src/test/kotlin/org/openapitools/client/models/StringEscapingEdgeCasesTest.kt new file mode 100644 index 000000000000..40a3db7282e1 --- /dev/null +++ b/samples/client/echo_api/kotlin-jvm-spring-3-webclient/src/test/kotlin/org/openapitools/client/models/StringEscapingEdgeCasesTest.kt @@ -0,0 +1,49 @@ +/** + * + * Please note: + * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * Do not edit this file manually. + * + */ + +@file:Suppress( + "ArrayInDataClass", + "DuplicatedCode", + "EnumEntryName", + "RemoveRedundantQualifierName", + "RemoveRedundantCallsOfConversionMethods", + "REDUNDANT_CALL_OF_CONVERSION_METHOD", + "RedundantUnitReturnType", + "RemoveEmptyClassBody", + "UnnecessaryVariable", + "UnusedImport", + "UnnecessaryVariable", + "unused" +) + +package org.openapitools.client.models + +import io.kotlintest.shouldBe +import io.kotlintest.specs.ShouldSpec + +import org.openapitools.client.models.StringEscapingEdgeCases + +class StringEscapingEdgeCasesTest : ShouldSpec() { + init { + // uncomment below to create an instance of StringEscapingEdgeCases + //val modelInstance = StringEscapingEdgeCases() + + // to test the property `dollarDefault` - A string whose default has $dollar, backslash \\, quote \" and comment-close *_/ + should("test dollarDefault") { + // uncomment below to test the property + //modelInstance.dollarDefault shouldBe ("TODO") + } + + // to test the property `regularProp` - Regular property for baseline comparison + should("test regularProp") { + // uncomment below to test the property + //modelInstance.regularProp shouldBe ("TODO") + } + + } +} diff --git a/samples/client/echo_api/kotlin-model-prefix-type-mappings/.openapi-generator/FILES b/samples/client/echo_api/kotlin-model-prefix-type-mappings/.openapi-generator/FILES index f0ac80519da4..145e6840cf19 100644 --- a/samples/client/echo_api/kotlin-model-prefix-type-mappings/.openapi-generator/FILES +++ b/samples/client/echo_api/kotlin-model-prefix-type-mappings/.openapi-generator/FILES @@ -5,6 +5,7 @@ docs/Bird.md docs/BodyApi.md docs/Category.md docs/DefaultValue.md +docs/EchoApi.md docs/FormApi.md docs/HeaderApi.md docs/NumberPropertiesOnly.md @@ -13,6 +14,7 @@ docs/Pet.md docs/Query.md docs/QueryApi.md docs/StringEnumRef.md +docs/StringEscapingEdgeCases.md docs/Tag.md docs/TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter.md gradle/wrapper/gradle-wrapper.jar @@ -22,6 +24,7 @@ gradlew.bat settings.gradle src/main/kotlin/org/openapitools/client/apis/AuthApi.kt src/main/kotlin/org/openapitools/client/apis/BodyApi.kt +src/main/kotlin/org/openapitools/client/apis/EchoApi.kt src/main/kotlin/org/openapitools/client/apis/FormApi.kt src/main/kotlin/org/openapitools/client/apis/HeaderApi.kt src/main/kotlin/org/openapitools/client/apis/PathApi.kt @@ -43,5 +46,6 @@ src/main/kotlin/org/openapitools/client/models/ApiNumberPropertiesOnly.kt src/main/kotlin/org/openapitools/client/models/ApiPet.kt src/main/kotlin/org/openapitools/client/models/ApiQuery.kt src/main/kotlin/org/openapitools/client/models/ApiStringEnumRef.kt +src/main/kotlin/org/openapitools/client/models/ApiStringEscapingEdgeCases.kt src/main/kotlin/org/openapitools/client/models/ApiTag.kt src/main/kotlin/org/openapitools/client/models/ApiTestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter.kt diff --git a/samples/client/echo_api/kotlin-model-prefix-type-mappings/README.md b/samples/client/echo_api/kotlin-model-prefix-type-mappings/README.md index 47700630a98e..f6397b984546 100644 --- a/samples/client/echo_api/kotlin-model-prefix-type-mappings/README.md +++ b/samples/client/echo_api/kotlin-model-prefix-type-mappings/README.md @@ -55,6 +55,7 @@ All URIs are relative to *http://localhost:3000* | *BodyApi* | [**testEchoBodyPet**](docs/BodyApi.md#testechobodypet) | **POST** echo/body/Pet | Test body parameter(s) | | *BodyApi* | [**testEchoBodyPetResponseString**](docs/BodyApi.md#testechobodypetresponsestring) | **POST** echo/body/Pet/response_string | Test empty response body | | *BodyApi* | [**testEchoBodyTagResponseString**](docs/BodyApi.md#testechobodytagresponsestring) | **POST** echo/body/Tag/response_string | Test empty json (request body) | +| *EchoApi* | [**testsEchoStringEscapingParamName**](docs/EchoApi.md#testsechostringescapingparamname) | **GET** echo/string-escaping/{$paramName} | Test $-in-path-param escaping | | *FormApi* | [**testFormIntegerBooleanString**](docs/FormApi.md#testformintegerbooleanstring) | **POST** form/integer/boolean/string | Test form parameter(s) | | *FormApi* | [**testFormOneof**](docs/FormApi.md#testformoneof) | **POST** form/oneof | Test form parameter(s) for oneOf schema | | *HeaderApi* | [**testHeaderIntegerBooleanStringEnums**](docs/HeaderApi.md#testheaderintegerbooleanstringenums) | **GET** header/integer/boolean/string/enums | Test header parameter(s) | @@ -77,6 +78,7 @@ All URIs are relative to *http://localhost:3000* - [org.openapitools.client.models.ApiPet](docs/ApiPet.md) - [org.openapitools.client.models.ApiQuery](docs/ApiQuery.md) - [org.openapitools.client.models.ApiStringEnumRef](docs/ApiStringEnumRef.md) + - [org.openapitools.client.models.ApiStringEscapingEdgeCases](docs/ApiStringEscapingEdgeCases.md) - [org.openapitools.client.models.ApiTag](docs/ApiTag.md) - [org.openapitools.client.models.ApiTestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter](docs/ApiTestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter.md) diff --git a/samples/client/echo_api/kotlin-model-prefix-type-mappings/docs/EchoApi.md b/samples/client/echo_api/kotlin-model-prefix-type-mappings/docs/EchoApi.md new file mode 100644 index 000000000000..d2d562c90c52 --- /dev/null +++ b/samples/client/echo_api/kotlin-model-prefix-type-mappings/docs/EchoApi.md @@ -0,0 +1,50 @@ +# EchoApi + +All URIs are relative to *http://localhost:3000* + +| Method | HTTP request | Description | +| ------------- | ------------- | ------------- | +| [**testsEchoStringEscapingParamName**](EchoApi.md#testsEchoStringEscapingParamName) | **GET** echo/string-escaping/{$paramName} | Test \$-in-path-param escaping | + + + +Test \$-in-path-param escaping + +Tests that path params with \$dollar, backslash \\ and quote " are properly escaped + +### Example +```kotlin +// Import classes: +//import org.openapitools.client.* +//import org.openapitools.client.infrastructure.* +//import org.openapitools.client.models.* + +val apiClient = ApiClient() +val webService = apiClient.createWebservice(EchoApi::class.java) +val dollarParamName : kotlin.String = dollarParamName_example // kotlin.String | +val filterDollarType : kotlin.String = filterDollarType_example // kotlin.String | Filter with $dollar in description and comment-close */ + +launch(Dispatchers.IO) { + val result : kotlin.String = webService.testsEchoStringEscapingParamName(dollarParamName, filterDollarType) +} +``` + +### Parameters +| **dollarParamName** | **kotlin.String**| | | +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **filterDollarType** | **kotlin.String**| Filter with \$dollar in description and comment-close */ | [optional] [default to "default\$Value with \\\\ and \\""] | + +### Return type + +**kotlin.String** + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: text/plain + diff --git a/samples/client/echo_api/kotlin-model-prefix-type-mappings/docs/StringEscapingEdgeCases.md b/samples/client/echo_api/kotlin-model-prefix-type-mappings/docs/StringEscapingEdgeCases.md new file mode 100644 index 000000000000..e49f8e50da00 --- /dev/null +++ b/samples/client/echo_api/kotlin-model-prefix-type-mappings/docs/StringEscapingEdgeCases.md @@ -0,0 +1,11 @@ + +# ApiStringEscapingEdgeCases + +## Properties +| Name | Type | Description | Notes | +| ------------ | ------------- | ------------- | ------------- | +| **dollarDefault** | **kotlin.String** | A string whose default has \$dollar, backslash \\, quote " and comment-close */ | [optional] | +| **regularProp** | **kotlin.String** | Regular property for baseline comparison | [optional] | + + + diff --git a/samples/client/echo_api/kotlin-model-prefix-type-mappings/src/main/kotlin/org/openapitools/client/apis/EchoApi.kt b/samples/client/echo_api/kotlin-model-prefix-type-mappings/src/main/kotlin/org/openapitools/client/apis/EchoApi.kt new file mode 100644 index 000000000000..81e9ebf9525b --- /dev/null +++ b/samples/client/echo_api/kotlin-model-prefix-type-mappings/src/main/kotlin/org/openapitools/client/apis/EchoApi.kt @@ -0,0 +1,25 @@ +package org.openapitools.client.apis + +import org.openapitools.client.infrastructure.CollectionFormats.* +import retrofit2.http.* +import retrofit2.Response +import okhttp3.RequestBody +import com.google.gson.annotations.SerializedName + + +interface EchoApi { + /** + * GET echo/string-escaping/{$paramName} + * Test $-in-path-param escaping + * Tests that path params with $dollar, backslash \\ and quote \" are properly escaped + * Responses: + * - 200: ok + * + * @param dollarParamName + * @param filterDollarType Filter with $dollar in description and comment-close *_/ (optional, default to "default\$Value with \\\\ and \\"") + * @return [kotlin.String] + */ + @GET("echo/string-escaping/{\$paramName}") + suspend fun testsEchoStringEscapingParamName(@Path("\$paramName") dollarParamName: kotlin.String, @Query("filter\$Type") filterDollarType: kotlin.String? = "default\$Value with \\ and \""): Response + +} diff --git a/samples/client/echo_api/kotlin-model-prefix-type-mappings/src/main/kotlin/org/openapitools/client/models/ApiStringEscapingEdgeCases.kt b/samples/client/echo_api/kotlin-model-prefix-type-mappings/src/main/kotlin/org/openapitools/client/models/ApiStringEscapingEdgeCases.kt new file mode 100644 index 000000000000..e9d6cecc3821 --- /dev/null +++ b/samples/client/echo_api/kotlin-model-prefix-type-mappings/src/main/kotlin/org/openapitools/client/models/ApiStringEscapingEdgeCases.kt @@ -0,0 +1,51 @@ +/** + * + * Please note: + * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * Do not edit this file manually. + * + */ + +@file:Suppress( + "ArrayInDataClass", + "DuplicatedCode", + "EnumEntryName", + "RemoveRedundantQualifierName", + "RemoveRedundantCallsOfConversionMethods", + "REDUNDANT_CALL_OF_CONVERSION_METHOD", + "RedundantUnitReturnType", + "RemoveEmptyClassBody", + "UnnecessaryVariable", + "UnusedImport", + "UnnecessaryVariable", + "unused" +) + +package org.openapitools.client.models + + +import com.google.gson.annotations.SerializedName + +/** + * Model to test: $dollar, backslash \\, quote \", comment-close *_/ + * + * @param dollarDefault A string whose default has $dollar, backslash \\, quote \" and comment-close *_/ + * @param regularProp Regular property for baseline comparison + */ + + +data class ApiStringEscapingEdgeCases ( + + /* A string whose default has $dollar, backslash \\, quote \" and comment-close *_/ */ + @SerializedName("dollarDefault") + val dollarDefault: kotlin.String? = "hello \$world, backslash=\\, quote=\", end */", + + /* Regular property for baseline comparison */ + @SerializedName("regularProp") + val regularProp: kotlin.String? = null + +) { + + +} + diff --git a/samples/client/echo_api/kotlin-model-prefix-type-mappings/src/test/kotlin/org/openapitools/client/apis/EchoApiTest.kt b/samples/client/echo_api/kotlin-model-prefix-type-mappings/src/test/kotlin/org/openapitools/client/apis/EchoApiTest.kt new file mode 100644 index 000000000000..f0f08d55a94b --- /dev/null +++ b/samples/client/echo_api/kotlin-model-prefix-type-mappings/src/test/kotlin/org/openapitools/client/apis/EchoApiTest.kt @@ -0,0 +1,46 @@ +/** + * + * Please note: + * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * Do not edit this file manually. + * + */ + +@file:Suppress( + "ArrayInDataClass", + "DuplicatedCode", + "EnumEntryName", + "RemoveRedundantQualifierName", + "RemoveRedundantCallsOfConversionMethods", + "REDUNDANT_CALL_OF_CONVERSION_METHOD", + "RedundantUnitReturnType", + "RemoveEmptyClassBody", + "UnnecessaryVariable", + "UnusedImport", + "UnnecessaryVariable", + "unused" +) + +package org.openapitools.client.apis + +import io.kotlintest.shouldBe +import io.kotlintest.specs.ShouldSpec + +import org.openapitools.client.apis.EchoApi + +class EchoApiTest : ShouldSpec() { + init { + // uncomment below to create an instance of EchoApi + //val apiInstance = EchoApi() + + // to test testsEchoStringEscapingParamName + should("test testsEchoStringEscapingParamName") { + // uncomment below to test testsEchoStringEscapingParamName + //val dollarParamName : kotlin.String = dollarParamName_example // kotlin.String | + //val filterDollarType : kotlin.String = filterDollarType_example // kotlin.String | Filter with $dollar in description and comment-close *_/ + //val result : kotlin.String = apiInstance.testsEchoStringEscapingParamName(dollarParamName, filterDollarType) + //result shouldBe ("TODO") + } + + } +} diff --git a/samples/client/echo_api/kotlin-model-prefix-type-mappings/src/test/kotlin/org/openapitools/client/models/StringEscapingEdgeCasesTest.kt b/samples/client/echo_api/kotlin-model-prefix-type-mappings/src/test/kotlin/org/openapitools/client/models/StringEscapingEdgeCasesTest.kt new file mode 100644 index 000000000000..6cfaf10ce897 --- /dev/null +++ b/samples/client/echo_api/kotlin-model-prefix-type-mappings/src/test/kotlin/org/openapitools/client/models/StringEscapingEdgeCasesTest.kt @@ -0,0 +1,49 @@ +/** + * + * Please note: + * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * Do not edit this file manually. + * + */ + +@file:Suppress( + "ArrayInDataClass", + "DuplicatedCode", + "EnumEntryName", + "RemoveRedundantQualifierName", + "RemoveRedundantCallsOfConversionMethods", + "REDUNDANT_CALL_OF_CONVERSION_METHOD", + "RedundantUnitReturnType", + "RemoveEmptyClassBody", + "UnnecessaryVariable", + "UnusedImport", + "UnnecessaryVariable", + "unused" +) + +package org.openapitools.client.models + +import io.kotlintest.shouldBe +import io.kotlintest.specs.ShouldSpec + +import org.openapitools.client.models.ApiStringEscapingEdgeCases + +class ApiStringEscapingEdgeCasesTest : ShouldSpec() { + init { + // uncomment below to create an instance of ApiStringEscapingEdgeCases + //val modelInstance = ApiStringEscapingEdgeCases() + + // to test the property `dollarDefault` - A string whose default has $dollar, backslash \\, quote \" and comment-close *_/ + should("test dollarDefault") { + // uncomment below to test the property + //modelInstance.dollarDefault shouldBe ("TODO") + } + + // to test the property `regularProp` - Regular property for baseline comparison + should("test regularProp") { + // uncomment below to test the property + //modelInstance.regularProp shouldBe ("TODO") + } + + } +} diff --git a/samples/client/others/kotlin-jvm-okhttp-non-ascii-headers/docs/StoreApi.md b/samples/client/others/kotlin-jvm-okhttp-non-ascii-headers/docs/StoreApi.md index bfbf6c75d797..c8cd9c416773 100644 --- a/samples/client/others/kotlin-jvm-okhttp-non-ascii-headers/docs/StoreApi.md +++ b/samples/client/others/kotlin-jvm-okhttp-non-ascii-headers/docs/StoreApi.md @@ -107,7 +107,7 @@ Configure api_key: Find purchase order by ID -For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions +For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions ### Example ```kotlin diff --git a/samples/client/others/kotlin-jvm-okhttp-parameter-tests/docs/DefaultApi.md b/samples/client/others/kotlin-jvm-okhttp-parameter-tests/docs/DefaultApi.md index d492f8228f40..12f8d8dc7f6b 100644 --- a/samples/client/others/kotlin-jvm-okhttp-parameter-tests/docs/DefaultApi.md +++ b/samples/client/others/kotlin-jvm-okhttp-parameter-tests/docs/DefaultApi.md @@ -51,13 +51,13 @@ try { ### Parameters | **pathDefault** | **kotlin.String**| path default | | | **pathNullable** | **kotlin.String**| path_nullable | | -| **queryDefault** | **kotlin.String**| query default | [optional] [default to "available"] | +| **queryDefault** | **kotlin.String**| query default | [optional] [default to "available"] | | **queryDefaultEnum** | **kotlin.String**| query default enum | [optional] [default to QueryDefaultEnum.B] [enum: A, B, C] | | **queryDefaultInt** | **java.math.BigDecimal**| query default int | [optional] [default to 3] | -| **headerDefault** | **kotlin.String**| header default | [optional] [default to "available"] | +| **headerDefault** | **kotlin.String**| header default | [optional] [default to "available"] | | **headerDefaultEnum** | **kotlin.String**| header default enum | [optional] [default to HeaderDefaultEnum.B] [enum: A, B, C] | | **headerDefaultInt** | **java.math.BigDecimal**| header default int | [optional] [default to 3] | -| **cookieDefault** | **kotlin.String**| cookie default | [optional] [default to "available"] | +| **cookieDefault** | **kotlin.String**| cookie default | [optional] [default to "available"] | | **cookieDefaultEnum** | **kotlin.String**| cookie default enum | [optional] [default to CookieDefaultEnum.B] [enum: A, B, C] | | **cookieDefaultInt** | **java.math.BigDecimal**| cookie default int | [optional] [default to 3] | | **queryNullable** | **kotlin.String**| query nullable | [optional] | diff --git a/samples/client/petstore/kotlin-default-values-jvm-okhttp4/docs/Apa.md b/samples/client/petstore/kotlin-default-values-jvm-okhttp4/docs/Apa.md index c83f71851c20..2b414b6ca1f4 100644 --- a/samples/client/petstore/kotlin-default-values-jvm-okhttp4/docs/Apa.md +++ b/samples/client/petstore/kotlin-default-values-jvm-okhttp4/docs/Apa.md @@ -8,6 +8,7 @@ | **n0** | [**java.math.BigDecimal**](java.math.BigDecimal.md) | | | | **i1** | **kotlin.Int** | | [optional] | | **n1** | [**java.math.BigDecimal**](java.math.BigDecimal.md) | | [optional] | +| **s0** | **kotlin.String** | String property with \$dollar, backslash, quote, comment-close in default | [optional] | diff --git a/samples/client/petstore/kotlin-default-values-jvm-okhttp4/docs/DefaultApi.md b/samples/client/petstore/kotlin-default-values-jvm-okhttp4/docs/DefaultApi.md index dd1534cf92fc..a9ad176c2c38 100644 --- a/samples/client/petstore/kotlin-default-values-jvm-okhttp4/docs/DefaultApi.md +++ b/samples/client/petstore/kotlin-default-values-jvm-okhttp4/docs/DefaultApi.md @@ -9,7 +9,7 @@ All URIs are relative to *http://localhost* # **test** -> test(pi0, pi1, pn0, pn1, qi0, qi1, qi2, qi3, qn0, qn1, qn2, qn3, hi0, hi1, hi2, hi3, hn0, hn1, hn2, hn3, fi0, fi1, fi2, fi3, fn0, fn1, fn2, fn3, fn4) +> test(pi0, pi1, pn0, pn1, qi0, qi1, qi2, qi3, qn0, qn1, qn2, qn3, hi0, hi1, hi2, hi3, hn0, hn1, hn2, hn3, qs0, fi0, fi1, fi2, fi3, fn0, fn1, fn2, fn3, fn4) Tests default values @@ -42,6 +42,7 @@ val hn0 : java.math.BigDecimal = 8.14 // java.math.BigDecimal | val hn1 : java.math.BigDecimal = 8.14 // java.math.BigDecimal | val hn2 : java.math.BigDecimal = 8.14 // java.math.BigDecimal | val hn3 : java.math.BigDecimal = 8.14 // java.math.BigDecimal | +val qs0 : kotlin.String = qs0_example // kotlin.String | String with $dollar, backslash, quote, comment-close in default val fi0 : kotlin.Int = 56 // kotlin.Int | val fi1 : kotlin.Int = 56 // kotlin.Int | val fi2 : kotlin.Int = 56 // kotlin.Int | @@ -52,7 +53,7 @@ val fn2 : java.math.BigDecimal = 8.14 // java.math.BigDecimal | val fn3 : java.math.BigDecimal = 8.14 // java.math.BigDecimal | val fn4 : kotlin.collections.List = // kotlin.collections.List | try { - apiInstance.test(pi0, pi1, pn0, pn1, qi0, qi1, qi2, qi3, qn0, qn1, qn2, qn3, hi0, hi1, hi2, hi3, hn0, hn1, hn2, hn3, fi0, fi1, fi2, fi3, fn0, fn1, fn2, fn3, fn4) + apiInstance.test(pi0, pi1, pn0, pn1, qi0, qi1, qi2, qi3, qn0, qn1, qn2, qn3, hi0, hi1, hi2, hi3, hn0, hn1, hn2, hn3, qs0, fi0, fi1, fi2, fi3, fn0, fn1, fn2, fn3, fn4) } catch (e: ClientException) { println("4xx response calling DefaultApi#test") e.printStackTrace() @@ -83,6 +84,7 @@ try { | **hn1** | **java.math.BigDecimal**| | [default to 71.0] | | **hn2** | **java.math.BigDecimal**| | [optional] | | **hn3** | **java.math.BigDecimal**| | | +| **qs0** | **kotlin.String**| String with \$dollar, backslash, quote, comment-close in default | [optional] [default to "hello \$world, backslash=\\\\, quote=\\", end *_/"] | | **fi0** | **kotlin.Int**| | [optional] [default to 10] | | **fi1** | **kotlin.Int**| | [default to 71] | | **fi2** | **kotlin.Int**| | [optional] | diff --git a/samples/client/petstore/kotlin-default-values-jvm-okhttp4/src/main/kotlin/org/openapitools/client/apis/DefaultApi.kt b/samples/client/petstore/kotlin-default-values-jvm-okhttp4/src/main/kotlin/org/openapitools/client/apis/DefaultApi.kt index 7a217ce1246b..eaa2027bd058 100644 --- a/samples/client/petstore/kotlin-default-values-jvm-okhttp4/src/main/kotlin/org/openapitools/client/apis/DefaultApi.kt +++ b/samples/client/petstore/kotlin-default-values-jvm-okhttp4/src/main/kotlin/org/openapitools/client/apis/DefaultApi.kt @@ -76,6 +76,7 @@ open class DefaultApi(basePath: kotlin.String = defaultBasePath, client: Call.Fa * @param hn1 (default to 71.0) * @param hn2 (optional) * @param hn3 + * @param qs0 String with $dollar, backslash, quote, comment-close in default (optional, default to "hello $world, backslash=\\, quote=\", end *_/") * @param fi0 (optional, default to 10) * @param fi1 (default to 71) * @param fi2 (optional) @@ -93,8 +94,8 @@ open class DefaultApi(basePath: kotlin.String = defaultBasePath, client: Call.Fa * @throws ServerException If the API returns a server error response */ @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun test(pi0: kotlin.Int = 10, pi1: kotlin.Int, pn0: java.math.BigDecimal = java.math.BigDecimal("10.0"), pn1: java.math.BigDecimal, qi0: kotlin.Int? = 10, qi1: kotlin.Int = 71, qi2: kotlin.Int? = null, qi3: kotlin.Int, qn0: java.math.BigDecimal? = java.math.BigDecimal("10.0"), qn1: java.math.BigDecimal = java.math.BigDecimal("71.0"), qn2: java.math.BigDecimal? = null, qn3: java.math.BigDecimal, hi0: kotlin.Int? = 10, hi1: kotlin.Int = 71, hi2: kotlin.Int? = null, hi3: kotlin.Int, hn0: java.math.BigDecimal? = java.math.BigDecimal("10.0"), hn1: java.math.BigDecimal = java.math.BigDecimal("71.0"), hn2: java.math.BigDecimal? = null, hn3: java.math.BigDecimal, fi0: kotlin.Int? = 10, fi1: kotlin.Int = 71, fi2: kotlin.Int? = null, fi3: kotlin.Int, fn0: java.math.BigDecimal? = java.math.BigDecimal("10.0"), fn1: java.math.BigDecimal = java.math.BigDecimal("71.0"), fn2: java.math.BigDecimal? = null, fn3: java.math.BigDecimal, fn4: kotlin.collections.List) : Unit { - val localVarResponse = testWithHttpInfo(pi0 = pi0, pi1 = pi1, pn0 = pn0, pn1 = pn1, qi0 = qi0, qi1 = qi1, qi2 = qi2, qi3 = qi3, qn0 = qn0, qn1 = qn1, qn2 = qn2, qn3 = qn3, hi0 = hi0, hi1 = hi1, hi2 = hi2, hi3 = hi3, hn0 = hn0, hn1 = hn1, hn2 = hn2, hn3 = hn3, fi0 = fi0, fi1 = fi1, fi2 = fi2, fi3 = fi3, fn0 = fn0, fn1 = fn1, fn2 = fn2, fn3 = fn3, fn4 = fn4) + fun test(pi0: kotlin.Int = 10, pi1: kotlin.Int, pn0: java.math.BigDecimal = java.math.BigDecimal("10.0"), pn1: java.math.BigDecimal, qi0: kotlin.Int? = 10, qi1: kotlin.Int = 71, qi2: kotlin.Int? = null, qi3: kotlin.Int, qn0: java.math.BigDecimal? = java.math.BigDecimal("10.0"), qn1: java.math.BigDecimal = java.math.BigDecimal("71.0"), qn2: java.math.BigDecimal? = null, qn3: java.math.BigDecimal, hi0: kotlin.Int? = 10, hi1: kotlin.Int = 71, hi2: kotlin.Int? = null, hi3: kotlin.Int, hn0: java.math.BigDecimal? = java.math.BigDecimal("10.0"), hn1: java.math.BigDecimal = java.math.BigDecimal("71.0"), hn2: java.math.BigDecimal? = null, hn3: java.math.BigDecimal, qs0: kotlin.String? = "hello \$world, backslash=\\, quote=\", end */", fi0: kotlin.Int? = 10, fi1: kotlin.Int = 71, fi2: kotlin.Int? = null, fi3: kotlin.Int, fn0: java.math.BigDecimal? = java.math.BigDecimal("10.0"), fn1: java.math.BigDecimal = java.math.BigDecimal("71.0"), fn2: java.math.BigDecimal? = null, fn3: java.math.BigDecimal, fn4: kotlin.collections.List) : Unit { + val localVarResponse = testWithHttpInfo(pi0 = pi0, pi1 = pi1, pn0 = pn0, pn1 = pn1, qi0 = qi0, qi1 = qi1, qi2 = qi2, qi3 = qi3, qn0 = qn0, qn1 = qn1, qn2 = qn2, qn3 = qn3, hi0 = hi0, hi1 = hi1, hi2 = hi2, hi3 = hi3, hn0 = hn0, hn1 = hn1, hn2 = hn2, hn3 = hn3, qs0 = qs0, fi0 = fi0, fi1 = fi1, fi2 = fi2, fi3 = fi3, fn0 = fn0, fn1 = fn1, fn2 = fn2, fn3 = fn3, fn4 = fn4) return when (localVarResponse.responseType) { ResponseType.Success -> Unit @@ -135,6 +136,7 @@ open class DefaultApi(basePath: kotlin.String = defaultBasePath, client: Call.Fa * @param hn1 (default to 71.0) * @param hn2 (optional) * @param hn3 + * @param qs0 String with $dollar, backslash, quote, comment-close in default (optional, default to "hello $world, backslash=\\, quote=\", end *_/") * @param fi0 (optional, default to 10) * @param fi1 (default to 71) * @param fi2 (optional) @@ -149,8 +151,8 @@ open class DefaultApi(basePath: kotlin.String = defaultBasePath, client: Call.Fa * @throws IOException Rethrows the OkHttp execute method exception */ @Throws(IllegalStateException::class, IOException::class) - fun testWithHttpInfo(pi0: kotlin.Int, pi1: kotlin.Int, pn0: java.math.BigDecimal, pn1: java.math.BigDecimal, qi0: kotlin.Int?, qi1: kotlin.Int, qi2: kotlin.Int?, qi3: kotlin.Int, qn0: java.math.BigDecimal?, qn1: java.math.BigDecimal, qn2: java.math.BigDecimal?, qn3: java.math.BigDecimal, hi0: kotlin.Int?, hi1: kotlin.Int, hi2: kotlin.Int?, hi3: kotlin.Int, hn0: java.math.BigDecimal?, hn1: java.math.BigDecimal, hn2: java.math.BigDecimal?, hn3: java.math.BigDecimal, fi0: kotlin.Int?, fi1: kotlin.Int, fi2: kotlin.Int?, fi3: kotlin.Int, fn0: java.math.BigDecimal?, fn1: java.math.BigDecimal, fn2: java.math.BigDecimal?, fn3: java.math.BigDecimal, fn4: kotlin.collections.List) : ApiResponse { - val localVariableConfig = testRequestConfig(pi0 = pi0, pi1 = pi1, pn0 = pn0, pn1 = pn1, qi0 = qi0, qi1 = qi1, qi2 = qi2, qi3 = qi3, qn0 = qn0, qn1 = qn1, qn2 = qn2, qn3 = qn3, hi0 = hi0, hi1 = hi1, hi2 = hi2, hi3 = hi3, hn0 = hn0, hn1 = hn1, hn2 = hn2, hn3 = hn3, fi0 = fi0, fi1 = fi1, fi2 = fi2, fi3 = fi3, fn0 = fn0, fn1 = fn1, fn2 = fn2, fn3 = fn3, fn4 = fn4) + fun testWithHttpInfo(pi0: kotlin.Int, pi1: kotlin.Int, pn0: java.math.BigDecimal, pn1: java.math.BigDecimal, qi0: kotlin.Int?, qi1: kotlin.Int, qi2: kotlin.Int?, qi3: kotlin.Int, qn0: java.math.BigDecimal?, qn1: java.math.BigDecimal, qn2: java.math.BigDecimal?, qn3: java.math.BigDecimal, hi0: kotlin.Int?, hi1: kotlin.Int, hi2: kotlin.Int?, hi3: kotlin.Int, hn0: java.math.BigDecimal?, hn1: java.math.BigDecimal, hn2: java.math.BigDecimal?, hn3: java.math.BigDecimal, qs0: kotlin.String?, fi0: kotlin.Int?, fi1: kotlin.Int, fi2: kotlin.Int?, fi3: kotlin.Int, fn0: java.math.BigDecimal?, fn1: java.math.BigDecimal, fn2: java.math.BigDecimal?, fn3: java.math.BigDecimal, fn4: kotlin.collections.List) : ApiResponse { + val localVariableConfig = testRequestConfig(pi0 = pi0, pi1 = pi1, pn0 = pn0, pn1 = pn1, qi0 = qi0, qi1 = qi1, qi2 = qi2, qi3 = qi3, qn0 = qn0, qn1 = qn1, qn2 = qn2, qn3 = qn3, hi0 = hi0, hi1 = hi1, hi2 = hi2, hi3 = hi3, hn0 = hn0, hn1 = hn1, hn2 = hn2, hn3 = hn3, qs0 = qs0, fi0 = fi0, fi1 = fi1, fi2 = fi2, fi3 = fi3, fn0 = fn0, fn1 = fn1, fn2 = fn2, fn3 = fn3, fn4 = fn4) return request>, Unit>( localVariableConfig @@ -180,6 +182,7 @@ open class DefaultApi(basePath: kotlin.String = defaultBasePath, client: Call.Fa * @param hn1 (default to 71.0) * @param hn2 (optional) * @param hn3 + * @param qs0 String with $dollar, backslash, quote, comment-close in default (optional, default to "hello $world, backslash=\\, quote=\", end *_/") * @param fi0 (optional, default to 10) * @param fi1 (default to 71) * @param fi2 (optional) @@ -191,7 +194,7 @@ open class DefaultApi(basePath: kotlin.String = defaultBasePath, client: Call.Fa * @param fn4 * @return RequestConfig */ - fun testRequestConfig(pi0: kotlin.Int, pi1: kotlin.Int, pn0: java.math.BigDecimal, pn1: java.math.BigDecimal, qi0: kotlin.Int?, qi1: kotlin.Int, qi2: kotlin.Int?, qi3: kotlin.Int, qn0: java.math.BigDecimal?, qn1: java.math.BigDecimal, qn2: java.math.BigDecimal?, qn3: java.math.BigDecimal, hi0: kotlin.Int?, hi1: kotlin.Int, hi2: kotlin.Int?, hi3: kotlin.Int, hn0: java.math.BigDecimal?, hn1: java.math.BigDecimal, hn2: java.math.BigDecimal?, hn3: java.math.BigDecimal, fi0: kotlin.Int?, fi1: kotlin.Int, fi2: kotlin.Int?, fi3: kotlin.Int, fn0: java.math.BigDecimal?, fn1: java.math.BigDecimal, fn2: java.math.BigDecimal?, fn3: java.math.BigDecimal, fn4: kotlin.collections.List) : RequestConfig>> { + fun testRequestConfig(pi0: kotlin.Int, pi1: kotlin.Int, pn0: java.math.BigDecimal, pn1: java.math.BigDecimal, qi0: kotlin.Int?, qi1: kotlin.Int, qi2: kotlin.Int?, qi3: kotlin.Int, qn0: java.math.BigDecimal?, qn1: java.math.BigDecimal, qn2: java.math.BigDecimal?, qn3: java.math.BigDecimal, hi0: kotlin.Int?, hi1: kotlin.Int, hi2: kotlin.Int?, hi3: kotlin.Int, hn0: java.math.BigDecimal?, hn1: java.math.BigDecimal, hn2: java.math.BigDecimal?, hn3: java.math.BigDecimal, qs0: kotlin.String?, fi0: kotlin.Int?, fi1: kotlin.Int, fi2: kotlin.Int?, fi3: kotlin.Int, fn0: java.math.BigDecimal?, fn1: java.math.BigDecimal, fn2: java.math.BigDecimal?, fn3: java.math.BigDecimal, fn4: kotlin.collections.List) : RequestConfig>> { val localVariableBody = mapOf( "fi0" to PartConfig(body = fi0, headers = mutableMapOf()), "fi1" to PartConfig(body = fi1, headers = mutableMapOf()), @@ -220,6 +223,9 @@ open class DefaultApi(basePath: kotlin.String = defaultBasePath, client: Call.Fa put("qn2", listOf(qn2.toString())) } put("qn3", listOf(qn3.toString())) + if (qs0 != null) { + put("qs0", listOf(qs0.toString())) + } } val localVariableHeaders: MutableMap = mutableMapOf("Content-Type" to "multipart/form-data") hi0?.apply { localVariableHeaders["hi0"] = this.toString() } diff --git a/samples/client/petstore/kotlin-default-values-jvm-okhttp4/src/main/kotlin/org/openapitools/client/models/Apa.kt b/samples/client/petstore/kotlin-default-values-jvm-okhttp4/src/main/kotlin/org/openapitools/client/models/Apa.kt index fdf64fda9a24..99483aa9ba69 100644 --- a/samples/client/petstore/kotlin-default-values-jvm-okhttp4/src/main/kotlin/org/openapitools/client/models/Apa.kt +++ b/samples/client/petstore/kotlin-default-values-jvm-okhttp4/src/main/kotlin/org/openapitools/client/models/Apa.kt @@ -34,6 +34,7 @@ import com.squareup.moshi.JsonClass * @param n0 * @param i1 * @param n1 + * @param s0 String property with $dollar, backslash, quote, comment-close in default */ @@ -49,7 +50,11 @@ data class Apa ( val i1: kotlin.Int? = null, @Json(name = "n1") - val n1: java.math.BigDecimal? = null + val n1: java.math.BigDecimal? = null, + + /* String property with $dollar, backslash, quote, comment-close in default */ + @Json(name = "s0") + val s0: kotlin.String? = "hello \$world, backslash=\\, quote=\", end */" ) { diff --git a/samples/client/petstore/kotlin-default-values-jvm-retrofit2/docs/Apa.md b/samples/client/petstore/kotlin-default-values-jvm-retrofit2/docs/Apa.md index c83f71851c20..2b414b6ca1f4 100644 --- a/samples/client/petstore/kotlin-default-values-jvm-retrofit2/docs/Apa.md +++ b/samples/client/petstore/kotlin-default-values-jvm-retrofit2/docs/Apa.md @@ -8,6 +8,7 @@ | **n0** | [**java.math.BigDecimal**](java.math.BigDecimal.md) | | | | **i1** | **kotlin.Int** | | [optional] | | **n1** | [**java.math.BigDecimal**](java.math.BigDecimal.md) | | [optional] | +| **s0** | **kotlin.String** | String property with \$dollar, backslash, quote, comment-close in default | [optional] | diff --git a/samples/client/petstore/kotlin-default-values-jvm-retrofit2/docs/DefaultApi.md b/samples/client/petstore/kotlin-default-values-jvm-retrofit2/docs/DefaultApi.md index 0545066c005b..0493b38d4809 100644 --- a/samples/client/petstore/kotlin-default-values-jvm-retrofit2/docs/DefaultApi.md +++ b/samples/client/petstore/kotlin-default-values-jvm-retrofit2/docs/DefaultApi.md @@ -41,6 +41,7 @@ val hn0 : java.math.BigDecimal = 8.14 // java.math.BigDecimal | val hn1 : java.math.BigDecimal = 8.14 // java.math.BigDecimal | val hn2 : java.math.BigDecimal = 8.14 // java.math.BigDecimal | val hn3 : java.math.BigDecimal = 8.14 // java.math.BigDecimal | +val qs0 : kotlin.String = qs0_example // kotlin.String | String with $dollar, backslash, quote, comment-close in default val fi0 : kotlin.Int = 56 // kotlin.Int | val fi1 : kotlin.Int = 56 // kotlin.Int | val fi2 : kotlin.Int = 56 // kotlin.Int | @@ -51,7 +52,7 @@ val fn2 : java.math.BigDecimal = 8.14 // java.math.BigDecimal | val fn3 : java.math.BigDecimal = 8.14 // java.math.BigDecimal | val fn4 : kotlin.collections.List = // kotlin.collections.List | -webService.test(pi0, pi1, pn0, pn1, qi0, qi1, qi2, qi3, qn0, qn1, qn2, qn3, hi0, hi1, hi2, hi3, hn0, hn1, hn2, hn3, fi0, fi1, fi2, fi3, fn0, fn1, fn2, fn3, fn4) +webService.test(pi0, pi1, pn0, pn1, qi0, qi1, qi2, qi3, qn0, qn1, qn2, qn3, hi0, hi1, hi2, hi3, hn0, hn1, hn2, hn3, qs0, fi0, fi1, fi2, fi3, fn0, fn1, fn2, fn3, fn4) ``` ### Parameters @@ -75,6 +76,7 @@ webService.test(pi0, pi1, pn0, pn1, qi0, qi1, qi2, qi3, qn0, qn1, qn2, qn3, hi0, | **hn1** | **java.math.BigDecimal**| | [default to 71.0] | | **hn2** | **java.math.BigDecimal**| | [optional] | | **hn3** | **java.math.BigDecimal**| | | +| **qs0** | **kotlin.String**| String with \$dollar, backslash, quote, comment-close in default | [optional] [default to "hello \$world, backslash=\\\\, quote=\\", end *_/"] | | **fi0** | **kotlin.Int**| | [optional] [default to 10] | | **fi1** | **kotlin.Int**| | [default to 71] | | **fi2** | **kotlin.Int**| | [optional] | diff --git a/samples/client/petstore/kotlin-default-values-jvm-retrofit2/src/main/kotlin/org/openapitools/client/apis/DefaultApi.kt b/samples/client/petstore/kotlin-default-values-jvm-retrofit2/src/main/kotlin/org/openapitools/client/apis/DefaultApi.kt index cb37c7fc44ce..960b7f7a1458 100644 --- a/samples/client/petstore/kotlin-default-values-jvm-retrofit2/src/main/kotlin/org/openapitools/client/apis/DefaultApi.kt +++ b/samples/client/petstore/kotlin-default-values-jvm-retrofit2/src/main/kotlin/org/openapitools/client/apis/DefaultApi.kt @@ -35,6 +35,7 @@ interface DefaultApi { * @param hn1 (default to 71.0) * @param hn2 (optional) * @param hn3 + * @param qs0 String with $dollar, backslash, quote, comment-close in default (optional, default to "hello \$world, backslash=\\\\, quote=\\", end *_/") * @param fi0 (optional, default to 10) * @param fi1 (default to 71) * @param fi2 (optional) @@ -48,6 +49,6 @@ interface DefaultApi { */ @Multipart @POST("test") - fun test(@Path("pi0") pi0: kotlin.Int = 10, @Path("pi1") pi1: kotlin.Int, @Path("pn0") pn0: java.math.BigDecimal = java.math.BigDecimal("10.0"), @Path("pn1") pn1: java.math.BigDecimal, @Query("qi0") qi0: kotlin.Int? = 10, @Query("qi1") qi1: kotlin.Int = 71, @Query("qi2") qi2: kotlin.Int? = null, @Query("qi3") qi3: kotlin.Int, @Query("qn0") qn0: java.math.BigDecimal? = java.math.BigDecimal("10.0"), @Query("qn1") qn1: java.math.BigDecimal = java.math.BigDecimal("71.0"), @Query("qn2") qn2: java.math.BigDecimal? = null, @Query("qn3") qn3: java.math.BigDecimal, @Header("hi0") hi0: kotlin.Int? = 10, @Header("hi1") hi1: kotlin.Int = 71, @Header("hi2") hi2: kotlin.Int? = null, @Header("hi3") hi3: kotlin.Int, @Header("hn0") hn0: java.math.BigDecimal? = java.math.BigDecimal("10.0"), @Header("hn1") hn1: java.math.BigDecimal = java.math.BigDecimal("71.0"), @Header("hn2") hn2: java.math.BigDecimal? = null, @Header("hn3") hn3: java.math.BigDecimal, @Part("fi0") fi0: kotlin.Int? = 10, @Part("fi1") fi1: kotlin.Int = 71, @Part("fi2") fi2: kotlin.Int? = null, @Part("fi3") fi3: kotlin.Int, @Part("fn0") fn0: java.math.BigDecimal? = java.math.BigDecimal("10.0"), @Part("fn1") fn1: java.math.BigDecimal = java.math.BigDecimal("71.0"), @Part("fn2") fn2: java.math.BigDecimal? = null, @Part("fn3") fn3: java.math.BigDecimal, @Part("fn4") fn4: kotlin.collections.List): Call + fun test(@Path("pi0") pi0: kotlin.Int = 10, @Path("pi1") pi1: kotlin.Int, @Path("pn0") pn0: java.math.BigDecimal = java.math.BigDecimal("10.0"), @Path("pn1") pn1: java.math.BigDecimal, @Query("qi0") qi0: kotlin.Int? = 10, @Query("qi1") qi1: kotlin.Int = 71, @Query("qi2") qi2: kotlin.Int? = null, @Query("qi3") qi3: kotlin.Int, @Query("qn0") qn0: java.math.BigDecimal? = java.math.BigDecimal("10.0"), @Query("qn1") qn1: java.math.BigDecimal = java.math.BigDecimal("71.0"), @Query("qn2") qn2: java.math.BigDecimal? = null, @Query("qn3") qn3: java.math.BigDecimal, @Header("hi0") hi0: kotlin.Int? = 10, @Header("hi1") hi1: kotlin.Int = 71, @Header("hi2") hi2: kotlin.Int? = null, @Header("hi3") hi3: kotlin.Int, @Header("hn0") hn0: java.math.BigDecimal? = java.math.BigDecimal("10.0"), @Header("hn1") hn1: java.math.BigDecimal = java.math.BigDecimal("71.0"), @Header("hn2") hn2: java.math.BigDecimal? = null, @Header("hn3") hn3: java.math.BigDecimal, @Query("qs0") qs0: kotlin.String? = "hello \$world, backslash=\\, quote=\", end */", @Part("fi0") fi0: kotlin.Int? = 10, @Part("fi1") fi1: kotlin.Int = 71, @Part("fi2") fi2: kotlin.Int? = null, @Part("fi3") fi3: kotlin.Int, @Part("fn0") fn0: java.math.BigDecimal? = java.math.BigDecimal("10.0"), @Part("fn1") fn1: java.math.BigDecimal = java.math.BigDecimal("71.0"), @Part("fn2") fn2: java.math.BigDecimal? = null, @Part("fn3") fn3: java.math.BigDecimal, @Part("fn4") fn4: kotlin.collections.List): Call } diff --git a/samples/client/petstore/kotlin-default-values-jvm-retrofit2/src/main/kotlin/org/openapitools/client/models/Apa.kt b/samples/client/petstore/kotlin-default-values-jvm-retrofit2/src/main/kotlin/org/openapitools/client/models/Apa.kt index fdf64fda9a24..99483aa9ba69 100644 --- a/samples/client/petstore/kotlin-default-values-jvm-retrofit2/src/main/kotlin/org/openapitools/client/models/Apa.kt +++ b/samples/client/petstore/kotlin-default-values-jvm-retrofit2/src/main/kotlin/org/openapitools/client/models/Apa.kt @@ -34,6 +34,7 @@ import com.squareup.moshi.JsonClass * @param n0 * @param i1 * @param n1 + * @param s0 String property with $dollar, backslash, quote, comment-close in default */ @@ -49,7 +50,11 @@ data class Apa ( val i1: kotlin.Int? = null, @Json(name = "n1") - val n1: java.math.BigDecimal? = null + val n1: java.math.BigDecimal? = null, + + /* String property with $dollar, backslash, quote, comment-close in default */ + @Json(name = "s0") + val s0: kotlin.String? = "hello \$world, backslash=\\, quote=\", end */" ) { diff --git a/samples/client/petstore/kotlin-default-values-multiplatform/docs/Apa.md b/samples/client/petstore/kotlin-default-values-multiplatform/docs/Apa.md index 078a27310550..7c271b8aa036 100644 --- a/samples/client/petstore/kotlin-default-values-multiplatform/docs/Apa.md +++ b/samples/client/petstore/kotlin-default-values-multiplatform/docs/Apa.md @@ -8,6 +8,7 @@ | **n0** | **kotlin.Double** | | | | **i1** | **kotlin.Int** | | [optional] | | **n1** | **kotlin.Double** | | [optional] | +| **s0** | **kotlin.String** | String property with \$dollar, backslash, quote, comment-close in default | [optional] | diff --git a/samples/client/petstore/kotlin-default-values-multiplatform/docs/DefaultApi.md b/samples/client/petstore/kotlin-default-values-multiplatform/docs/DefaultApi.md index 65928b193472..c2fb4914e534 100644 --- a/samples/client/petstore/kotlin-default-values-multiplatform/docs/DefaultApi.md +++ b/samples/client/petstore/kotlin-default-values-multiplatform/docs/DefaultApi.md @@ -9,7 +9,7 @@ All URIs are relative to *http://localhost* # **test** -> test(pi0, pi1, pn0, pn1, qi0, qi1, qi2, qi3, qn0, qn1, qn2, qn3, hi0, hi1, hi2, hi3, hn0, hn1, hn2, hn3, fi0, fi1, fi2, fi3, fn0, fn1, fn2, fn3, fn4) +> test(pi0, pi1, pn0, pn1, qi0, qi1, qi2, qi3, qn0, qn1, qn2, qn3, hi0, hi1, hi2, hi3, hn0, hn1, hn2, hn3, qs0, fi0, fi1, fi2, fi3, fn0, fn1, fn2, fn3, fn4) Tests default values @@ -42,6 +42,7 @@ val hn0 : kotlin.Double = 8.14 // kotlin.Double | val hn1 : kotlin.Double = 8.14 // kotlin.Double | val hn2 : kotlin.Double = 8.14 // kotlin.Double | val hn3 : kotlin.Double = 8.14 // kotlin.Double | +val qs0 : kotlin.String = qs0_example // kotlin.String | String with $dollar, backslash, quote, comment-close in default val fi0 : kotlin.Int = 56 // kotlin.Int | val fi1 : kotlin.Int = 56 // kotlin.Int | val fi2 : kotlin.Int = 56 // kotlin.Int | @@ -52,7 +53,7 @@ val fn2 : kotlin.Double = 8.14 // kotlin.Double | val fn3 : kotlin.Double = 8.14 // kotlin.Double | val fn4 : kotlin.collections.List = // kotlin.collections.List | try { - apiInstance.test(pi0, pi1, pn0, pn1, qi0, qi1, qi2, qi3, qn0, qn1, qn2, qn3, hi0, hi1, hi2, hi3, hn0, hn1, hn2, hn3, fi0, fi1, fi2, fi3, fn0, fn1, fn2, fn3, fn4) + apiInstance.test(pi0, pi1, pn0, pn1, qi0, qi1, qi2, qi3, qn0, qn1, qn2, qn3, hi0, hi1, hi2, hi3, hn0, hn1, hn2, hn3, qs0, fi0, fi1, fi2, fi3, fn0, fn1, fn2, fn3, fn4) } catch (e: ClientException) { println("4xx response calling DefaultApi#test") e.printStackTrace() @@ -83,6 +84,7 @@ try { | **hn1** | **kotlin.Double**| | [default to 71.0] | | **hn2** | **kotlin.Double**| | [optional] | | **hn3** | **kotlin.Double**| | | +| **qs0** | **kotlin.String**| String with \$dollar, backslash, quote, comment-close in default | [optional] [default to "hello \$world, backslash=\\\\, quote=\\", end *_/"] | | **fi0** | **kotlin.Int**| | [optional] [default to 10] | | **fi1** | **kotlin.Int**| | [default to 71] | | **fi2** | **kotlin.Int**| | [optional] | diff --git a/samples/client/petstore/kotlin-default-values-multiplatform/src/commonMain/kotlin/org/openapitools/client/apis/DefaultApi.kt b/samples/client/petstore/kotlin-default-values-multiplatform/src/commonMain/kotlin/org/openapitools/client/apis/DefaultApi.kt index d921fa3929d6..f3c7f4f7a1b1 100644 --- a/samples/client/petstore/kotlin-default-values-multiplatform/src/commonMain/kotlin/org/openapitools/client/apis/DefaultApi.kt +++ b/samples/client/petstore/kotlin-default-values-multiplatform/src/commonMain/kotlin/org/openapitools/client/apis/DefaultApi.kt @@ -76,6 +76,7 @@ open class DefaultApi : ApiClient { * @param hn1 (default to 71.0) * @param hn2 (optional) * @param hn3 + * @param qs0 String with $dollar, backslash, quote, comment-close in default (optional, default to "hello $world, backslash=\\, quote=\", end *_/") * @param fi0 (optional, default to 10) * @param fi1 (default to 71) * @param fi2 (optional) @@ -87,7 +88,7 @@ open class DefaultApi : ApiClient { * @param fn4 * @return void */ - open suspend fun test(pi0: kotlin.Int = 10, pi1: kotlin.Int, pn0: kotlin.Double = 10.0.toDouble(), pn1: kotlin.Double, qi0: kotlin.Int? = 10, qi1: kotlin.Int = 71, qi2: kotlin.Int? = null, qi3: kotlin.Int, qn0: kotlin.Double? = 10.0.toDouble(), qn1: kotlin.Double = 71.0.toDouble(), qn2: kotlin.Double? = null, qn3: kotlin.Double, hi0: kotlin.Int? = 10, hi1: kotlin.Int = 71, hi2: kotlin.Int? = null, hi3: kotlin.Int, hn0: kotlin.Double? = 10.0.toDouble(), hn1: kotlin.Double = 71.0.toDouble(), hn2: kotlin.Double? = null, hn3: kotlin.Double, fi0: kotlin.Int? = 10, fi1: kotlin.Int = 71, fi2: kotlin.Int? = null, fi3: kotlin.Int, fn0: kotlin.Double? = 10.0.toDouble(), fn1: kotlin.Double = 71.0.toDouble(), fn2: kotlin.Double? = null, fn3: kotlin.Double, fn4: kotlin.collections.List): HttpResponse { + open suspend fun test(pi0: kotlin.Int = 10, pi1: kotlin.Int, pn0: kotlin.Double = 10.0.toDouble(), pn1: kotlin.Double, qi0: kotlin.Int? = 10, qi1: kotlin.Int = 71, qi2: kotlin.Int? = null, qi3: kotlin.Int, qn0: kotlin.Double? = 10.0.toDouble(), qn1: kotlin.Double = 71.0.toDouble(), qn2: kotlin.Double? = null, qn3: kotlin.Double, hi0: kotlin.Int? = 10, hi1: kotlin.Int = 71, hi2: kotlin.Int? = null, hi3: kotlin.Int, hn0: kotlin.Double? = 10.0.toDouble(), hn1: kotlin.Double = 71.0.toDouble(), hn2: kotlin.Double? = null, hn3: kotlin.Double, qs0: kotlin.String? = "hello \$world, backslash=\\, quote=\", end */", fi0: kotlin.Int? = 10, fi1: kotlin.Int = 71, fi2: kotlin.Int? = null, fi3: kotlin.Int, fn0: kotlin.Double? = 10.0.toDouble(), fn1: kotlin.Double = 71.0.toDouble(), fn2: kotlin.Double? = null, fn3: kotlin.Double, fn4: kotlin.collections.List): HttpResponse { val localVariableAuthNames = listOf() @@ -115,6 +116,7 @@ open class DefaultApi : ApiClient { qn1?.apply { localVariableQuery["qn1"] = listOf("$qn1") } qn2?.apply { localVariableQuery["qn2"] = listOf("$qn2") } qn3?.apply { localVariableQuery["qn3"] = listOf("$qn3") } + qs0?.apply { localVariableQuery["qs0"] = listOf("$qs0") } val localVariableHeaders = mutableMapOf() hi0?.apply { localVariableHeaders["hi0"] = this.toString() } hi1?.apply { localVariableHeaders["hi1"] = this.toString() } diff --git a/samples/client/petstore/kotlin-default-values-multiplatform/src/commonMain/kotlin/org/openapitools/client/models/Apa.kt b/samples/client/petstore/kotlin-default-values-multiplatform/src/commonMain/kotlin/org/openapitools/client/models/Apa.kt index b637884e85c9..302d967d4267 100644 --- a/samples/client/petstore/kotlin-default-values-multiplatform/src/commonMain/kotlin/org/openapitools/client/models/Apa.kt +++ b/samples/client/petstore/kotlin-default-values-multiplatform/src/commonMain/kotlin/org/openapitools/client/models/Apa.kt @@ -35,6 +35,7 @@ import kotlinx.serialization.encoding.* * @param n0 * @param i1 * @param n1 + * @param s0 String property with $dollar, backslash, quote, comment-close in default */ @Serializable @@ -46,7 +47,10 @@ data class Apa ( @SerialName(value = "i1") val i1: kotlin.Int? = null, - @SerialName(value = "n1") val n1: kotlin.Double? = null + @SerialName(value = "n1") val n1: kotlin.Double? = null, + + /* String property with $dollar, backslash, quote, comment-close in default */ + @SerialName(value = "s0") val s0: kotlin.String? = "hello \$world, backslash=\\, quote=\", end */" ) { diff --git a/samples/client/petstore/kotlin-explicit/docs/StoreApi.md b/samples/client/petstore/kotlin-explicit/docs/StoreApi.md index 53ff17b16676..b19af1a400ef 100644 --- a/samples/client/petstore/kotlin-explicit/docs/StoreApi.md +++ b/samples/client/petstore/kotlin-explicit/docs/StoreApi.md @@ -107,7 +107,7 @@ Configure api_key: Find purchase order by ID -For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions +For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions ### Example ```kotlin diff --git a/samples/client/petstore/kotlin-gson/docs/StoreApi.md b/samples/client/petstore/kotlin-gson/docs/StoreApi.md index bfbf6c75d797..c8cd9c416773 100644 --- a/samples/client/petstore/kotlin-gson/docs/StoreApi.md +++ b/samples/client/petstore/kotlin-gson/docs/StoreApi.md @@ -107,7 +107,7 @@ Configure api_key: Find purchase order by ID -For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions +For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions ### Example ```kotlin diff --git a/samples/client/petstore/kotlin-jackson/docs/StoreApi.md b/samples/client/petstore/kotlin-jackson/docs/StoreApi.md index 53ff17b16676..b19af1a400ef 100644 --- a/samples/client/petstore/kotlin-jackson/docs/StoreApi.md +++ b/samples/client/petstore/kotlin-jackson/docs/StoreApi.md @@ -107,7 +107,7 @@ Configure api_key: Find purchase order by ID -For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions +For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions ### Example ```kotlin diff --git a/samples/client/petstore/kotlin-json-request-string/docs/StoreApi.md b/samples/client/petstore/kotlin-json-request-string/docs/StoreApi.md index 53ff17b16676..b19af1a400ef 100644 --- a/samples/client/petstore/kotlin-json-request-string/docs/StoreApi.md +++ b/samples/client/petstore/kotlin-json-request-string/docs/StoreApi.md @@ -107,7 +107,7 @@ Configure api_key: Find purchase order by ID -For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions +For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions ### Example ```kotlin diff --git a/samples/client/petstore/kotlin-jvm-jackson/docs/StoreApi.md b/samples/client/petstore/kotlin-jvm-jackson/docs/StoreApi.md index 34b0e0700a72..6448b963dc71 100644 --- a/samples/client/petstore/kotlin-jvm-jackson/docs/StoreApi.md +++ b/samples/client/petstore/kotlin-jvm-jackson/docs/StoreApi.md @@ -84,7 +84,7 @@ This endpoint does not need any parameter. Find purchase order by ID -For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions +For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions ### Example ```kotlin diff --git a/samples/client/petstore/kotlin-jvm-ktor-gson/.openapi-generator/FILES b/samples/client/petstore/kotlin-jvm-ktor-gson/.openapi-generator/FILES index 1b45f7fe9a51..43f9908db67c 100644 --- a/samples/client/petstore/kotlin-jvm-ktor-gson/.openapi-generator/FILES +++ b/samples/client/petstore/kotlin-jvm-ktor-gson/.openapi-generator/FILES @@ -9,6 +9,7 @@ docs/FakeApi.md docs/Order.md docs/Pet.md docs/PetApi.md +docs/PetWithSpecialProps.md docs/StoreApi.md docs/Tag.md docs/User.md @@ -41,6 +42,7 @@ src/main/kotlin/org/openapitools/client/models/Category.kt src/main/kotlin/org/openapitools/client/models/ModelApiResponse.kt src/main/kotlin/org/openapitools/client/models/Order.kt src/main/kotlin/org/openapitools/client/models/Pet.kt +src/main/kotlin/org/openapitools/client/models/PetWithSpecialProps.kt src/main/kotlin/org/openapitools/client/models/Tag.kt src/main/kotlin/org/openapitools/client/models/User.kt src/main/kotlin/org/openapitools/client/models/UserOrPet.kt diff --git a/samples/client/petstore/kotlin-jvm-ktor-gson/README.md b/samples/client/petstore/kotlin-jvm-ktor-gson/README.md index b0bbb1d576e0..a3fbffa97467 100644 --- a/samples/client/petstore/kotlin-jvm-ktor-gson/README.md +++ b/samples/client/petstore/kotlin-jvm-ktor-gson/README.md @@ -79,6 +79,7 @@ All URIs are relative to *http://petstore.swagger.io/v2* - [org.openapitools.client.models.ModelApiResponse](docs/ModelApiResponse.md) - [org.openapitools.client.models.Order](docs/Order.md) - [org.openapitools.client.models.Pet](docs/Pet.md) + - [org.openapitools.client.models.PetWithSpecialProps](docs/PetWithSpecialProps.md) - [org.openapitools.client.models.Tag](docs/Tag.md) - [org.openapitools.client.models.User](docs/User.md) - [org.openapitools.client.models.UserOrPet](docs/UserOrPet.md) diff --git a/samples/client/petstore/kotlin-jvm-ktor-gson/docs/PetWithSpecialProps.md b/samples/client/petstore/kotlin-jvm-ktor-gson/docs/PetWithSpecialProps.md new file mode 100644 index 000000000000..53fe36ec810a --- /dev/null +++ b/samples/client/petstore/kotlin-jvm-ktor-gson/docs/PetWithSpecialProps.md @@ -0,0 +1,11 @@ + +# PetWithSpecialProps + +## Properties +| Name | Type | Description | Notes | +| ------------ | ------------- | ------------- | ------------- | +| **dollarId** | **kotlin.String** | Property with \$-prefix in name; default has \$dollar and backslash \\ | [optional] | +| **nameDollarSuffix** | **kotlin.String** | Property with \$ mid-name; description has backslash \\ and quote " | [optional] | + + + diff --git a/samples/client/petstore/kotlin-jvm-ktor-gson/docs/StoreApi.md b/samples/client/petstore/kotlin-jvm-ktor-gson/docs/StoreApi.md index aac02408ec79..091727af5301 100644 --- a/samples/client/petstore/kotlin-jvm-ktor-gson/docs/StoreApi.md +++ b/samples/client/petstore/kotlin-jvm-ktor-gson/docs/StoreApi.md @@ -107,7 +107,7 @@ Configure api_key: Find purchase order by ID -For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions +For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions ### Example ```kotlin diff --git a/samples/client/petstore/kotlin-jvm-ktor-gson/src/main/kotlin/org/openapitools/client/models/PetWithSpecialProps.kt b/samples/client/petstore/kotlin-jvm-ktor-gson/src/main/kotlin/org/openapitools/client/models/PetWithSpecialProps.kt new file mode 100644 index 000000000000..f02ff8067716 --- /dev/null +++ b/samples/client/petstore/kotlin-jvm-ktor-gson/src/main/kotlin/org/openapitools/client/models/PetWithSpecialProps.kt @@ -0,0 +1,51 @@ +/** + * + * Please note: + * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * Do not edit this file manually. + * + */ + +@file:Suppress( + "ArrayInDataClass", + "DuplicatedCode", + "EnumEntryName", + "RemoveRedundantQualifierName", + "RemoveRedundantCallsOfConversionMethods", + "REDUNDANT_CALL_OF_CONVERSION_METHOD", + "RedundantUnitReturnType", + "RemoveEmptyClassBody", + "UnnecessaryVariable", + "UnusedImport", + "UnnecessaryVariable", + "unused" +) + +package org.openapitools.client.models + + +import com.google.gson.annotations.SerializedName + +/** + * Model with $-prefixed property names for escaping tests (Issue 20502) + * + * @param dollarId Property with $-prefix in name; default has $dollar and backslash \\ + * @param nameDollarSuffix Property with $ mid-name; description has backslash \\ and quote \" + */ + + +data class PetWithSpecialProps ( + + /* Property with $-prefix in name; default has $dollar and backslash \\ */ + @SerializedName("\$id") + val dollarId: kotlin.String? = "hello \$world", + + /* Property with $ mid-name; description has backslash \\ and quote \" */ + @SerializedName("name\$Suffix") + val nameDollarSuffix: kotlin.String? = null + +) { + + +} + diff --git a/samples/client/petstore/kotlin-jvm-ktor-gson/src/test/kotlin/org/openapitools/client/models/PetWithSpecialPropsTest.kt b/samples/client/petstore/kotlin-jvm-ktor-gson/src/test/kotlin/org/openapitools/client/models/PetWithSpecialPropsTest.kt new file mode 100644 index 000000000000..ba24493a7f26 --- /dev/null +++ b/samples/client/petstore/kotlin-jvm-ktor-gson/src/test/kotlin/org/openapitools/client/models/PetWithSpecialPropsTest.kt @@ -0,0 +1,49 @@ +/** + * + * Please note: + * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * Do not edit this file manually. + * + */ + +@file:Suppress( + "ArrayInDataClass", + "DuplicatedCode", + "EnumEntryName", + "RemoveRedundantQualifierName", + "RemoveRedundantCallsOfConversionMethods", + "REDUNDANT_CALL_OF_CONVERSION_METHOD", + "RedundantUnitReturnType", + "RemoveEmptyClassBody", + "UnnecessaryVariable", + "UnusedImport", + "UnnecessaryVariable", + "unused" +) + +package org.openapitools.client.models + +import io.kotlintest.shouldBe +import io.kotlintest.specs.ShouldSpec + +import org.openapitools.client.models.PetWithSpecialProps + +class PetWithSpecialPropsTest : ShouldSpec() { + init { + // uncomment below to create an instance of PetWithSpecialProps + //val modelInstance = PetWithSpecialProps() + + // to test the property `dollarId` - Property with $-prefix in name; default has $dollar and backslash \\ + should("test dollarId") { + // uncomment below to test the property + //modelInstance.dollarId shouldBe ("TODO") + } + + // to test the property `nameDollarSuffix` - Property with $ mid-name; description has backslash \\ and quote \" + should("test nameDollarSuffix") { + // uncomment below to test the property + //modelInstance.nameDollarSuffix shouldBe ("TODO") + } + + } +} diff --git a/samples/client/petstore/kotlin-jvm-ktor-jackson/docs/StoreApi.md b/samples/client/petstore/kotlin-jvm-ktor-jackson/docs/StoreApi.md index 27694e9e7100..d6f7e52c88ab 100644 --- a/samples/client/petstore/kotlin-jvm-ktor-jackson/docs/StoreApi.md +++ b/samples/client/petstore/kotlin-jvm-ktor-jackson/docs/StoreApi.md @@ -107,7 +107,7 @@ Configure api_key: Find purchase order by ID -For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions +For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions ### Example ```kotlin diff --git a/samples/client/petstore/kotlin-jvm-ktor-kotlinx_serialization/docs/StoreApi.md b/samples/client/petstore/kotlin-jvm-ktor-kotlinx_serialization/docs/StoreApi.md index aac02408ec79..091727af5301 100644 --- a/samples/client/petstore/kotlin-jvm-ktor-kotlinx_serialization/docs/StoreApi.md +++ b/samples/client/petstore/kotlin-jvm-ktor-kotlinx_serialization/docs/StoreApi.md @@ -107,7 +107,7 @@ Configure api_key: Find purchase order by ID -For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions +For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions ### Example ```kotlin diff --git a/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/docs/StoreApi.md b/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/docs/StoreApi.md index 53ff17b16676..b19af1a400ef 100644 --- a/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/docs/StoreApi.md +++ b/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/docs/StoreApi.md @@ -107,7 +107,7 @@ Configure api_key: Find purchase order by ID -For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions +For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions ### Example ```kotlin diff --git a/samples/client/petstore/kotlin-jvm-retrofit2-coroutines/docs/StoreApi.md b/samples/client/petstore/kotlin-jvm-retrofit2-coroutines/docs/StoreApi.md index bbc53bb2f774..dd4ba6708459 100644 --- a/samples/client/petstore/kotlin-jvm-retrofit2-coroutines/docs/StoreApi.md +++ b/samples/client/petstore/kotlin-jvm-retrofit2-coroutines/docs/StoreApi.md @@ -88,7 +88,7 @@ This endpoint does not need any parameter. Find purchase order by ID -For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions +For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions ### Example ```kotlin diff --git a/samples/client/petstore/kotlin-jvm-spring-2-webclient/docs/StoreApi.md b/samples/client/petstore/kotlin-jvm-spring-2-webclient/docs/StoreApi.md index aac02408ec79..091727af5301 100644 --- a/samples/client/petstore/kotlin-jvm-spring-2-webclient/docs/StoreApi.md +++ b/samples/client/petstore/kotlin-jvm-spring-2-webclient/docs/StoreApi.md @@ -107,7 +107,7 @@ Configure api_key: Find purchase order by ID -For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions +For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions ### Example ```kotlin diff --git a/samples/client/petstore/kotlin-jvm-spring-3-restclient/docs/StoreApi.md b/samples/client/petstore/kotlin-jvm-spring-3-restclient/docs/StoreApi.md index aac02408ec79..091727af5301 100644 --- a/samples/client/petstore/kotlin-jvm-spring-3-restclient/docs/StoreApi.md +++ b/samples/client/petstore/kotlin-jvm-spring-3-restclient/docs/StoreApi.md @@ -107,7 +107,7 @@ Configure api_key: Find purchase order by ID -For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions +For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions ### Example ```kotlin diff --git a/samples/client/petstore/kotlin-jvm-spring-3-webclient/docs/StoreApi.md b/samples/client/petstore/kotlin-jvm-spring-3-webclient/docs/StoreApi.md index aac02408ec79..091727af5301 100644 --- a/samples/client/petstore/kotlin-jvm-spring-3-webclient/docs/StoreApi.md +++ b/samples/client/petstore/kotlin-jvm-spring-3-webclient/docs/StoreApi.md @@ -107,7 +107,7 @@ Configure api_key: Find purchase order by ID -For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions +For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions ### Example ```kotlin diff --git a/samples/client/petstore/kotlin-jvm-vertx-gson/docs/StoreApi.md b/samples/client/petstore/kotlin-jvm-vertx-gson/docs/StoreApi.md index aac02408ec79..091727af5301 100644 --- a/samples/client/petstore/kotlin-jvm-vertx-gson/docs/StoreApi.md +++ b/samples/client/petstore/kotlin-jvm-vertx-gson/docs/StoreApi.md @@ -107,7 +107,7 @@ Configure api_key: Find purchase order by ID -For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions +For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions ### Example ```kotlin diff --git a/samples/client/petstore/kotlin-jvm-vertx-jackson-coroutines/docs/StoreApi.md b/samples/client/petstore/kotlin-jvm-vertx-jackson-coroutines/docs/StoreApi.md index aac02408ec79..091727af5301 100644 --- a/samples/client/petstore/kotlin-jvm-vertx-jackson-coroutines/docs/StoreApi.md +++ b/samples/client/petstore/kotlin-jvm-vertx-jackson-coroutines/docs/StoreApi.md @@ -107,7 +107,7 @@ Configure api_key: Find purchase order by ID -For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions +For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions ### Example ```kotlin diff --git a/samples/client/petstore/kotlin-jvm-vertx-jackson/docs/StoreApi.md b/samples/client/petstore/kotlin-jvm-vertx-jackson/docs/StoreApi.md index aac02408ec79..091727af5301 100644 --- a/samples/client/petstore/kotlin-jvm-vertx-jackson/docs/StoreApi.md +++ b/samples/client/petstore/kotlin-jvm-vertx-jackson/docs/StoreApi.md @@ -107,7 +107,7 @@ Configure api_key: Find purchase order by ID -For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions +For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions ### Example ```kotlin diff --git a/samples/client/petstore/kotlin-jvm-vertx-moshi/docs/StoreApi.md b/samples/client/petstore/kotlin-jvm-vertx-moshi/docs/StoreApi.md index aac02408ec79..091727af5301 100644 --- a/samples/client/petstore/kotlin-jvm-vertx-moshi/docs/StoreApi.md +++ b/samples/client/petstore/kotlin-jvm-vertx-moshi/docs/StoreApi.md @@ -107,7 +107,7 @@ Configure api_key: Find purchase order by ID -For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions +For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions ### Example ```kotlin diff --git a/samples/client/petstore/kotlin-kotlinx-datetime/docs/StoreApi.md b/samples/client/petstore/kotlin-kotlinx-datetime/docs/StoreApi.md index 53ff17b16676..b19af1a400ef 100644 --- a/samples/client/petstore/kotlin-kotlinx-datetime/docs/StoreApi.md +++ b/samples/client/petstore/kotlin-kotlinx-datetime/docs/StoreApi.md @@ -107,7 +107,7 @@ Configure api_key: Find purchase order by ID -For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions +For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions ### Example ```kotlin diff --git a/samples/client/petstore/kotlin-model-prefix-type-mappings/.openapi-generator/FILES b/samples/client/petstore/kotlin-model-prefix-type-mappings/.openapi-generator/FILES index 2b66c25862d7..346027c8e906 100644 --- a/samples/client/petstore/kotlin-model-prefix-type-mappings/.openapi-generator/FILES +++ b/samples/client/petstore/kotlin-model-prefix-type-mappings/.openapi-generator/FILES @@ -9,6 +9,7 @@ docs/FakeApi.md docs/Order.md docs/Pet.md docs/PetApi.md +docs/PetWithSpecialProps.md docs/StoreApi.md docs/Tag.md docs/User.md @@ -43,6 +44,7 @@ src/main/kotlin/org/openapitools/client/models/ApiApiResponse.kt src/main/kotlin/org/openapitools/client/models/ApiCategory.kt src/main/kotlin/org/openapitools/client/models/ApiOrder.kt src/main/kotlin/org/openapitools/client/models/ApiPet.kt +src/main/kotlin/org/openapitools/client/models/ApiPetWithSpecialProps.kt src/main/kotlin/org/openapitools/client/models/ApiTag.kt src/main/kotlin/org/openapitools/client/models/ApiUser.kt src/main/kotlin/org/openapitools/client/models/ApiUserOrPet.kt diff --git a/samples/client/petstore/kotlin-model-prefix-type-mappings/README.md b/samples/client/petstore/kotlin-model-prefix-type-mappings/README.md index 635416314c8a..628aa3796aea 100644 --- a/samples/client/petstore/kotlin-model-prefix-type-mappings/README.md +++ b/samples/client/petstore/kotlin-model-prefix-type-mappings/README.md @@ -79,6 +79,7 @@ All URIs are relative to *http://petstore.swagger.io/v2* - [org.openapitools.client.models.ApiCategory](docs/ApiCategory.md) - [org.openapitools.client.models.ApiOrder](docs/ApiOrder.md) - [org.openapitools.client.models.ApiPet](docs/ApiPet.md) + - [org.openapitools.client.models.ApiPetWithSpecialProps](docs/ApiPetWithSpecialProps.md) - [org.openapitools.client.models.ApiTag](docs/ApiTag.md) - [org.openapitools.client.models.ApiUser](docs/ApiUser.md) - [org.openapitools.client.models.ApiUserOrPet](docs/ApiUserOrPet.md) diff --git a/samples/client/petstore/kotlin-model-prefix-type-mappings/docs/PetWithSpecialProps.md b/samples/client/petstore/kotlin-model-prefix-type-mappings/docs/PetWithSpecialProps.md new file mode 100644 index 000000000000..6ea7aeb3180d --- /dev/null +++ b/samples/client/petstore/kotlin-model-prefix-type-mappings/docs/PetWithSpecialProps.md @@ -0,0 +1,11 @@ + +# ApiPetWithSpecialProps + +## Properties +| Name | Type | Description | Notes | +| ------------ | ------------- | ------------- | ------------- | +| **dollarId** | **kotlin.String** | Property with \$-prefix in name; default has \$dollar and backslash \\ | [optional] | +| **nameDollarSuffix** | **kotlin.String** | Property with \$ mid-name; description has backslash \\ and quote " | [optional] | + + + diff --git a/samples/client/petstore/kotlin-model-prefix-type-mappings/docs/StoreApi.md b/samples/client/petstore/kotlin-model-prefix-type-mappings/docs/StoreApi.md index 53388dff3032..185f1ce4e3c7 100644 --- a/samples/client/petstore/kotlin-model-prefix-type-mappings/docs/StoreApi.md +++ b/samples/client/petstore/kotlin-model-prefix-type-mappings/docs/StoreApi.md @@ -88,7 +88,7 @@ This endpoint does not need any parameter. Find purchase order by ID -For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions +For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions ### Example ```kotlin diff --git a/samples/client/petstore/kotlin-model-prefix-type-mappings/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt b/samples/client/petstore/kotlin-model-prefix-type-mappings/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt index 085e5e1fe1e2..291e760063a9 100644 --- a/samples/client/petstore/kotlin-model-prefix-type-mappings/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt +++ b/samples/client/petstore/kotlin-model-prefix-type-mappings/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt @@ -91,6 +91,7 @@ class ApiClient( serializerBuilder.registerTypeAdapterFactory(org.openapitools.client.models.ApiCategory.CustomTypeAdapterFactory()) serializerBuilder.registerTypeAdapterFactory(org.openapitools.client.models.ApiOrder.CustomTypeAdapterFactory()) serializerBuilder.registerTypeAdapterFactory(org.openapitools.client.models.ApiPet.CustomTypeAdapterFactory()) + serializerBuilder.registerTypeAdapterFactory(org.openapitools.client.models.ApiPetWithSpecialProps.CustomTypeAdapterFactory()) serializerBuilder.registerTypeAdapterFactory(org.openapitools.client.models.ApiTag.CustomTypeAdapterFactory()) serializerBuilder.registerTypeAdapterFactory(org.openapitools.client.models.ApiUser.CustomTypeAdapterFactory()) serializerBuilder.registerTypeAdapterFactory(org.openapitools.client.models.ApiUserOrPet.CustomTypeAdapterFactory()) @@ -259,6 +260,7 @@ fun registerTypeAdapterFactoryForAllModels(gsonBuilder: GsonBuilder): GsonBuilde gsonBuilder.registerTypeAdapterFactory(org.openapitools.client.models.ApiCategory.CustomTypeAdapterFactory()) gsonBuilder.registerTypeAdapterFactory(org.openapitools.client.models.ApiOrder.CustomTypeAdapterFactory()) gsonBuilder.registerTypeAdapterFactory(org.openapitools.client.models.ApiPet.CustomTypeAdapterFactory()) + gsonBuilder.registerTypeAdapterFactory(org.openapitools.client.models.ApiPetWithSpecialProps.CustomTypeAdapterFactory()) gsonBuilder.registerTypeAdapterFactory(org.openapitools.client.models.ApiTag.CustomTypeAdapterFactory()) gsonBuilder.registerTypeAdapterFactory(org.openapitools.client.models.ApiUser.CustomTypeAdapterFactory()) gsonBuilder.registerTypeAdapterFactory(org.openapitools.client.models.ApiUserOrPet.CustomTypeAdapterFactory()) diff --git a/samples/client/petstore/kotlin-model-prefix-type-mappings/src/main/kotlin/org/openapitools/client/infrastructure/Serializer.kt b/samples/client/petstore/kotlin-model-prefix-type-mappings/src/main/kotlin/org/openapitools/client/infrastructure/Serializer.kt index 1426926f13fc..1b94e3943802 100644 --- a/samples/client/petstore/kotlin-model-prefix-type-mappings/src/main/kotlin/org/openapitools/client/infrastructure/Serializer.kt +++ b/samples/client/petstore/kotlin-model-prefix-type-mappings/src/main/kotlin/org/openapitools/client/infrastructure/Serializer.kt @@ -21,6 +21,7 @@ object Serializer { .registerTypeAdapterFactory(org.openapitools.client.models.ApiCategory.CustomTypeAdapterFactory()) .registerTypeAdapterFactory(org.openapitools.client.models.ApiOrder.CustomTypeAdapterFactory()) .registerTypeAdapterFactory(org.openapitools.client.models.ApiPet.CustomTypeAdapterFactory()) + .registerTypeAdapterFactory(org.openapitools.client.models.ApiPetWithSpecialProps.CustomTypeAdapterFactory()) .registerTypeAdapterFactory(org.openapitools.client.models.ApiTag.CustomTypeAdapterFactory()) .registerTypeAdapterFactory(org.openapitools.client.models.ApiUser.CustomTypeAdapterFactory()) .registerTypeAdapterFactory(org.openapitools.client.models.ApiUserOrPet.CustomTypeAdapterFactory()) diff --git a/samples/client/petstore/kotlin-model-prefix-type-mappings/src/main/kotlin/org/openapitools/client/models/ApiPetWithSpecialProps.kt b/samples/client/petstore/kotlin-model-prefix-type-mappings/src/main/kotlin/org/openapitools/client/models/ApiPetWithSpecialProps.kt new file mode 100644 index 000000000000..bece1d3997aa --- /dev/null +++ b/samples/client/petstore/kotlin-model-prefix-type-mappings/src/main/kotlin/org/openapitools/client/models/ApiPetWithSpecialProps.kt @@ -0,0 +1,124 @@ +/** + * + * Please note: + * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * Do not edit this file manually. + * + */ + +@file:Suppress( + "ArrayInDataClass", + "DuplicatedCode", + "EnumEntryName", + "RemoveRedundantQualifierName", + "RemoveRedundantCallsOfConversionMethods", + "REDUNDANT_CALL_OF_CONVERSION_METHOD", + "RedundantUnitReturnType", + "RemoveEmptyClassBody", + "UnnecessaryVariable", + "UnusedImport", + "UnnecessaryVariable", + "unused" +) + +package org.openapitools.client.models + + +import com.google.gson.Gson +import com.google.gson.JsonElement +import com.google.gson.TypeAdapter +import com.google.gson.TypeAdapterFactory +import com.google.gson.reflect.TypeToken +import com.google.gson.stream.JsonReader +import com.google.gson.stream.JsonWriter +import com.google.gson.annotations.JsonAdapter +import java.io.IOException +import com.google.gson.annotations.SerializedName + +/** + * Model with $-prefixed property names for escaping tests (Issue 20502) + * + * @param dollarId Property with $-prefix in name; default has $dollar and backslash \\ + * @param nameDollarSuffix Property with $ mid-name; description has backslash \\ and quote \" + */ + + +data class ApiPetWithSpecialProps ( + + /* Property with $-prefix in name; default has $dollar and backslash \\ */ + @SerializedName("\$id") + val dollarId: kotlin.String? = "hello \$world", + + /* Property with $ mid-name; description has backslash \\ and quote \" */ + @SerializedName("name\$Suffix") + val nameDollarSuffix: kotlin.String? = null + +) { + + + class CustomTypeAdapterFactory : TypeAdapterFactory { + override fun create(gson: Gson, type: TypeToken): TypeAdapter? { + if (!ApiPetWithSpecialProps::class.java.isAssignableFrom(type.rawType)) { + return null // this class only serializes 'ApiPetWithSpecialProps' and its subtypes + } + val elementAdapter = gson.getAdapter(JsonElement::class.java) + val thisAdapter = gson.getDelegateAdapter(this, TypeToken.get(ApiPetWithSpecialProps::class.java)) + + @Suppress("UNCHECKED_CAST") + return object : TypeAdapter() { + @Throws(IOException::class) + override fun write(out: JsonWriter, value: ApiPetWithSpecialProps) { + val obj = thisAdapter.toJsonTree(value).getAsJsonObject() + elementAdapter.write(out, obj) + } + + @Throws(IOException::class) + override fun read(jsonReader: JsonReader): ApiPetWithSpecialProps { + val jsonElement = elementAdapter.read(jsonReader) + validateJsonElement(jsonElement) + return thisAdapter.fromJsonTree(jsonElement) + } + }.nullSafe() as TypeAdapter + } + } + + companion object { + var openapiFields = HashSet() + var openapiRequiredFields = HashSet() + + init { + // a set of all properties/fields (JSON key names) + openapiFields.add("\$id") + openapiFields.add("name\$Suffix") + + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ApiPetWithSpecialProps + */ + @Throws(IOException::class) + fun validateJsonElement(jsonElement: JsonElement?) { + if (jsonElement == null) { + require(openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + String.format("The required field(s) %s in ApiPetWithSpecialProps is not found in the empty JSON string", ApiPetWithSpecialProps.openapiRequiredFields.toString()) + } + } + val jsonObj = jsonElement!!.getAsJsonObject() + if (jsonObj["\$id"] != null && !jsonObj["\$id"].isJsonNull) { + require(jsonObj.get("\$id").isJsonPrimitive) { + String.format("Expected the field `\$id` to be a primitive type in the JSON string but got `%s`", jsonObj["\$id"].toString()) + } + } + if (jsonObj["name\$Suffix"] != null && !jsonObj["name\$Suffix"].isJsonNull) { + require(jsonObj.get("name\$Suffix").isJsonPrimitive) { + String.format("Expected the field `name\$Suffix` to be a primitive type in the JSON string but got `%s`", jsonObj["name\$Suffix"].toString()) + } + } + } + } + +} + diff --git a/samples/client/petstore/kotlin-model-prefix-type-mappings/src/test/kotlin/org/openapitools/client/models/PetWithSpecialPropsTest.kt b/samples/client/petstore/kotlin-model-prefix-type-mappings/src/test/kotlin/org/openapitools/client/models/PetWithSpecialPropsTest.kt new file mode 100644 index 000000000000..e345bb576354 --- /dev/null +++ b/samples/client/petstore/kotlin-model-prefix-type-mappings/src/test/kotlin/org/openapitools/client/models/PetWithSpecialPropsTest.kt @@ -0,0 +1,49 @@ +/** + * + * Please note: + * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * Do not edit this file manually. + * + */ + +@file:Suppress( + "ArrayInDataClass", + "DuplicatedCode", + "EnumEntryName", + "RemoveRedundantQualifierName", + "RemoveRedundantCallsOfConversionMethods", + "REDUNDANT_CALL_OF_CONVERSION_METHOD", + "RedundantUnitReturnType", + "RemoveEmptyClassBody", + "UnnecessaryVariable", + "UnusedImport", + "UnnecessaryVariable", + "unused" +) + +package org.openapitools.client.models + +import io.kotlintest.shouldBe +import io.kotlintest.specs.ShouldSpec + +import org.openapitools.client.models.ApiPetWithSpecialProps + +class ApiPetWithSpecialPropsTest : ShouldSpec() { + init { + // uncomment below to create an instance of ApiPetWithSpecialProps + //val modelInstance = ApiPetWithSpecialProps() + + // to test the property `dollarId` - Property with $-prefix in name; default has $dollar and backslash \\ + should("test dollarId") { + // uncomment below to test the property + //modelInstance.dollarId shouldBe ("TODO") + } + + // to test the property `nameDollarSuffix` - Property with $ mid-name; description has backslash \\ and quote \" + should("test nameDollarSuffix") { + // uncomment below to test the property + //modelInstance.nameDollarSuffix shouldBe ("TODO") + } + + } +} diff --git a/samples/client/petstore/kotlin-modelMutable/docs/StoreApi.md b/samples/client/petstore/kotlin-modelMutable/docs/StoreApi.md index 9d9f4c673e6f..44d1a3b65b33 100644 --- a/samples/client/petstore/kotlin-modelMutable/docs/StoreApi.md +++ b/samples/client/petstore/kotlin-modelMutable/docs/StoreApi.md @@ -107,7 +107,7 @@ Configure api_key: Find purchase order by ID -For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions +For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions ### Example ```kotlin diff --git a/samples/client/petstore/kotlin-moshi-codegen/docs/StoreApi.md b/samples/client/petstore/kotlin-moshi-codegen/docs/StoreApi.md index 53ff17b16676..b19af1a400ef 100644 --- a/samples/client/petstore/kotlin-moshi-codegen/docs/StoreApi.md +++ b/samples/client/petstore/kotlin-moshi-codegen/docs/StoreApi.md @@ -107,7 +107,7 @@ Configure api_key: Find purchase order by ID -For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions +For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions ### Example ```kotlin diff --git a/samples/client/petstore/kotlin-multiplatform-kotlinx-datetime/docs/StoreApi.md b/samples/client/petstore/kotlin-multiplatform-kotlinx-datetime/docs/StoreApi.md index 27694e9e7100..d6f7e52c88ab 100644 --- a/samples/client/petstore/kotlin-multiplatform-kotlinx-datetime/docs/StoreApi.md +++ b/samples/client/petstore/kotlin-multiplatform-kotlinx-datetime/docs/StoreApi.md @@ -107,7 +107,7 @@ Configure api_key: Find purchase order by ID -For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions +For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions ### Example ```kotlin diff --git a/samples/client/petstore/kotlin-multiplatform/docs/StoreApi.md b/samples/client/petstore/kotlin-multiplatform/docs/StoreApi.md index 27694e9e7100..d6f7e52c88ab 100644 --- a/samples/client/petstore/kotlin-multiplatform/docs/StoreApi.md +++ b/samples/client/petstore/kotlin-multiplatform/docs/StoreApi.md @@ -107,7 +107,7 @@ Configure api_key: Find purchase order by ID -For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions +For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions ### Example ```kotlin diff --git a/samples/client/petstore/kotlin-nonpublic/docs/StoreApi.md b/samples/client/petstore/kotlin-nonpublic/docs/StoreApi.md index 53ff17b16676..b19af1a400ef 100644 --- a/samples/client/petstore/kotlin-nonpublic/docs/StoreApi.md +++ b/samples/client/petstore/kotlin-nonpublic/docs/StoreApi.md @@ -107,7 +107,7 @@ Configure api_key: Find purchase order by ID -For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions +For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions ### Example ```kotlin diff --git a/samples/client/petstore/kotlin-nullable/docs/StoreApi.md b/samples/client/petstore/kotlin-nullable/docs/StoreApi.md index 7a65eab968d3..69663a68eff2 100644 --- a/samples/client/petstore/kotlin-nullable/docs/StoreApi.md +++ b/samples/client/petstore/kotlin-nullable/docs/StoreApi.md @@ -107,7 +107,7 @@ Configure api_key: Find purchase order by ID -For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions +For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions ### Example ```kotlin diff --git a/samples/client/petstore/kotlin-retrofit2-jackson/docs/StoreApi.md b/samples/client/petstore/kotlin-retrofit2-jackson/docs/StoreApi.md index 34b0e0700a72..6448b963dc71 100644 --- a/samples/client/petstore/kotlin-retrofit2-jackson/docs/StoreApi.md +++ b/samples/client/petstore/kotlin-retrofit2-jackson/docs/StoreApi.md @@ -84,7 +84,7 @@ This endpoint does not need any parameter. Find purchase order by ID -For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions +For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions ### Example ```kotlin diff --git a/samples/client/petstore/kotlin-retrofit2-kotlinx_serialization/docs/StoreApi.md b/samples/client/petstore/kotlin-retrofit2-kotlinx_serialization/docs/StoreApi.md index 18640563db31..ded29cf05361 100644 --- a/samples/client/petstore/kotlin-retrofit2-kotlinx_serialization/docs/StoreApi.md +++ b/samples/client/petstore/kotlin-retrofit2-kotlinx_serialization/docs/StoreApi.md @@ -84,7 +84,7 @@ This endpoint does not need any parameter. Find purchase order by ID -For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions +For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions ### Example ```kotlin diff --git a/samples/client/petstore/kotlin-retrofit2-rx3/docs/StoreApi.md b/samples/client/petstore/kotlin-retrofit2-rx3/docs/StoreApi.md index 18640563db31..ded29cf05361 100644 --- a/samples/client/petstore/kotlin-retrofit2-rx3/docs/StoreApi.md +++ b/samples/client/petstore/kotlin-retrofit2-rx3/docs/StoreApi.md @@ -84,7 +84,7 @@ This endpoint does not need any parameter. Find purchase order by ID -For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions +For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions ### Example ```kotlin diff --git a/samples/client/petstore/kotlin-retrofit2/docs/StoreApi.md b/samples/client/petstore/kotlin-retrofit2/docs/StoreApi.md index 18640563db31..ded29cf05361 100644 --- a/samples/client/petstore/kotlin-retrofit2/docs/StoreApi.md +++ b/samples/client/petstore/kotlin-retrofit2/docs/StoreApi.md @@ -84,7 +84,7 @@ This endpoint does not need any parameter. Find purchase order by ID -For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions +For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions ### Example ```kotlin diff --git a/samples/client/petstore/kotlin-string/docs/StoreApi.md b/samples/client/petstore/kotlin-string/docs/StoreApi.md index 53ff17b16676..b19af1a400ef 100644 --- a/samples/client/petstore/kotlin-string/docs/StoreApi.md +++ b/samples/client/petstore/kotlin-string/docs/StoreApi.md @@ -107,7 +107,7 @@ Configure api_key: Find purchase order by ID -For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions +For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions ### Example ```kotlin diff --git a/samples/client/petstore/kotlin-threetenbp/docs/StoreApi.md b/samples/client/petstore/kotlin-threetenbp/docs/StoreApi.md index 53ff17b16676..b19af1a400ef 100644 --- a/samples/client/petstore/kotlin-threetenbp/docs/StoreApi.md +++ b/samples/client/petstore/kotlin-threetenbp/docs/StoreApi.md @@ -107,7 +107,7 @@ Configure api_key: Find purchase order by ID -For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions +For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions ### Example ```kotlin diff --git a/samples/client/petstore/kotlin/docs/StoreApi.md b/samples/client/petstore/kotlin/docs/StoreApi.md index 53ff17b16676..b19af1a400ef 100644 --- a/samples/client/petstore/kotlin/docs/StoreApi.md +++ b/samples/client/petstore/kotlin/docs/StoreApi.md @@ -107,7 +107,7 @@ Configure api_key: Find purchase order by ID -For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions +For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions ### Example ```kotlin diff --git a/samples/documentation/html/index.html b/samples/documentation/html/index.html index 81a6253d5e79..e97c154c4269 100644 --- a/samples/documentation/html/index.html +++ b/samples/documentation/html/index.html @@ -248,7 +248,7 @@

Request body

Pet Pet (required)
-
Body Parameter
+
Body Parameter — Pet object that needs to be added to the store
@@ -663,7 +663,7 @@

Request body

Pet Pet (required)
-
Body Parameter
+
Body Parameter — Pet object that needs to be added to the store
@@ -992,7 +992,7 @@

Request body

Order Order (required)
-
Body Parameter
+
Body Parameter — order placed for purchasing the pet
@@ -1064,7 +1064,7 @@

Request body

User User (required)
-
Body Parameter
+
Body Parameter — Created user object
@@ -1100,7 +1100,7 @@

Request body

User array[User] (required)
-
Body Parameter
+
Body Parameter — List of user object
@@ -1136,7 +1136,7 @@

Request body

User array[User] (required)
-
Body Parameter
+
Body Parameter — List of user object
@@ -1354,7 +1354,7 @@

Request body

User User (required)
-
Body Parameter
+
Body Parameter — Updated user object
diff --git a/samples/documentation/html2/index.html b/samples/documentation/html2/index.html index defce7cd6ce2..d74b2161a56e 100644 --- a/samples/documentation/html2/index.html +++ b/samples/documentation/html2/index.html @@ -1216,7 +1216,7 @@

Usage and SDK Samples

// Create an instance of the API class PetApi apiInstance = new PetApi(); - Pet pet = ; // Pet | + Pet pet = ; // Pet | Pet object that needs to be added to the store try { Pet result = apiInstance.addPet(pet); @@ -1235,7 +1235,7 @@

Usage and SDK Samples

final api_instance = DefaultApi(); -final Pet pet = new Pet(); // Pet | +final Pet pet = new Pet(); // Pet | Pet object that needs to be added to the store try { final result = await api_instance.addPet(pet); @@ -1253,7 +1253,7 @@

Usage and SDK Samples

public class PetApiExample { public static void main(String[] args) { PetApi apiInstance = new PetApi(); - Pet pet = ; // Pet | + Pet pet = ; // Pet | Pet object that needs to be added to the store try { Pet result = apiInstance.addPet(pet); @@ -1278,7 +1278,7 @@

Usage and SDK Samples

// Create an instance of the API class PetApi *apiInstance = [[PetApi alloc] init]; -Pet *pet = ; // +Pet *pet = ; // Pet object that needs to be added to the store // Add a new pet to the store [apiInstance addPetWith:pet @@ -1303,7 +1303,7 @@

Usage and SDK Samples

// Create an instance of the API class var api = new OpenApiPetstore.PetApi() -var pet = ; // {Pet} +var pet = ; // {Pet} Pet object that needs to be added to the store var callback = function(error, data, response) { if (error) { @@ -1337,7 +1337,7 @@

Usage and SDK Samples

// Create an instance of the API class var apiInstance = new PetApi(); - var pet = new Pet(); // Pet | + var pet = new Pet(); // Pet | Pet object that needs to be added to the store try { // Add a new pet to the store @@ -1361,7 +1361,7 @@

Usage and SDK Samples

// Create an instance of the API class $api_instance = new OpenAPITools\Client\Api\PetApi(); -$pet = ; // Pet | +$pet = ; // Pet | Pet object that needs to be added to the store try { $result = $api_instance->addPet($pet); @@ -1382,7 +1382,7 @@

Usage and SDK Samples

# Create an instance of the API class my $api_instance = WWW::OPenAPIClient::PetApi->new(); -my $pet = WWW::OPenAPIClient::Object::Pet->new(); # Pet | +my $pet = WWW::OPenAPIClient::Object::Pet->new(); # Pet | Pet object that needs to be added to the store eval { my $result = $api_instance->addPet(pet => $pet); @@ -1405,7 +1405,7 @@

Usage and SDK Samples

# Create an instance of the API class api_instance = openapi_client.PetApi() -pet = # Pet | +pet = # Pet | Pet object that needs to be added to the store try: # Add a new pet to the store @@ -3668,7 +3668,7 @@

Usage and SDK Samples

// Create an instance of the API class PetApi apiInstance = new PetApi(); - Pet pet = ; // Pet | + Pet pet = ; // Pet | Pet object that needs to be added to the store try { Pet result = apiInstance.updatePet(pet); @@ -3687,7 +3687,7 @@

Usage and SDK Samples

final api_instance = DefaultApi(); -final Pet pet = new Pet(); // Pet | +final Pet pet = new Pet(); // Pet | Pet object that needs to be added to the store try { final result = await api_instance.updatePet(pet); @@ -3705,7 +3705,7 @@

Usage and SDK Samples

public class PetApiExample { public static void main(String[] args) { PetApi apiInstance = new PetApi(); - Pet pet = ; // Pet | + Pet pet = ; // Pet | Pet object that needs to be added to the store try { Pet result = apiInstance.updatePet(pet); @@ -3730,7 +3730,7 @@

Usage and SDK Samples

// Create an instance of the API class PetApi *apiInstance = [[PetApi alloc] init]; -Pet *pet = ; // +Pet *pet = ; // Pet object that needs to be added to the store // Update an existing pet [apiInstance updatePetWith:pet @@ -3755,7 +3755,7 @@

Usage and SDK Samples

// Create an instance of the API class var api = new OpenApiPetstore.PetApi() -var pet = ; // {Pet} +var pet = ; // {Pet} Pet object that needs to be added to the store var callback = function(error, data, response) { if (error) { @@ -3789,7 +3789,7 @@

Usage and SDK Samples

// Create an instance of the API class var apiInstance = new PetApi(); - var pet = new Pet(); // Pet | + var pet = new Pet(); // Pet | Pet object that needs to be added to the store try { // Update an existing pet @@ -3813,7 +3813,7 @@

Usage and SDK Samples

// Create an instance of the API class $api_instance = new OpenAPITools\Client\Api\PetApi(); -$pet = ; // Pet | +$pet = ; // Pet | Pet object that needs to be added to the store try { $result = $api_instance->updatePet($pet); @@ -3834,7 +3834,7 @@

Usage and SDK Samples

# Create an instance of the API class my $api_instance = WWW::OPenAPIClient::PetApi->new(); -my $pet = WWW::OPenAPIClient::Object::Pet->new(); # Pet | +my $pet = WWW::OPenAPIClient::Object::Pet->new(); # Pet | Pet object that needs to be added to the store eval { my $result = $api_instance->updatePet(pet => $pet); @@ -3857,7 +3857,7 @@

Usage and SDK Samples

# Create an instance of the API class api_instance = openapi_client.PetApi() -pet = # Pet | +pet = # Pet | Pet object that needs to be added to the store try: # Update an existing pet @@ -6529,7 +6529,7 @@

Usage and SDK Samples

// Create an instance of the API class StoreApi apiInstance = new StoreApi(); - Order order = ; // Order | + Order order = ; // Order | order placed for purchasing the pet try { Order result = apiInstance.placeOrder(order); @@ -6548,7 +6548,7 @@

Usage and SDK Samples

final api_instance = DefaultApi(); -final Order order = new Order(); // Order | +final Order order = new Order(); // Order | order placed for purchasing the pet try { final result = await api_instance.placeOrder(order); @@ -6566,7 +6566,7 @@

Usage and SDK Samples

public class StoreApiExample { public static void main(String[] args) { StoreApi apiInstance = new StoreApi(); - Order order = ; // Order | + Order order = ; // Order | order placed for purchasing the pet try { Order result = apiInstance.placeOrder(order); @@ -6587,7 +6587,7 @@

Usage and SDK Samples

// Create an instance of the API class StoreApi *apiInstance = [[StoreApi alloc] init]; -Order *order = ; // +Order *order = ; // order placed for purchasing the pet // Place an order for a pet [apiInstance placeOrderWith:order @@ -6607,7 +6607,7 @@

Usage and SDK Samples

// Create an instance of the API class var api = new OpenApiPetstore.StoreApi() -var order = ; // {Order} +var order = ; // {Order} order placed for purchasing the pet var callback = function(error, data, response) { if (error) { @@ -6639,7 +6639,7 @@

Usage and SDK Samples

// Create an instance of the API class var apiInstance = new StoreApi(); - var order = new Order(); // Order | + var order = new Order(); // Order | order placed for purchasing the pet try { // Place an order for a pet @@ -6660,7 +6660,7 @@

Usage and SDK Samples

// Create an instance of the API class $api_instance = new OpenAPITools\Client\Api\StoreApi(); -$order = ; // Order | +$order = ; // Order | order placed for purchasing the pet try { $result = $api_instance->placeOrder($order); @@ -6678,7 +6678,7 @@

Usage and SDK Samples

# Create an instance of the API class my $api_instance = WWW::OPenAPIClient::StoreApi->new(); -my $order = WWW::OPenAPIClient::Object::Order->new(); # Order | +my $order = WWW::OPenAPIClient::Object::Order->new(); # Order | order placed for purchasing the pet eval { my $result = $api_instance->placeOrder(order => $order); @@ -6698,7 +6698,7 @@

Usage and SDK Samples

# Create an instance of the API class api_instance = openapi_client.StoreApi() -order = # Order | +order = # Order | order placed for purchasing the pet try: # Place an order for a pet @@ -7007,7 +7007,7 @@

Usage and SDK Samples

// Create an instance of the API class UserApi apiInstance = new UserApi(); - User user = ; // User | + User user = ; // User | Created user object try { apiInstance.createUser(user); @@ -7025,7 +7025,7 @@

Usage and SDK Samples

final api_instance = DefaultApi(); -final User user = new User(); // User | +final User user = new User(); // User | Created user object try { final result = await api_instance.createUser(user); @@ -7043,7 +7043,7 @@

Usage and SDK Samples

public class UserApiExample { public static void main(String[] args) { UserApi apiInstance = new UserApi(); - User user = ; // User | + User user = ; // User | Created user object try { apiInstance.createUser(user); @@ -7069,7 +7069,7 @@

Usage and SDK Samples

// Create an instance of the API class UserApi *apiInstance = [[UserApi alloc] init]; -User *user = ; // +User *user = ; // Created user object // Create user [apiInstance createUserWith:user @@ -7093,7 +7093,7 @@

Usage and SDK Samples

// Create an instance of the API class var api = new OpenApiPetstore.UserApi() -var user = ; // {User} +var user = ; // {User} Created user object var callback = function(error, data, response) { if (error) { @@ -7129,7 +7129,7 @@

Usage and SDK Samples

// Create an instance of the API class var apiInstance = new UserApi(); - var user = new User(); // User | + var user = new User(); // User | Created user object try { // Create user @@ -7154,7 +7154,7 @@

Usage and SDK Samples

// Create an instance of the API class $api_instance = new OpenAPITools\Client\Api\UserApi(); -$user = ; // User | +$user = ; // User | Created user object try { $api_instance->createUser($user); @@ -7176,7 +7176,7 @@

Usage and SDK Samples

# Create an instance of the API class my $api_instance = WWW::OPenAPIClient::UserApi->new(); -my $user = WWW::OPenAPIClient::Object::User->new(); # User | +my $user = WWW::OPenAPIClient::Object::User->new(); # User | Created user object eval { $api_instance->createUser(user => $user); @@ -7200,7 +7200,7 @@

Usage and SDK Samples

# Create an instance of the API class api_instance = openapi_client.UserApi() -user = # User | +user = # User | Created user object try: # Create user @@ -7424,7 +7424,7 @@

Usage and SDK Samples

// Create an instance of the API class UserApi apiInstance = new UserApi(); - array[User] user = ; // array[User] | + array[User] user = ; // array[User] | List of user object try { apiInstance.createUsersWithArrayInput(user); @@ -7442,7 +7442,7 @@

Usage and SDK Samples

final api_instance = DefaultApi(); -final array[User] user = new array[User](); // array[User] | +final array[User] user = new array[User](); // array[User] | List of user object try { final result = await api_instance.createUsersWithArrayInput(user); @@ -7460,7 +7460,7 @@

Usage and SDK Samples

public class UserApiExample { public static void main(String[] args) { UserApi apiInstance = new UserApi(); - array[User] user = ; // array[User] | + array[User] user = ; // array[User] | List of user object try { apiInstance.createUsersWithArrayInput(user); @@ -7486,7 +7486,7 @@

Usage and SDK Samples

// Create an instance of the API class UserApi *apiInstance = [[UserApi alloc] init]; -array[User] *user = ; // +array[User] *user = ; // List of user object // Creates list of users with given input array [apiInstance createUsersWithArrayInputWith:user @@ -7510,7 +7510,7 @@

Usage and SDK Samples

// Create an instance of the API class var api = new OpenApiPetstore.UserApi() -var user = ; // {array[User]} +var user = ; // {array[User]} List of user object var callback = function(error, data, response) { if (error) { @@ -7546,7 +7546,7 @@

Usage and SDK Samples

// Create an instance of the API class var apiInstance = new UserApi(); - var user = new array[User](); // array[User] | + var user = new array[User](); // array[User] | List of user object try { // Creates list of users with given input array @@ -7571,7 +7571,7 @@

Usage and SDK Samples

// Create an instance of the API class $api_instance = new OpenAPITools\Client\Api\UserApi(); -$user = ; // array[User] | +$user = ; // array[User] | List of user object try { $api_instance->createUsersWithArrayInput($user); @@ -7593,7 +7593,7 @@

Usage and SDK Samples

# Create an instance of the API class my $api_instance = WWW::OPenAPIClient::UserApi->new(); -my $user = [WWW::OPenAPIClient::Object::array[User]->new()]; # array[User] | +my $user = [WWW::OPenAPIClient::Object::array[User]->new()]; # array[User] | List of user object eval { $api_instance->createUsersWithArrayInput(user => $user); @@ -7617,7 +7617,7 @@

Usage and SDK Samples

# Create an instance of the API class api_instance = openapi_client.UserApi() -user = # array[User] | +user = # array[User] | List of user object try: # Creates list of users with given input array @@ -7844,7 +7844,7 @@

Usage and SDK Samples

// Create an instance of the API class UserApi apiInstance = new UserApi(); - array[User] user = ; // array[User] | + array[User] user = ; // array[User] | List of user object try { apiInstance.createUsersWithListInput(user); @@ -7862,7 +7862,7 @@

Usage and SDK Samples

final api_instance = DefaultApi(); -final array[User] user = new array[User](); // array[User] | +final array[User] user = new array[User](); // array[User] | List of user object try { final result = await api_instance.createUsersWithListInput(user); @@ -7880,7 +7880,7 @@

Usage and SDK Samples

public class UserApiExample { public static void main(String[] args) { UserApi apiInstance = new UserApi(); - array[User] user = ; // array[User] | + array[User] user = ; // array[User] | List of user object try { apiInstance.createUsersWithListInput(user); @@ -7906,7 +7906,7 @@

Usage and SDK Samples

// Create an instance of the API class UserApi *apiInstance = [[UserApi alloc] init]; -array[User] *user = ; // +array[User] *user = ; // List of user object // Creates list of users with given input array [apiInstance createUsersWithListInputWith:user @@ -7930,7 +7930,7 @@

Usage and SDK Samples

// Create an instance of the API class var api = new OpenApiPetstore.UserApi() -var user = ; // {array[User]} +var user = ; // {array[User]} List of user object var callback = function(error, data, response) { if (error) { @@ -7966,7 +7966,7 @@

Usage and SDK Samples

// Create an instance of the API class var apiInstance = new UserApi(); - var user = new array[User](); // array[User] | + var user = new array[User](); // array[User] | List of user object try { // Creates list of users with given input array @@ -7991,7 +7991,7 @@

Usage and SDK Samples

// Create an instance of the API class $api_instance = new OpenAPITools\Client\Api\UserApi(); -$user = ; // array[User] | +$user = ; // array[User] | List of user object try { $api_instance->createUsersWithListInput($user); @@ -8013,7 +8013,7 @@

Usage and SDK Samples

# Create an instance of the API class my $api_instance = WWW::OPenAPIClient::UserApi->new(); -my $user = [WWW::OPenAPIClient::Object::array[User]->new()]; # array[User] | +my $user = [WWW::OPenAPIClient::Object::array[User]->new()]; # array[User] | List of user object eval { $api_instance->createUsersWithListInput(user => $user); @@ -8037,7 +8037,7 @@

Usage and SDK Samples

# Create an instance of the API class api_instance = openapi_client.UserApi() -user = # array[User] | +user = # array[User] | List of user object try: # Creates list of users with given input array @@ -10096,7 +10096,7 @@

Usage and SDK Samples

// Create an instance of the API class UserApi apiInstance = new UserApi(); String username = username_example; // String | name that need to be deleted - User user = ; // User | + User user = ; // User | Updated user object try { apiInstance.updateUser(username, user); @@ -10115,7 +10115,7 @@

Usage and SDK Samples

final api_instance = DefaultApi(); final String username = new String(); // String | name that need to be deleted -final User user = new User(); // User | +final User user = new User(); // User | Updated user object try { final result = await api_instance.updateUser(username, user); @@ -10134,7 +10134,7 @@

Usage and SDK Samples

public static void main(String[] args) { UserApi apiInstance = new UserApi(); String username = username_example; // String | name that need to be deleted - User user = ; // User | + User user = ; // User | Updated user object try { apiInstance.updateUser(username, user); @@ -10161,7 +10161,7 @@

Usage and SDK Samples

// Create an instance of the API class UserApi *apiInstance = [[UserApi alloc] init]; String *username = username_example; // name that need to be deleted (default to null) -User *user = ; // +User *user = ; // Updated user object // Updated user [apiInstance updateUserWith:username @@ -10187,7 +10187,7 @@

Usage and SDK Samples

// Create an instance of the API class var api = new OpenApiPetstore.UserApi() var username = username_example; // {String} name that need to be deleted -var user = ; // {User} +var user = ; // {User} Updated user object var callback = function(error, data, response) { if (error) { @@ -10224,7 +10224,7 @@

Usage and SDK Samples

// Create an instance of the API class var apiInstance = new UserApi(); var username = username_example; // String | name that need to be deleted (default to null) - var user = new User(); // User | + var user = new User(); // User | Updated user object try { // Updated user @@ -10250,7 +10250,7 @@

Usage and SDK Samples

// Create an instance of the API class $api_instance = new OpenAPITools\Client\Api\UserApi(); $username = username_example; // String | name that need to be deleted -$user = ; // User | +$user = ; // User | Updated user object try { $api_instance->updateUser($username, $user); @@ -10273,7 +10273,7 @@

Usage and SDK Samples

# Create an instance of the API class my $api_instance = WWW::OPenAPIClient::UserApi->new(); my $username = username_example; # String | name that need to be deleted -my $user = WWW::OPenAPIClient::Object::User->new(); # User | +my $user = WWW::OPenAPIClient::Object::User->new(); # User | Updated user object eval { $api_instance->updateUser(username => $username, user => $user); @@ -10298,7 +10298,7 @@

Usage and SDK Samples

# Create an instance of the API class api_instance = openapi_client.UserApi() username = username_example # String | name that need to be deleted (default to null) -user = # User | +user = # User | Updated user object try: # Updated user diff --git a/samples/openapi3/client/petstore/kotlin/.openapi-generator/FILES b/samples/openapi3/client/petstore/kotlin/.openapi-generator/FILES index 2deaf69a977c..f3a9fde69053 100644 --- a/samples/openapi3/client/petstore/kotlin/.openapi-generator/FILES +++ b/samples/openapi3/client/petstore/kotlin/.openapi-generator/FILES @@ -2,6 +2,7 @@ README.md build.gradle docs/200Response.md docs/AdditionalPropertiesClass.md +docs/AllOfWithSingleRef.md docs/Animal.md docs/AnotherFakeApi.md docs/ApiResponse.md @@ -10,45 +11,56 @@ docs/ArrayOfNumberOnly.md docs/ArrayTest.md docs/Capitalization.md docs/Cat.md -docs/CatAllOf.md docs/Category.md +docs/ChildWithNullable.md docs/ClassModel.md docs/Client.md docs/DefaultApi.md +docs/DeprecatedObject.md docs/Dog.md -docs/DogAllOf.md docs/EnumArrays.md docs/EnumClass.md docs/EnumTest.md docs/FakeApi.md +docs/FakeBigDecimalMap200Response.md docs/FakeClassnameTags123Api.md +docs/File.md docs/FileSchemaTestClass.md docs/Foo.md +docs/FooGetDefaultResponse.md docs/FormatTest.md docs/HasOnlyReadOnly.md docs/HealthCheckResult.md -docs/InlineResponseDefault.md docs/List.md docs/MapTest.md docs/MixedPropertiesAndAdditionalPropertiesClass.md docs/Name.md docs/NullableClass.md docs/NumberOnly.md +docs/ObjectWithDeprecatedFields.md docs/Order.md docs/OuterComposite.md docs/OuterEnum.md docs/OuterEnumDefaultValue.md docs/OuterEnumInteger.md docs/OuterEnumIntegerDefaultValue.md +docs/OuterObjectWithEnumProperty.md +docs/ParentWithNullable.md docs/Pet.md docs/PetApi.md docs/ReadOnlyFirst.md docs/Return.md +docs/SingleRefType.md docs/SpecialModelName.md docs/StoreApi.md docs/Tag.md +docs/TestInlineFreeformAdditionalPropertiesRequest.md docs/User.md docs/UserApi.md +gradle/wrapper/gradle-wrapper.jar +gradle/wrapper/gradle-wrapper.properties +gradlew +gradlew.bat settings.gradle src/main/kotlin/org/openapitools/client/apis/AnotherFakeApi.kt src/main/kotlin/org/openapitools/client/apis/DefaultApi.kt @@ -59,57 +71,125 @@ src/main/kotlin/org/openapitools/client/apis/StoreApi.kt src/main/kotlin/org/openapitools/client/apis/UserApi.kt src/main/kotlin/org/openapitools/client/infrastructure/ApiAbstractions.kt src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt -src/main/kotlin/org/openapitools/client/infrastructure/ApiInfrastructureResponse.kt -src/main/kotlin/org/openapitools/client/infrastructure/ApplicationDelegates.kt +src/main/kotlin/org/openapitools/client/infrastructure/ApiResponse.kt +src/main/kotlin/org/openapitools/client/infrastructure/BigDecimalAdapter.kt +src/main/kotlin/org/openapitools/client/infrastructure/BigIntegerAdapter.kt src/main/kotlin/org/openapitools/client/infrastructure/ByteArrayAdapter.kt src/main/kotlin/org/openapitools/client/infrastructure/Errors.kt src/main/kotlin/org/openapitools/client/infrastructure/LocalDateAdapter.kt src/main/kotlin/org/openapitools/client/infrastructure/LocalDateTimeAdapter.kt src/main/kotlin/org/openapitools/client/infrastructure/OffsetDateTimeAdapter.kt +src/main/kotlin/org/openapitools/client/infrastructure/PartConfig.kt src/main/kotlin/org/openapitools/client/infrastructure/RequestConfig.kt src/main/kotlin/org/openapitools/client/infrastructure/RequestMethod.kt src/main/kotlin/org/openapitools/client/infrastructure/ResponseExtensions.kt src/main/kotlin/org/openapitools/client/infrastructure/Serializer.kt +src/main/kotlin/org/openapitools/client/infrastructure/URIAdapter.kt src/main/kotlin/org/openapitools/client/infrastructure/UUIDAdapter.kt src/main/kotlin/org/openapitools/client/models/AdditionalPropertiesClass.kt +src/main/kotlin/org/openapitools/client/models/AllOfWithSingleRef.kt src/main/kotlin/org/openapitools/client/models/Animal.kt -src/main/kotlin/org/openapitools/client/models/ApiResponse.kt src/main/kotlin/org/openapitools/client/models/ArrayOfArrayOfNumberOnly.kt src/main/kotlin/org/openapitools/client/models/ArrayOfNumberOnly.kt src/main/kotlin/org/openapitools/client/models/ArrayTest.kt src/main/kotlin/org/openapitools/client/models/Capitalization.kt src/main/kotlin/org/openapitools/client/models/Cat.kt -src/main/kotlin/org/openapitools/client/models/CatAllOf.kt src/main/kotlin/org/openapitools/client/models/Category.kt +src/main/kotlin/org/openapitools/client/models/ChildWithNullable.kt src/main/kotlin/org/openapitools/client/models/ClassModel.kt src/main/kotlin/org/openapitools/client/models/Client.kt +src/main/kotlin/org/openapitools/client/models/DeprecatedObject.kt src/main/kotlin/org/openapitools/client/models/Dog.kt -src/main/kotlin/org/openapitools/client/models/DogAllOf.kt src/main/kotlin/org/openapitools/client/models/EnumArrays.kt src/main/kotlin/org/openapitools/client/models/EnumClass.kt src/main/kotlin/org/openapitools/client/models/EnumTest.kt +src/main/kotlin/org/openapitools/client/models/FakeBigDecimalMap200Response.kt src/main/kotlin/org/openapitools/client/models/FileSchemaTestClass.kt src/main/kotlin/org/openapitools/client/models/Foo.kt +src/main/kotlin/org/openapitools/client/models/FooGetDefaultResponse.kt src/main/kotlin/org/openapitools/client/models/FormatTest.kt src/main/kotlin/org/openapitools/client/models/HasOnlyReadOnly.kt src/main/kotlin/org/openapitools/client/models/HealthCheckResult.kt -src/main/kotlin/org/openapitools/client/models/InlineResponseDefault.kt src/main/kotlin/org/openapitools/client/models/List.kt src/main/kotlin/org/openapitools/client/models/MapTest.kt src/main/kotlin/org/openapitools/client/models/MixedPropertiesAndAdditionalPropertiesClass.kt src/main/kotlin/org/openapitools/client/models/Model200Response.kt +src/main/kotlin/org/openapitools/client/models/ModelApiResponse.kt src/main/kotlin/org/openapitools/client/models/Name.kt src/main/kotlin/org/openapitools/client/models/NullableClass.kt src/main/kotlin/org/openapitools/client/models/NumberOnly.kt +src/main/kotlin/org/openapitools/client/models/ObjectWithDeprecatedFields.kt src/main/kotlin/org/openapitools/client/models/Order.kt src/main/kotlin/org/openapitools/client/models/OuterComposite.kt src/main/kotlin/org/openapitools/client/models/OuterEnum.kt src/main/kotlin/org/openapitools/client/models/OuterEnumDefaultValue.kt src/main/kotlin/org/openapitools/client/models/OuterEnumInteger.kt src/main/kotlin/org/openapitools/client/models/OuterEnumIntegerDefaultValue.kt +src/main/kotlin/org/openapitools/client/models/OuterObjectWithEnumProperty.kt +src/main/kotlin/org/openapitools/client/models/ParentWithNullable.kt src/main/kotlin/org/openapitools/client/models/Pet.kt src/main/kotlin/org/openapitools/client/models/ReadOnlyFirst.kt src/main/kotlin/org/openapitools/client/models/Return.kt +src/main/kotlin/org/openapitools/client/models/SingleRefType.kt src/main/kotlin/org/openapitools/client/models/SpecialModelname.kt src/main/kotlin/org/openapitools/client/models/Tag.kt +src/main/kotlin/org/openapitools/client/models/TestInlineFreeformAdditionalPropertiesRequest.kt src/main/kotlin/org/openapitools/client/models/User.kt +src/main/kotlin/org/openapitools/client/models/java.io.File.kt +src/test/kotlin/org/openapitools/client/apis/AnotherFakeApiTest.kt +src/test/kotlin/org/openapitools/client/apis/DefaultApiTest.kt +src/test/kotlin/org/openapitools/client/apis/FakeApiTest.kt +src/test/kotlin/org/openapitools/client/apis/FakeClassnameTags123ApiTest.kt +src/test/kotlin/org/openapitools/client/apis/PetApiTest.kt +src/test/kotlin/org/openapitools/client/apis/StoreApiTest.kt +src/test/kotlin/org/openapitools/client/apis/UserApiTest.kt +src/test/kotlin/org/openapitools/client/models/200ResponseTest.kt +src/test/kotlin/org/openapitools/client/models/AdditionalPropertiesClassTest.kt +src/test/kotlin/org/openapitools/client/models/AllOfWithSingleRefTest.kt +src/test/kotlin/org/openapitools/client/models/AnimalTest.kt +src/test/kotlin/org/openapitools/client/models/ApiResponseTest.kt +src/test/kotlin/org/openapitools/client/models/ArrayOfArrayOfNumberOnlyTest.kt +src/test/kotlin/org/openapitools/client/models/ArrayOfNumberOnlyTest.kt +src/test/kotlin/org/openapitools/client/models/ArrayTestTest.kt +src/test/kotlin/org/openapitools/client/models/CapitalizationTest.kt +src/test/kotlin/org/openapitools/client/models/CatTest.kt +src/test/kotlin/org/openapitools/client/models/CategoryTest.kt +src/test/kotlin/org/openapitools/client/models/ChildWithNullableTest.kt +src/test/kotlin/org/openapitools/client/models/ClassModelTest.kt +src/test/kotlin/org/openapitools/client/models/ClientTest.kt +src/test/kotlin/org/openapitools/client/models/DeprecatedObjectTest.kt +src/test/kotlin/org/openapitools/client/models/DogTest.kt +src/test/kotlin/org/openapitools/client/models/EnumArraysTest.kt +src/test/kotlin/org/openapitools/client/models/EnumClassTest.kt +src/test/kotlin/org/openapitools/client/models/EnumTestTest.kt +src/test/kotlin/org/openapitools/client/models/FakeBigDecimalMap200ResponseTest.kt +src/test/kotlin/org/openapitools/client/models/FileSchemaTestClassTest.kt +src/test/kotlin/org/openapitools/client/models/FileTest.kt +src/test/kotlin/org/openapitools/client/models/FooGetDefaultResponseTest.kt +src/test/kotlin/org/openapitools/client/models/FooTest.kt +src/test/kotlin/org/openapitools/client/models/FormatTestTest.kt +src/test/kotlin/org/openapitools/client/models/HasOnlyReadOnlyTest.kt +src/test/kotlin/org/openapitools/client/models/HealthCheckResultTest.kt +src/test/kotlin/org/openapitools/client/models/ListTest.kt +src/test/kotlin/org/openapitools/client/models/MapTestTest.kt +src/test/kotlin/org/openapitools/client/models/MixedPropertiesAndAdditionalPropertiesClassTest.kt +src/test/kotlin/org/openapitools/client/models/NameTest.kt +src/test/kotlin/org/openapitools/client/models/NullableClassTest.kt +src/test/kotlin/org/openapitools/client/models/NumberOnlyTest.kt +src/test/kotlin/org/openapitools/client/models/ObjectWithDeprecatedFieldsTest.kt +src/test/kotlin/org/openapitools/client/models/OrderTest.kt +src/test/kotlin/org/openapitools/client/models/OuterCompositeTest.kt +src/test/kotlin/org/openapitools/client/models/OuterEnumDefaultValueTest.kt +src/test/kotlin/org/openapitools/client/models/OuterEnumIntegerDefaultValueTest.kt +src/test/kotlin/org/openapitools/client/models/OuterEnumIntegerTest.kt +src/test/kotlin/org/openapitools/client/models/OuterEnumTest.kt +src/test/kotlin/org/openapitools/client/models/OuterObjectWithEnumPropertyTest.kt +src/test/kotlin/org/openapitools/client/models/ParentWithNullableTest.kt +src/test/kotlin/org/openapitools/client/models/PetTest.kt +src/test/kotlin/org/openapitools/client/models/ReadOnlyFirstTest.kt +src/test/kotlin/org/openapitools/client/models/ReturnTest.kt +src/test/kotlin/org/openapitools/client/models/SingleRefTypeTest.kt +src/test/kotlin/org/openapitools/client/models/SpecialModelNameTest.kt +src/test/kotlin/org/openapitools/client/models/TagTest.kt +src/test/kotlin/org/openapitools/client/models/TestInlineFreeformAdditionalPropertiesRequestTest.kt +src/test/kotlin/org/openapitools/client/models/UserTest.kt diff --git a/samples/openapi3/client/petstore/kotlin/.openapi-generator/VERSION b/samples/openapi3/client/petstore/kotlin/.openapi-generator/VERSION index 3fa3b389a57d..f7962df3e243 100644 --- a/samples/openapi3/client/petstore/kotlin/.openapi-generator/VERSION +++ b/samples/openapi3/client/petstore/kotlin/.openapi-generator/VERSION @@ -1 +1 @@ -5.0.1-SNAPSHOT \ No newline at end of file +7.22.0-SNAPSHOT diff --git a/samples/openapi3/client/petstore/kotlin/README.md b/samples/openapi3/client/petstore/kotlin/README.md index 760c3de3a887..53278cad2de2 100644 --- a/samples/openapi3/client/petstore/kotlin/README.md +++ b/samples/openapi3/client/petstore/kotlin/README.md @@ -1,9 +1,19 @@ # org.openapitools.client - Kotlin client library for OpenAPI Petstore +This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + +## Overview +This API client was generated by the [OpenAPI Generator](https://openapi-generator.tech) project. By using the [openapi-spec](https://github.com/OAI/OpenAPI-Specification) from a remote server, you can easily generate an API client. + +- API version: 1.0.0 +- Package version: +- Generator version: 7.22.0-SNAPSHOT +- Build package: org.openapitools.codegen.languages.KotlinClientCodegen + ## Requires -* Kotlin 1.3.61 -* Gradle 4.9 +* Kotlin 2.2.20 +* Gradle 8.14 ## Build @@ -28,140 +38,157 @@ This runs all tests and packages the library. * Some Kotlin and Java types are fully qualified to avoid conflicts with types defined in OpenAPI definitions. * Implementation of ApiClient is intended to reduce method counts, specifically to benefit Android targets. - + ## Documentation for API Endpoints All URIs are relative to *http://petstore.swagger.io:80/v2* -Class | Method | HTTP request | Description ------------- | ------------- | ------------- | ------------- -*AnotherFakeApi* | [**call123testSpecialTags**](docs/AnotherFakeApi.md#call123testspecialtags) | **PATCH** /another-fake/dummy | To test special tags -*DefaultApi* | [**fooGet**](docs/DefaultApi.md#fooget) | **GET** /foo | -*FakeApi* | [**fakeHealthGet**](docs/FakeApi.md#fakehealthget) | **GET** /fake/health | Health check endpoint -*FakeApi* | [**fakeHttpSignatureTest**](docs/FakeApi.md#fakehttpsignaturetest) | **GET** /fake/http-signature-test | test http signature authentication -*FakeApi* | [**fakeOuterBooleanSerialize**](docs/FakeApi.md#fakeouterbooleanserialize) | **POST** /fake/outer/boolean | -*FakeApi* | [**fakeOuterCompositeSerialize**](docs/FakeApi.md#fakeoutercompositeserialize) | **POST** /fake/outer/composite | -*FakeApi* | [**fakeOuterNumberSerialize**](docs/FakeApi.md#fakeouternumberserialize) | **POST** /fake/outer/number | -*FakeApi* | [**fakeOuterStringSerialize**](docs/FakeApi.md#fakeouterstringserialize) | **POST** /fake/outer/string | -*FakeApi* | [**testBodyWithFileSchema**](docs/FakeApi.md#testbodywithfileschema) | **PUT** /fake/body-with-file-schema | -*FakeApi* | [**testBodyWithQueryParams**](docs/FakeApi.md#testbodywithqueryparams) | **PUT** /fake/body-with-query-params | -*FakeApi* | [**testClientModel**](docs/FakeApi.md#testclientmodel) | **PATCH** /fake | To test \"client\" model -*FakeApi* | [**testEndpointParameters**](docs/FakeApi.md#testendpointparameters) | **POST** /fake | Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 -*FakeApi* | [**testEnumParameters**](docs/FakeApi.md#testenumparameters) | **GET** /fake | To test enum parameters -*FakeApi* | [**testGroupParameters**](docs/FakeApi.md#testgroupparameters) | **DELETE** /fake | Fake endpoint to test group parameters (optional) -*FakeApi* | [**testInlineAdditionalProperties**](docs/FakeApi.md#testinlineadditionalproperties) | **POST** /fake/inline-additionalProperties | test inline additionalProperties -*FakeApi* | [**testJsonFormData**](docs/FakeApi.md#testjsonformdata) | **GET** /fake/jsonFormData | test json serialization of form data -*FakeApi* | [**testQueryParameterCollectionFormat**](docs/FakeApi.md#testqueryparametercollectionformat) | **PUT** /fake/test-query-parameters | -*FakeClassnameTags123Api* | [**testClassname**](docs/FakeClassnameTags123Api.md#testclassname) | **PATCH** /fake_classname_test | To test class name in snake case -*PetApi* | [**addPet**](docs/PetApi.md#addpet) | **POST** /pet | Add a new pet to the store -*PetApi* | [**deletePet**](docs/PetApi.md#deletepet) | **DELETE** /pet/{petId} | Deletes a pet -*PetApi* | [**findPetsByStatus**](docs/PetApi.md#findpetsbystatus) | **GET** /pet/findByStatus | Finds Pets by status -*PetApi* | [**findPetsByTags**](docs/PetApi.md#findpetsbytags) | **GET** /pet/findByTags | Finds Pets by tags -*PetApi* | [**getPetById**](docs/PetApi.md#getpetbyid) | **GET** /pet/{petId} | Find pet by ID -*PetApi* | [**updatePet**](docs/PetApi.md#updatepet) | **PUT** /pet | Update an existing pet -*PetApi* | [**updatePetWithForm**](docs/PetApi.md#updatepetwithform) | **POST** /pet/{petId} | Updates a pet in the store with form data -*PetApi* | [**uploadFile**](docs/PetApi.md#uploadfile) | **POST** /pet/{petId}/uploadImage | uploads an image -*PetApi* | [**uploadFileWithRequiredFile**](docs/PetApi.md#uploadfilewithrequiredfile) | **POST** /fake/{petId}/uploadImageWithRequiredFile | uploads an image (required) -*StoreApi* | [**deleteOrder**](docs/StoreApi.md#deleteorder) | **DELETE** /store/order/{order_id} | Delete purchase order by ID -*StoreApi* | [**getInventory**](docs/StoreApi.md#getinventory) | **GET** /store/inventory | Returns pet inventories by status -*StoreApi* | [**getOrderById**](docs/StoreApi.md#getorderbyid) | **GET** /store/order/{order_id} | Find purchase order by ID -*StoreApi* | [**placeOrder**](docs/StoreApi.md#placeorder) | **POST** /store/order | Place an order for a pet -*UserApi* | [**createUser**](docs/UserApi.md#createuser) | **POST** /user | Create user -*UserApi* | [**createUsersWithArrayInput**](docs/UserApi.md#createuserswitharrayinput) | **POST** /user/createWithArray | Creates list of users with given input array -*UserApi* | [**createUsersWithListInput**](docs/UserApi.md#createuserswithlistinput) | **POST** /user/createWithList | Creates list of users with given input array -*UserApi* | [**deleteUser**](docs/UserApi.md#deleteuser) | **DELETE** /user/{username} | Delete user -*UserApi* | [**getUserByName**](docs/UserApi.md#getuserbyname) | **GET** /user/{username} | Get user by user name -*UserApi* | [**loginUser**](docs/UserApi.md#loginuser) | **GET** /user/login | Logs user into the system -*UserApi* | [**logoutUser**](docs/UserApi.md#logoutuser) | **GET** /user/logout | Logs out current logged in user session -*UserApi* | [**updateUser**](docs/UserApi.md#updateuser) | **PUT** /user/{username} | Updated user - - - +| Class | Method | HTTP request | Description | +| ------------ | ------------- | ------------- | ------------- | +| *AnotherFakeApi* | [**call123testSpecialTags**](docs/AnotherFakeApi.md#call123testspecialtags) | **PATCH** /another-fake/dummy | To test special tags | +| *DefaultApi* | [**fooGet**](docs/DefaultApi.md#fooget) | **GET** /foo | | +| *FakeApi* | [**fakeBigDecimalMap**](docs/FakeApi.md#fakebigdecimalmap) | **GET** /fake/BigDecimalMap | | +| *FakeApi* | [**fakeHealthGet**](docs/FakeApi.md#fakehealthget) | **GET** /fake/health | Health check endpoint | +| *FakeApi* | [**fakeHttpSignatureTest**](docs/FakeApi.md#fakehttpsignaturetest) | **GET** /fake/http-signature-test | test http signature authentication | +| *FakeApi* | [**fakeOuterBooleanSerialize**](docs/FakeApi.md#fakeouterbooleanserialize) | **POST** /fake/outer/boolean | | +| *FakeApi* | [**fakeOuterCompositeSerialize**](docs/FakeApi.md#fakeoutercompositeserialize) | **POST** /fake/outer/composite | | +| *FakeApi* | [**fakeOuterNumberSerialize**](docs/FakeApi.md#fakeouternumberserialize) | **POST** /fake/outer/number | | +| *FakeApi* | [**fakeOuterStringSerialize**](docs/FakeApi.md#fakeouterstringserialize) | **POST** /fake/outer/string | | +| *FakeApi* | [**fakePropertyEnumIntegerSerialize**](docs/FakeApi.md#fakepropertyenumintegerserialize) | **POST** /fake/property/enum-int | | +| *FakeApi* | [**testAdditionalPropertiesReference**](docs/FakeApi.md#testadditionalpropertiesreference) | **POST** /fake/additionalProperties-reference | test referenced additionalProperties | +| *FakeApi* | [**testBodyWithBinary**](docs/FakeApi.md#testbodywithbinary) | **PUT** /fake/body-with-binary | | +| *FakeApi* | [**testBodyWithFileSchema**](docs/FakeApi.md#testbodywithfileschema) | **PUT** /fake/body-with-file-schema | | +| *FakeApi* | [**testBodyWithQueryParams**](docs/FakeApi.md#testbodywithqueryparams) | **PUT** /fake/body-with-query-params | | +| *FakeApi* | [**testClientModel**](docs/FakeApi.md#testclientmodel) | **PATCH** /fake | To test \"client\" model | +| *FakeApi* | [**testEndpointParameters**](docs/FakeApi.md#testendpointparameters) | **POST** /fake | Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 | +| *FakeApi* | [**testEnumParameters**](docs/FakeApi.md#testenumparameters) | **GET** /fake | To test enum parameters | +| *FakeApi* | [**testGroupParameters**](docs/FakeApi.md#testgroupparameters) | **DELETE** /fake | Fake endpoint to test group parameters (optional) | +| *FakeApi* | [**testInlineAdditionalProperties**](docs/FakeApi.md#testinlineadditionalproperties) | **POST** /fake/inline-additionalProperties | test inline additionalProperties | +| *FakeApi* | [**testInlineFreeformAdditionalProperties**](docs/FakeApi.md#testinlinefreeformadditionalproperties) | **POST** /fake/inline-freeform-additionalProperties | test inline free-form additionalProperties | +| *FakeApi* | [**testJsonFormData**](docs/FakeApi.md#testjsonformdata) | **GET** /fake/jsonFormData | test json serialization of form data | +| *FakeApi* | [**testNullable**](docs/FakeApi.md#testnullable) | **POST** /fake/nullable | test nullable parent property | +| *FakeApi* | [**testQueryParameterCollectionFormat**](docs/FakeApi.md#testqueryparametercollectionformat) | **PUT** /fake/test-query-parameters | | +| *FakeApi* | [**testStringMapReference**](docs/FakeApi.md#teststringmapreference) | **POST** /fake/stringMap-reference | test referenced string map | +| *FakeClassnameTags123Api* | [**testClassname**](docs/FakeClassnameTags123Api.md#testclassname) | **PATCH** /fake_classname_test | To test class name in snake case | +| *PetApi* | [**addPet**](docs/PetApi.md#addpet) | **POST** /pet | Add a new pet to the store | +| *PetApi* | [**deletePet**](docs/PetApi.md#deletepet) | **DELETE** /pet/{petId} | Deletes a pet | +| *PetApi* | [**findPetsByStatus**](docs/PetApi.md#findpetsbystatus) | **GET** /pet/findByStatus | Finds Pets by status | +| *PetApi* | [**findPetsByTags**](docs/PetApi.md#findpetsbytags) | **GET** /pet/findByTags | Finds Pets by tags | +| *PetApi* | [**getPetById**](docs/PetApi.md#getpetbyid) | **GET** /pet/{petId} | Find pet by ID | +| *PetApi* | [**updatePet**](docs/PetApi.md#updatepet) | **PUT** /pet | Update an existing pet | +| *PetApi* | [**updatePetWithForm**](docs/PetApi.md#updatepetwithform) | **POST** /pet/{petId} | Updates a pet in the store with form data | +| *PetApi* | [**uploadFile**](docs/PetApi.md#uploadfile) | **POST** /pet/{petId}/uploadImage | uploads an image | +| *PetApi* | [**uploadFileWithRequiredFile**](docs/PetApi.md#uploadfilewithrequiredfile) | **POST** /fake/{petId}/uploadImageWithRequiredFile | uploads an image (required) | +| *StoreApi* | [**deleteOrder**](docs/StoreApi.md#deleteorder) | **DELETE** /store/order/{order_id} | Delete purchase order by ID | +| *StoreApi* | [**getInventory**](docs/StoreApi.md#getinventory) | **GET** /store/inventory | Returns pet inventories by status | +| *StoreApi* | [**getOrderById**](docs/StoreApi.md#getorderbyid) | **GET** /store/order/{order_id} | Find purchase order by ID | +| *StoreApi* | [**placeOrder**](docs/StoreApi.md#placeorder) | **POST** /store/order | Place an order for a pet | +| *UserApi* | [**createUser**](docs/UserApi.md#createuser) | **POST** /user | Create user | +| *UserApi* | [**createUsersWithArrayInput**](docs/UserApi.md#createuserswitharrayinput) | **POST** /user/createWithArray | Creates list of users with given input array | +| *UserApi* | [**createUsersWithListInput**](docs/UserApi.md#createuserswithlistinput) | **POST** /user/createWithList | Creates list of users with given input array | +| *UserApi* | [**deleteUser**](docs/UserApi.md#deleteuser) | **DELETE** /user/{username} | Delete user | +| *UserApi* | [**getUserByName**](docs/UserApi.md#getuserbyname) | **GET** /user/{username} | Get user by user name | +| *UserApi* | [**loginUser**](docs/UserApi.md#loginuser) | **GET** /user/login | Logs user into the system | +| *UserApi* | [**logoutUser**](docs/UserApi.md#logoutuser) | **GET** /user/logout | Logs out current logged in user session | +| *UserApi* | [**updateUser**](docs/UserApi.md#updateuser) | **PUT** /user/{username} | Updated user | + + + ## Documentation for Models - [org.openapitools.client.models.AdditionalPropertiesClass](docs/AdditionalPropertiesClass.md) + - [org.openapitools.client.models.AllOfWithSingleRef](docs/AllOfWithSingleRef.md) - [org.openapitools.client.models.Animal](docs/Animal.md) - - [org.openapitools.client.models.ApiResponse](docs/ApiResponse.md) - [org.openapitools.client.models.ArrayOfArrayOfNumberOnly](docs/ArrayOfArrayOfNumberOnly.md) - [org.openapitools.client.models.ArrayOfNumberOnly](docs/ArrayOfNumberOnly.md) - [org.openapitools.client.models.ArrayTest](docs/ArrayTest.md) - [org.openapitools.client.models.Capitalization](docs/Capitalization.md) - [org.openapitools.client.models.Cat](docs/Cat.md) - - [org.openapitools.client.models.CatAllOf](docs/CatAllOf.md) - [org.openapitools.client.models.Category](docs/Category.md) + - [org.openapitools.client.models.ChildWithNullable](docs/ChildWithNullable.md) - [org.openapitools.client.models.ClassModel](docs/ClassModel.md) - [org.openapitools.client.models.Client](docs/Client.md) + - [org.openapitools.client.models.DeprecatedObject](docs/DeprecatedObject.md) - [org.openapitools.client.models.Dog](docs/Dog.md) - - [org.openapitools.client.models.DogAllOf](docs/DogAllOf.md) - [org.openapitools.client.models.EnumArrays](docs/EnumArrays.md) - [org.openapitools.client.models.EnumClass](docs/EnumClass.md) - [org.openapitools.client.models.EnumTest](docs/EnumTest.md) + - [org.openapitools.client.models.FakeBigDecimalMap200Response](docs/FakeBigDecimalMap200Response.md) - [org.openapitools.client.models.FileSchemaTestClass](docs/FileSchemaTestClass.md) - [org.openapitools.client.models.Foo](docs/Foo.md) + - [org.openapitools.client.models.FooGetDefaultResponse](docs/FooGetDefaultResponse.md) - [org.openapitools.client.models.FormatTest](docs/FormatTest.md) - [org.openapitools.client.models.HasOnlyReadOnly](docs/HasOnlyReadOnly.md) - [org.openapitools.client.models.HealthCheckResult](docs/HealthCheckResult.md) - - [org.openapitools.client.models.InlineResponseDefault](docs/InlineResponseDefault.md) - [org.openapitools.client.models.List](docs/List.md) - [org.openapitools.client.models.MapTest](docs/MapTest.md) - [org.openapitools.client.models.MixedPropertiesAndAdditionalPropertiesClass](docs/MixedPropertiesAndAdditionalPropertiesClass.md) - [org.openapitools.client.models.Model200Response](docs/Model200Response.md) + - [org.openapitools.client.models.ModelApiResponse](docs/ModelApiResponse.md) - [org.openapitools.client.models.Name](docs/Name.md) - [org.openapitools.client.models.NullableClass](docs/NullableClass.md) - [org.openapitools.client.models.NumberOnly](docs/NumberOnly.md) + - [org.openapitools.client.models.ObjectWithDeprecatedFields](docs/ObjectWithDeprecatedFields.md) - [org.openapitools.client.models.Order](docs/Order.md) - [org.openapitools.client.models.OuterComposite](docs/OuterComposite.md) - [org.openapitools.client.models.OuterEnum](docs/OuterEnum.md) - [org.openapitools.client.models.OuterEnumDefaultValue](docs/OuterEnumDefaultValue.md) - [org.openapitools.client.models.OuterEnumInteger](docs/OuterEnumInteger.md) - [org.openapitools.client.models.OuterEnumIntegerDefaultValue](docs/OuterEnumIntegerDefaultValue.md) + - [org.openapitools.client.models.OuterObjectWithEnumProperty](docs/OuterObjectWithEnumProperty.md) + - [org.openapitools.client.models.ParentWithNullable](docs/ParentWithNullable.md) - [org.openapitools.client.models.Pet](docs/Pet.md) - [org.openapitools.client.models.ReadOnlyFirst](docs/ReadOnlyFirst.md) - [org.openapitools.client.models.Return](docs/Return.md) + - [org.openapitools.client.models.SingleRefType](docs/SingleRefType.md) - [org.openapitools.client.models.SpecialModelname](docs/SpecialModelname.md) - [org.openapitools.client.models.Tag](docs/Tag.md) + - [org.openapitools.client.models.TestInlineFreeformAdditionalPropertiesRequest](docs/TestInlineFreeformAdditionalPropertiesRequest.md) - [org.openapitools.client.models.User](docs/User.md) + - [org.openapitools.client.models.java.io.File](docs/java.io.File.md) - + ## Documentation for Authorization - + +Authentication schemes defined for the API: + +### petstore_auth + +- **Type**: OAuth +- **Flow**: implicit +- **Authorization URL**: http://petstore.swagger.io/api/oauth/dialog +- **Scopes**: + - write:pets: modify pets in your account + - read:pets: read your pets + + ### api_key - **Type**: API key - **API key parameter name**: api_key - **Location**: HTTP header - + ### api_key_query - **Type**: API key - **API key parameter name**: api_key_query - **Location**: URL query string - -### bearer_test - -- **Type**: HTTP basic authentication - - + ### http_basic_test - **Type**: HTTP basic authentication - -### http_signature_test + +### bearer_test -- **Type**: HTTP basic authentication +- **Type**: HTTP Bearer Token authentication (JWT) - -### petstore_auth + +### http_signature_test -- **Type**: OAuth -- **Flow**: implicit -- **Authorization URL**: http://petstore.swagger.io/api/oauth/dialog -- **Scopes**: - - write:pets: modify pets in your account - - read:pets: read your pets +- **Type**: HTTP signature authentication diff --git a/samples/openapi3/client/petstore/kotlin/build.gradle b/samples/openapi3/client/petstore/kotlin/build.gradle index 56be0bd0dd87..1737ce9d75f9 100644 --- a/samples/openapi3/client/petstore/kotlin/build.gradle +++ b/samples/openapi3/client/petstore/kotlin/build.gradle @@ -2,36 +2,76 @@ group 'org.openapitools' version '1.0.0' wrapper { - gradleVersion = '4.9' + gradleVersion = '8.14.3' distributionUrl = "https://services.gradle.org/distributions/gradle-$gradleVersion-all.zip" } buildscript { - ext.kotlin_version = '1.3.61' + ext.kotlin_version = '2.2.20' + ext.spotless_version = "7.2.1" repositories { maven { url "https://repo1.maven.org/maven2" } } dependencies { classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" + classpath "com.diffplug.spotless:spotless-plugin-gradle:$spotless_version" } } apply plugin: 'kotlin' +apply plugin: 'maven-publish' +apply plugin: 'com.diffplug.spotless' repositories { maven { url "https://repo1.maven.org/maven2" } } +// Use spotless plugin to automatically format code, remove unused import, etc +// To apply changes directly to the file, run `gradlew spotlessApply` +// Ref: https://github.com/diffplug/spotless/tree/main/plugin-gradle +spotless { + // comment out below to run spotless as part of the `check` task + enforceCheck false + + format 'misc', { + // define the files (e.g. '*.gradle', '*.md') to apply `misc` to + target '.gitignore' + + // define the steps to apply to those files + trimTrailingWhitespace() + indentWithSpaces() // Takes an integer argument if you don't like 4 + endWithNewline() + } + kotlin { + ktfmt() + } +} + test { useJUnitPlatform() } dependencies { - compile "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version" - compile "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version" - compile "com.squareup.moshi:moshi-kotlin:1.9.2" - compile "com.squareup.moshi:moshi-adapters:1.9.2" - compile "com.squareup.okhttp3:okhttp:4.2.2" - testCompile "io.kotlintest:kotlintest-runner-junit5:3.1.0" + implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version" + implementation "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version" + implementation "com.squareup.moshi:moshi-kotlin:1.15.2" + implementation "com.squareup.moshi:moshi-adapters:1.15.2" + implementation "com.squareup.okhttp3:okhttp:5.1.0" + testImplementation "io.kotlintest:kotlintest-runner-junit5:3.4.2" +} + +java { + withSourcesJar() +} + +publishing { + publications { + maven(MavenPublication) { + groupId = 'org.openapitools' + artifactId = 'kotlin-petstore-client' + version = '1.0.0' + from components.java + } + } } diff --git a/samples/openapi3/client/petstore/kotlin/docs/200Response.md b/samples/openapi3/client/petstore/kotlin/docs/200Response.md index 53c1edacfb84..b7c5d1c68e29 100644 --- a/samples/openapi3/client/petstore/kotlin/docs/200Response.md +++ b/samples/openapi3/client/petstore/kotlin/docs/200Response.md @@ -2,10 +2,10 @@ # Model200Response ## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**name** | **kotlin.Int** | | [optional] -**propertyClass** | **kotlin.String** | | [optional] +| Name | Type | Description | Notes | +| ------------ | ------------- | ------------- | ------------- | +| **name** | **kotlin.Int** | | [optional] | +| **propertyClass** | **kotlin.String** | | [optional] | diff --git a/samples/openapi3/client/petstore/kotlin/docs/AdditionalPropertiesClass.md b/samples/openapi3/client/petstore/kotlin/docs/AdditionalPropertiesClass.md index 1025301ce946..418082a7d642 100644 --- a/samples/openapi3/client/petstore/kotlin/docs/AdditionalPropertiesClass.md +++ b/samples/openapi3/client/petstore/kotlin/docs/AdditionalPropertiesClass.md @@ -2,10 +2,10 @@ # AdditionalPropertiesClass ## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**mapProperty** | **kotlin.collections.Map<kotlin.String, kotlin.String>** | | [optional] -**mapOfMapProperty** | **kotlin.collections.Map<kotlin.String, kotlin.collections.Map<kotlin.String, kotlin.String>>** | | [optional] +| Name | Type | Description | Notes | +| ------------ | ------------- | ------------- | ------------- | +| **mapProperty** | **kotlin.collections.Map<kotlin.String, kotlin.String>** | | [optional] | +| **mapOfMapProperty** | **kotlin.collections.Map<kotlin.String, kotlin.collections.Map<kotlin.String, kotlin.String>>** | | [optional] | diff --git a/samples/openapi3/client/petstore/kotlin/docs/AllOfWithSingleRef.md b/samples/openapi3/client/petstore/kotlin/docs/AllOfWithSingleRef.md new file mode 100644 index 000000000000..0660a77588af --- /dev/null +++ b/samples/openapi3/client/petstore/kotlin/docs/AllOfWithSingleRef.md @@ -0,0 +1,11 @@ + +# AllOfWithSingleRef + +## Properties +| Name | Type | Description | Notes | +| ------------ | ------------- | ------------- | ------------- | +| **username** | **kotlin.String** | | [optional] | +| **singleRefType** | [**SingleRefType**](SingleRefType.md) | | [optional] | + + + diff --git a/samples/openapi3/client/petstore/kotlin/docs/Animal.md b/samples/openapi3/client/petstore/kotlin/docs/Animal.md index 5ce5a4972c8c..494c7fcd6c5d 100644 --- a/samples/openapi3/client/petstore/kotlin/docs/Animal.md +++ b/samples/openapi3/client/petstore/kotlin/docs/Animal.md @@ -2,10 +2,10 @@ # Animal ## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**className** | **kotlin.String** | | -**color** | **kotlin.String** | | [optional] +| Name | Type | Description | Notes | +| ------------ | ------------- | ------------- | ------------- | +| **className** | **kotlin.String** | | | +| **color** | **kotlin.String** | | [optional] | diff --git a/samples/openapi3/client/petstore/kotlin/docs/AnotherFakeApi.md b/samples/openapi3/client/petstore/kotlin/docs/AnotherFakeApi.md index 55d482238db4..a9ce207f39b6 100644 --- a/samples/openapi3/client/petstore/kotlin/docs/AnotherFakeApi.md +++ b/samples/openapi3/client/petstore/kotlin/docs/AnotherFakeApi.md @@ -2,12 +2,12 @@ All URIs are relative to *http://petstore.swagger.io:80/v2* -Method | HTTP request | Description -------------- | ------------- | ------------- -[**call123testSpecialTags**](AnotherFakeApi.md#call123testSpecialTags) | **PATCH** /another-fake/dummy | To test special tags +| Method | HTTP request | Description | +| ------------- | ------------- | ------------- | +| [**call123testSpecialTags**](AnotherFakeApi.md#call123testSpecialTags) | **PATCH** /another-fake/dummy | To test special tags | - + # **call123testSpecialTags** > Client call123testSpecialTags(client) @@ -36,10 +36,9 @@ try { ``` ### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **client** | [**Client**](Client.md)| client model | +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **client** | [**Client**](Client.md)| client model | | ### Return type diff --git a/samples/openapi3/client/petstore/kotlin/docs/ApiResponse.md b/samples/openapi3/client/petstore/kotlin/docs/ApiResponse.md index 6b4c6bf27795..059525a99512 100644 --- a/samples/openapi3/client/petstore/kotlin/docs/ApiResponse.md +++ b/samples/openapi3/client/petstore/kotlin/docs/ApiResponse.md @@ -1,12 +1,12 @@ -# ApiResponse +# ModelApiResponse ## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**code** | **kotlin.Int** | | [optional] -**type** | **kotlin.String** | | [optional] -**message** | **kotlin.String** | | [optional] +| Name | Type | Description | Notes | +| ------------ | ------------- | ------------- | ------------- | +| **code** | **kotlin.Int** | | [optional] | +| **type** | **kotlin.String** | | [optional] | +| **message** | **kotlin.String** | | [optional] | diff --git a/samples/openapi3/client/petstore/kotlin/docs/ArrayOfArrayOfNumberOnly.md b/samples/openapi3/client/petstore/kotlin/docs/ArrayOfArrayOfNumberOnly.md index bcc306caeb6d..8483665f1513 100644 --- a/samples/openapi3/client/petstore/kotlin/docs/ArrayOfArrayOfNumberOnly.md +++ b/samples/openapi3/client/petstore/kotlin/docs/ArrayOfArrayOfNumberOnly.md @@ -2,9 +2,9 @@ # ArrayOfArrayOfNumberOnly ## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**arrayArrayNumber** | **kotlin.collections.List<kotlin.collections.List<java.math.BigDecimal>>** | | [optional] +| Name | Type | Description | Notes | +| ------------ | ------------- | ------------- | ------------- | +| **arrayArrayNumber** | **kotlin.collections.List<kotlin.collections.List<java.math.BigDecimal>>** | | [optional] | diff --git a/samples/openapi3/client/petstore/kotlin/docs/ArrayOfNumberOnly.md b/samples/openapi3/client/petstore/kotlin/docs/ArrayOfNumberOnly.md index 00c57a7885e8..5e1c041bb9f7 100644 --- a/samples/openapi3/client/petstore/kotlin/docs/ArrayOfNumberOnly.md +++ b/samples/openapi3/client/petstore/kotlin/docs/ArrayOfNumberOnly.md @@ -2,9 +2,9 @@ # ArrayOfNumberOnly ## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**arrayNumber** | [**kotlin.collections.List<java.math.BigDecimal>**](java.math.BigDecimal.md) | | [optional] +| Name | Type | Description | Notes | +| ------------ | ------------- | ------------- | ------------- | +| **arrayNumber** | [**kotlin.collections.List<java.math.BigDecimal>**](java.math.BigDecimal.md) | | [optional] | diff --git a/samples/openapi3/client/petstore/kotlin/docs/ArrayTest.md b/samples/openapi3/client/petstore/kotlin/docs/ArrayTest.md index 45e59c8fe77c..7aec1a299b29 100644 --- a/samples/openapi3/client/petstore/kotlin/docs/ArrayTest.md +++ b/samples/openapi3/client/petstore/kotlin/docs/ArrayTest.md @@ -2,11 +2,11 @@ # ArrayTest ## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**arrayOfString** | **kotlin.collections.List<kotlin.String>** | | [optional] -**arrayArrayOfInteger** | **kotlin.collections.List<kotlin.collections.List<kotlin.Long>>** | | [optional] -**arrayArrayOfModel** | **kotlin.collections.List<kotlin.collections.List<ReadOnlyFirst>>** | | [optional] +| Name | Type | Description | Notes | +| ------------ | ------------- | ------------- | ------------- | +| **arrayOfString** | **kotlin.collections.List<kotlin.String>** | | [optional] | +| **arrayArrayOfInteger** | **kotlin.collections.List<kotlin.collections.List<kotlin.Long>>** | | [optional] | +| **arrayArrayOfModel** | **kotlin.collections.List<kotlin.collections.List<ReadOnlyFirst>>** | | [optional] | diff --git a/samples/openapi3/client/petstore/kotlin/docs/Capitalization.md b/samples/openapi3/client/petstore/kotlin/docs/Capitalization.md index 9d44a82fb7ff..30f2fa04c61a 100644 --- a/samples/openapi3/client/petstore/kotlin/docs/Capitalization.md +++ b/samples/openapi3/client/petstore/kotlin/docs/Capitalization.md @@ -2,14 +2,15 @@ # Capitalization ## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**smallCamel** | **kotlin.String** | | [optional] -**capitalCamel** | **kotlin.String** | | [optional] -**smallSnake** | **kotlin.String** | | [optional] -**capitalSnake** | **kotlin.String** | | [optional] -**scAETHFlowPoints** | **kotlin.String** | | [optional] -**ATT_NAME** | **kotlin.String** | Name of the pet | [optional] +| Name | Type | Description | Notes | +| ------------ | ------------- | ------------- | ------------- | +| **smallCamel** | **kotlin.String** | | [optional] | +| **capitalCamel** | **kotlin.String** | | [optional] | +| **smallSnake** | **kotlin.String** | | [optional] | +| **capitalSnake** | **kotlin.String** | | [optional] | +| **scAETHFlowPoints** | **kotlin.String** | | [optional] | +| **ATT_NAME** | **kotlin.String** | Name of the pet + | [optional] | diff --git a/samples/openapi3/client/petstore/kotlin/docs/Cat.md b/samples/openapi3/client/petstore/kotlin/docs/Cat.md index b6da7c47cedd..6901dc7d977c 100644 --- a/samples/openapi3/client/petstore/kotlin/docs/Cat.md +++ b/samples/openapi3/client/petstore/kotlin/docs/Cat.md @@ -2,9 +2,9 @@ # Cat ## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**declawed** | **kotlin.Boolean** | | [optional] +| Name | Type | Description | Notes | +| ------------ | ------------- | ------------- | ------------- | +| **declawed** | **kotlin.Boolean** | | [optional] | diff --git a/samples/openapi3/client/petstore/kotlin/docs/Category.md b/samples/openapi3/client/petstore/kotlin/docs/Category.md index 1f12c3eb1582..5b9ec7b71f65 100644 --- a/samples/openapi3/client/petstore/kotlin/docs/Category.md +++ b/samples/openapi3/client/petstore/kotlin/docs/Category.md @@ -2,10 +2,10 @@ # Category ## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**name** | **kotlin.String** | | -**id** | **kotlin.Long** | | [optional] +| Name | Type | Description | Notes | +| ------------ | ------------- | ------------- | ------------- | +| **name** | **kotlin.String** | | | +| **id** | **kotlin.Long** | | [optional] | diff --git a/samples/openapi3/client/petstore/kotlin/docs/ChildWithNullable.md b/samples/openapi3/client/petstore/kotlin/docs/ChildWithNullable.md new file mode 100644 index 000000000000..4525bb143073 --- /dev/null +++ b/samples/openapi3/client/petstore/kotlin/docs/ChildWithNullable.md @@ -0,0 +1,10 @@ + +# ChildWithNullable + +## Properties +| Name | Type | Description | Notes | +| ------------ | ------------- | ------------- | ------------- | +| **otherProperty** | **kotlin.String** | | [optional] | + + + diff --git a/samples/openapi3/client/petstore/kotlin/docs/ClassModel.md b/samples/openapi3/client/petstore/kotlin/docs/ClassModel.md index 50ad61b51a56..884046b6bada 100644 --- a/samples/openapi3/client/petstore/kotlin/docs/ClassModel.md +++ b/samples/openapi3/client/petstore/kotlin/docs/ClassModel.md @@ -2,9 +2,9 @@ # ClassModel ## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**propertyClass** | **kotlin.String** | | [optional] +| Name | Type | Description | Notes | +| ------------ | ------------- | ------------- | ------------- | +| **propertyClass** | **kotlin.String** | | [optional] | diff --git a/samples/openapi3/client/petstore/kotlin/docs/Client.md b/samples/openapi3/client/petstore/kotlin/docs/Client.md index 11afbcf0c9f5..140c8bb82c9c 100644 --- a/samples/openapi3/client/petstore/kotlin/docs/Client.md +++ b/samples/openapi3/client/petstore/kotlin/docs/Client.md @@ -2,9 +2,9 @@ # Client ## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**client** | **kotlin.String** | | [optional] +| Name | Type | Description | Notes | +| ------------ | ------------- | ------------- | ------------- | +| **client** | **kotlin.String** | | [optional] | diff --git a/samples/openapi3/client/petstore/kotlin/docs/DefaultApi.md b/samples/openapi3/client/petstore/kotlin/docs/DefaultApi.md index 784be537594d..6b0314bd115d 100644 --- a/samples/openapi3/client/petstore/kotlin/docs/DefaultApi.md +++ b/samples/openapi3/client/petstore/kotlin/docs/DefaultApi.md @@ -2,14 +2,14 @@ All URIs are relative to *http://petstore.swagger.io:80/v2* -Method | HTTP request | Description -------------- | ------------- | ------------- -[**fooGet**](DefaultApi.md#fooGet) | **GET** /foo | +| Method | HTTP request | Description | +| ------------- | ------------- | ------------- | +| [**fooGet**](DefaultApi.md#fooGet) | **GET** /foo | | - + # **fooGet** -> InlineResponseDefault fooGet() +> FooGetDefaultResponse fooGet() @@ -21,7 +21,7 @@ Method | HTTP request | Description val apiInstance = DefaultApi() try { - val result : InlineResponseDefault = apiInstance.fooGet() + val result : FooGetDefaultResponse = apiInstance.fooGet() println(result) } catch (e: ClientException) { println("4xx response calling DefaultApi#fooGet") @@ -37,7 +37,7 @@ This endpoint does not need any parameter. ### Return type -[**InlineResponseDefault**](InlineResponseDefault.md) +[**FooGetDefaultResponse**](FooGetDefaultResponse.md) ### Authorization diff --git a/samples/openapi3/client/petstore/kotlin/docs/DeprecatedObject.md b/samples/openapi3/client/petstore/kotlin/docs/DeprecatedObject.md new file mode 100644 index 000000000000..050fa955a988 --- /dev/null +++ b/samples/openapi3/client/petstore/kotlin/docs/DeprecatedObject.md @@ -0,0 +1,10 @@ + +# DeprecatedObject + +## Properties +| Name | Type | Description | Notes | +| ------------ | ------------- | ------------- | ------------- | +| **name** | **kotlin.String** | | [optional] | + + + diff --git a/samples/openapi3/client/petstore/kotlin/docs/Dog.md b/samples/openapi3/client/petstore/kotlin/docs/Dog.md index 41d9c6ba0d17..e859fa8814cc 100644 --- a/samples/openapi3/client/petstore/kotlin/docs/Dog.md +++ b/samples/openapi3/client/petstore/kotlin/docs/Dog.md @@ -2,9 +2,9 @@ # Dog ## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**breed** | **kotlin.String** | | [optional] +| Name | Type | Description | Notes | +| ------------ | ------------- | ------------- | ------------- | +| **breed** | **kotlin.String** | | [optional] | diff --git a/samples/openapi3/client/petstore/kotlin/docs/EnumArrays.md b/samples/openapi3/client/petstore/kotlin/docs/EnumArrays.md index c3c5e235bfed..89b083493795 100644 --- a/samples/openapi3/client/petstore/kotlin/docs/EnumArrays.md +++ b/samples/openapi3/client/petstore/kotlin/docs/EnumArrays.md @@ -2,24 +2,24 @@ # EnumArrays ## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**justSymbol** | [**inline**](#JustSymbolEnum) | | [optional] -**arrayEnum** | [**inline**](#kotlin.collections.List<ArrayEnumEnum>) | | [optional] +| Name | Type | Description | Notes | +| ------------ | ------------- | ------------- | ------------- | +| **justSymbol** | [**inline**](#JustSymbol) | | [optional] | +| **arrayEnum** | [**inline**](#kotlin.collections.List<ArrayEnum>) | | [optional] | - + ## Enum: just_symbol -Name | Value ----- | ----- -justSymbol | >=, $ +| Name | Value | +| ---- | ----- | +| justSymbol | >=, $ | - + ## Enum: array_enum -Name | Value ----- | ----- -arrayEnum | fish, crab +| Name | Value | +| ---- | ----- | +| arrayEnum | fish, crab | diff --git a/samples/openapi3/client/petstore/kotlin/docs/EnumClass.md b/samples/openapi3/client/petstore/kotlin/docs/EnumClass.md index 5ddb262871f9..5deb04462097 100644 --- a/samples/openapi3/client/petstore/kotlin/docs/EnumClass.md +++ b/samples/openapi3/client/petstore/kotlin/docs/EnumClass.md @@ -4,11 +4,11 @@ ## Enum - * `abc` (value: `"_abc"`) + * `_abc` (value: `"_abc"`) - * `minusEfg` (value: `"-efg"`) + * `MinusEfg` (value: `"-efg"`) - * `leftParenthesisXyzRightParenthesis` (value: `"(xyz)"`) + * `Left_ParenthesisXyzRight_Parenthesis` (value: `"(xyz)"`) diff --git a/samples/openapi3/client/petstore/kotlin/docs/EnumTest.md b/samples/openapi3/client/petstore/kotlin/docs/EnumTest.md index f0370049eb3e..40216ba0b10d 100644 --- a/samples/openapi3/client/petstore/kotlin/docs/EnumTest.md +++ b/samples/openapi3/client/petstore/kotlin/docs/EnumTest.md @@ -2,44 +2,44 @@ # EnumTest ## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**enumStringRequired** | [**inline**](#EnumStringRequiredEnum) | | -**enumString** | [**inline**](#EnumStringEnum) | | [optional] -**enumInteger** | [**inline**](#EnumIntegerEnum) | | [optional] -**enumNumber** | [**inline**](#EnumNumberEnum) | | [optional] -**outerEnum** | [**OuterEnum**](OuterEnum.md) | | [optional] -**outerEnumInteger** | [**OuterEnumInteger**](OuterEnumInteger.md) | | [optional] -**outerEnumDefaultValue** | [**OuterEnumDefaultValue**](OuterEnumDefaultValue.md) | | [optional] -**outerEnumIntegerDefaultValue** | [**OuterEnumIntegerDefaultValue**](OuterEnumIntegerDefaultValue.md) | | [optional] - - - +| Name | Type | Description | Notes | +| ------------ | ------------- | ------------- | ------------- | +| **enumStringRequired** | [**inline**](#EnumStringRequired) | | | +| **enumString** | [**inline**](#EnumString) | | [optional] | +| **enumInteger** | [**inline**](#EnumInteger) | | [optional] | +| **enumNumber** | [**inline**](#EnumNumber) | | [optional] | +| **outerEnum** | [**OuterEnum**](OuterEnum.md) | | [optional] | +| **outerEnumInteger** | [**OuterEnumInteger**](OuterEnumInteger.md) | | [optional] | +| **outerEnumDefaultValue** | [**OuterEnumDefaultValue**](OuterEnumDefaultValue.md) | | [optional] | +| **outerEnumIntegerDefaultValue** | [**OuterEnumIntegerDefaultValue**](OuterEnumIntegerDefaultValue.md) | | [optional] | + + + ## Enum: enum_string_required -Name | Value ----- | ----- -enumStringRequired | UPPER, lower, +| Name | Value | +| ---- | ----- | +| enumStringRequired | UPPER, lower, | - + ## Enum: enum_string -Name | Value ----- | ----- -enumString | UPPER, lower, +| Name | Value | +| ---- | ----- | +| enumString | UPPER, lower, | - + ## Enum: enum_integer -Name | Value ----- | ----- -enumInteger | 1, -1 +| Name | Value | +| ---- | ----- | +| enumInteger | 1, -1 | - + ## Enum: enum_number -Name | Value ----- | ----- -enumNumber | 1.1, -1.2 +| Name | Value | +| ---- | ----- | +| enumNumber | 1.1, -1.2 | diff --git a/samples/openapi3/client/petstore/kotlin/docs/FakeApi.md b/samples/openapi3/client/petstore/kotlin/docs/FakeApi.md index 5d92dc7cd9b1..adceaadc14ff 100644 --- a/samples/openapi3/client/petstore/kotlin/docs/FakeApi.md +++ b/samples/openapi3/client/petstore/kotlin/docs/FakeApi.md @@ -2,26 +2,80 @@ All URIs are relative to *http://petstore.swagger.io:80/v2* -Method | HTTP request | Description -------------- | ------------- | ------------- -[**fakeHealthGet**](FakeApi.md#fakeHealthGet) | **GET** /fake/health | Health check endpoint -[**fakeHttpSignatureTest**](FakeApi.md#fakeHttpSignatureTest) | **GET** /fake/http-signature-test | test http signature authentication -[**fakeOuterBooleanSerialize**](FakeApi.md#fakeOuterBooleanSerialize) | **POST** /fake/outer/boolean | -[**fakeOuterCompositeSerialize**](FakeApi.md#fakeOuterCompositeSerialize) | **POST** /fake/outer/composite | -[**fakeOuterNumberSerialize**](FakeApi.md#fakeOuterNumberSerialize) | **POST** /fake/outer/number | -[**fakeOuterStringSerialize**](FakeApi.md#fakeOuterStringSerialize) | **POST** /fake/outer/string | -[**testBodyWithFileSchema**](FakeApi.md#testBodyWithFileSchema) | **PUT** /fake/body-with-file-schema | -[**testBodyWithQueryParams**](FakeApi.md#testBodyWithQueryParams) | **PUT** /fake/body-with-query-params | -[**testClientModel**](FakeApi.md#testClientModel) | **PATCH** /fake | To test \"client\" model -[**testEndpointParameters**](FakeApi.md#testEndpointParameters) | **POST** /fake | Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 -[**testEnumParameters**](FakeApi.md#testEnumParameters) | **GET** /fake | To test enum parameters -[**testGroupParameters**](FakeApi.md#testGroupParameters) | **DELETE** /fake | Fake endpoint to test group parameters (optional) -[**testInlineAdditionalProperties**](FakeApi.md#testInlineAdditionalProperties) | **POST** /fake/inline-additionalProperties | test inline additionalProperties -[**testJsonFormData**](FakeApi.md#testJsonFormData) | **GET** /fake/jsonFormData | test json serialization of form data -[**testQueryParameterCollectionFormat**](FakeApi.md#testQueryParameterCollectionFormat) | **PUT** /fake/test-query-parameters | - - - +| Method | HTTP request | Description | +| ------------- | ------------- | ------------- | +| [**fakeBigDecimalMap**](FakeApi.md#fakeBigDecimalMap) | **GET** /fake/BigDecimalMap | | +| [**fakeHealthGet**](FakeApi.md#fakeHealthGet) | **GET** /fake/health | Health check endpoint | +| [**fakeHttpSignatureTest**](FakeApi.md#fakeHttpSignatureTest) | **GET** /fake/http-signature-test | test http signature authentication | +| [**fakeOuterBooleanSerialize**](FakeApi.md#fakeOuterBooleanSerialize) | **POST** /fake/outer/boolean | | +| [**fakeOuterCompositeSerialize**](FakeApi.md#fakeOuterCompositeSerialize) | **POST** /fake/outer/composite | | +| [**fakeOuterNumberSerialize**](FakeApi.md#fakeOuterNumberSerialize) | **POST** /fake/outer/number | | +| [**fakeOuterStringSerialize**](FakeApi.md#fakeOuterStringSerialize) | **POST** /fake/outer/string | | +| [**fakePropertyEnumIntegerSerialize**](FakeApi.md#fakePropertyEnumIntegerSerialize) | **POST** /fake/property/enum-int | | +| [**testAdditionalPropertiesReference**](FakeApi.md#testAdditionalPropertiesReference) | **POST** /fake/additionalProperties-reference | test referenced additionalProperties | +| [**testBodyWithBinary**](FakeApi.md#testBodyWithBinary) | **PUT** /fake/body-with-binary | | +| [**testBodyWithFileSchema**](FakeApi.md#testBodyWithFileSchema) | **PUT** /fake/body-with-file-schema | | +| [**testBodyWithQueryParams**](FakeApi.md#testBodyWithQueryParams) | **PUT** /fake/body-with-query-params | | +| [**testClientModel**](FakeApi.md#testClientModel) | **PATCH** /fake | To test "client" model | +| [**testEndpointParameters**](FakeApi.md#testEndpointParameters) | **POST** /fake | Fake endpoint for testing various parameters +假端點 +偽のエンドポイント +가짜 엔드 포인트 + | +| [**testEnumParameters**](FakeApi.md#testEnumParameters) | **GET** /fake | To test enum parameters | +| [**testGroupParameters**](FakeApi.md#testGroupParameters) | **DELETE** /fake | Fake endpoint to test group parameters (optional) | +| [**testInlineAdditionalProperties**](FakeApi.md#testInlineAdditionalProperties) | **POST** /fake/inline-additionalProperties | test inline additionalProperties | +| [**testInlineFreeformAdditionalProperties**](FakeApi.md#testInlineFreeformAdditionalProperties) | **POST** /fake/inline-freeform-additionalProperties | test inline free-form additionalProperties | +| [**testJsonFormData**](FakeApi.md#testJsonFormData) | **GET** /fake/jsonFormData | test json serialization of form data | +| [**testNullable**](FakeApi.md#testNullable) | **POST** /fake/nullable | test nullable parent property | +| [**testQueryParameterCollectionFormat**](FakeApi.md#testQueryParameterCollectionFormat) | **PUT** /fake/test-query-parameters | | +| [**testStringMapReference**](FakeApi.md#testStringMapReference) | **POST** /fake/stringMap-reference | test referenced string map | + + + +# **fakeBigDecimalMap** +> FakeBigDecimalMap200Response fakeBigDecimalMap() + + + +for Java apache and Java native, test toUrlQueryString for maps with BegDecimal keys + +### Example +```kotlin +// Import classes: +//import org.openapitools.client.infrastructure.* +//import org.openapitools.client.models.* + +val apiInstance = FakeApi() +try { + val result : FakeBigDecimalMap200Response = apiInstance.fakeBigDecimalMap() + println(result) +} catch (e: ClientException) { + println("4xx response calling FakeApi#fakeBigDecimalMap") + e.printStackTrace() +} catch (e: ServerException) { + println("5xx response calling FakeApi#fakeBigDecimalMap") + e.printStackTrace() +} +``` + +### Parameters +This endpoint does not need any parameter. + +### Return type + +[**FakeBigDecimalMap200Response**](FakeBigDecimalMap200Response.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + + # **fakeHealthGet** > HealthCheckResult fakeHealthGet() @@ -62,7 +116,7 @@ No authorization required - **Content-Type**: Not defined - **Accept**: application/json - + # **fakeHttpSignatureTest** > fakeHttpSignatureTest(pet, query1, header1) @@ -90,12 +144,11 @@ try { ``` ### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **pet** | [**Pet**](Pet.md)| Pet object that needs to be added to the store | - **query1** | **kotlin.String**| query parameter | [optional] - **header1** | **kotlin.String**| header parameter | [optional] +| **pet** | [**Pet**](Pet.md)| Pet object that needs to be added to the store | | +| **query1** | **kotlin.String**| query parameter | [optional] | +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **header1** | **kotlin.String**| header parameter | [optional] | ### Return type @@ -107,10 +160,10 @@ null (empty response body) ### HTTP request headers - - **Content-Type**: application/json, application/xml + - **Content-Type**: application/json - **Accept**: Not defined - + # **fakeOuterBooleanSerialize** > kotlin.Boolean fakeOuterBooleanSerialize(body) @@ -139,10 +192,9 @@ try { ``` ### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **body** | **kotlin.Boolean**| Input boolean as post body | [optional] +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **body** | **kotlin.Boolean**| Input boolean as post body | [optional] | ### Return type @@ -155,9 +207,9 @@ No authorization required ### HTTP request headers - **Content-Type**: application/json - - **Accept**: */* + - **Accept**: Not defined - + # **fakeOuterCompositeSerialize** > OuterComposite fakeOuterCompositeSerialize(outerComposite) @@ -186,10 +238,9 @@ try { ``` ### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **outerComposite** | [**OuterComposite**](OuterComposite.md)| Input composite as post body | [optional] +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **outerComposite** | [**OuterComposite**](OuterComposite.md)| Input composite as post body | [optional] | ### Return type @@ -202,9 +253,9 @@ No authorization required ### HTTP request headers - **Content-Type**: application/json - - **Accept**: */* + - **Accept**: Not defined - + # **fakeOuterNumberSerialize** > java.math.BigDecimal fakeOuterNumberSerialize(body) @@ -233,10 +284,9 @@ try { ``` ### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **body** | **java.math.BigDecimal**| Input number as post body | [optional] +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **body** | **java.math.BigDecimal**| Input number as post body | [optional] | ### Return type @@ -249,9 +299,9 @@ No authorization required ### HTTP request headers - **Content-Type**: application/json - - **Accept**: */* + - **Accept**: Not defined - + # **fakeOuterStringSerialize** > kotlin.String fakeOuterStringSerialize(body) @@ -280,10 +330,9 @@ try { ``` ### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **body** | **kotlin.String**| Input string as post body | [optional] +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **body** | **kotlin.String**| Input string as post body | [optional] | ### Return type @@ -296,15 +345,151 @@ No authorization required ### HTTP request headers - **Content-Type**: application/json - - **Accept**: */* + - **Accept**: Not defined + + +# **fakePropertyEnumIntegerSerialize** +> OuterObjectWithEnumProperty fakePropertyEnumIntegerSerialize(outerObjectWithEnumProperty) + + + +Test serialization of enum (int) properties with examples + +### Example +```kotlin +// Import classes: +//import org.openapitools.client.infrastructure.* +//import org.openapitools.client.models.* + +val apiInstance = FakeApi() +val outerObjectWithEnumProperty : OuterObjectWithEnumProperty = // OuterObjectWithEnumProperty | Input enum (int) as post body +try { + val result : OuterObjectWithEnumProperty = apiInstance.fakePropertyEnumIntegerSerialize(outerObjectWithEnumProperty) + println(result) +} catch (e: ClientException) { + println("4xx response calling FakeApi#fakePropertyEnumIntegerSerialize") + e.printStackTrace() +} catch (e: ServerException) { + println("5xx response calling FakeApi#fakePropertyEnumIntegerSerialize") + e.printStackTrace() +} +``` + +### Parameters +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **outerObjectWithEnumProperty** | [**OuterObjectWithEnumProperty**](OuterObjectWithEnumProperty.md)| Input enum (int) as post body | | + +### Return type + +[**OuterObjectWithEnumProperty**](OuterObjectWithEnumProperty.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: Not defined + + +# **testAdditionalPropertiesReference** +> testAdditionalPropertiesReference(requestBody) + +test referenced additionalProperties + + + +### Example +```kotlin +// Import classes: +//import org.openapitools.client.infrastructure.* +//import org.openapitools.client.models.* + +val apiInstance = FakeApi() +val requestBody : kotlin.collections.Map = Object // kotlin.collections.Map | request body +try { + apiInstance.testAdditionalPropertiesReference(requestBody) +} catch (e: ClientException) { + println("4xx response calling FakeApi#testAdditionalPropertiesReference") + e.printStackTrace() +} catch (e: ServerException) { + println("5xx response calling FakeApi#testAdditionalPropertiesReference") + e.printStackTrace() +} +``` + +### Parameters +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **requestBody** | [**kotlin.collections.Map<kotlin.String, kotlin.Any>**](kotlin.Any.md)| request body | | + +### Return type + +null (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: Not defined + + +# **testBodyWithBinary** +> testBodyWithBinary(body) + + + +For this test, the body has to be a binary file. + +### Example +```kotlin +// Import classes: +//import org.openapitools.client.infrastructure.* +//import org.openapitools.client.models.* + +val apiInstance = FakeApi() +val body : java.io.File = BINARY_DATA_HERE // java.io.File | image to upload +try { + apiInstance.testBodyWithBinary(body) +} catch (e: ClientException) { + println("4xx response calling FakeApi#testBodyWithBinary") + e.printStackTrace() +} catch (e: ServerException) { + println("5xx response calling FakeApi#testBodyWithBinary") + e.printStackTrace() +} +``` + +### Parameters +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **body** | **java.io.File**| image to upload | | + +### Return type + +null (empty response body) + +### Authorization + +No authorization required - +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + + # **testBodyWithFileSchema** > testBodyWithFileSchema(fileSchemaTestClass) -For this test, the body for this request much reference a schema named `File`. +For this test, the body for this request must reference a schema named `File`. ### Example ```kotlin @@ -326,10 +511,9 @@ try { ``` ### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **fileSchemaTestClass** | [**FileSchemaTestClass**](FileSchemaTestClass.md)| | +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **fileSchemaTestClass** | [**FileSchemaTestClass**](FileSchemaTestClass.md)| | | ### Return type @@ -344,7 +528,7 @@ No authorization required - **Content-Type**: application/json - **Accept**: Not defined - + # **testBodyWithQueryParams** > testBodyWithQueryParams(query, user) @@ -371,11 +555,10 @@ try { ``` ### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **query** | **kotlin.String**| | - **user** | [**User**](User.md)| | +| **query** | **kotlin.String**| | | +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **user** | [**User**](User.md)| | | ### Return type @@ -390,13 +573,13 @@ No authorization required - **Content-Type**: application/json - **Accept**: Not defined - + # **testClientModel** > Client testClientModel(client) -To test \"client\" model +To test "client" model -To test \"client\" model +To test "client" model ### Example ```kotlin @@ -419,10 +602,9 @@ try { ``` ### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **client** | [**Client**](Client.md)| client model | +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **client** | [**Client**](Client.md)| client model | | ### Return type @@ -437,13 +619,21 @@ No authorization required - **Content-Type**: application/json - **Accept**: application/json - + # **testEndpointParameters** > testEndpointParameters(number, double, patternWithoutDelimiter, byte, integer, int32, int64, float, string, binary, date, dateTime, password, paramCallback) -Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 +Fake endpoint for testing various parameters +假端點 +偽のエンドポイント +가짜 엔드 포인트 + + +Fake endpoint for testing various parameters +假端點 +偽のエンドポイント +가짜 엔드 포인트 -Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 ### Example ```kotlin @@ -478,23 +668,22 @@ try { ``` ### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **number** | **java.math.BigDecimal**| None | - **double** | **kotlin.Double**| None | - **patternWithoutDelimiter** | **kotlin.String**| None | - **byte** | **kotlin.ByteArray**| None | - **integer** | **kotlin.Int**| None | [optional] - **int32** | **kotlin.Int**| None | [optional] - **int64** | **kotlin.Long**| None | [optional] - **float** | **kotlin.Float**| None | [optional] - **string** | **kotlin.String**| None | [optional] - **binary** | **java.io.File**| None | [optional] - **date** | **java.time.LocalDate**| None | [optional] - **dateTime** | **java.time.OffsetDateTime**| None | [optional] - **password** | **kotlin.String**| None | [optional] - **paramCallback** | **kotlin.String**| None | [optional] +| **number** | **java.math.BigDecimal**| None | | +| **double** | **kotlin.Double**| None | | +| **patternWithoutDelimiter** | **kotlin.String**| None | | +| **byte** | **kotlin.ByteArray**| None | | +| **integer** | **kotlin.Int**| None | [optional] | +| **int32** | **kotlin.Int**| None | [optional] | +| **int64** | **kotlin.Long**| None | [optional] | +| **float** | **kotlin.Float**| None | [optional] | +| **string** | **kotlin.String**| None | [optional] | +| **binary** | **java.io.File**| None | [optional] | +| **date** | **java.time.LocalDate**| None | [optional] | +| **dateTime** | **java.time.OffsetDateTime**| None | [optional] | +| **password** | **kotlin.String**| None | [optional] | +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **paramCallback** | **kotlin.String**| None | [optional] | ### Return type @@ -512,9 +701,9 @@ Configure http_basic_test: - **Content-Type**: application/x-www-form-urlencoded - **Accept**: Not defined - + # **testEnumParameters** -> testEnumParameters(enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble, enumFormStringArray, enumFormString) +> testEnumParameters(enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble, enumQueryModelArray, enumFormStringArray, enumFormString) To test enum parameters @@ -533,10 +722,11 @@ val enumQueryStringArray : kotlin.collections.List = // kotlin.c val enumQueryString : kotlin.String = enumQueryString_example // kotlin.String | Query parameter enum test (string) val enumQueryInteger : kotlin.Int = 56 // kotlin.Int | Query parameter enum test (double) val enumQueryDouble : kotlin.Double = 1.2 // kotlin.Double | Query parameter enum test (double) -val enumFormStringArray : kotlin.collections.List = enumFormStringArray_example // kotlin.collections.List | Form parameter enum test (string array) +val enumQueryModelArray : kotlin.collections.List = // kotlin.collections.List | +val enumFormStringArray : kotlin.collections.List = // kotlin.collections.List | Form parameter enum test (string array) val enumFormString : kotlin.String = enumFormString_example // kotlin.String | Form parameter enum test (string) try { - apiInstance.testEnumParameters(enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble, enumFormStringArray, enumFormString) + apiInstance.testEnumParameters(enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble, enumQueryModelArray, enumFormStringArray, enumFormString) } catch (e: ClientException) { println("4xx response calling FakeApi#testEnumParameters") e.printStackTrace() @@ -547,17 +737,17 @@ try { ``` ### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **enumHeaderStringArray** | [**kotlin.collections.List<kotlin.String>**](kotlin.String.md)| Header parameter enum test (string array) | [optional] [enum: >, $] - **enumHeaderString** | **kotlin.String**| Header parameter enum test (string) | [optional] [default to -efg] [enum: _abc, -efg, (xyz)] - **enumQueryStringArray** | [**kotlin.collections.List<kotlin.String>**](kotlin.String.md)| Query parameter enum test (string array) | [optional] [enum: >, $] - **enumQueryString** | **kotlin.String**| Query parameter enum test (string) | [optional] [default to -efg] [enum: _abc, -efg, (xyz)] - **enumQueryInteger** | **kotlin.Int**| Query parameter enum test (double) | [optional] [enum: 1, -2] - **enumQueryDouble** | **kotlin.Double**| Query parameter enum test (double) | [optional] [enum: 1.1, -1.2] - **enumFormStringArray** | [**kotlin.collections.List<kotlin.String>**](kotlin.String.md)| Form parameter enum test (string array) | [optional] [default to $] [enum: >, $] - **enumFormString** | **kotlin.String**| Form parameter enum test (string) | [optional] [default to -efg] [enum: _abc, -efg, (xyz)] +| **enumHeaderStringArray** | [**kotlin.collections.List<kotlin.String>**](kotlin.String.md)| Header parameter enum test (string array) | [optional] [enum: >, $] | +| **enumHeaderString** | **kotlin.String**| Header parameter enum test (string) | [optional] [default to EnumHeaderString.MinusEfg] [enum: _abc, -efg, (xyz)] | +| **enumQueryStringArray** | [**kotlin.collections.List<kotlin.String>**](kotlin.String.md)| Query parameter enum test (string array) | [optional] [enum: >, $] | +| **enumQueryString** | **kotlin.String**| Query parameter enum test (string) | [optional] [default to EnumQueryString.MinusEfg] [enum: _abc, -efg, (xyz)] | +| **enumQueryInteger** | **kotlin.Int**| Query parameter enum test (double) | [optional] [enum: 1, -2] | +| **enumQueryDouble** | **kotlin.Double**| Query parameter enum test (double) | [optional] [enum: 1.1, -1.2] | +| **enumQueryModelArray** | [**kotlin.collections.List<EnumClass>**](EnumClass.md)| | [optional] | +| **enumFormStringArray** | [**kotlin.collections.List<kotlin.String>**](kotlin.String.md)| Form parameter enum test (string array) | [optional] [default to kotlin.collections.List.Dollar] [enum: >, $] | +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **enumFormString** | **kotlin.String**| Form parameter enum test (string) | [optional] [default to EnumFormString.MinusEfg] [enum: _abc, -efg, (xyz)] | ### Return type @@ -572,7 +762,7 @@ No authorization required - **Content-Type**: application/x-www-form-urlencoded - **Accept**: Not defined - + # **testGroupParameters** > testGroupParameters(requiredStringGroup, requiredBooleanGroup, requiredInt64Group, stringGroup, booleanGroup, int64Group) @@ -605,15 +795,14 @@ try { ``` ### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **requiredStringGroup** | **kotlin.Int**| Required String in group parameters | - **requiredBooleanGroup** | **kotlin.Boolean**| Required Boolean in group parameters | - **requiredInt64Group** | **kotlin.Long**| Required Integer in group parameters | - **stringGroup** | **kotlin.Int**| String in group parameters | [optional] - **booleanGroup** | **kotlin.Boolean**| Boolean in group parameters | [optional] - **int64Group** | **kotlin.Long**| Integer in group parameters | [optional] +| **requiredStringGroup** | **kotlin.Int**| Required String in group parameters | | +| **requiredBooleanGroup** | **kotlin.Boolean**| Required Boolean in group parameters | | +| **requiredInt64Group** | **kotlin.Long**| Required Integer in group parameters | | +| **stringGroup** | **kotlin.Int**| String in group parameters | [optional] | +| **booleanGroup** | **kotlin.Boolean**| Boolean in group parameters | [optional] | +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **int64Group** | **kotlin.Long**| Integer in group parameters | [optional] | ### Return type @@ -630,12 +819,14 @@ Configure bearer_test: - **Content-Type**: Not defined - **Accept**: Not defined - + # **testInlineAdditionalProperties** > testInlineAdditionalProperties(requestBody) test inline additionalProperties + + ### Example ```kotlin // Import classes: @@ -656,10 +847,54 @@ try { ``` ### Parameters +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **requestBody** | [**kotlin.collections.Map<kotlin.String, kotlin.String>**](kotlin.String.md)| request body | | + +### Return type + +null (empty response body) + +### Authorization + +No authorization required -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **requestBody** | [**kotlin.collections.Map<kotlin.String, kotlin.String>**](kotlin.String.md)| request body | +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: Not defined + + +# **testInlineFreeformAdditionalProperties** +> testInlineFreeformAdditionalProperties(testInlineFreeformAdditionalPropertiesRequest) + +test inline free-form additionalProperties + + + +### Example +```kotlin +// Import classes: +//import org.openapitools.client.infrastructure.* +//import org.openapitools.client.models.* + +val apiInstance = FakeApi() +val testInlineFreeformAdditionalPropertiesRequest : TestInlineFreeformAdditionalPropertiesRequest = // TestInlineFreeformAdditionalPropertiesRequest | request body +try { + apiInstance.testInlineFreeformAdditionalProperties(testInlineFreeformAdditionalPropertiesRequest) +} catch (e: ClientException) { + println("4xx response calling FakeApi#testInlineFreeformAdditionalProperties") + e.printStackTrace() +} catch (e: ServerException) { + println("5xx response calling FakeApi#testInlineFreeformAdditionalProperties") + e.printStackTrace() +} +``` + +### Parameters +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **testInlineFreeformAdditionalPropertiesRequest** | [**TestInlineFreeformAdditionalPropertiesRequest**](TestInlineFreeformAdditionalPropertiesRequest.md)| request body | | ### Return type @@ -674,12 +909,14 @@ No authorization required - **Content-Type**: application/json - **Accept**: Not defined - + # **testJsonFormData** -> testJsonFormData(param, param2) +> testJsonFormData(`param`, param2) test json serialization of form data + + ### Example ```kotlin // Import classes: @@ -687,10 +924,10 @@ test json serialization of form data //import org.openapitools.client.models.* val apiInstance = FakeApi() -val param : kotlin.String = param_example // kotlin.String | field1 +val `param` : kotlin.String = `param`_example // kotlin.String | field1 val param2 : kotlin.String = param2_example // kotlin.String | field2 try { - apiInstance.testJsonFormData(param, param2) + apiInstance.testJsonFormData(`param`, param2) } catch (e: ClientException) { println("4xx response calling FakeApi#testJsonFormData") e.printStackTrace() @@ -701,11 +938,10 @@ try { ``` ### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **param** | **kotlin.String**| field1 | - **param2** | **kotlin.String**| field2 | +| **`param`** | **kotlin.String**| field1 | | +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **param2** | **kotlin.String**| field2 | | ### Return type @@ -720,9 +956,54 @@ No authorization required - **Content-Type**: application/x-www-form-urlencoded - **Accept**: Not defined - + +# **testNullable** +> testNullable(childWithNullable) + +test nullable parent property + + + +### Example +```kotlin +// Import classes: +//import org.openapitools.client.infrastructure.* +//import org.openapitools.client.models.* + +val apiInstance = FakeApi() +val childWithNullable : ChildWithNullable = // ChildWithNullable | request body +try { + apiInstance.testNullable(childWithNullable) +} catch (e: ClientException) { + println("4xx response calling FakeApi#testNullable") + e.printStackTrace() +} catch (e: ServerException) { + println("5xx response calling FakeApi#testNullable") + e.printStackTrace() +} +``` + +### Parameters +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **childWithNullable** | [**ChildWithNullable**](ChildWithNullable.md)| request body | | + +### Return type + +null (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: Not defined + + # **testQueryParameterCollectionFormat** -> testQueryParameterCollectionFormat(pipe, ioutil, http, url, context) +> testQueryParameterCollectionFormat(pipe, ioutil, http, url, context, allowEmpty, language) @@ -740,8 +1021,10 @@ val ioutil : kotlin.collections.List = // kotlin.collections.Lis val http : kotlin.collections.List = // kotlin.collections.List | val url : kotlin.collections.List = // kotlin.collections.List | val context : kotlin.collections.List = // kotlin.collections.List | +val allowEmpty : kotlin.String = allowEmpty_example // kotlin.String | +val language : kotlin.collections.Map = // kotlin.collections.Map | try { - apiInstance.testQueryParameterCollectionFormat(pipe, ioutil, http, url, context) + apiInstance.testQueryParameterCollectionFormat(pipe, ioutil, http, url, context, allowEmpty, language) } catch (e: ClientException) { println("4xx response calling FakeApi#testQueryParameterCollectionFormat") e.printStackTrace() @@ -752,14 +1035,15 @@ try { ``` ### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **pipe** | [**kotlin.collections.List<kotlin.String>**](kotlin.String.md)| | - **ioutil** | [**kotlin.collections.List<kotlin.String>**](kotlin.String.md)| | - **http** | [**kotlin.collections.List<kotlin.String>**](kotlin.String.md)| | - **url** | [**kotlin.collections.List<kotlin.String>**](kotlin.String.md)| | - **context** | [**kotlin.collections.List<kotlin.String>**](kotlin.String.md)| | +| **pipe** | [**kotlin.collections.List<kotlin.String>**](kotlin.String.md)| | | +| **ioutil** | [**kotlin.collections.List<kotlin.String>**](kotlin.String.md)| | | +| **http** | [**kotlin.collections.List<kotlin.String>**](kotlin.String.md)| | | +| **url** | [**kotlin.collections.List<kotlin.String>**](kotlin.String.md)| | | +| **context** | [**kotlin.collections.List<kotlin.String>**](kotlin.String.md)| | | +| **allowEmpty** | **kotlin.String**| | | +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **language** | [**kotlin.collections.Map<kotlin.String, kotlin.String>**](kotlin.String.md)| | [optional] | ### Return type @@ -774,3 +1058,48 @@ No authorization required - **Content-Type**: Not defined - **Accept**: Not defined + +# **testStringMapReference** +> testStringMapReference(requestBody) + +test referenced string map + + + +### Example +```kotlin +// Import classes: +//import org.openapitools.client.infrastructure.* +//import org.openapitools.client.models.* + +val apiInstance = FakeApi() +val requestBody : kotlin.collections.Map = // kotlin.collections.Map | request body +try { + apiInstance.testStringMapReference(requestBody) +} catch (e: ClientException) { + println("4xx response calling FakeApi#testStringMapReference") + e.printStackTrace() +} catch (e: ServerException) { + println("5xx response calling FakeApi#testStringMapReference") + e.printStackTrace() +} +``` + +### Parameters +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **requestBody** | [**kotlin.collections.Map<kotlin.String, kotlin.String>**](kotlin.String.md)| request body | | + +### Return type + +null (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: Not defined + diff --git a/samples/openapi3/client/petstore/kotlin/docs/FakeBigDecimalMap200Response.md b/samples/openapi3/client/petstore/kotlin/docs/FakeBigDecimalMap200Response.md new file mode 100644 index 000000000000..8feb74744d4c --- /dev/null +++ b/samples/openapi3/client/petstore/kotlin/docs/FakeBigDecimalMap200Response.md @@ -0,0 +1,11 @@ + +# FakeBigDecimalMap200Response + +## Properties +| Name | Type | Description | Notes | +| ------------ | ------------- | ------------- | ------------- | +| **someId** | [**java.math.BigDecimal**](java.math.BigDecimal.md) | | [optional] | +| **someMap** | [**kotlin.collections.Map<kotlin.String, java.math.BigDecimal>**](java.math.BigDecimal.md) | | [optional] | + + + diff --git a/samples/openapi3/client/petstore/kotlin/docs/FakeClassnameTags123Api.md b/samples/openapi3/client/petstore/kotlin/docs/FakeClassnameTags123Api.md index 962dfd4d2dc2..91469967dc14 100644 --- a/samples/openapi3/client/petstore/kotlin/docs/FakeClassnameTags123Api.md +++ b/samples/openapi3/client/petstore/kotlin/docs/FakeClassnameTags123Api.md @@ -2,12 +2,12 @@ All URIs are relative to *http://petstore.swagger.io:80/v2* -Method | HTTP request | Description -------------- | ------------- | ------------- -[**testClassname**](FakeClassnameTags123Api.md#testClassname) | **PATCH** /fake_classname_test | To test class name in snake case +| Method | HTTP request | Description | +| ------------- | ------------- | ------------- | +| [**testClassname**](FakeClassnameTags123Api.md#testClassname) | **PATCH** /fake_classname_test | To test class name in snake case | - + # **testClassname** > Client testClassname(client) @@ -36,10 +36,9 @@ try { ``` ### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **client** | [**Client**](Client.md)| client model | +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **client** | [**Client**](Client.md)| client model | | ### Return type diff --git a/samples/openapi3/client/petstore/kotlin/docs/File.md b/samples/openapi3/client/petstore/kotlin/docs/File.md new file mode 100644 index 000000000000..ef31b0384033 --- /dev/null +++ b/samples/openapi3/client/petstore/kotlin/docs/File.md @@ -0,0 +1,10 @@ + +# java.io.File + +## Properties +| Name | Type | Description | Notes | +| ------------ | ------------- | ------------- | ------------- | +| **sourceURI** | **kotlin.String** | Test capitalization | [optional] | + + + diff --git a/samples/openapi3/client/petstore/kotlin/docs/FileSchemaTestClass.md b/samples/openapi3/client/petstore/kotlin/docs/FileSchemaTestClass.md index e5512f82f6f6..a7eb6783e52c 100644 --- a/samples/openapi3/client/petstore/kotlin/docs/FileSchemaTestClass.md +++ b/samples/openapi3/client/petstore/kotlin/docs/FileSchemaTestClass.md @@ -2,10 +2,10 @@ # FileSchemaTestClass ## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**file** | [**java.io.File**](java.io.File.md) | | [optional] -**files** | [**kotlin.collections.List<java.io.File>**](java.io.File.md) | | [optional] +| Name | Type | Description | Notes | +| ------------ | ------------- | ------------- | ------------- | +| **file** | [**java.io.File**](java.io.File.md) | | [optional] | +| **files** | [**kotlin.collections.List<java.io.File>**](java.io.File.md) | | [optional] | diff --git a/samples/openapi3/client/petstore/kotlin/docs/Foo.md b/samples/openapi3/client/petstore/kotlin/docs/Foo.md index e3e9918872b3..0a911e835e4b 100644 --- a/samples/openapi3/client/petstore/kotlin/docs/Foo.md +++ b/samples/openapi3/client/petstore/kotlin/docs/Foo.md @@ -2,9 +2,9 @@ # Foo ## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**bar** | **kotlin.String** | | [optional] +| Name | Type | Description | Notes | +| ------------ | ------------- | ------------- | ------------- | +| **bar** | **kotlin.String** | | [optional] | diff --git a/samples/openapi3/client/petstore/kotlin/docs/FooGetDefaultResponse.md b/samples/openapi3/client/petstore/kotlin/docs/FooGetDefaultResponse.md new file mode 100644 index 000000000000..d02a2b5bca31 --- /dev/null +++ b/samples/openapi3/client/petstore/kotlin/docs/FooGetDefaultResponse.md @@ -0,0 +1,10 @@ + +# FooGetDefaultResponse + +## Properties +| Name | Type | Description | Notes | +| ------------ | ------------- | ------------- | ------------- | +| **string** | [**Foo**](Foo.md) | | [optional] | + + + diff --git a/samples/openapi3/client/petstore/kotlin/docs/FormatTest.md b/samples/openapi3/client/petstore/kotlin/docs/FormatTest.md index 01b408499e73..e1cd5daea594 100644 --- a/samples/openapi3/client/petstore/kotlin/docs/FormatTest.md +++ b/samples/openapi3/client/petstore/kotlin/docs/FormatTest.md @@ -2,24 +2,24 @@ # FormatTest ## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**number** | [**java.math.BigDecimal**](java.math.BigDecimal.md) | | -**byte** | **kotlin.ByteArray** | | -**date** | [**java.time.LocalDate**](java.time.LocalDate.md) | | -**password** | **kotlin.String** | | -**integer** | **kotlin.Int** | | [optional] -**int32** | **kotlin.Int** | | [optional] -**int64** | **kotlin.Long** | | [optional] -**float** | **kotlin.Float** | | [optional] -**double** | **kotlin.Double** | | [optional] -**decimal** | [**java.math.BigDecimal**](java.math.BigDecimal.md) | | [optional] -**string** | **kotlin.String** | | [optional] -**binary** | [**java.io.File**](java.io.File.md) | | [optional] -**dateTime** | [**java.time.OffsetDateTime**](java.time.OffsetDateTime.md) | | [optional] -**uuid** | [**java.util.UUID**](java.util.UUID.md) | | [optional] -**patternWithDigits** | **kotlin.String** | A string that is a 10 digit number. Can have leading zeros. | [optional] -**patternWithDigitsAndDelimiter** | **kotlin.String** | A string starting with 'image_' (case insensitive) and one to three digits following i.e. Image_01. | [optional] +| Name | Type | Description | Notes | +| ------------ | ------------- | ------------- | ------------- | +| **number** | [**java.math.BigDecimal**](java.math.BigDecimal.md) | | | +| **byte** | **kotlin.ByteArray** | | | +| **date** | [**java.time.LocalDate**](java.time.LocalDate.md) | | | +| **password** | **kotlin.String** | | | +| **integer** | **kotlin.Int** | | [optional] | +| **int32** | **kotlin.Int** | | [optional] | +| **int64** | **kotlin.Long** | | [optional] | +| **float** | **kotlin.Float** | | [optional] | +| **double** | **kotlin.Double** | | [optional] | +| **decimal** | [**java.math.BigDecimal**](java.math.BigDecimal.md) | | [optional] | +| **string** | **kotlin.String** | | [optional] | +| **binary** | [**java.io.File**](java.io.File.md) | | [optional] | +| **dateTime** | [**java.time.OffsetDateTime**](java.time.OffsetDateTime.md) | | [optional] | +| **uuid** | [**java.util.UUID**](java.util.UUID.md) | | [optional] | +| **patternWithDigits** | **kotlin.String** | A string that is a 10 digit number. Can have leading zeros. | [optional] | +| **patternWithDigitsAndDelimiter** | **kotlin.String** | A string starting with 'image_' (case insensitive) and one to three digits following i.e. Image_01. | [optional] | diff --git a/samples/openapi3/client/petstore/kotlin/docs/HasOnlyReadOnly.md b/samples/openapi3/client/petstore/kotlin/docs/HasOnlyReadOnly.md index ed3e4750f44f..893e256f4699 100644 --- a/samples/openapi3/client/petstore/kotlin/docs/HasOnlyReadOnly.md +++ b/samples/openapi3/client/petstore/kotlin/docs/HasOnlyReadOnly.md @@ -2,10 +2,10 @@ # HasOnlyReadOnly ## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**bar** | **kotlin.String** | | [optional] [readonly] -**foo** | **kotlin.String** | | [optional] [readonly] +| Name | Type | Description | Notes | +| ------------ | ------------- | ------------- | ------------- | +| **bar** | **kotlin.String** | | [optional] [readonly] | +| **foo** | **kotlin.String** | | [optional] [readonly] | diff --git a/samples/openapi3/client/petstore/kotlin/docs/HealthCheckResult.md b/samples/openapi3/client/petstore/kotlin/docs/HealthCheckResult.md index 472dc3104571..7dab71a21037 100644 --- a/samples/openapi3/client/petstore/kotlin/docs/HealthCheckResult.md +++ b/samples/openapi3/client/petstore/kotlin/docs/HealthCheckResult.md @@ -2,9 +2,9 @@ # HealthCheckResult ## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**nullableMessage** | **kotlin.String** | | [optional] +| Name | Type | Description | Notes | +| ------------ | ------------- | ------------- | ------------- | +| **nullableMessage** | **kotlin.String** | | [optional] | diff --git a/samples/openapi3/client/petstore/kotlin/docs/List.md b/samples/openapi3/client/petstore/kotlin/docs/List.md index f426d541a409..5c78e7737a35 100644 --- a/samples/openapi3/client/petstore/kotlin/docs/List.md +++ b/samples/openapi3/client/petstore/kotlin/docs/List.md @@ -2,9 +2,9 @@ # List ## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**`123list`** | **kotlin.String** | | [optional] +| Name | Type | Description | Notes | +| ------------ | ------------- | ------------- | ------------- | +| **`123list`** | **kotlin.String** | | [optional] | diff --git a/samples/openapi3/client/petstore/kotlin/docs/MapTest.md b/samples/openapi3/client/petstore/kotlin/docs/MapTest.md index 8cee39e36048..e4553a04481a 100644 --- a/samples/openapi3/client/petstore/kotlin/docs/MapTest.md +++ b/samples/openapi3/client/petstore/kotlin/docs/MapTest.md @@ -2,19 +2,19 @@ # MapTest ## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**mapMapOfString** | **kotlin.collections.Map<kotlin.String, kotlin.collections.Map<kotlin.String, kotlin.String>>** | | [optional] -**mapOfEnumString** | [**inline**](#kotlin.collections.Map<kotlin.String, InnerEnum>) | | [optional] -**directMap** | **kotlin.collections.Map<kotlin.String, kotlin.Boolean>** | | [optional] -**indirectMap** | **kotlin.collections.Map<kotlin.String, kotlin.Boolean>** | | [optional] +| Name | Type | Description | Notes | +| ------------ | ------------- | ------------- | ------------- | +| **mapMapOfString** | **kotlin.collections.Map<kotlin.String, kotlin.collections.Map<kotlin.String, kotlin.String>>** | | [optional] | +| **mapOfEnumString** | [**inline**](#kotlin.collections.Map<kotlin.String, `Inner`>) | | [optional] | +| **directMap** | **kotlin.collections.Map<kotlin.String, kotlin.Boolean>** | | [optional] | +| **indirectMap** | **kotlin.collections.Map<kotlin.String, kotlin.Boolean>** | | [optional] | - + ## Enum: map_of_enum_string -Name | Value ----- | ----- -mapOfEnumString | UPPER, lower +| Name | Value | +| ---- | ----- | +| mapOfEnumString | UPPER, lower | diff --git a/samples/openapi3/client/petstore/kotlin/docs/MixedPropertiesAndAdditionalPropertiesClass.md b/samples/openapi3/client/petstore/kotlin/docs/MixedPropertiesAndAdditionalPropertiesClass.md index 744567412172..02610c06594f 100644 --- a/samples/openapi3/client/petstore/kotlin/docs/MixedPropertiesAndAdditionalPropertiesClass.md +++ b/samples/openapi3/client/petstore/kotlin/docs/MixedPropertiesAndAdditionalPropertiesClass.md @@ -2,11 +2,11 @@ # MixedPropertiesAndAdditionalPropertiesClass ## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**uuid** | [**java.util.UUID**](java.util.UUID.md) | | [optional] -**dateTime** | [**java.time.OffsetDateTime**](java.time.OffsetDateTime.md) | | [optional] -**map** | [**kotlin.collections.Map<kotlin.String, Animal>**](Animal.md) | | [optional] +| Name | Type | Description | Notes | +| ------------ | ------------- | ------------- | ------------- | +| **uuid** | [**java.util.UUID**](java.util.UUID.md) | | [optional] | +| **dateTime** | [**java.time.OffsetDateTime**](java.time.OffsetDateTime.md) | | [optional] | +| **map** | [**kotlin.collections.Map<kotlin.String, Animal>**](Animal.md) | | [optional] | diff --git a/samples/openapi3/client/petstore/kotlin/docs/Name.md b/samples/openapi3/client/petstore/kotlin/docs/Name.md index 343700533c72..0c22135d391d 100644 --- a/samples/openapi3/client/petstore/kotlin/docs/Name.md +++ b/samples/openapi3/client/petstore/kotlin/docs/Name.md @@ -2,12 +2,12 @@ # Name ## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**name** | **kotlin.Int** | | -**snakeCase** | **kotlin.Int** | | [optional] [readonly] -**property** | **kotlin.String** | | [optional] -**`123number`** | **kotlin.Int** | | [optional] [readonly] +| Name | Type | Description | Notes | +| ------------ | ------------- | ------------- | ------------- | +| **name** | **kotlin.Int** | | | +| **snakeCase** | **kotlin.Int** | | [optional] [readonly] | +| **`property`** | **kotlin.String** | | [optional] | +| **`123number`** | **kotlin.Int** | | [optional] [readonly] | diff --git a/samples/openapi3/client/petstore/kotlin/docs/NullableClass.md b/samples/openapi3/client/petstore/kotlin/docs/NullableClass.md index 335943c01eae..fba9179f5847 100644 --- a/samples/openapi3/client/petstore/kotlin/docs/NullableClass.md +++ b/samples/openapi3/client/petstore/kotlin/docs/NullableClass.md @@ -2,20 +2,20 @@ # NullableClass ## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**integerProp** | **kotlin.Int** | | [optional] -**numberProp** | [**java.math.BigDecimal**](java.math.BigDecimal.md) | | [optional] -**booleanProp** | **kotlin.Boolean** | | [optional] -**stringProp** | **kotlin.String** | | [optional] -**dateProp** | [**java.time.LocalDate**](java.time.LocalDate.md) | | [optional] -**datetimeProp** | [**java.time.OffsetDateTime**](java.time.OffsetDateTime.md) | | [optional] -**arrayNullableProp** | [**kotlin.collections.List<kotlin.Any>**](kotlin.Any.md) | | [optional] -**arrayAndItemsNullableProp** | [**kotlin.collections.List<kotlin.Any>**](kotlin.Any.md) | | [optional] -**arrayItemsNullable** | [**kotlin.collections.List<kotlin.Any>**](kotlin.Any.md) | | [optional] -**objectNullableProp** | [**kotlin.collections.Map<kotlin.String, kotlin.Any>**](kotlin.Any.md) | | [optional] -**objectAndItemsNullableProp** | [**kotlin.collections.Map<kotlin.String, kotlin.Any>**](kotlin.Any.md) | | [optional] -**objectItemsNullable** | [**kotlin.collections.Map<kotlin.String, kotlin.Any>**](kotlin.Any.md) | | [optional] +| Name | Type | Description | Notes | +| ------------ | ------------- | ------------- | ------------- | +| **integerProp** | **kotlin.Int** | | [optional] | +| **numberProp** | [**java.math.BigDecimal**](java.math.BigDecimal.md) | | [optional] | +| **booleanProp** | **kotlin.Boolean** | | [optional] | +| **stringProp** | **kotlin.String** | | [optional] | +| **dateProp** | [**java.time.LocalDate**](java.time.LocalDate.md) | | [optional] | +| **datetimeProp** | [**java.time.OffsetDateTime**](java.time.OffsetDateTime.md) | | [optional] | +| **arrayNullableProp** | [**kotlin.collections.List<kotlin.Any>**](kotlin.Any.md) | | [optional] | +| **arrayAndItemsNullableProp** | [**kotlin.collections.List<kotlin.Any?>**](kotlin.Any.md) | | [optional] | +| **arrayItemsNullable** | [**kotlin.collections.List<kotlin.Any?>**](kotlin.Any.md) | | [optional] | +| **objectNullableProp** | [**kotlin.collections.Map<kotlin.String, kotlin.Any>**](kotlin.Any.md) | | [optional] | +| **objectAndItemsNullableProp** | [**kotlin.collections.Map<kotlin.String, kotlin.Any?>**](kotlin.Any.md) | | [optional] | +| **objectItemsNullable** | [**kotlin.collections.Map<kotlin.String, kotlin.Any?>**](kotlin.Any.md) | | [optional] | diff --git a/samples/openapi3/client/petstore/kotlin/docs/NumberOnly.md b/samples/openapi3/client/petstore/kotlin/docs/NumberOnly.md index 41e8b82470bc..be4467ac8976 100644 --- a/samples/openapi3/client/petstore/kotlin/docs/NumberOnly.md +++ b/samples/openapi3/client/petstore/kotlin/docs/NumberOnly.md @@ -2,9 +2,9 @@ # NumberOnly ## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**justNumber** | [**java.math.BigDecimal**](java.math.BigDecimal.md) | | [optional] +| Name | Type | Description | Notes | +| ------------ | ------------- | ------------- | ------------- | +| **justNumber** | [**java.math.BigDecimal**](java.math.BigDecimal.md) | | [optional] | diff --git a/samples/openapi3/client/petstore/kotlin/docs/ObjectWithDeprecatedFields.md b/samples/openapi3/client/petstore/kotlin/docs/ObjectWithDeprecatedFields.md new file mode 100644 index 000000000000..034fe022ec65 --- /dev/null +++ b/samples/openapi3/client/petstore/kotlin/docs/ObjectWithDeprecatedFields.md @@ -0,0 +1,13 @@ + +# ObjectWithDeprecatedFields + +## Properties +| Name | Type | Description | Notes | +| ------------ | ------------- | ------------- | ------------- | +| **uuid** | **kotlin.String** | | [optional] | +| **id** | [**java.math.BigDecimal**](java.math.BigDecimal.md) | | [optional] | +| **deprecatedRef** | [**DeprecatedObject**](DeprecatedObject.md) | | [optional] | +| **bars** | **kotlin.collections.List<kotlin.String>** | | [optional] | + + + diff --git a/samples/openapi3/client/petstore/kotlin/docs/Order.md b/samples/openapi3/client/petstore/kotlin/docs/Order.md index 5112f08958d5..7b7a399f7f75 100644 --- a/samples/openapi3/client/petstore/kotlin/docs/Order.md +++ b/samples/openapi3/client/petstore/kotlin/docs/Order.md @@ -2,21 +2,21 @@ # Order ## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**id** | **kotlin.Long** | | [optional] -**petId** | **kotlin.Long** | | [optional] -**quantity** | **kotlin.Int** | | [optional] -**shipDate** | [**java.time.OffsetDateTime**](java.time.OffsetDateTime.md) | | [optional] -**status** | [**inline**](#StatusEnum) | Order Status | [optional] -**complete** | **kotlin.Boolean** | | [optional] +| Name | Type | Description | Notes | +| ------------ | ------------- | ------------- | ------------- | +| **id** | **kotlin.Long** | | [optional] | +| **petId** | **kotlin.Long** | | [optional] | +| **quantity** | **kotlin.Int** | | [optional] | +| **shipDate** | [**java.time.OffsetDateTime**](java.time.OffsetDateTime.md) | | [optional] | +| **status** | [**inline**](#Status) | Order Status | [optional] | +| **complete** | **kotlin.Boolean** | | [optional] | - + ## Enum: status -Name | Value ----- | ----- -status | placed, approved, delivered +| Name | Value | +| ---- | ----- | +| status | placed, approved, delivered | diff --git a/samples/openapi3/client/petstore/kotlin/docs/OuterComposite.md b/samples/openapi3/client/petstore/kotlin/docs/OuterComposite.md index 5296703674de..fe90fa4eacdd 100644 --- a/samples/openapi3/client/petstore/kotlin/docs/OuterComposite.md +++ b/samples/openapi3/client/petstore/kotlin/docs/OuterComposite.md @@ -2,11 +2,11 @@ # OuterComposite ## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**myNumber** | [**java.math.BigDecimal**](java.math.BigDecimal.md) | | [optional] -**myString** | **kotlin.String** | | [optional] -**myBoolean** | **kotlin.Boolean** | | [optional] +| Name | Type | Description | Notes | +| ------------ | ------------- | ------------- | ------------- | +| **myNumber** | [**java.math.BigDecimal**](java.math.BigDecimal.md) | | [optional] | +| **myString** | **kotlin.String** | | [optional] | +| **myBoolean** | **kotlin.Boolean** | | [optional] | diff --git a/samples/openapi3/client/petstore/kotlin/docs/OuterObjectWithEnumProperty.md b/samples/openapi3/client/petstore/kotlin/docs/OuterObjectWithEnumProperty.md new file mode 100644 index 000000000000..c60ae16122c2 --- /dev/null +++ b/samples/openapi3/client/petstore/kotlin/docs/OuterObjectWithEnumProperty.md @@ -0,0 +1,10 @@ + +# OuterObjectWithEnumProperty + +## Properties +| Name | Type | Description | Notes | +| ------------ | ------------- | ------------- | ------------- | +| **`value`** | [**OuterEnumInteger**](OuterEnumInteger.md) | | | + + + diff --git a/samples/openapi3/client/petstore/kotlin/docs/ParentWithNullable.md b/samples/openapi3/client/petstore/kotlin/docs/ParentWithNullable.md new file mode 100644 index 000000000000..635c38add1d4 --- /dev/null +++ b/samples/openapi3/client/petstore/kotlin/docs/ParentWithNullable.md @@ -0,0 +1,18 @@ + +# ParentWithNullable + +## Properties +| Name | Type | Description | Notes | +| ------------ | ------------- | ------------- | ------------- | +| **type** | [**inline**](#Type) | | [optional] | +| **nullableProperty** | **kotlin.String** | | [optional] | + + + +## Enum: type +| Name | Value | +| ---- | ----- | +| type | ChildWithNullable | + + + diff --git a/samples/openapi3/client/petstore/kotlin/docs/Pet.md b/samples/openapi3/client/petstore/kotlin/docs/Pet.md index c82844b5ee80..858abbdcbfce 100644 --- a/samples/openapi3/client/petstore/kotlin/docs/Pet.md +++ b/samples/openapi3/client/petstore/kotlin/docs/Pet.md @@ -2,21 +2,21 @@ # Pet ## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**name** | **kotlin.String** | | -**photoUrls** | **kotlin.collections.List<kotlin.String>** | | -**id** | **kotlin.Long** | | [optional] -**category** | [**Category**](Category.md) | | [optional] -**tags** | [**kotlin.collections.List<Tag>**](Tag.md) | | [optional] -**status** | [**inline**](#StatusEnum) | pet status in the store | [optional] +| Name | Type | Description | Notes | +| ------------ | ------------- | ------------- | ------------- | +| **name** | **kotlin.String** | | | +| **photoUrls** | **kotlin.collections.Set<kotlin.String>** | | | +| **id** | **kotlin.Long** | | [optional] | +| **category** | [**Category**](Category.md) | | [optional] | +| **tags** | [**kotlin.collections.List<Tag>**](Tag.md) | | [optional] | +| **status** | [**inline**](#Status) | pet status in the store | [optional] | - + ## Enum: status -Name | Value ----- | ----- -status | available, pending, sold +| Name | Value | +| ---- | ----- | +| status | available, pending, sold | diff --git a/samples/openapi3/client/petstore/kotlin/docs/PetApi.md b/samples/openapi3/client/petstore/kotlin/docs/PetApi.md index 9987ca87a857..2a9bb5267175 100644 --- a/samples/openapi3/client/petstore/kotlin/docs/PetApi.md +++ b/samples/openapi3/client/petstore/kotlin/docs/PetApi.md @@ -2,25 +2,27 @@ All URIs are relative to *http://petstore.swagger.io:80/v2* -Method | HTTP request | Description -------------- | ------------- | ------------- -[**addPet**](PetApi.md#addPet) | **POST** /pet | Add a new pet to the store -[**deletePet**](PetApi.md#deletePet) | **DELETE** /pet/{petId} | Deletes a pet -[**findPetsByStatus**](PetApi.md#findPetsByStatus) | **GET** /pet/findByStatus | Finds Pets by status -[**findPetsByTags**](PetApi.md#findPetsByTags) | **GET** /pet/findByTags | Finds Pets by tags -[**getPetById**](PetApi.md#getPetById) | **GET** /pet/{petId} | Find pet by ID -[**updatePet**](PetApi.md#updatePet) | **PUT** /pet | Update an existing pet -[**updatePetWithForm**](PetApi.md#updatePetWithForm) | **POST** /pet/{petId} | Updates a pet in the store with form data -[**uploadFile**](PetApi.md#uploadFile) | **POST** /pet/{petId}/uploadImage | uploads an image -[**uploadFileWithRequiredFile**](PetApi.md#uploadFileWithRequiredFile) | **POST** /fake/{petId}/uploadImageWithRequiredFile | uploads an image (required) - - - +| Method | HTTP request | Description | +| ------------- | ------------- | ------------- | +| [**addPet**](PetApi.md#addPet) | **POST** /pet | Add a new pet to the store | +| [**deletePet**](PetApi.md#deletePet) | **DELETE** /pet/{petId} | Deletes a pet | +| [**findPetsByStatus**](PetApi.md#findPetsByStatus) | **GET** /pet/findByStatus | Finds Pets by status | +| [**findPetsByTags**](PetApi.md#findPetsByTags) | **GET** /pet/findByTags | Finds Pets by tags | +| [**getPetById**](PetApi.md#getPetById) | **GET** /pet/{petId} | Find pet by ID | +| [**updatePet**](PetApi.md#updatePet) | **PUT** /pet | Update an existing pet | +| [**updatePetWithForm**](PetApi.md#updatePetWithForm) | **POST** /pet/{petId} | Updates a pet in the store with form data | +| [**uploadFile**](PetApi.md#uploadFile) | **POST** /pet/{petId}/uploadImage | uploads an image | +| [**uploadFileWithRequiredFile**](PetApi.md#uploadFileWithRequiredFile) | **POST** /fake/{petId}/uploadImageWithRequiredFile | uploads an image (required) | + + + # **addPet** > addPet(pet) Add a new pet to the store + + ### Example ```kotlin // Import classes: @@ -41,10 +43,9 @@ try { ``` ### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **pet** | [**Pet**](Pet.md)| Pet object that needs to be added to the store | +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **pet** | [**Pet**](Pet.md)| Pet object that needs to be added to the store | | ### Return type @@ -58,15 +59,17 @@ Configure petstore_auth: ### HTTP request headers - - **Content-Type**: application/json, application/xml + - **Content-Type**: application/json - **Accept**: Not defined - + # **deletePet** > deletePet(petId, apiKey) Deletes a pet + + ### Example ```kotlin // Import classes: @@ -88,11 +91,10 @@ try { ``` ### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **petId** | **kotlin.Long**| Pet id to delete | - **apiKey** | **kotlin.String**| | [optional] +| **petId** | **kotlin.Long**| Pet id to delete | | +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **apiKey** | **kotlin.String**| | [optional] | ### Return type @@ -109,7 +111,7 @@ Configure petstore_auth: - **Content-Type**: Not defined - **Accept**: Not defined - + # **findPetsByStatus** > kotlin.collections.List<Pet> findPetsByStatus(status) @@ -138,10 +140,9 @@ try { ``` ### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **status** | [**kotlin.collections.List<kotlin.String>**](kotlin.String.md)| Status values that need to be considered for filter | [enum: available, pending, sold] +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **status** | [**kotlin.collections.List<kotlin.String>**](kotlin.String.md)| Status values that need to be considered for filter | [enum: available, pending, sold] | ### Return type @@ -156,11 +157,11 @@ Configure petstore_auth: ### HTTP request headers - **Content-Type**: Not defined - - **Accept**: application/xml, application/json + - **Accept**: application/json - + # **findPetsByTags** -> kotlin.collections.List<Pet> findPetsByTags(tags) +> kotlin.collections.Set<Pet> findPetsByTags(tags) Finds Pets by tags @@ -173,9 +174,9 @@ Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 //import org.openapitools.client.models.* val apiInstance = PetApi() -val tags : kotlin.collections.List = // kotlin.collections.List | Tags to filter by +val tags : kotlin.collections.Set = // kotlin.collections.Set | Tags to filter by try { - val result : kotlin.collections.List = apiInstance.findPetsByTags(tags) + val result : kotlin.collections.Set = apiInstance.findPetsByTags(tags) println(result) } catch (e: ClientException) { println("4xx response calling PetApi#findPetsByTags") @@ -187,14 +188,13 @@ try { ``` ### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **tags** | [**kotlin.collections.List<kotlin.String>**](kotlin.String.md)| Tags to filter by | +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **tags** | [**kotlin.collections.Set<kotlin.String>**](kotlin.String.md)| Tags to filter by | | ### Return type -[**kotlin.collections.List<Pet>**](Pet.md) +[**kotlin.collections.Set<Pet>**](Pet.md) ### Authorization @@ -205,9 +205,9 @@ Configure petstore_auth: ### HTTP request headers - **Content-Type**: Not defined - - **Accept**: application/xml, application/json + - **Accept**: application/json - + # **getPetById** > Pet getPetById(petId) @@ -236,10 +236,9 @@ try { ``` ### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **petId** | **kotlin.Long**| ID of pet to return | +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **petId** | **kotlin.Long**| ID of pet to return | | ### Return type @@ -255,14 +254,16 @@ Configure api_key: ### HTTP request headers - **Content-Type**: Not defined - - **Accept**: application/xml, application/json + - **Accept**: application/json - + # **updatePet** > updatePet(pet) Update an existing pet + + ### Example ```kotlin // Import classes: @@ -283,10 +284,9 @@ try { ``` ### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **pet** | [**Pet**](Pet.md)| Pet object that needs to be added to the store | +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **pet** | [**Pet**](Pet.md)| Pet object that needs to be added to the store | | ### Return type @@ -300,15 +300,17 @@ Configure petstore_auth: ### HTTP request headers - - **Content-Type**: application/json, application/xml + - **Content-Type**: application/json - **Accept**: Not defined - + # **updatePetWithForm** > updatePetWithForm(petId, name, status) Updates a pet in the store with form data + + ### Example ```kotlin // Import classes: @@ -331,12 +333,11 @@ try { ``` ### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **petId** | **kotlin.Long**| ID of pet that needs to be updated | - **name** | **kotlin.String**| Updated name of the pet | [optional] - **status** | **kotlin.String**| Updated status of the pet | [optional] +| **petId** | **kotlin.Long**| ID of pet that needs to be updated | | +| **name** | **kotlin.String**| Updated name of the pet | [optional] | +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **status** | **kotlin.String**| Updated status of the pet | [optional] | ### Return type @@ -353,12 +354,14 @@ Configure petstore_auth: - **Content-Type**: application/x-www-form-urlencoded - **Accept**: Not defined - + # **uploadFile** -> ApiResponse uploadFile(petId, additionalMetadata, file) +> ModelApiResponse uploadFile(petId, additionalMetadata, file) uploads an image + + ### Example ```kotlin // Import classes: @@ -370,7 +373,7 @@ val petId : kotlin.Long = 789 // kotlin.Long | ID of pet to update val additionalMetadata : kotlin.String = additionalMetadata_example // kotlin.String | Additional data to pass to server val file : java.io.File = BINARY_DATA_HERE // java.io.File | file to upload try { - val result : ApiResponse = apiInstance.uploadFile(petId, additionalMetadata, file) + val result : ModelApiResponse = apiInstance.uploadFile(petId, additionalMetadata, file) println(result) } catch (e: ClientException) { println("4xx response calling PetApi#uploadFile") @@ -382,16 +385,15 @@ try { ``` ### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **petId** | **kotlin.Long**| ID of pet to update | - **additionalMetadata** | **kotlin.String**| Additional data to pass to server | [optional] - **file** | **java.io.File**| file to upload | [optional] +| **petId** | **kotlin.Long**| ID of pet to update | | +| **additionalMetadata** | **kotlin.String**| Additional data to pass to server | [optional] | +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **file** | **java.io.File**| file to upload | [optional] | ### Return type -[**ApiResponse**](ApiResponse.md) +[**ModelApiResponse**](ModelApiResponse.md) ### Authorization @@ -404,12 +406,14 @@ Configure petstore_auth: - **Content-Type**: multipart/form-data - **Accept**: application/json - + # **uploadFileWithRequiredFile** -> ApiResponse uploadFileWithRequiredFile(petId, requiredFile, additionalMetadata) +> ModelApiResponse uploadFileWithRequiredFile(petId, requiredFile, additionalMetadata) uploads an image (required) + + ### Example ```kotlin // Import classes: @@ -421,7 +425,7 @@ val petId : kotlin.Long = 789 // kotlin.Long | ID of pet to update val requiredFile : java.io.File = BINARY_DATA_HERE // java.io.File | file to upload val additionalMetadata : kotlin.String = additionalMetadata_example // kotlin.String | Additional data to pass to server try { - val result : ApiResponse = apiInstance.uploadFileWithRequiredFile(petId, requiredFile, additionalMetadata) + val result : ModelApiResponse = apiInstance.uploadFileWithRequiredFile(petId, requiredFile, additionalMetadata) println(result) } catch (e: ClientException) { println("4xx response calling PetApi#uploadFileWithRequiredFile") @@ -433,16 +437,15 @@ try { ``` ### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **petId** | **kotlin.Long**| ID of pet to update | - **requiredFile** | **java.io.File**| file to upload | - **additionalMetadata** | **kotlin.String**| Additional data to pass to server | [optional] +| **petId** | **kotlin.Long**| ID of pet to update | | +| **requiredFile** | **java.io.File**| file to upload | | +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **additionalMetadata** | **kotlin.String**| Additional data to pass to server | [optional] | ### Return type -[**ApiResponse**](ApiResponse.md) +[**ModelApiResponse**](ModelApiResponse.md) ### Authorization diff --git a/samples/openapi3/client/petstore/kotlin/docs/ReadOnlyFirst.md b/samples/openapi3/client/petstore/kotlin/docs/ReadOnlyFirst.md index 825f613f0907..060b9fa8aa77 100644 --- a/samples/openapi3/client/petstore/kotlin/docs/ReadOnlyFirst.md +++ b/samples/openapi3/client/petstore/kotlin/docs/ReadOnlyFirst.md @@ -2,10 +2,10 @@ # ReadOnlyFirst ## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**bar** | **kotlin.String** | | [optional] [readonly] -**baz** | **kotlin.String** | | [optional] +| Name | Type | Description | Notes | +| ------------ | ------------- | ------------- | ------------- | +| **bar** | **kotlin.String** | | [optional] [readonly] | +| **baz** | **kotlin.String** | | [optional] | diff --git a/samples/openapi3/client/petstore/kotlin/docs/Return.md b/samples/openapi3/client/petstore/kotlin/docs/Return.md index a5437240dc32..0e21a3240d7e 100644 --- a/samples/openapi3/client/petstore/kotlin/docs/Return.md +++ b/samples/openapi3/client/petstore/kotlin/docs/Return.md @@ -2,9 +2,9 @@ # Return ## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**`return`** | **kotlin.Int** | | [optional] +| Name | Type | Description | Notes | +| ------------ | ------------- | ------------- | ------------- | +| **`return`** | **kotlin.Int** | | [optional] | diff --git a/samples/openapi3/client/petstore/kotlin/docs/SingleRefType.md b/samples/openapi3/client/petstore/kotlin/docs/SingleRefType.md new file mode 100644 index 000000000000..a71640f9df77 --- /dev/null +++ b/samples/openapi3/client/petstore/kotlin/docs/SingleRefType.md @@ -0,0 +1,12 @@ + +# SingleRefType + +## Enum + + + * `admin` (value: `"admin"`) + + * `user` (value: `"user"`) + + + diff --git a/samples/openapi3/client/petstore/kotlin/docs/SpecialModelName.md b/samples/openapi3/client/petstore/kotlin/docs/SpecialModelName.md index b179e705ab05..4072cb1f2f39 100644 --- a/samples/openapi3/client/petstore/kotlin/docs/SpecialModelName.md +++ b/samples/openapi3/client/petstore/kotlin/docs/SpecialModelName.md @@ -2,9 +2,9 @@ # SpecialModelname ## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**dollarSpecialPropertyName** | **kotlin.Long** | | [optional] +| Name | Type | Description | Notes | +| ------------ | ------------- | ------------- | ------------- | +| **dollarSpecialPropertyName** | **kotlin.Long** | | [optional] | diff --git a/samples/openapi3/client/petstore/kotlin/docs/StoreApi.md b/samples/openapi3/client/petstore/kotlin/docs/StoreApi.md index 9ffc2eb32abd..718fd98e5359 100644 --- a/samples/openapi3/client/petstore/kotlin/docs/StoreApi.md +++ b/samples/openapi3/client/petstore/kotlin/docs/StoreApi.md @@ -2,21 +2,21 @@ All URIs are relative to *http://petstore.swagger.io:80/v2* -Method | HTTP request | Description -------------- | ------------- | ------------- -[**deleteOrder**](StoreApi.md#deleteOrder) | **DELETE** /store/order/{order_id} | Delete purchase order by ID -[**getInventory**](StoreApi.md#getInventory) | **GET** /store/inventory | Returns pet inventories by status -[**getOrderById**](StoreApi.md#getOrderById) | **GET** /store/order/{order_id} | Find purchase order by ID -[**placeOrder**](StoreApi.md#placeOrder) | **POST** /store/order | Place an order for a pet +| Method | HTTP request | Description | +| ------------- | ------------- | ------------- | +| [**deleteOrder**](StoreApi.md#deleteOrder) | **DELETE** /store/order/{order_id} | Delete purchase order by ID | +| [**getInventory**](StoreApi.md#getInventory) | **GET** /store/inventory | Returns pet inventories by status | +| [**getOrderById**](StoreApi.md#getOrderById) | **GET** /store/order/{order_id} | Find purchase order by ID | +| [**placeOrder**](StoreApi.md#placeOrder) | **POST** /store/order | Place an order for a pet | - + # **deleteOrder** > deleteOrder(orderId) Delete purchase order by ID -For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors +For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors ### Example ```kotlin @@ -38,10 +38,9 @@ try { ``` ### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **orderId** | **kotlin.String**| ID of the order that needs to be deleted | +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **orderId** | **kotlin.String**| ID of the order that needs to be deleted | | ### Return type @@ -56,7 +55,7 @@ No authorization required - **Content-Type**: Not defined - **Accept**: Not defined - + # **getInventory** > kotlin.collections.Map<kotlin.String, kotlin.Int> getInventory() @@ -102,13 +101,13 @@ Configure api_key: - **Content-Type**: Not defined - **Accept**: application/json - + # **getOrderById** > Order getOrderById(orderId) Find purchase order by ID -For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions +For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions ### Example ```kotlin @@ -131,10 +130,9 @@ try { ``` ### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **orderId** | **kotlin.Long**| ID of pet that needs to be fetched | +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **orderId** | **kotlin.Long**| ID of pet that needs to be fetched | | ### Return type @@ -147,14 +145,16 @@ No authorization required ### HTTP request headers - **Content-Type**: Not defined - - **Accept**: application/xml, application/json + - **Accept**: application/json - + # **placeOrder** > Order placeOrder(order) Place an order for a pet + + ### Example ```kotlin // Import classes: @@ -176,10 +176,9 @@ try { ``` ### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **order** | [**Order**](Order.md)| order placed for purchasing the pet | +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **order** | [**Order**](Order.md)| order placed for purchasing the pet | | ### Return type @@ -192,5 +191,5 @@ No authorization required ### HTTP request headers - **Content-Type**: application/json - - **Accept**: application/xml, application/json + - **Accept**: application/json diff --git a/samples/openapi3/client/petstore/kotlin/docs/Tag.md b/samples/openapi3/client/petstore/kotlin/docs/Tag.md index 60ce1bcdbad3..dc8fa3cb555d 100644 --- a/samples/openapi3/client/petstore/kotlin/docs/Tag.md +++ b/samples/openapi3/client/petstore/kotlin/docs/Tag.md @@ -2,10 +2,10 @@ # Tag ## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**id** | **kotlin.Long** | | [optional] -**name** | **kotlin.String** | | [optional] +| Name | Type | Description | Notes | +| ------------ | ------------- | ------------- | ------------- | +| **id** | **kotlin.Long** | | [optional] | +| **name** | **kotlin.String** | | [optional] | diff --git a/samples/openapi3/client/petstore/kotlin/docs/TestInlineFreeformAdditionalPropertiesRequest.md b/samples/openapi3/client/petstore/kotlin/docs/TestInlineFreeformAdditionalPropertiesRequest.md new file mode 100644 index 000000000000..ee05033c5389 --- /dev/null +++ b/samples/openapi3/client/petstore/kotlin/docs/TestInlineFreeformAdditionalPropertiesRequest.md @@ -0,0 +1,10 @@ + +# TestInlineFreeformAdditionalPropertiesRequest + +## Properties +| Name | Type | Description | Notes | +| ------------ | ------------- | ------------- | ------------- | +| **someProperty** | **kotlin.String** | | [optional] | + + + diff --git a/samples/openapi3/client/petstore/kotlin/docs/User.md b/samples/openapi3/client/petstore/kotlin/docs/User.md index e801729b5ed1..a9f35788637e 100644 --- a/samples/openapi3/client/petstore/kotlin/docs/User.md +++ b/samples/openapi3/client/petstore/kotlin/docs/User.md @@ -2,16 +2,16 @@ # User ## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**id** | **kotlin.Long** | | [optional] -**username** | **kotlin.String** | | [optional] -**firstName** | **kotlin.String** | | [optional] -**lastName** | **kotlin.String** | | [optional] -**email** | **kotlin.String** | | [optional] -**password** | **kotlin.String** | | [optional] -**phone** | **kotlin.String** | | [optional] -**userStatus** | **kotlin.Int** | User Status | [optional] +| Name | Type | Description | Notes | +| ------------ | ------------- | ------------- | ------------- | +| **id** | **kotlin.Long** | | [optional] | +| **username** | **kotlin.String** | | [optional] | +| **firstName** | **kotlin.String** | | [optional] | +| **lastName** | **kotlin.String** | | [optional] | +| **email** | **kotlin.String** | | [optional] | +| **password** | **kotlin.String** | | [optional] | +| **phone** | **kotlin.String** | | [optional] | +| **userStatus** | **kotlin.Int** | User Status | [optional] | diff --git a/samples/openapi3/client/petstore/kotlin/docs/UserApi.md b/samples/openapi3/client/petstore/kotlin/docs/UserApi.md index 543cbee5a390..bed900c84970 100644 --- a/samples/openapi3/client/petstore/kotlin/docs/UserApi.md +++ b/samples/openapi3/client/petstore/kotlin/docs/UserApi.md @@ -2,19 +2,19 @@ All URIs are relative to *http://petstore.swagger.io:80/v2* -Method | HTTP request | Description -------------- | ------------- | ------------- -[**createUser**](UserApi.md#createUser) | **POST** /user | Create user -[**createUsersWithArrayInput**](UserApi.md#createUsersWithArrayInput) | **POST** /user/createWithArray | Creates list of users with given input array -[**createUsersWithListInput**](UserApi.md#createUsersWithListInput) | **POST** /user/createWithList | Creates list of users with given input array -[**deleteUser**](UserApi.md#deleteUser) | **DELETE** /user/{username} | Delete user -[**getUserByName**](UserApi.md#getUserByName) | **GET** /user/{username} | Get user by user name -[**loginUser**](UserApi.md#loginUser) | **GET** /user/login | Logs user into the system -[**logoutUser**](UserApi.md#logoutUser) | **GET** /user/logout | Logs out current logged in user session -[**updateUser**](UserApi.md#updateUser) | **PUT** /user/{username} | Updated user - - - +| Method | HTTP request | Description | +| ------------- | ------------- | ------------- | +| [**createUser**](UserApi.md#createUser) | **POST** /user | Create user | +| [**createUsersWithArrayInput**](UserApi.md#createUsersWithArrayInput) | **POST** /user/createWithArray | Creates list of users with given input array | +| [**createUsersWithListInput**](UserApi.md#createUsersWithListInput) | **POST** /user/createWithList | Creates list of users with given input array | +| [**deleteUser**](UserApi.md#deleteUser) | **DELETE** /user/{username} | Delete user | +| [**getUserByName**](UserApi.md#getUserByName) | **GET** /user/{username} | Get user by user name | +| [**loginUser**](UserApi.md#loginUser) | **GET** /user/login | Logs user into the system | +| [**logoutUser**](UserApi.md#logoutUser) | **GET** /user/logout | Logs out current logged in user session | +| [**updateUser**](UserApi.md#updateUser) | **PUT** /user/{username} | Updated user | + + + # **createUser** > createUser(user) @@ -42,10 +42,9 @@ try { ``` ### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **user** | [**User**](User.md)| Created user object | +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **user** | [**User**](User.md)| Created user object | | ### Return type @@ -60,12 +59,14 @@ No authorization required - **Content-Type**: application/json - **Accept**: Not defined - + # **createUsersWithArrayInput** > createUsersWithArrayInput(user) Creates list of users with given input array + + ### Example ```kotlin // Import classes: @@ -86,10 +87,9 @@ try { ``` ### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **user** | [**kotlin.collections.List<User>**](User.md)| List of user object | +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **user** | [**kotlin.collections.List<User>**](User.md)| List of user object | | ### Return type @@ -104,12 +104,14 @@ No authorization required - **Content-Type**: application/json - **Accept**: Not defined - + # **createUsersWithListInput** > createUsersWithListInput(user) Creates list of users with given input array + + ### Example ```kotlin // Import classes: @@ -130,10 +132,9 @@ try { ``` ### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **user** | [**kotlin.collections.List<User>**](User.md)| List of user object | +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **user** | [**kotlin.collections.List<User>**](User.md)| List of user object | | ### Return type @@ -148,7 +149,7 @@ No authorization required - **Content-Type**: application/json - **Accept**: Not defined - + # **deleteUser** > deleteUser(username) @@ -176,10 +177,9 @@ try { ``` ### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **username** | **kotlin.String**| The name that needs to be deleted | +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **username** | **kotlin.String**| The name that needs to be deleted | | ### Return type @@ -194,12 +194,14 @@ No authorization required - **Content-Type**: Not defined - **Accept**: Not defined - + # **getUserByName** > User getUserByName(username) Get user by user name + + ### Example ```kotlin // Import classes: @@ -221,10 +223,9 @@ try { ``` ### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **username** | **kotlin.String**| The name that needs to be fetched. Use user1 for testing. | +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **username** | **kotlin.String**| The name that needs to be fetched. Use user1 for testing. | | ### Return type @@ -237,14 +238,16 @@ No authorization required ### HTTP request headers - **Content-Type**: Not defined - - **Accept**: application/xml, application/json + - **Accept**: application/json - + # **loginUser** > kotlin.String loginUser(username, password) Logs user into the system + + ### Example ```kotlin // Import classes: @@ -267,11 +270,10 @@ try { ``` ### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **username** | **kotlin.String**| The user name for login | - **password** | **kotlin.String**| The password for login in clear text | +| **username** | **kotlin.String**| The user name for login | | +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **password** | **kotlin.String**| The password for login in clear text | | ### Return type @@ -284,14 +286,16 @@ No authorization required ### HTTP request headers - **Content-Type**: Not defined - - **Accept**: application/xml, application/json + - **Accept**: application/json - + # **logoutUser** > logoutUser() Logs out current logged in user session + + ### Example ```kotlin // Import classes: @@ -326,7 +330,7 @@ No authorization required - **Content-Type**: Not defined - **Accept**: Not defined - + # **updateUser** > updateUser(username, user) @@ -355,11 +359,10 @@ try { ``` ### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **username** | **kotlin.String**| name that need to be deleted | - **user** | [**User**](User.md)| Updated user object | +| **username** | **kotlin.String**| name that need to be deleted | | +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **user** | [**User**](User.md)| Updated user object | | ### Return type diff --git a/samples/openapi3/client/petstore/kotlin/gradle/wrapper/gradle-wrapper.jar b/samples/openapi3/client/petstore/kotlin/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 000000000000..2c3521197d7c Binary files /dev/null and b/samples/openapi3/client/petstore/kotlin/gradle/wrapper/gradle-wrapper.jar differ diff --git a/samples/openapi3/client/petstore/kotlin/gradle/wrapper/gradle-wrapper.properties b/samples/openapi3/client/petstore/kotlin/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 000000000000..7705927e949f --- /dev/null +++ b/samples/openapi3/client/petstore/kotlin/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,7 @@ +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.3-all.zip +networkTimeout=10000 +validateDistributionUrl=true +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists diff --git a/samples/openapi3/client/petstore/kotlin/gradlew b/samples/openapi3/client/petstore/kotlin/gradlew new file mode 100644 index 000000000000..51eb8bb47109 --- /dev/null +++ b/samples/openapi3/client/petstore/kotlin/gradlew @@ -0,0 +1,252 @@ +#!/bin/sh + +# +# Copyright © 2015-2021 the original authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# SPDX-License-Identifier: Apache-2.0 +# + +############################################################################## +# +# Gradle start up script for POSIX generated by Gradle. +# +# Important for running: +# +# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is +# noncompliant, but you have some other compliant shell such as ksh or +# bash, then to run this script, type that shell name before the whole +# command line, like: +# +# ksh Gradle +# +# Busybox and similar reduced shells will NOT work, because this script +# requires all of these POSIX shell features: +# * functions; +# * expansions «$var», «${var}», «${var:-default}», «${var+SET}», +# «${var#prefix}», «${var%suffix}», and «$( cmd )»; +# * compound commands having a testable exit status, especially «case»; +# * various built-in commands including «command», «set», and «ulimit». +# +# Important for patching: +# +# (2) This script targets any POSIX shell, so it avoids extensions provided +# by Bash, Ksh, etc; in particular arrays are avoided. +# +# The "traditional" practice of packing multiple parameters into a +# space-separated string is a well documented source of bugs and security +# problems, so this is (mostly) avoided, by progressively accumulating +# options in "$@", and eventually passing that to Java. +# +# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS, +# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly; +# see the in-line comments for details. +# +# There are tweaks for specific operating systems such as AIX, CygWin, +# Darwin, MinGW, and NonStop. +# +# (3) This script is generated from the Groovy template +# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# within the Gradle project. +# +# You can find Gradle at https://github.com/gradle/gradle/. +# +############################################################################## + +# Attempt to set APP_HOME + +# Resolve links: $0 may be a link +app_path=$0 + +# Need this for daisy-chained symlinks. +while +APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path +[ -h "$app_path" ] +do +ls=$( ls -ld "$app_path" ) +link=${ls#*' -> '} +case $link in #( +/*) app_path=$link ;; #( +*) app_path=$APP_HOME$link ;; +esac +done + +# This is normally unused +# shellcheck disable=SC2034 +APP_BASE_NAME=${0##*/} +# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036) +APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s +' "$PWD" ) || exit + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD=maximum + +warn () { +echo "$*" +} >&2 + +die () { +echo +echo "$*" +echo +exit 1 +} >&2 + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +nonstop=false +case "$( uname )" in #( +CYGWIN* ) cygwin=true ;; #( +Darwin* ) darwin=true ;; #( +MSYS* | MINGW* ) msys=true ;; #( +NONSTOP* ) nonstop=true ;; +esac + +CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + + +# Determine the Java command to use to start the JVM. +if [ -n "$JAVA_HOME" ] ; then +if [ -x "$JAVA_HOME/jre/sh/java" ] ; then +# IBM's JDK on AIX uses strange locations for the executables +JAVACMD=$JAVA_HOME/jre/sh/java +else +JAVACMD=$JAVA_HOME/bin/java +fi +if [ ! -x "$JAVACMD" ] ; then +die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +fi +else +JAVACMD=java +if ! command -v java >/dev/null 2>&1 +then +die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +fi +fi + +# Increase the maximum file descriptors if we can. +if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then +case $MAX_FD in #( +max*) +# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. +# shellcheck disable=SC2039,SC3045 +MAX_FD=$( ulimit -H -n ) || +warn "Could not query maximum file descriptor limit" +esac +case $MAX_FD in #( +'' | soft) :;; #( +*) +# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. +# shellcheck disable=SC2039,SC3045 +ulimit -n "$MAX_FD" || +warn "Could not set maximum file descriptor limit to $MAX_FD" +esac +fi + +# Collect all arguments for the java command, stacking in reverse order: +# * args from the command line +# * the main class name +# * -classpath +# * -D...appname settings +# * --module-path (only if needed) +# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. + +# For Cygwin or MSYS, switch paths to Windows format before running java +if "$cygwin" || "$msys" ; then +APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) +CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) + +JAVACMD=$( cygpath --unix "$JAVACMD" ) + +# Now convert the arguments - kludge to limit ourselves to /bin/sh +for arg do +if +case $arg in #( +-*) false ;; # don't mess with options #( +/?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath +[ -e "$t" ] ;; #( +*) false ;; +esac +then +arg=$( cygpath --path --ignore --mixed "$arg" ) +fi +# Roll the args list around exactly as many times as the number of +# args, so each arg winds up back in the position where it started, but +# possibly modified. +# +# NB: a `for` loop captures its iteration list before it begins, so +# changing the positional parameters here affects neither the number of +# iterations, nor the values presented in `arg`. +shift # remove old arg +set -- "$@" "$arg" # push replacement arg +done +fi + + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' + +# Collect all arguments for the java command: +# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments, +# and any embedded shellness will be escaped. +# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be +# treated as '${Hostname}' itself on the command line. + +set -- \ +"-Dorg.gradle.appname=$APP_BASE_NAME" \ +-classpath "$CLASSPATH" \ +org.gradle.wrapper.GradleWrapperMain \ +"$@" + +# Stop when "xargs" is not available. +if ! command -v xargs >/dev/null 2>&1 +then +die "xargs is not available" +fi + +# Use "xargs" to parse quoted args. +# +# With -n1 it outputs one arg per line, with the quotes and backslashes removed. +# +# In Bash we could simply go: +# +# readarray ARGS < <( xargs -n1 <<<"$var" ) && +# set -- "${ARGS[@]}" "$@" +# +# but POSIX shell has neither arrays nor command substitution, so instead we +# post-process each arg (as a line of input to sed) to backslash-escape any +# character that might be a shell metacharacter, then use eval to reverse +# that process (while maintaining the separation between arguments), and wrap +# the whole thing up as a single "set" statement. +# +# This will of course break if any of these variables contains a newline or +# an unmatched quote. +# + +eval "set -- $( +printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | +xargs -n1 | +sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | +tr '\n' ' ' +)" '"$@"' + +exec "$JAVACMD" "$@" diff --git a/samples/openapi3/client/petstore/kotlin/gradlew.bat b/samples/openapi3/client/petstore/kotlin/gradlew.bat new file mode 100644 index 000000000000..9d21a21834d5 --- /dev/null +++ b/samples/openapi3/client/petstore/kotlin/gradlew.bat @@ -0,0 +1,94 @@ +@rem +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem https://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem +@rem SPDX-License-Identifier: Apache-2.0 +@rem + +@if "%DEBUG%"=="" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +if "%DIRNAME%"=="" set DIRNAME=. +@rem This is normally unused +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Resolve any "." and ".." in APP_HOME to make it shorter. +for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if %ERRORLEVEL% equ 0 goto execute + +echo. 1>&2 +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto execute + +echo. 1>&2 +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 + +goto fail + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* + +:end +@rem End local scope for the variables with windows NT shell +if %ERRORLEVEL% equ 0 goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +set EXIT_CODE=%ERRORLEVEL% +if %EXIT_CODE% equ 0 set EXIT_CODE=1 +if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% +exit /b %EXIT_CODE% + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/samples/openapi3/client/petstore/kotlin/settings.gradle b/samples/openapi3/client/petstore/kotlin/settings.gradle index 7540d01de36c..5a53369817d7 100644 --- a/samples/openapi3/client/petstore/kotlin/settings.gradle +++ b/samples/openapi3/client/petstore/kotlin/settings.gradle @@ -1,2 +1 @@ - -rootProject.name = 'kotlin-petstore-client' \ No newline at end of file +rootProject.name = 'kotlin-petstore-client' diff --git a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/apis/AnotherFakeApi.kt b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/apis/AnotherFakeApi.kt index ed16413ba9cc..d4c58fda7d62 100644 --- a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/apis/AnotherFakeApi.kt +++ b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/apis/AnotherFakeApi.kt @@ -1,63 +1,74 @@ /** -* OpenAPI Petstore -* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ -* -* The version of the OpenAPI document: 1.0.0 -* -* -* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). -* https://openapi-generator.tech -* Do not edit the class manually. -*/ + * + * Please note: + * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * Do not edit this file manually. + * + */ + +@file:Suppress( + "ArrayInDataClass", + "DuplicatedCode", + "EnumEntryName", + "RemoveRedundantQualifierName", + "RemoveRedundantCallsOfConversionMethods", + "REDUNDANT_CALL_OF_CONVERSION_METHOD", + "RedundantUnitReturnType", + "RemoveEmptyClassBody", + "UnnecessaryVariable", + "UnusedImport", + "UnnecessaryVariable", + "unused" +) + package org.openapitools.client.apis +import java.io.IOException +import okhttp3.Call +import okhttp3.HttpUrl + import org.openapitools.client.models.Client +import com.squareup.moshi.Json + import org.openapitools.client.infrastructure.ApiClient +import org.openapitools.client.infrastructure.ApiResponse import org.openapitools.client.infrastructure.ClientException import org.openapitools.client.infrastructure.ClientError import org.openapitools.client.infrastructure.ServerException import org.openapitools.client.infrastructure.ServerError import org.openapitools.client.infrastructure.MultiValueMap +import org.openapitools.client.infrastructure.PartConfig import org.openapitools.client.infrastructure.RequestConfig import org.openapitools.client.infrastructure.RequestMethod import org.openapitools.client.infrastructure.ResponseType import org.openapitools.client.infrastructure.Success import org.openapitools.client.infrastructure.toMultiValue -class AnotherFakeApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { +open class AnotherFakeApi(basePath: kotlin.String = defaultBasePath, client: Call.Factory = ApiClient.defaultClient) : ApiClient(basePath, client) { companion object { @JvmStatic val defaultBasePath: String by lazy { - System.getProperties().getProperty("org.openapitools.client.baseUrl", "http://petstore.swagger.io:80/v2") + System.getProperties().getProperty(ApiClient.BASE_URL_KEY, "http://petstore.swagger.io:80/v2") } } /** - * To test special tags - * To test special tags and operation ID starting with number - * @param client client model - * @return Client - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ + * PATCH /another-fake/dummy + * To test special tags + * To test special tags and operation ID starting with number + * @param client client model + * @return Client + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception + * @throws UnsupportedOperationException If the API returns an informational or redirection response + * @throws ClientException If the API returns a client error response + * @throws ServerException If the API returns a server error response + */ @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun call123testSpecialTags(client: Client) : Client { - val localVariableBody: kotlin.Any? = client - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - val localVariableConfig = RequestConfig( - RequestMethod.PATCH, - "/another-fake/dummy", - query = localVariableQuery, - headers = localVariableHeaders - ) - val localVarResponse = request( - localVariableConfig, - localVariableBody - ) + val localVarResponse = call123testSpecialTagsWithHttpInfo(client = client) return when (localVarResponse.responseType) { ResponseType.Success -> (localVarResponse as Success<*>).data as Client @@ -69,9 +80,54 @@ class AnotherFakeApi(basePath: kotlin.String = defaultBasePath) : ApiClient(base } ResponseType.ServerError -> { val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) + throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()} ${localVarError.body}", localVarError.statusCode, localVarResponse) } } } + /** + * PATCH /another-fake/dummy + * To test special tags + * To test special tags and operation ID starting with number + * @param client client model + * @return ApiResponse + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception + */ + @Suppress("UNCHECKED_CAST") + @Throws(IllegalStateException::class, IOException::class) + fun call123testSpecialTagsWithHttpInfo(client: Client) : ApiResponse { + val localVariableConfig = call123testSpecialTagsRequestConfig(client = client) + + return request( + localVariableConfig + ) + } + + /** + * To obtain the request config of the operation call123testSpecialTags + * + * @param client client model + * @return RequestConfig + */ + fun call123testSpecialTagsRequestConfig(client: Client) : RequestConfig { + val localVariableBody = client + val localVariableQuery: MultiValueMap = mutableMapOf() + val localVariableHeaders: MutableMap = mutableMapOf() + localVariableHeaders["Content-Type"] = "application/json" + localVariableHeaders["Accept"] = "application/json" + + return RequestConfig( + method = RequestMethod.PATCH, + path = "/another-fake/dummy", + query = localVariableQuery, + headers = localVariableHeaders, + requiresAuthentication = false, + body = localVariableBody + ) + } + + + private fun encodeURIComponent(uriComponent: kotlin.String): kotlin.String = + HttpUrl.Builder().scheme("http").host("localhost").addPathSegment(uriComponent).build().encodedPathSegments[0] } diff --git a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/apis/DefaultApi.kt b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/apis/DefaultApi.kt index 25a92f753483..a28c4c6032e0 100644 --- a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/apis/DefaultApi.kt +++ b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/apis/DefaultApi.kt @@ -1,65 +1,76 @@ /** -* OpenAPI Petstore -* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ -* -* The version of the OpenAPI document: 1.0.0 -* -* -* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). -* https://openapi-generator.tech -* Do not edit the class manually. -*/ + * + * Please note: + * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * Do not edit this file manually. + * + */ + +@file:Suppress( + "ArrayInDataClass", + "DuplicatedCode", + "EnumEntryName", + "RemoveRedundantQualifierName", + "RemoveRedundantCallsOfConversionMethods", + "REDUNDANT_CALL_OF_CONVERSION_METHOD", + "RedundantUnitReturnType", + "RemoveEmptyClassBody", + "UnnecessaryVariable", + "UnusedImport", + "UnnecessaryVariable", + "unused" +) + package org.openapitools.client.apis -import org.openapitools.client.models.InlineResponseDefault +import java.io.IOException +import okhttp3.Call +import okhttp3.HttpUrl + +import org.openapitools.client.models.FooGetDefaultResponse + +import com.squareup.moshi.Json import org.openapitools.client.infrastructure.ApiClient +import org.openapitools.client.infrastructure.ApiResponse import org.openapitools.client.infrastructure.ClientException import org.openapitools.client.infrastructure.ClientError import org.openapitools.client.infrastructure.ServerException import org.openapitools.client.infrastructure.ServerError import org.openapitools.client.infrastructure.MultiValueMap +import org.openapitools.client.infrastructure.PartConfig import org.openapitools.client.infrastructure.RequestConfig import org.openapitools.client.infrastructure.RequestMethod import org.openapitools.client.infrastructure.ResponseType import org.openapitools.client.infrastructure.Success import org.openapitools.client.infrastructure.toMultiValue -class DefaultApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { +open class DefaultApi(basePath: kotlin.String = defaultBasePath, client: Call.Factory = ApiClient.defaultClient) : ApiClient(basePath, client) { companion object { @JvmStatic val defaultBasePath: String by lazy { - System.getProperties().getProperty("org.openapitools.client.baseUrl", "http://petstore.swagger.io:80/v2") + System.getProperties().getProperty(ApiClient.BASE_URL_KEY, "http://petstore.swagger.io:80/v2") } } /** - * - * - * @return InlineResponseDefault - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ + * GET /foo + * + * + * @return FooGetDefaultResponse + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception + * @throws UnsupportedOperationException If the API returns an informational or redirection response + * @throws ClientException If the API returns a client error response + * @throws ServerException If the API returns a server error response + */ @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun fooGet() : InlineResponseDefault { - val localVariableBody: kotlin.Any? = null - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - val localVariableConfig = RequestConfig( - RequestMethod.GET, - "/foo", - query = localVariableQuery, - headers = localVariableHeaders - ) - val localVarResponse = request( - localVariableConfig, - localVariableBody - ) + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) + fun fooGet() : FooGetDefaultResponse { + val localVarResponse = fooGetWithHttpInfo() return when (localVarResponse.responseType) { - ResponseType.Success -> (localVarResponse as Success<*>).data as InlineResponseDefault + ResponseType.Success -> (localVarResponse as Success<*>).data as FooGetDefaultResponse ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") ResponseType.ClientError -> { @@ -68,9 +79,51 @@ class DefaultApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath } ResponseType.ServerError -> { val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) + throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()} ${localVarError.body}", localVarError.statusCode, localVarResponse) } } } + /** + * GET /foo + * + * + * @return ApiResponse + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception + */ + @Suppress("UNCHECKED_CAST") + @Throws(IllegalStateException::class, IOException::class) + fun fooGetWithHttpInfo() : ApiResponse { + val localVariableConfig = fooGetRequestConfig() + + return request( + localVariableConfig + ) + } + + /** + * To obtain the request config of the operation fooGet + * + * @return RequestConfig + */ + fun fooGetRequestConfig() : RequestConfig { + val localVariableBody = null + val localVariableQuery: MultiValueMap = mutableMapOf() + val localVariableHeaders: MutableMap = mutableMapOf() + localVariableHeaders["Accept"] = "application/json" + + return RequestConfig( + method = RequestMethod.GET, + path = "/foo", + query = localVariableQuery, + headers = localVariableHeaders, + requiresAuthentication = false, + body = localVariableBody + ) + } + + + private fun encodeURIComponent(uriComponent: kotlin.String): kotlin.String = + HttpUrl.Builder().scheme("http").host("localhost").addPathSegment(uriComponent).build().encodedPathSegments[0] } diff --git a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/apis/FakeApi.kt b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/apis/FakeApi.kt index 2a3bcc659c46..c2040087297b 100644 --- a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/apis/FakeApi.kt +++ b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/apis/FakeApi.kt @@ -1,67 +1,152 @@ /** -* OpenAPI Petstore -* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ -* -* The version of the OpenAPI document: 1.0.0 -* -* -* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). -* https://openapi-generator.tech -* Do not edit the class manually. -*/ + * + * Please note: + * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * Do not edit this file manually. + * + */ + +@file:Suppress( + "ArrayInDataClass", + "DuplicatedCode", + "EnumEntryName", + "RemoveRedundantQualifierName", + "RemoveRedundantCallsOfConversionMethods", + "REDUNDANT_CALL_OF_CONVERSION_METHOD", + "RedundantUnitReturnType", + "RemoveEmptyClassBody", + "UnnecessaryVariable", + "UnusedImport", + "UnnecessaryVariable", + "unused" +) + package org.openapitools.client.apis +import java.io.IOException +import okhttp3.Call +import okhttp3.HttpUrl + +import org.openapitools.client.models.ChildWithNullable import org.openapitools.client.models.Client +import org.openapitools.client.models.EnumClass +import org.openapitools.client.models.FakeBigDecimalMap200Response import org.openapitools.client.models.FileSchemaTestClass import org.openapitools.client.models.HealthCheckResult import org.openapitools.client.models.OuterComposite +import org.openapitools.client.models.OuterObjectWithEnumProperty import org.openapitools.client.models.Pet +import org.openapitools.client.models.TestInlineFreeformAdditionalPropertiesRequest import org.openapitools.client.models.User +import com.squareup.moshi.Json + import org.openapitools.client.infrastructure.ApiClient +import org.openapitools.client.infrastructure.ApiResponse import org.openapitools.client.infrastructure.ClientException import org.openapitools.client.infrastructure.ClientError import org.openapitools.client.infrastructure.ServerException import org.openapitools.client.infrastructure.ServerError import org.openapitools.client.infrastructure.MultiValueMap +import org.openapitools.client.infrastructure.PartConfig import org.openapitools.client.infrastructure.RequestConfig import org.openapitools.client.infrastructure.RequestMethod import org.openapitools.client.infrastructure.ResponseType import org.openapitools.client.infrastructure.Success import org.openapitools.client.infrastructure.toMultiValue -class FakeApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { +open class FakeApi(basePath: kotlin.String = defaultBasePath, client: Call.Factory = ApiClient.defaultClient) : ApiClient(basePath, client) { companion object { @JvmStatic val defaultBasePath: String by lazy { - System.getProperties().getProperty("org.openapitools.client.baseUrl", "http://petstore.swagger.io:80/v2") + System.getProperties().getProperty(ApiClient.BASE_URL_KEY, "http://petstore.swagger.io:80/v2") } } /** - * Health check endpoint - * - * @return HealthCheckResult - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ + * GET /fake/BigDecimalMap + * + * for Java apache and Java native, test toUrlQueryString for maps with BegDecimal keys + * @return FakeBigDecimalMap200Response + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception + * @throws UnsupportedOperationException If the API returns an informational or redirection response + * @throws ClientException If the API returns a client error response + * @throws ServerException If the API returns a server error response + */ @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun fakeHealthGet() : HealthCheckResult { - val localVariableBody: kotlin.Any? = null + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) + fun fakeBigDecimalMap() : FakeBigDecimalMap200Response { + val localVarResponse = fakeBigDecimalMapWithHttpInfo() + + return when (localVarResponse.responseType) { + ResponseType.Success -> (localVarResponse as Success<*>).data as FakeBigDecimalMap200Response + ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") + ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") + ResponseType.ClientError -> { + val localVarError = localVarResponse as ClientError<*> + throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) + } + ResponseType.ServerError -> { + val localVarError = localVarResponse as ServerError<*> + throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()} ${localVarError.body}", localVarError.statusCode, localVarResponse) + } + } + } + + /** + * GET /fake/BigDecimalMap + * + * for Java apache and Java native, test toUrlQueryString for maps with BegDecimal keys + * @return ApiResponse + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception + */ + @Suppress("UNCHECKED_CAST") + @Throws(IllegalStateException::class, IOException::class) + fun fakeBigDecimalMapWithHttpInfo() : ApiResponse { + val localVariableConfig = fakeBigDecimalMapRequestConfig() + + return request( + localVariableConfig + ) + } + + /** + * To obtain the request config of the operation fakeBigDecimalMap + * + * @return RequestConfig + */ + fun fakeBigDecimalMapRequestConfig() : RequestConfig { + val localVariableBody = null val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf() - val localVariableConfig = RequestConfig( - RequestMethod.GET, - "/fake/health", + + return RequestConfig( + method = RequestMethod.GET, + path = "/fake/BigDecimalMap", query = localVariableQuery, - headers = localVariableHeaders - ) - val localVarResponse = request( - localVariableConfig, - localVariableBody + headers = localVariableHeaders, + requiresAuthentication = false, + body = localVariableBody ) + } + + /** + * GET /fake/health + * Health check endpoint + * + * @return HealthCheckResult + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception + * @throws UnsupportedOperationException If the API returns an informational or redirection response + * @throws ClientException If the API returns a client error response + * @throws ServerException If the API returns a server error response + */ + @Suppress("UNCHECKED_CAST") + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) + fun fakeHealthGet() : HealthCheckResult { + val localVarResponse = fakeHealthGetWithHttpInfo() return when (localVarResponse.responseType) { ResponseType.Success -> (localVarResponse as Success<*>).data as HealthCheckResult @@ -73,26 +158,114 @@ class FakeApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { } ResponseType.ServerError -> { val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) + throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()} ${localVarError.body}", localVarError.statusCode, localVarResponse) } } } /** - * test http signature authentication - * - * @param pet Pet object that needs to be added to the store - * @param query1 query parameter (optional) - * @param header1 header parameter (optional) - * @return void - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun fakeHttpSignatureTest(pet: Pet, query1: kotlin.String?, header1: kotlin.String?) : Unit { - val localVariableBody: kotlin.Any? = pet - val localVariableQuery: MultiValueMap = mutableMapOf>() + * GET /fake/health + * Health check endpoint + * + * @return ApiResponse + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception + */ + @Suppress("UNCHECKED_CAST") + @Throws(IllegalStateException::class, IOException::class) + fun fakeHealthGetWithHttpInfo() : ApiResponse { + val localVariableConfig = fakeHealthGetRequestConfig() + + return request( + localVariableConfig + ) + } + + /** + * To obtain the request config of the operation fakeHealthGet + * + * @return RequestConfig + */ + fun fakeHealthGetRequestConfig() : RequestConfig { + val localVariableBody = null + val localVariableQuery: MultiValueMap = mutableMapOf() + val localVariableHeaders: MutableMap = mutableMapOf() + localVariableHeaders["Accept"] = "application/json" + + return RequestConfig( + method = RequestMethod.GET, + path = "/fake/health", + query = localVariableQuery, + headers = localVariableHeaders, + requiresAuthentication = false, + body = localVariableBody + ) + } + + /** + * GET /fake/http-signature-test + * test http signature authentication + * + * @param pet Pet object that needs to be added to the store + * @param query1 query parameter (optional) + * @param header1 header parameter (optional) + * @return void + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception + * @throws UnsupportedOperationException If the API returns an informational or redirection response + * @throws ClientException If the API returns a client error response + * @throws ServerException If the API returns a server error response + */ + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) + fun fakeHttpSignatureTest(pet: Pet, query1: kotlin.String? = null, header1: kotlin.String? = null) : Unit { + val localVarResponse = fakeHttpSignatureTestWithHttpInfo(pet = pet, query1 = query1, header1 = header1) + + return when (localVarResponse.responseType) { + ResponseType.Success -> Unit + ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") + ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") + ResponseType.ClientError -> { + val localVarError = localVarResponse as ClientError<*> + throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) + } + ResponseType.ServerError -> { + val localVarError = localVarResponse as ServerError<*> + throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()} ${localVarError.body}", localVarError.statusCode, localVarResponse) + } + } + } + + /** + * GET /fake/http-signature-test + * test http signature authentication + * + * @param pet Pet object that needs to be added to the store + * @param query1 query parameter (optional) + * @param header1 header parameter (optional) + * @return ApiResponse + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception + */ + @Throws(IllegalStateException::class, IOException::class) + fun fakeHttpSignatureTestWithHttpInfo(pet: Pet, query1: kotlin.String?, header1: kotlin.String?) : ApiResponse { + val localVariableConfig = fakeHttpSignatureTestRequestConfig(pet = pet, query1 = query1, header1 = header1) + + return request( + localVariableConfig + ) + } + + /** + * To obtain the request config of the operation fakeHttpSignatureTest + * + * @param pet Pet object that needs to be added to the store + * @param query1 query parameter (optional) + * @param header1 header parameter (optional) + * @return RequestConfig + */ + fun fakeHttpSignatureTestRequestConfig(pet: Pet, query1: kotlin.String?, header1: kotlin.String?) : RequestConfig { + val localVariableBody = pet + val localVariableQuery: MultiValueMap = mutableMapOf>() .apply { if (query1 != null) { put("query_1", listOf(query1.toString())) @@ -100,19 +273,37 @@ class FakeApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { } val localVariableHeaders: MutableMap = mutableMapOf() header1?.apply { localVariableHeaders["header_1"] = this.toString() } - val localVariableConfig = RequestConfig( - RequestMethod.GET, - "/fake/http-signature-test", + localVariableHeaders["Content-Type"] = "application/json" + + return RequestConfig( + method = RequestMethod.GET, + path = "/fake/http-signature-test", query = localVariableQuery, - headers = localVariableHeaders - ) - val localVarResponse = request( - localVariableConfig, - localVariableBody + headers = localVariableHeaders, + requiresAuthentication = true, + body = localVariableBody ) + } + + /** + * POST /fake/outer/boolean + * + * Test serialization of outer boolean types + * @param body Input boolean as post body (optional) + * @return kotlin.Boolean + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception + * @throws UnsupportedOperationException If the API returns an informational or redirection response + * @throws ClientException If the API returns a client error response + * @throws ServerException If the API returns a server error response + */ + @Suppress("UNCHECKED_CAST") + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) + fun fakeOuterBooleanSerialize(body: kotlin.Boolean? = null) : kotlin.Boolean { + val localVarResponse = fakeOuterBooleanSerializeWithHttpInfo(body = body) return when (localVarResponse.responseType) { - ResponseType.Success -> Unit + ResponseType.Success -> (localVarResponse as Success<*>).data as kotlin.Boolean ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") ResponseType.ClientError -> { @@ -121,39 +312,71 @@ class FakeApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { } ResponseType.ServerError -> { val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) + throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()} ${localVarError.body}", localVarError.statusCode, localVarResponse) } } } /** - * - * Test serialization of outer boolean types - * @param body Input boolean as post body (optional) - * @return kotlin.Boolean - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ + * POST /fake/outer/boolean + * + * Test serialization of outer boolean types + * @param body Input boolean as post body (optional) + * @return ApiResponse + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception + */ @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun fakeOuterBooleanSerialize(body: kotlin.Boolean?) : kotlin.Boolean { - val localVariableBody: kotlin.Any? = body + @Throws(IllegalStateException::class, IOException::class) + fun fakeOuterBooleanSerializeWithHttpInfo(body: kotlin.Boolean?) : ApiResponse { + val localVariableConfig = fakeOuterBooleanSerializeRequestConfig(body = body) + + return request( + localVariableConfig + ) + } + + /** + * To obtain the request config of the operation fakeOuterBooleanSerialize + * + * @param body Input boolean as post body (optional) + * @return RequestConfig + */ + fun fakeOuterBooleanSerializeRequestConfig(body: kotlin.Boolean?) : RequestConfig { + val localVariableBody = body val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf() - val localVariableConfig = RequestConfig( - RequestMethod.POST, - "/fake/outer/boolean", + localVariableHeaders["Content-Type"] = "application/json" + + return RequestConfig( + method = RequestMethod.POST, + path = "/fake/outer/boolean", query = localVariableQuery, - headers = localVariableHeaders - ) - val localVarResponse = request( - localVariableConfig, - localVariableBody + headers = localVariableHeaders, + requiresAuthentication = false, + body = localVariableBody ) + } + + /** + * POST /fake/outer/composite + * + * Test serialization of object with outer number type + * @param outerComposite Input composite as post body (optional) + * @return OuterComposite + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception + * @throws UnsupportedOperationException If the API returns an informational or redirection response + * @throws ClientException If the API returns a client error response + * @throws ServerException If the API returns a server error response + */ + @Suppress("UNCHECKED_CAST") + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) + fun fakeOuterCompositeSerialize(outerComposite: OuterComposite? = null) : OuterComposite { + val localVarResponse = fakeOuterCompositeSerializeWithHttpInfo(outerComposite = outerComposite) return when (localVarResponse.responseType) { - ResponseType.Success -> (localVarResponse as Success<*>).data as kotlin.Boolean + ResponseType.Success -> (localVarResponse as Success<*>).data as OuterComposite ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") ResponseType.ClientError -> { @@ -162,39 +385,71 @@ class FakeApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { } ResponseType.ServerError -> { val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) + throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()} ${localVarError.body}", localVarError.statusCode, localVarResponse) } } } /** - * - * Test serialization of object with outer number type - * @param outerComposite Input composite as post body (optional) - * @return OuterComposite - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ + * POST /fake/outer/composite + * + * Test serialization of object with outer number type + * @param outerComposite Input composite as post body (optional) + * @return ApiResponse + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception + */ @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun fakeOuterCompositeSerialize(outerComposite: OuterComposite?) : OuterComposite { - val localVariableBody: kotlin.Any? = outerComposite + @Throws(IllegalStateException::class, IOException::class) + fun fakeOuterCompositeSerializeWithHttpInfo(outerComposite: OuterComposite?) : ApiResponse { + val localVariableConfig = fakeOuterCompositeSerializeRequestConfig(outerComposite = outerComposite) + + return request( + localVariableConfig + ) + } + + /** + * To obtain the request config of the operation fakeOuterCompositeSerialize + * + * @param outerComposite Input composite as post body (optional) + * @return RequestConfig + */ + fun fakeOuterCompositeSerializeRequestConfig(outerComposite: OuterComposite?) : RequestConfig { + val localVariableBody = outerComposite val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf() - val localVariableConfig = RequestConfig( - RequestMethod.POST, - "/fake/outer/composite", + localVariableHeaders["Content-Type"] = "application/json" + + return RequestConfig( + method = RequestMethod.POST, + path = "/fake/outer/composite", query = localVariableQuery, - headers = localVariableHeaders - ) - val localVarResponse = request( - localVariableConfig, - localVariableBody + headers = localVariableHeaders, + requiresAuthentication = false, + body = localVariableBody ) + } + + /** + * POST /fake/outer/number + * + * Test serialization of outer number types + * @param body Input number as post body (optional) + * @return java.math.BigDecimal + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception + * @throws UnsupportedOperationException If the API returns an informational or redirection response + * @throws ClientException If the API returns a client error response + * @throws ServerException If the API returns a server error response + */ + @Suppress("UNCHECKED_CAST") + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) + fun fakeOuterNumberSerialize(body: java.math.BigDecimal? = null) : java.math.BigDecimal { + val localVarResponse = fakeOuterNumberSerializeWithHttpInfo(body = body) return when (localVarResponse.responseType) { - ResponseType.Success -> (localVarResponse as Success<*>).data as OuterComposite + ResponseType.Success -> (localVarResponse as Success<*>).data as java.math.BigDecimal ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") ResponseType.ClientError -> { @@ -203,39 +458,71 @@ class FakeApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { } ResponseType.ServerError -> { val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) + throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()} ${localVarError.body}", localVarError.statusCode, localVarResponse) } } } /** - * - * Test serialization of outer number types - * @param body Input number as post body (optional) - * @return java.math.BigDecimal - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ + * POST /fake/outer/number + * + * Test serialization of outer number types + * @param body Input number as post body (optional) + * @return ApiResponse + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception + */ @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun fakeOuterNumberSerialize(body: java.math.BigDecimal?) : java.math.BigDecimal { - val localVariableBody: kotlin.Any? = body + @Throws(IllegalStateException::class, IOException::class) + fun fakeOuterNumberSerializeWithHttpInfo(body: java.math.BigDecimal?) : ApiResponse { + val localVariableConfig = fakeOuterNumberSerializeRequestConfig(body = body) + + return request( + localVariableConfig + ) + } + + /** + * To obtain the request config of the operation fakeOuterNumberSerialize + * + * @param body Input number as post body (optional) + * @return RequestConfig + */ + fun fakeOuterNumberSerializeRequestConfig(body: java.math.BigDecimal?) : RequestConfig { + val localVariableBody = body val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf() - val localVariableConfig = RequestConfig( - RequestMethod.POST, - "/fake/outer/number", + localVariableHeaders["Content-Type"] = "application/json" + + return RequestConfig( + method = RequestMethod.POST, + path = "/fake/outer/number", query = localVariableQuery, - headers = localVariableHeaders - ) - val localVarResponse = request( - localVariableConfig, - localVariableBody + headers = localVariableHeaders, + requiresAuthentication = false, + body = localVariableBody ) + } + + /** + * POST /fake/outer/string + * + * Test serialization of outer string types + * @param body Input string as post body (optional) + * @return kotlin.String + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception + * @throws UnsupportedOperationException If the API returns an informational or redirection response + * @throws ClientException If the API returns a client error response + * @throws ServerException If the API returns a server error response + */ + @Suppress("UNCHECKED_CAST") + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) + fun fakeOuterStringSerialize(body: kotlin.String? = null) : kotlin.String { + val localVarResponse = fakeOuterStringSerializeWithHttpInfo(body = body) return when (localVarResponse.responseType) { - ResponseType.Success -> (localVarResponse as Success<*>).data as java.math.BigDecimal + ResponseType.Success -> (localVarResponse as Success<*>).data as kotlin.String ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") ResponseType.ClientError -> { @@ -244,39 +531,143 @@ class FakeApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { } ResponseType.ServerError -> { val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) + throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()} ${localVarError.body}", localVarError.statusCode, localVarResponse) } } } /** - * - * Test serialization of outer string types - * @param body Input string as post body (optional) - * @return kotlin.String - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ + * POST /fake/outer/string + * + * Test serialization of outer string types + * @param body Input string as post body (optional) + * @return ApiResponse + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception + */ @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun fakeOuterStringSerialize(body: kotlin.String?) : kotlin.String { - val localVariableBody: kotlin.Any? = body + @Throws(IllegalStateException::class, IOException::class) + fun fakeOuterStringSerializeWithHttpInfo(body: kotlin.String?) : ApiResponse { + val localVariableConfig = fakeOuterStringSerializeRequestConfig(body = body) + + return request( + localVariableConfig + ) + } + + /** + * To obtain the request config of the operation fakeOuterStringSerialize + * + * @param body Input string as post body (optional) + * @return RequestConfig + */ + fun fakeOuterStringSerializeRequestConfig(body: kotlin.String?) : RequestConfig { + val localVariableBody = body val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf() - val localVariableConfig = RequestConfig( - RequestMethod.POST, - "/fake/outer/string", + localVariableHeaders["Content-Type"] = "application/json" + + return RequestConfig( + method = RequestMethod.POST, + path = "/fake/outer/string", query = localVariableQuery, - headers = localVariableHeaders + headers = localVariableHeaders, + requiresAuthentication = false, + body = localVariableBody + ) + } + + /** + * POST /fake/property/enum-int + * + * Test serialization of enum (int) properties with examples + * @param outerObjectWithEnumProperty Input enum (int) as post body + * @return OuterObjectWithEnumProperty + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception + * @throws UnsupportedOperationException If the API returns an informational or redirection response + * @throws ClientException If the API returns a client error response + * @throws ServerException If the API returns a server error response + */ + @Suppress("UNCHECKED_CAST") + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) + fun fakePropertyEnumIntegerSerialize(outerObjectWithEnumProperty: OuterObjectWithEnumProperty) : OuterObjectWithEnumProperty { + val localVarResponse = fakePropertyEnumIntegerSerializeWithHttpInfo(outerObjectWithEnumProperty = outerObjectWithEnumProperty) + + return when (localVarResponse.responseType) { + ResponseType.Success -> (localVarResponse as Success<*>).data as OuterObjectWithEnumProperty + ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") + ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") + ResponseType.ClientError -> { + val localVarError = localVarResponse as ClientError<*> + throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) + } + ResponseType.ServerError -> { + val localVarError = localVarResponse as ServerError<*> + throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()} ${localVarError.body}", localVarError.statusCode, localVarResponse) + } + } + } + + /** + * POST /fake/property/enum-int + * + * Test serialization of enum (int) properties with examples + * @param outerObjectWithEnumProperty Input enum (int) as post body + * @return ApiResponse + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception + */ + @Suppress("UNCHECKED_CAST") + @Throws(IllegalStateException::class, IOException::class) + fun fakePropertyEnumIntegerSerializeWithHttpInfo(outerObjectWithEnumProperty: OuterObjectWithEnumProperty) : ApiResponse { + val localVariableConfig = fakePropertyEnumIntegerSerializeRequestConfig(outerObjectWithEnumProperty = outerObjectWithEnumProperty) + + return request( + localVariableConfig ) - val localVarResponse = request( - localVariableConfig, - localVariableBody + } + + /** + * To obtain the request config of the operation fakePropertyEnumIntegerSerialize + * + * @param outerObjectWithEnumProperty Input enum (int) as post body + * @return RequestConfig + */ + fun fakePropertyEnumIntegerSerializeRequestConfig(outerObjectWithEnumProperty: OuterObjectWithEnumProperty) : RequestConfig { + val localVariableBody = outerObjectWithEnumProperty + val localVariableQuery: MultiValueMap = mutableMapOf() + val localVariableHeaders: MutableMap = mutableMapOf() + localVariableHeaders["Content-Type"] = "application/json" + + return RequestConfig( + method = RequestMethod.POST, + path = "/fake/property/enum-int", + query = localVariableQuery, + headers = localVariableHeaders, + requiresAuthentication = false, + body = localVariableBody ) + } + + /** + * POST /fake/additionalProperties-reference + * test referenced additionalProperties + * + * @param requestBody request body + * @return void + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception + * @throws UnsupportedOperationException If the API returns an informational or redirection response + * @throws ClientException If the API returns a client error response + * @throws ServerException If the API returns a server error response + */ + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) + fun testAdditionalPropertiesReference(requestBody: kotlin.collections.Map) : Unit { + val localVarResponse = testAdditionalPropertiesReferenceWithHttpInfo(requestBody = requestBody) return when (localVarResponse.responseType) { - ResponseType.Success -> (localVarResponse as Success<*>).data as kotlin.String + ResponseType.Success -> Unit ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") ResponseType.ClientError -> { @@ -285,35 +676,136 @@ class FakeApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { } ResponseType.ServerError -> { val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) + throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()} ${localVarError.body}", localVarError.statusCode, localVarResponse) } } } /** - * - * For this test, the body for this request much reference a schema named `File`. - * @param fileSchemaTestClass - * @return void - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun testBodyWithFileSchema(fileSchemaTestClass: FileSchemaTestClass) : Unit { - val localVariableBody: kotlin.Any? = fileSchemaTestClass + * POST /fake/additionalProperties-reference + * test referenced additionalProperties + * + * @param requestBody request body + * @return ApiResponse + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception + */ + @Throws(IllegalStateException::class, IOException::class) + fun testAdditionalPropertiesReferenceWithHttpInfo(requestBody: kotlin.collections.Map) : ApiResponse { + val localVariableConfig = testAdditionalPropertiesReferenceRequestConfig(requestBody = requestBody) + + return request, Unit>( + localVariableConfig + ) + } + + /** + * To obtain the request config of the operation testAdditionalPropertiesReference + * + * @param requestBody request body + * @return RequestConfig + */ + fun testAdditionalPropertiesReferenceRequestConfig(requestBody: kotlin.collections.Map) : RequestConfig> { + val localVariableBody = requestBody val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf() - val localVariableConfig = RequestConfig( - RequestMethod.PUT, - "/fake/body-with-file-schema", + localVariableHeaders["Content-Type"] = "application/json" + + return RequestConfig( + method = RequestMethod.POST, + path = "/fake/additionalProperties-reference", query = localVariableQuery, - headers = localVariableHeaders + headers = localVariableHeaders, + requiresAuthentication = false, + body = localVariableBody + ) + } + + /** + * PUT /fake/body-with-binary + * + * For this test, the body has to be a binary file. + * @param body image to upload + * @return void + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception + * @throws UnsupportedOperationException If the API returns an informational or redirection response + * @throws ClientException If the API returns a client error response + * @throws ServerException If the API returns a server error response + */ + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) + fun testBodyWithBinary(body: java.io.File) : Unit { + val localVarResponse = testBodyWithBinaryWithHttpInfo(body = body) + + return when (localVarResponse.responseType) { + ResponseType.Success -> Unit + ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") + ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") + ResponseType.ClientError -> { + val localVarError = localVarResponse as ClientError<*> + throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) + } + ResponseType.ServerError -> { + val localVarError = localVarResponse as ServerError<*> + throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()} ${localVarError.body}", localVarError.statusCode, localVarResponse) + } + } + } + + /** + * PUT /fake/body-with-binary + * + * For this test, the body has to be a binary file. + * @param body image to upload + * @return ApiResponse + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception + */ + @Throws(IllegalStateException::class, IOException::class) + fun testBodyWithBinaryWithHttpInfo(body: java.io.File) : ApiResponse { + val localVariableConfig = testBodyWithBinaryRequestConfig(body = body) + + return request( + localVariableConfig ) - val localVarResponse = request( - localVariableConfig, - localVariableBody + } + + /** + * To obtain the request config of the operation testBodyWithBinary + * + * @param body image to upload + * @return RequestConfig + */ + fun testBodyWithBinaryRequestConfig(body: java.io.File) : RequestConfig { + val localVariableBody = body + val localVariableQuery: MultiValueMap = mutableMapOf() + val localVariableHeaders: MutableMap = mutableMapOf() + + return RequestConfig( + method = RequestMethod.PUT, + path = "/fake/body-with-binary", + query = localVariableQuery, + headers = localVariableHeaders, + requiresAuthentication = false, + body = localVariableBody ) + } + + /** + * PUT /fake/body-with-file-schema + * + * For this test, the body for this request must reference a schema named `File`. + * @param fileSchemaTestClass + * @return void + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception + * @throws UnsupportedOperationException If the API returns an informational or redirection response + * @throws ClientException If the API returns a client error response + * @throws ServerException If the API returns a server error response + */ + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) + fun testBodyWithFileSchema(fileSchemaTestClass: FileSchemaTestClass) : Unit { + val localVarResponse = testBodyWithFileSchemaWithHttpInfo(fileSchemaTestClass = fileSchemaTestClass) return when (localVarResponse.responseType) { ResponseType.Success -> Unit @@ -325,42 +817,147 @@ class FakeApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { } ResponseType.ServerError -> { val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) + throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()} ${localVarError.body}", localVarError.statusCode, localVarResponse) } } } /** - * - * - * @param query - * @param user - * @return void - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + * PUT /fake/body-with-file-schema + * + * For this test, the body for this request must reference a schema named `File`. + * @param fileSchemaTestClass + * @return ApiResponse + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception + */ + @Throws(IllegalStateException::class, IOException::class) + fun testBodyWithFileSchemaWithHttpInfo(fileSchemaTestClass: FileSchemaTestClass) : ApiResponse { + val localVariableConfig = testBodyWithFileSchemaRequestConfig(fileSchemaTestClass = fileSchemaTestClass) + + return request( + localVariableConfig + ) + } + + /** + * To obtain the request config of the operation testBodyWithFileSchema + * + * @param fileSchemaTestClass + * @return RequestConfig + */ + fun testBodyWithFileSchemaRequestConfig(fileSchemaTestClass: FileSchemaTestClass) : RequestConfig { + val localVariableBody = fileSchemaTestClass + val localVariableQuery: MultiValueMap = mutableMapOf() + val localVariableHeaders: MutableMap = mutableMapOf() + localVariableHeaders["Content-Type"] = "application/json" + + return RequestConfig( + method = RequestMethod.PUT, + path = "/fake/body-with-file-schema", + query = localVariableQuery, + headers = localVariableHeaders, + requiresAuthentication = false, + body = localVariableBody + ) + } + + /** + * PUT /fake/body-with-query-params + * + * + * @param query + * @param user + * @return void + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception + * @throws UnsupportedOperationException If the API returns an informational or redirection response + * @throws ClientException If the API returns a client error response + * @throws ServerException If the API returns a server error response + */ + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun testBodyWithQueryParams(query: kotlin.String, user: User) : Unit { - val localVariableBody: kotlin.Any? = user - val localVariableQuery: MultiValueMap = mutableMapOf>() + val localVarResponse = testBodyWithQueryParamsWithHttpInfo(query = query, user = user) + + return when (localVarResponse.responseType) { + ResponseType.Success -> Unit + ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") + ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") + ResponseType.ClientError -> { + val localVarError = localVarResponse as ClientError<*> + throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) + } + ResponseType.ServerError -> { + val localVarError = localVarResponse as ServerError<*> + throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()} ${localVarError.body}", localVarError.statusCode, localVarResponse) + } + } + } + + /** + * PUT /fake/body-with-query-params + * + * + * @param query + * @param user + * @return ApiResponse + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception + */ + @Throws(IllegalStateException::class, IOException::class) + fun testBodyWithQueryParamsWithHttpInfo(query: kotlin.String, user: User) : ApiResponse { + val localVariableConfig = testBodyWithQueryParamsRequestConfig(query = query, user = user) + + return request( + localVariableConfig + ) + } + + /** + * To obtain the request config of the operation testBodyWithQueryParams + * + * @param query + * @param user + * @return RequestConfig + */ + fun testBodyWithQueryParamsRequestConfig(query: kotlin.String, user: User) : RequestConfig { + val localVariableBody = user + val localVariableQuery: MultiValueMap = mutableMapOf>() .apply { put("query", listOf(query.toString())) } val localVariableHeaders: MutableMap = mutableMapOf() - val localVariableConfig = RequestConfig( - RequestMethod.PUT, - "/fake/body-with-query-params", + localVariableHeaders["Content-Type"] = "application/json" + + return RequestConfig( + method = RequestMethod.PUT, + path = "/fake/body-with-query-params", query = localVariableQuery, - headers = localVariableHeaders - ) - val localVarResponse = request( - localVariableConfig, - localVariableBody + headers = localVariableHeaders, + requiresAuthentication = false, + body = localVariableBody ) + } + + /** + * PATCH /fake + * To test \"client\" model + * To test \"client\" model + * @param client client model + * @return Client + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception + * @throws UnsupportedOperationException If the API returns an informational or redirection response + * @throws ClientException If the API returns a client error response + * @throws ServerException If the API returns a server error response + */ + @Suppress("UNCHECKED_CAST") + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) + fun testClientModel(client: Client) : Client { + val localVarResponse = testClientModelWithHttpInfo(client = client) return when (localVarResponse.responseType) { - ResponseType.Success -> Unit + ResponseType.Success -> (localVarResponse as Success<*>).data as Client ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") ResponseType.ClientError -> { @@ -369,39 +966,84 @@ class FakeApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { } ResponseType.ServerError -> { val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) + throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()} ${localVarError.body}", localVarError.statusCode, localVarResponse) } } } /** - * To test \"client\" model - * To test \"client\" model - * @param client client model - * @return Client - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ + * PATCH /fake + * To test \"client\" model + * To test \"client\" model + * @param client client model + * @return ApiResponse + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception + */ @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun testClientModel(client: Client) : Client { - val localVariableBody: kotlin.Any? = client + @Throws(IllegalStateException::class, IOException::class) + fun testClientModelWithHttpInfo(client: Client) : ApiResponse { + val localVariableConfig = testClientModelRequestConfig(client = client) + + return request( + localVariableConfig + ) + } + + /** + * To obtain the request config of the operation testClientModel + * + * @param client client model + * @return RequestConfig + */ + fun testClientModelRequestConfig(client: Client) : RequestConfig { + val localVariableBody = client val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf() - val localVariableConfig = RequestConfig( - RequestMethod.PATCH, - "/fake", + localVariableHeaders["Content-Type"] = "application/json" + localVariableHeaders["Accept"] = "application/json" + + return RequestConfig( + method = RequestMethod.PATCH, + path = "/fake", query = localVariableQuery, - headers = localVariableHeaders - ) - val localVarResponse = request( - localVariableConfig, - localVariableBody + headers = localVariableHeaders, + requiresAuthentication = false, + body = localVariableBody ) + } + + /** + * POST /fake + * Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + * Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + * @param number None + * @param double None + * @param patternWithoutDelimiter None + * @param byte None + * @param integer None (optional) + * @param int32 None (optional) + * @param int64 None (optional) + * @param float None (optional) + * @param string None (optional) + * @param binary None (optional) + * @param date None (optional) + * @param dateTime None (optional) + * @param password None (optional) + * @param paramCallback None (optional) + * @return void + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception + * @throws UnsupportedOperationException If the API returns an informational or redirection response + * @throws ClientException If the API returns a client error response + * @throws ServerException If the API returns a server error response + */ + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) + fun testEndpointParameters(number: java.math.BigDecimal, double: kotlin.Double, patternWithoutDelimiter: kotlin.String, byte: kotlin.ByteArray, integer: kotlin.Int? = null, int32: kotlin.Int? = null, int64: kotlin.Long? = null, float: kotlin.Float? = null, string: kotlin.String? = null, binary: java.io.File? = null, date: java.time.LocalDate? = null, dateTime: java.time.OffsetDateTime? = null, password: kotlin.String? = null, paramCallback: kotlin.String? = null) : Unit { + val localVarResponse = testEndpointParametersWithHttpInfo(number = number, double = double, patternWithoutDelimiter = patternWithoutDelimiter, byte = byte, integer = integer, int32 = int32, int64 = int64, float = float, string = string, binary = binary, date = date, dateTime = dateTime, password = password, paramCallback = paramCallback) return when (localVarResponse.responseType) { - ResponseType.Success -> (localVarResponse as Success<*>).data as Client + ResponseType.Success -> Unit ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") ResponseType.ClientError -> { @@ -410,48 +1052,252 @@ class FakeApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { } ResponseType.ServerError -> { val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) + throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()} ${localVarError.body}", localVarError.statusCode, localVarResponse) } } } /** - * Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 - * Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 - * @param number None - * @param double None - * @param patternWithoutDelimiter None - * @param byte None - * @param integer None (optional) - * @param int32 None (optional) - * @param int64 None (optional) - * @param float None (optional) - * @param string None (optional) - * @param binary None (optional) - * @param date None (optional) - * @param dateTime None (optional) - * @param password None (optional) - * @param paramCallback None (optional) - * @return void - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun testEndpointParameters(number: java.math.BigDecimal, double: kotlin.Double, patternWithoutDelimiter: kotlin.String, byte: kotlin.ByteArray, integer: kotlin.Int?, int32: kotlin.Int?, int64: kotlin.Long?, float: kotlin.Float?, string: kotlin.String?, binary: java.io.File?, date: java.time.LocalDate?, dateTime: java.time.OffsetDateTime?, password: kotlin.String?, paramCallback: kotlin.String?) : Unit { - val localVariableBody: kotlin.Any? = mapOf("integer" to integer, "int32" to int32, "int64" to int64, "number" to number, "float" to float, "double" to double, "string" to string, "pattern_without_delimiter" to patternWithoutDelimiter, "byte" to byte, "binary" to binary, "date" to date, "dateTime" to dateTime, "password" to password, "callback" to paramCallback) + * POST /fake + * Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + * Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + * @param number None + * @param double None + * @param patternWithoutDelimiter None + * @param byte None + * @param integer None (optional) + * @param int32 None (optional) + * @param int64 None (optional) + * @param float None (optional) + * @param string None (optional) + * @param binary None (optional) + * @param date None (optional) + * @param dateTime None (optional) + * @param password None (optional) + * @param paramCallback None (optional) + * @return ApiResponse + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception + */ + @Throws(IllegalStateException::class, IOException::class) + fun testEndpointParametersWithHttpInfo(number: java.math.BigDecimal, double: kotlin.Double, patternWithoutDelimiter: kotlin.String, byte: kotlin.ByteArray, integer: kotlin.Int?, int32: kotlin.Int?, int64: kotlin.Long?, float: kotlin.Float?, string: kotlin.String?, binary: java.io.File?, date: java.time.LocalDate?, dateTime: java.time.OffsetDateTime?, password: kotlin.String?, paramCallback: kotlin.String?) : ApiResponse { + val localVariableConfig = testEndpointParametersRequestConfig(number = number, double = double, patternWithoutDelimiter = patternWithoutDelimiter, byte = byte, integer = integer, int32 = int32, int64 = int64, float = float, string = string, binary = binary, date = date, dateTime = dateTime, password = password, paramCallback = paramCallback) + + return request>, Unit>( + localVariableConfig + ) + } + + /** + * To obtain the request config of the operation testEndpointParameters + * + * @param number None + * @param double None + * @param patternWithoutDelimiter None + * @param byte None + * @param integer None (optional) + * @param int32 None (optional) + * @param int64 None (optional) + * @param float None (optional) + * @param string None (optional) + * @param binary None (optional) + * @param date None (optional) + * @param dateTime None (optional) + * @param password None (optional) + * @param paramCallback None (optional) + * @return RequestConfig + */ + fun testEndpointParametersRequestConfig(number: java.math.BigDecimal, double: kotlin.Double, patternWithoutDelimiter: kotlin.String, byte: kotlin.ByteArray, integer: kotlin.Int?, int32: kotlin.Int?, int64: kotlin.Long?, float: kotlin.Float?, string: kotlin.String?, binary: java.io.File?, date: java.time.LocalDate?, dateTime: java.time.OffsetDateTime?, password: kotlin.String?, paramCallback: kotlin.String?) : RequestConfig>> { + val localVariableBody = mapOf( + "integer" to PartConfig(body = integer, headers = mutableMapOf()), + "int32" to PartConfig(body = int32, headers = mutableMapOf()), + "int64" to PartConfig(body = int64, headers = mutableMapOf()), + "number" to PartConfig(body = number, headers = mutableMapOf()), + "float" to PartConfig(body = float, headers = mutableMapOf()), + "double" to PartConfig(body = double, headers = mutableMapOf()), + "string" to PartConfig(body = string, headers = mutableMapOf()), + "pattern_without_delimiter" to PartConfig(body = patternWithoutDelimiter, headers = mutableMapOf()), + "byte" to PartConfig(body = byte, headers = mutableMapOf()), + "binary" to PartConfig(body = binary, headers = mutableMapOf()), + "date" to PartConfig(body = date, headers = mutableMapOf()), + "dateTime" to PartConfig(body = dateTime, headers = mutableMapOf()), + "password" to PartConfig(body = password, headers = mutableMapOf()), + "callback" to PartConfig(body = paramCallback, headers = mutableMapOf()),) val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf("Content-Type" to "application/x-www-form-urlencoded") - val localVariableConfig = RequestConfig( - RequestMethod.POST, - "/fake", + + return RequestConfig( + method = RequestMethod.POST, + path = "/fake", query = localVariableQuery, - headers = localVariableHeaders - ) - val localVarResponse = request( - localVariableConfig, - localVariableBody + headers = localVariableHeaders, + requiresAuthentication = true, + body = localVariableBody ) + } + + /** + * enum for parameter enumHeaderStringArray + */ + enum class EnumHeaderStringArrayTestEnumParameters(val value: kotlin.String) { + @Json(name = ">") Greater_Than(">"), + @Json(name = "$") Dollar("$"); + + /** + * Override [toString()] to avoid using the enum variable name as the value, and instead use + * the actual value defined in the API spec file. + * + * This solves a problem when the variable name and its value are different, and ensures that + * the client sends the correct enum values to the server always. + */ + override fun toString(): kotlin.String = "$value" + } + + /** + * enum for parameter enumHeaderString + */ + enum class EnumHeaderStringTestEnumParameters(val value: kotlin.String) { + @Json(name = "_abc") _abc("_abc"), + @Json(name = "-efg") MinusEfg("-efg"), + @Json(name = "(xyz)") Left_ParenthesisXyzRight_Parenthesis("(xyz)"); + + /** + * Override [toString()] to avoid using the enum variable name as the value, and instead use + * the actual value defined in the API spec file. + * + * This solves a problem when the variable name and its value are different, and ensures that + * the client sends the correct enum values to the server always. + */ + override fun toString(): kotlin.String = "$value" + } + + /** + * enum for parameter enumQueryStringArray + */ + enum class EnumQueryStringArrayTestEnumParameters(val value: kotlin.String) { + @Json(name = ">") Greater_Than(">"), + @Json(name = "$") Dollar("$"); + + /** + * Override [toString()] to avoid using the enum variable name as the value, and instead use + * the actual value defined in the API spec file. + * + * This solves a problem when the variable name and its value are different, and ensures that + * the client sends the correct enum values to the server always. + */ + override fun toString(): kotlin.String = "$value" + } + + /** + * enum for parameter enumQueryString + */ + enum class EnumQueryStringTestEnumParameters(val value: kotlin.String) { + @Json(name = "_abc") _abc("_abc"), + @Json(name = "-efg") MinusEfg("-efg"), + @Json(name = "(xyz)") Left_ParenthesisXyzRight_Parenthesis("(xyz)"); + + /** + * Override [toString()] to avoid using the enum variable name as the value, and instead use + * the actual value defined in the API spec file. + * + * This solves a problem when the variable name and its value are different, and ensures that + * the client sends the correct enum values to the server always. + */ + override fun toString(): kotlin.String = "$value" + } + + /** + * enum for parameter enumQueryInteger + */ + enum class EnumQueryIntegerTestEnumParameters(val value: kotlin.Int) { + @Json(name = "1") _1(1), + @Json(name = "-2") Minus2(-2); + + /** + * Override [toString()] to avoid using the enum variable name as the value, and instead use + * the actual value defined in the API spec file. + * + * This solves a problem when the variable name and its value are different, and ensures that + * the client sends the correct enum values to the server always. + */ + override fun toString(): kotlin.String = "$value" + } + + /** + * enum for parameter enumQueryDouble + */ + enum class EnumQueryDoubleTestEnumParameters(val value: kotlin.Double) { + @Json(name = "1.1") _1Period1(1.1), + @Json(name = "-1.2") Minus1Period2(-1.2); + + /** + * Override [toString()] to avoid using the enum variable name as the value, and instead use + * the actual value defined in the API spec file. + * + * This solves a problem when the variable name and its value are different, and ensures that + * the client sends the correct enum values to the server always. + */ + override fun toString(): kotlin.String = "$value" + } + + /** + * enum for parameter enumFormStringArray + */ + enum class EnumFormStringArrayTestEnumParameters(val value: kotlin.String) { + @Json(name = ">") Greater_Than(">"), + @Json(name = "$") Dollar("$"); + + /** + * Override [toString()] to avoid using the enum variable name as the value, and instead use + * the actual value defined in the API spec file. + * + * This solves a problem when the variable name and its value are different, and ensures that + * the client sends the correct enum values to the server always. + */ + override fun toString(): kotlin.String = "$value" + } + + /** + * enum for parameter enumFormString + */ + enum class EnumFormStringTestEnumParameters(val value: kotlin.String) { + @Json(name = "_abc") _abc("_abc"), + @Json(name = "-efg") MinusEfg("-efg"), + @Json(name = "(xyz)") Left_ParenthesisXyzRight_Parenthesis("(xyz)"); + + /** + * Override [toString()] to avoid using the enum variable name as the value, and instead use + * the actual value defined in the API spec file. + * + * This solves a problem when the variable name and its value are different, and ensures that + * the client sends the correct enum values to the server always. + */ + override fun toString(): kotlin.String = "$value" + } + + /** + * GET /fake + * To test enum parameters + * To test enum parameters + * @param enumHeaderStringArray Header parameter enum test (string array) (optional) + * @param enumHeaderString Header parameter enum test (string) (optional, default to EnumHeaderString.MinusEfg) + * @param enumQueryStringArray Query parameter enum test (string array) (optional) + * @param enumQueryString Query parameter enum test (string) (optional, default to EnumQueryString.MinusEfg) + * @param enumQueryInteger Query parameter enum test (double) (optional) + * @param enumQueryDouble Query parameter enum test (double) (optional) + * @param enumQueryModelArray (optional) + * @param enumFormStringArray Form parameter enum test (string array) (optional, default to kotlin.collections.List.Dollar) + * @param enumFormString Form parameter enum test (string) (optional, default to EnumFormString.MinusEfg) + * @return void + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception + * @throws UnsupportedOperationException If the API returns an informational or redirection response + * @throws ClientException If the API returns a client error response + * @throws ServerException If the API returns a server error response + */ + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) + fun testEnumParameters(enumHeaderStringArray: kotlin.collections.List? = null, enumHeaderString: EnumHeaderStringTestEnumParameters? = EnumHeaderStringTestEnumParameters.MinusEfg, enumQueryStringArray: kotlin.collections.List? = null, enumQueryString: EnumQueryStringTestEnumParameters? = EnumQueryStringTestEnumParameters.MinusEfg, enumQueryInteger: EnumQueryIntegerTestEnumParameters? = null, enumQueryDouble: EnumQueryDoubleTestEnumParameters? = null, enumQueryModelArray: kotlin.collections.List? = null, enumFormStringArray: kotlin.collections.List? = EnumFormStringArrayTestEnumParameters.Dollar, enumFormString: EnumFormStringTestEnumParameters? = EnumFormStringTestEnumParameters.MinusEfg) : Unit { + val localVarResponse = testEnumParametersWithHttpInfo(enumHeaderStringArray = enumHeaderStringArray, enumHeaderString = enumHeaderString, enumQueryStringArray = enumQueryStringArray, enumQueryString = enumQueryString, enumQueryInteger = enumQueryInteger, enumQueryDouble = enumQueryDouble, enumQueryModelArray = enumQueryModelArray, enumFormStringArray = enumFormStringArray, enumFormString = enumFormString) return when (localVarResponse.responseType) { ResponseType.Success -> Unit @@ -463,37 +1309,62 @@ class FakeApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { } ResponseType.ServerError -> { val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) + throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()} ${localVarError.body}", localVarError.statusCode, localVarResponse) } } } /** - * To test enum parameters - * To test enum parameters - * @param enumHeaderStringArray Header parameter enum test (string array) (optional) - * @param enumHeaderString Header parameter enum test (string) (optional, default to -efg) - * @param enumQueryStringArray Query parameter enum test (string array) (optional) - * @param enumQueryString Query parameter enum test (string) (optional, default to -efg) - * @param enumQueryInteger Query parameter enum test (double) (optional) - * @param enumQueryDouble Query parameter enum test (double) (optional) - * @param enumFormStringArray Form parameter enum test (string array) (optional, default to $) - * @param enumFormString Form parameter enum test (string) (optional, default to -efg) - * @return void - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun testEnumParameters(enumHeaderStringArray: kotlin.collections.List?, enumHeaderString: kotlin.String?, enumQueryStringArray: kotlin.collections.List?, enumQueryString: kotlin.String?, enumQueryInteger: kotlin.Int?, enumQueryDouble: kotlin.Double?, enumFormStringArray: kotlin.collections.List?, enumFormString: kotlin.String?) : Unit { - val localVariableBody: kotlin.Any? = mapOf("enum_form_string_array" to enumFormStringArray, "enum_form_string" to enumFormString) - val localVariableQuery: MultiValueMap = mutableMapOf>() + * GET /fake + * To test enum parameters + * To test enum parameters + * @param enumHeaderStringArray Header parameter enum test (string array) (optional) + * @param enumHeaderString Header parameter enum test (string) (optional, default to EnumHeaderString.MinusEfg) + * @param enumQueryStringArray Query parameter enum test (string array) (optional) + * @param enumQueryString Query parameter enum test (string) (optional, default to EnumQueryString.MinusEfg) + * @param enumQueryInteger Query parameter enum test (double) (optional) + * @param enumQueryDouble Query parameter enum test (double) (optional) + * @param enumQueryModelArray (optional) + * @param enumFormStringArray Form parameter enum test (string array) (optional, default to kotlin.collections.List.Dollar) + * @param enumFormString Form parameter enum test (string) (optional, default to EnumFormString.MinusEfg) + * @return ApiResponse + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception + */ + @Throws(IllegalStateException::class, IOException::class) + fun testEnumParametersWithHttpInfo(enumHeaderStringArray: kotlin.collections.List?, enumHeaderString: EnumHeaderStringTestEnumParameters?, enumQueryStringArray: kotlin.collections.List?, enumQueryString: EnumQueryStringTestEnumParameters?, enumQueryInteger: EnumQueryIntegerTestEnumParameters?, enumQueryDouble: EnumQueryDoubleTestEnumParameters?, enumQueryModelArray: kotlin.collections.List?, enumFormStringArray: kotlin.collections.List?, enumFormString: EnumFormStringTestEnumParameters?) : ApiResponse { + val localVariableConfig = testEnumParametersRequestConfig(enumHeaderStringArray = enumHeaderStringArray, enumHeaderString = enumHeaderString, enumQueryStringArray = enumQueryStringArray, enumQueryString = enumQueryString, enumQueryInteger = enumQueryInteger, enumQueryDouble = enumQueryDouble, enumQueryModelArray = enumQueryModelArray, enumFormStringArray = enumFormStringArray, enumFormString = enumFormString) + + return request>, Unit>( + localVariableConfig + ) + } + + /** + * To obtain the request config of the operation testEnumParameters + * + * @param enumHeaderStringArray Header parameter enum test (string array) (optional) + * @param enumHeaderString Header parameter enum test (string) (optional, default to EnumHeaderString.MinusEfg) + * @param enumQueryStringArray Query parameter enum test (string array) (optional) + * @param enumQueryString Query parameter enum test (string) (optional, default to EnumQueryString.MinusEfg) + * @param enumQueryInteger Query parameter enum test (double) (optional) + * @param enumQueryDouble Query parameter enum test (double) (optional) + * @param enumQueryModelArray (optional) + * @param enumFormStringArray Form parameter enum test (string array) (optional, default to kotlin.collections.List.Dollar) + * @param enumFormString Form parameter enum test (string) (optional, default to EnumFormString.MinusEfg) + * @return RequestConfig + */ + fun testEnumParametersRequestConfig(enumHeaderStringArray: kotlin.collections.List?, enumHeaderString: EnumHeaderStringTestEnumParameters?, enumQueryStringArray: kotlin.collections.List?, enumQueryString: EnumQueryStringTestEnumParameters?, enumQueryInteger: EnumQueryIntegerTestEnumParameters?, enumQueryDouble: EnumQueryDoubleTestEnumParameters?, enumQueryModelArray: kotlin.collections.List?, enumFormStringArray: kotlin.collections.List?, enumFormString: EnumFormStringTestEnumParameters?) : RequestConfig>> { + val localVariableBody = mapOf( + "enum_form_string_array" to PartConfig(body = enumFormStringArray?.value, headers = mutableMapOf()), + "enum_form_string" to PartConfig(body = enumFormString?.value, headers = mutableMapOf()),) + val localVariableQuery: MultiValueMap = mutableMapOf>() .apply { if (enumQueryStringArray != null) { put("enum_query_string_array", toMultiValue(enumQueryStringArray.toList(), "multi")) } if (enumQueryString != null) { - put("enum_query_string", listOf(enumQueryString.toString())) + put("enum_query_string", listOf(enumQueryString.value)) } if (enumQueryInteger != null) { put("enum_query_integer", listOf(enumQueryInteger.toString())) @@ -501,20 +1372,44 @@ class FakeApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { if (enumQueryDouble != null) { put("enum_query_double", listOf(enumQueryDouble.toString())) } + if (enumQueryModelArray != null) { + put("enum_query_model_array", toMultiValue(enumQueryModelArray.toList(), "multi")) + } } val localVariableHeaders: MutableMap = mutableMapOf("Content-Type" to "application/x-www-form-urlencoded") enumHeaderStringArray?.apply { localVariableHeaders["enum_header_string_array"] = this.joinToString(separator = collectionDelimiter("csv")) } enumHeaderString?.apply { localVariableHeaders["enum_header_string"] = this.toString() } - val localVariableConfig = RequestConfig( - RequestMethod.GET, - "/fake", + + return RequestConfig( + method = RequestMethod.GET, + path = "/fake", query = localVariableQuery, - headers = localVariableHeaders - ) - val localVarResponse = request( - localVariableConfig, - localVariableBody + headers = localVariableHeaders, + requiresAuthentication = false, + body = localVariableBody ) + } + + /** + * DELETE /fake + * Fake endpoint to test group parameters (optional) + * Fake endpoint to test group parameters (optional) + * @param requiredStringGroup Required String in group parameters + * @param requiredBooleanGroup Required Boolean in group parameters + * @param requiredInt64Group Required Integer in group parameters + * @param stringGroup String in group parameters (optional) + * @param booleanGroup Boolean in group parameters (optional) + * @param int64Group Integer in group parameters (optional) + * @return void + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception + * @throws UnsupportedOperationException If the API returns an informational or redirection response + * @throws ClientException If the API returns a client error response + * @throws ServerException If the API returns a server error response + */ + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) + fun testGroupParameters(requiredStringGroup: kotlin.Int, requiredBooleanGroup: kotlin.Boolean, requiredInt64Group: kotlin.Long, stringGroup: kotlin.Int? = null, booleanGroup: kotlin.Boolean? = null, int64Group: kotlin.Long? = null) : Unit { + val localVarResponse = testGroupParametersWithHttpInfo(requiredStringGroup = requiredStringGroup, requiredBooleanGroup = requiredBooleanGroup, requiredInt64Group = requiredInt64Group, stringGroup = stringGroup, booleanGroup = booleanGroup, int64Group = int64Group) return when (localVarResponse.responseType) { ResponseType.Success -> Unit @@ -526,29 +1421,48 @@ class FakeApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { } ResponseType.ServerError -> { val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) + throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()} ${localVarError.body}", localVarError.statusCode, localVarResponse) } } } /** - * Fake endpoint to test group parameters (optional) - * Fake endpoint to test group parameters (optional) - * @param requiredStringGroup Required String in group parameters - * @param requiredBooleanGroup Required Boolean in group parameters - * @param requiredInt64Group Required Integer in group parameters - * @param stringGroup String in group parameters (optional) - * @param booleanGroup Boolean in group parameters (optional) - * @param int64Group Integer in group parameters (optional) - * @return void - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun testGroupParameters(requiredStringGroup: kotlin.Int, requiredBooleanGroup: kotlin.Boolean, requiredInt64Group: kotlin.Long, stringGroup: kotlin.Int?, booleanGroup: kotlin.Boolean?, int64Group: kotlin.Long?) : Unit { - val localVariableBody: kotlin.Any? = null - val localVariableQuery: MultiValueMap = mutableMapOf>() + * DELETE /fake + * Fake endpoint to test group parameters (optional) + * Fake endpoint to test group parameters (optional) + * @param requiredStringGroup Required String in group parameters + * @param requiredBooleanGroup Required Boolean in group parameters + * @param requiredInt64Group Required Integer in group parameters + * @param stringGroup String in group parameters (optional) + * @param booleanGroup Boolean in group parameters (optional) + * @param int64Group Integer in group parameters (optional) + * @return ApiResponse + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception + */ + @Throws(IllegalStateException::class, IOException::class) + fun testGroupParametersWithHttpInfo(requiredStringGroup: kotlin.Int, requiredBooleanGroup: kotlin.Boolean, requiredInt64Group: kotlin.Long, stringGroup: kotlin.Int?, booleanGroup: kotlin.Boolean?, int64Group: kotlin.Long?) : ApiResponse { + val localVariableConfig = testGroupParametersRequestConfig(requiredStringGroup = requiredStringGroup, requiredBooleanGroup = requiredBooleanGroup, requiredInt64Group = requiredInt64Group, stringGroup = stringGroup, booleanGroup = booleanGroup, int64Group = int64Group) + + return request( + localVariableConfig + ) + } + + /** + * To obtain the request config of the operation testGroupParameters + * + * @param requiredStringGroup Required String in group parameters + * @param requiredBooleanGroup Required Boolean in group parameters + * @param requiredInt64Group Required Integer in group parameters + * @param stringGroup String in group parameters (optional) + * @param booleanGroup Boolean in group parameters (optional) + * @param int64Group Integer in group parameters (optional) + * @return RequestConfig + */ + fun testGroupParametersRequestConfig(requiredStringGroup: kotlin.Int, requiredBooleanGroup: kotlin.Boolean, requiredInt64Group: kotlin.Long, stringGroup: kotlin.Int?, booleanGroup: kotlin.Boolean?, int64Group: kotlin.Long?) : RequestConfig { + val localVariableBody = null + val localVariableQuery: MultiValueMap = mutableMapOf>() .apply { put("required_string_group", listOf(requiredStringGroup.toString())) put("required_int64_group", listOf(requiredInt64Group.toString())) @@ -560,18 +1474,34 @@ class FakeApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { } } val localVariableHeaders: MutableMap = mutableMapOf() - requiredBooleanGroup?.apply { localVariableHeaders["required_boolean_group"] = this.toString() } + requiredBooleanGroup.apply { localVariableHeaders["required_boolean_group"] = this.toString() } booleanGroup?.apply { localVariableHeaders["boolean_group"] = this.toString() } - val localVariableConfig = RequestConfig( - RequestMethod.DELETE, - "/fake", + + return RequestConfig( + method = RequestMethod.DELETE, + path = "/fake", query = localVariableQuery, - headers = localVariableHeaders - ) - val localVarResponse = request( - localVariableConfig, - localVariableBody + headers = localVariableHeaders, + requiresAuthentication = true, + body = localVariableBody ) + } + + /** + * POST /fake/inline-additionalProperties + * test inline additionalProperties + * + * @param requestBody request body + * @return void + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception + * @throws UnsupportedOperationException If the API returns an informational or redirection response + * @throws ClientException If the API returns a client error response + * @throws ServerException If the API returns a server error response + */ + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) + fun testInlineAdditionalProperties(requestBody: kotlin.collections.Map) : Unit { + val localVarResponse = testInlineAdditionalPropertiesWithHttpInfo(requestBody = requestBody) return when (localVarResponse.responseType) { ResponseType.Success -> Unit @@ -583,35 +1513,138 @@ class FakeApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { } ResponseType.ServerError -> { val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) + throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()} ${localVarError.body}", localVarError.statusCode, localVarResponse) } } } /** - * test inline additionalProperties - * - * @param requestBody request body - * @return void - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun testInlineAdditionalProperties(requestBody: kotlin.collections.Map) : Unit { - val localVariableBody: kotlin.Any? = requestBody + * POST /fake/inline-additionalProperties + * test inline additionalProperties + * + * @param requestBody request body + * @return ApiResponse + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception + */ + @Throws(IllegalStateException::class, IOException::class) + fun testInlineAdditionalPropertiesWithHttpInfo(requestBody: kotlin.collections.Map) : ApiResponse { + val localVariableConfig = testInlineAdditionalPropertiesRequestConfig(requestBody = requestBody) + + return request, Unit>( + localVariableConfig + ) + } + + /** + * To obtain the request config of the operation testInlineAdditionalProperties + * + * @param requestBody request body + * @return RequestConfig + */ + fun testInlineAdditionalPropertiesRequestConfig(requestBody: kotlin.collections.Map) : RequestConfig> { + val localVariableBody = requestBody val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf() - val localVariableConfig = RequestConfig( - RequestMethod.POST, - "/fake/inline-additionalProperties", + localVariableHeaders["Content-Type"] = "application/json" + + return RequestConfig( + method = RequestMethod.POST, + path = "/fake/inline-additionalProperties", query = localVariableQuery, - headers = localVariableHeaders + headers = localVariableHeaders, + requiresAuthentication = false, + body = localVariableBody + ) + } + + /** + * POST /fake/inline-freeform-additionalProperties + * test inline free-form additionalProperties + * + * @param testInlineFreeformAdditionalPropertiesRequest request body + * @return void + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception + * @throws UnsupportedOperationException If the API returns an informational or redirection response + * @throws ClientException If the API returns a client error response + * @throws ServerException If the API returns a server error response + */ + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) + fun testInlineFreeformAdditionalProperties(testInlineFreeformAdditionalPropertiesRequest: TestInlineFreeformAdditionalPropertiesRequest) : Unit { + val localVarResponse = testInlineFreeformAdditionalPropertiesWithHttpInfo(testInlineFreeformAdditionalPropertiesRequest = testInlineFreeformAdditionalPropertiesRequest) + + return when (localVarResponse.responseType) { + ResponseType.Success -> Unit + ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") + ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") + ResponseType.ClientError -> { + val localVarError = localVarResponse as ClientError<*> + throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) + } + ResponseType.ServerError -> { + val localVarError = localVarResponse as ServerError<*> + throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()} ${localVarError.body}", localVarError.statusCode, localVarResponse) + } + } + } + + /** + * POST /fake/inline-freeform-additionalProperties + * test inline free-form additionalProperties + * + * @param testInlineFreeformAdditionalPropertiesRequest request body + * @return ApiResponse + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception + */ + @Throws(IllegalStateException::class, IOException::class) + fun testInlineFreeformAdditionalPropertiesWithHttpInfo(testInlineFreeformAdditionalPropertiesRequest: TestInlineFreeformAdditionalPropertiesRequest) : ApiResponse { + val localVariableConfig = testInlineFreeformAdditionalPropertiesRequestConfig(testInlineFreeformAdditionalPropertiesRequest = testInlineFreeformAdditionalPropertiesRequest) + + return request( + localVariableConfig ) - val localVarResponse = request( - localVariableConfig, - localVariableBody + } + + /** + * To obtain the request config of the operation testInlineFreeformAdditionalProperties + * + * @param testInlineFreeformAdditionalPropertiesRequest request body + * @return RequestConfig + */ + fun testInlineFreeformAdditionalPropertiesRequestConfig(testInlineFreeformAdditionalPropertiesRequest: TestInlineFreeformAdditionalPropertiesRequest) : RequestConfig { + val localVariableBody = testInlineFreeformAdditionalPropertiesRequest + val localVariableQuery: MultiValueMap = mutableMapOf() + val localVariableHeaders: MutableMap = mutableMapOf() + localVariableHeaders["Content-Type"] = "application/json" + + return RequestConfig( + method = RequestMethod.POST, + path = "/fake/inline-freeform-additionalProperties", + query = localVariableQuery, + headers = localVariableHeaders, + requiresAuthentication = false, + body = localVariableBody ) + } + + /** + * GET /fake/jsonFormData + * test json serialization of form data + * + * @param `param` field1 + * @param param2 field2 + * @return void + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception + * @throws UnsupportedOperationException If the API returns an informational or redirection response + * @throws ClientException If the API returns a client error response + * @throws ServerException If the API returns a server error response + */ + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) + fun testJsonFormData(`param`: kotlin.String, param2: kotlin.String) : Unit { + val localVarResponse = testJsonFormDataWithHttpInfo(`param` = `param`, param2 = param2) return when (localVarResponse.responseType) { ResponseType.Success -> Unit @@ -623,36 +1656,146 @@ class FakeApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { } ResponseType.ServerError -> { val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) + throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()} ${localVarError.body}", localVarError.statusCode, localVarResponse) } } } /** - * test json serialization of form data - * - * @param param field1 - * @param param2 field2 - * @return void - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun testJsonFormData(param: kotlin.String, param2: kotlin.String) : Unit { - val localVariableBody: kotlin.Any? = mapOf("param" to param, "param2" to param2) + * GET /fake/jsonFormData + * test json serialization of form data + * + * @param `param` field1 + * @param param2 field2 + * @return ApiResponse + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception + */ + @Throws(IllegalStateException::class, IOException::class) + fun testJsonFormDataWithHttpInfo(`param`: kotlin.String, param2: kotlin.String) : ApiResponse { + val localVariableConfig = testJsonFormDataRequestConfig(`param` = `param`, param2 = param2) + + return request>, Unit>( + localVariableConfig + ) + } + + /** + * To obtain the request config of the operation testJsonFormData + * + * @param `param` field1 + * @param param2 field2 + * @return RequestConfig + */ + fun testJsonFormDataRequestConfig(`param`: kotlin.String, param2: kotlin.String) : RequestConfig>> { + val localVariableBody = mapOf( + "param" to PartConfig(body = `param`, headers = mutableMapOf()), + "param2" to PartConfig(body = param2, headers = mutableMapOf()),) val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf("Content-Type" to "application/x-www-form-urlencoded") - val localVariableConfig = RequestConfig( - RequestMethod.GET, - "/fake/jsonFormData", + + return RequestConfig( + method = RequestMethod.GET, + path = "/fake/jsonFormData", query = localVariableQuery, - headers = localVariableHeaders + headers = localVariableHeaders, + requiresAuthentication = false, + body = localVariableBody + ) + } + + /** + * POST /fake/nullable + * test nullable parent property + * + * @param childWithNullable request body + * @return void + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception + * @throws UnsupportedOperationException If the API returns an informational or redirection response + * @throws ClientException If the API returns a client error response + * @throws ServerException If the API returns a server error response + */ + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) + fun testNullable(childWithNullable: ChildWithNullable) : Unit { + val localVarResponse = testNullableWithHttpInfo(childWithNullable = childWithNullable) + + return when (localVarResponse.responseType) { + ResponseType.Success -> Unit + ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") + ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") + ResponseType.ClientError -> { + val localVarError = localVarResponse as ClientError<*> + throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) + } + ResponseType.ServerError -> { + val localVarError = localVarResponse as ServerError<*> + throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()} ${localVarError.body}", localVarError.statusCode, localVarResponse) + } + } + } + + /** + * POST /fake/nullable + * test nullable parent property + * + * @param childWithNullable request body + * @return ApiResponse + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception + */ + @Throws(IllegalStateException::class, IOException::class) + fun testNullableWithHttpInfo(childWithNullable: ChildWithNullable) : ApiResponse { + val localVariableConfig = testNullableRequestConfig(childWithNullable = childWithNullable) + + return request( + localVariableConfig ) - val localVarResponse = request( - localVariableConfig, - localVariableBody + } + + /** + * To obtain the request config of the operation testNullable + * + * @param childWithNullable request body + * @return RequestConfig + */ + fun testNullableRequestConfig(childWithNullable: ChildWithNullable) : RequestConfig { + val localVariableBody = childWithNullable + val localVariableQuery: MultiValueMap = mutableMapOf() + val localVariableHeaders: MutableMap = mutableMapOf() + localVariableHeaders["Content-Type"] = "application/json" + + return RequestConfig( + method = RequestMethod.POST, + path = "/fake/nullable", + query = localVariableQuery, + headers = localVariableHeaders, + requiresAuthentication = false, + body = localVariableBody ) + } + + /** + * PUT /fake/test-query-parameters + * + * To test the collection format in query parameters + * @param pipe + * @param ioutil + * @param http + * @param url + * @param context + * @param allowEmpty + * @param language (optional) + * @return void + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception + * @throws UnsupportedOperationException If the API returns an informational or redirection response + * @throws ClientException If the API returns a client error response + * @throws ServerException If the API returns a server error response + */ + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) + fun testQueryParameterCollectionFormat(pipe: kotlin.collections.List, ioutil: kotlin.collections.List, http: kotlin.collections.List, url: kotlin.collections.List, context: kotlin.collections.List, allowEmpty: kotlin.String, language: kotlin.collections.Map? = null) : Unit { + val localVarResponse = testQueryParameterCollectionFormatWithHttpInfo(pipe = pipe, ioutil = ioutil, http = http, url = url, context = context, allowEmpty = allowEmpty, language = language) return when (localVarResponse.responseType) { ResponseType.Success -> Unit @@ -664,46 +1807,88 @@ class FakeApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { } ResponseType.ServerError -> { val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) + throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()} ${localVarError.body}", localVarError.statusCode, localVarResponse) } } } /** - * - * To test the collection format in query parameters - * @param pipe - * @param ioutil - * @param http - * @param url - * @param context - * @return void - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun testQueryParameterCollectionFormat(pipe: kotlin.collections.List, ioutil: kotlin.collections.List, http: kotlin.collections.List, url: kotlin.collections.List, context: kotlin.collections.List) : Unit { - val localVariableBody: kotlin.Any? = null - val localVariableQuery: MultiValueMap = mutableMapOf>() + * PUT /fake/test-query-parameters + * + * To test the collection format in query parameters + * @param pipe + * @param ioutil + * @param http + * @param url + * @param context + * @param allowEmpty + * @param language (optional) + * @return ApiResponse + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception + */ + @Throws(IllegalStateException::class, IOException::class) + fun testQueryParameterCollectionFormatWithHttpInfo(pipe: kotlin.collections.List, ioutil: kotlin.collections.List, http: kotlin.collections.List, url: kotlin.collections.List, context: kotlin.collections.List, allowEmpty: kotlin.String, language: kotlin.collections.Map?) : ApiResponse { + val localVariableConfig = testQueryParameterCollectionFormatRequestConfig(pipe = pipe, ioutil = ioutil, http = http, url = url, context = context, allowEmpty = allowEmpty, language = language) + + return request( + localVariableConfig + ) + } + + /** + * To obtain the request config of the operation testQueryParameterCollectionFormat + * + * @param pipe + * @param ioutil + * @param http + * @param url + * @param context + * @param allowEmpty + * @param language (optional) + * @return RequestConfig + */ + fun testQueryParameterCollectionFormatRequestConfig(pipe: kotlin.collections.List, ioutil: kotlin.collections.List, http: kotlin.collections.List, url: kotlin.collections.List, context: kotlin.collections.List, allowEmpty: kotlin.String, language: kotlin.collections.Map?) : RequestConfig { + val localVariableBody = null + val localVariableQuery: MultiValueMap = mutableMapOf>() .apply { - put("pipe", toMultiValue(pipe.toList(), "multi")) + put("pipe", toMultiValue(pipe.toList(), "pipes")) put("ioutil", toMultiValue(ioutil.toList(), "csv")) put("http", toMultiValue(http.toList(), "ssv")) put("url", toMultiValue(url.toList(), "csv")) put("context", toMultiValue(context.toList(), "multi")) + if (language != null) { + put("language", toMultiValue(language.toList(), "")) + } + put("allowEmpty", listOf(allowEmpty.toString())) } val localVariableHeaders: MutableMap = mutableMapOf() - val localVariableConfig = RequestConfig( - RequestMethod.PUT, - "/fake/test-query-parameters", + + return RequestConfig( + method = RequestMethod.PUT, + path = "/fake/test-query-parameters", query = localVariableQuery, - headers = localVariableHeaders - ) - val localVarResponse = request( - localVariableConfig, - localVariableBody + headers = localVariableHeaders, + requiresAuthentication = false, + body = localVariableBody ) + } + + /** + * POST /fake/stringMap-reference + * test referenced string map + * + * @param requestBody request body + * @return void + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception + * @throws UnsupportedOperationException If the API returns an informational or redirection response + * @throws ClientException If the API returns a client error response + * @throws ServerException If the API returns a server error response + */ + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) + fun testStringMapReference(requestBody: kotlin.collections.Map) : Unit { + val localVarResponse = testStringMapReferenceWithHttpInfo(requestBody = requestBody) return when (localVarResponse.responseType) { ResponseType.Success -> Unit @@ -715,9 +1900,52 @@ class FakeApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { } ResponseType.ServerError -> { val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) + throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()} ${localVarError.body}", localVarError.statusCode, localVarResponse) } } } + /** + * POST /fake/stringMap-reference + * test referenced string map + * + * @param requestBody request body + * @return ApiResponse + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception + */ + @Throws(IllegalStateException::class, IOException::class) + fun testStringMapReferenceWithHttpInfo(requestBody: kotlin.collections.Map) : ApiResponse { + val localVariableConfig = testStringMapReferenceRequestConfig(requestBody = requestBody) + + return request, Unit>( + localVariableConfig + ) + } + + /** + * To obtain the request config of the operation testStringMapReference + * + * @param requestBody request body + * @return RequestConfig + */ + fun testStringMapReferenceRequestConfig(requestBody: kotlin.collections.Map) : RequestConfig> { + val localVariableBody = requestBody + val localVariableQuery: MultiValueMap = mutableMapOf() + val localVariableHeaders: MutableMap = mutableMapOf() + localVariableHeaders["Content-Type"] = "application/json" + + return RequestConfig( + method = RequestMethod.POST, + path = "/fake/stringMap-reference", + query = localVariableQuery, + headers = localVariableHeaders, + requiresAuthentication = false, + body = localVariableBody + ) + } + + + private fun encodeURIComponent(uriComponent: kotlin.String): kotlin.String = + HttpUrl.Builder().scheme("http").host("localhost").addPathSegment(uriComponent).build().encodedPathSegments[0] } diff --git a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/apis/FakeClassnameTags123Api.kt b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/apis/FakeClassnameTags123Api.kt index 0145742af683..111b3c2b24d4 100644 --- a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/apis/FakeClassnameTags123Api.kt +++ b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/apis/FakeClassnameTags123Api.kt @@ -1,63 +1,74 @@ /** -* OpenAPI Petstore -* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ -* -* The version of the OpenAPI document: 1.0.0 -* -* -* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). -* https://openapi-generator.tech -* Do not edit the class manually. -*/ + * + * Please note: + * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * Do not edit this file manually. + * + */ + +@file:Suppress( + "ArrayInDataClass", + "DuplicatedCode", + "EnumEntryName", + "RemoveRedundantQualifierName", + "RemoveRedundantCallsOfConversionMethods", + "REDUNDANT_CALL_OF_CONVERSION_METHOD", + "RedundantUnitReturnType", + "RemoveEmptyClassBody", + "UnnecessaryVariable", + "UnusedImport", + "UnnecessaryVariable", + "unused" +) + package org.openapitools.client.apis +import java.io.IOException +import okhttp3.Call +import okhttp3.HttpUrl + import org.openapitools.client.models.Client +import com.squareup.moshi.Json + import org.openapitools.client.infrastructure.ApiClient +import org.openapitools.client.infrastructure.ApiResponse import org.openapitools.client.infrastructure.ClientException import org.openapitools.client.infrastructure.ClientError import org.openapitools.client.infrastructure.ServerException import org.openapitools.client.infrastructure.ServerError import org.openapitools.client.infrastructure.MultiValueMap +import org.openapitools.client.infrastructure.PartConfig import org.openapitools.client.infrastructure.RequestConfig import org.openapitools.client.infrastructure.RequestMethod import org.openapitools.client.infrastructure.ResponseType import org.openapitools.client.infrastructure.Success import org.openapitools.client.infrastructure.toMultiValue -class FakeClassnameTags123Api(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { +open class FakeClassnameTags123Api(basePath: kotlin.String = defaultBasePath, client: Call.Factory = ApiClient.defaultClient) : ApiClient(basePath, client) { companion object { @JvmStatic val defaultBasePath: String by lazy { - System.getProperties().getProperty("org.openapitools.client.baseUrl", "http://petstore.swagger.io:80/v2") + System.getProperties().getProperty(ApiClient.BASE_URL_KEY, "http://petstore.swagger.io:80/v2") } } /** - * To test class name in snake case - * To test class name in snake case - * @param client client model - * @return Client - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ + * PATCH /fake_classname_test + * To test class name in snake case + * To test class name in snake case + * @param client client model + * @return Client + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception + * @throws UnsupportedOperationException If the API returns an informational or redirection response + * @throws ClientException If the API returns a client error response + * @throws ServerException If the API returns a server error response + */ @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun testClassname(client: Client) : Client { - val localVariableBody: kotlin.Any? = client - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - val localVariableConfig = RequestConfig( - RequestMethod.PATCH, - "/fake_classname_test", - query = localVariableQuery, - headers = localVariableHeaders - ) - val localVarResponse = request( - localVariableConfig, - localVariableBody - ) + val localVarResponse = testClassnameWithHttpInfo(client = client) return when (localVarResponse.responseType) { ResponseType.Success -> (localVarResponse as Success<*>).data as Client @@ -69,9 +80,54 @@ class FakeClassnameTags123Api(basePath: kotlin.String = defaultBasePath) : ApiCl } ResponseType.ServerError -> { val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) + throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()} ${localVarError.body}", localVarError.statusCode, localVarResponse) } } } + /** + * PATCH /fake_classname_test + * To test class name in snake case + * To test class name in snake case + * @param client client model + * @return ApiResponse + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception + */ + @Suppress("UNCHECKED_CAST") + @Throws(IllegalStateException::class, IOException::class) + fun testClassnameWithHttpInfo(client: Client) : ApiResponse { + val localVariableConfig = testClassnameRequestConfig(client = client) + + return request( + localVariableConfig + ) + } + + /** + * To obtain the request config of the operation testClassname + * + * @param client client model + * @return RequestConfig + */ + fun testClassnameRequestConfig(client: Client) : RequestConfig { + val localVariableBody = client + val localVariableQuery: MultiValueMap = mutableMapOf() + val localVariableHeaders: MutableMap = mutableMapOf() + localVariableHeaders["Content-Type"] = "application/json" + localVariableHeaders["Accept"] = "application/json" + + return RequestConfig( + method = RequestMethod.PATCH, + path = "/fake_classname_test", + query = localVariableQuery, + headers = localVariableHeaders, + requiresAuthentication = true, + body = localVariableBody + ) + } + + + private fun encodeURIComponent(uriComponent: kotlin.String): kotlin.String = + HttpUrl.Builder().scheme("http").host("localhost").addPathSegment(uriComponent).build().encodedPathSegments[0] } diff --git a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/apis/PetApi.kt b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/apis/PetApi.kt index d0295348e3fd..2cd062094497 100644 --- a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/apis/PetApi.kt +++ b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/apis/PetApi.kt @@ -1,63 +1,74 @@ /** -* OpenAPI Petstore -* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ -* -* The version of the OpenAPI document: 1.0.0 -* -* -* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). -* https://openapi-generator.tech -* Do not edit the class manually. -*/ + * + * Please note: + * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * Do not edit this file manually. + * + */ + +@file:Suppress( + "ArrayInDataClass", + "DuplicatedCode", + "EnumEntryName", + "RemoveRedundantQualifierName", + "RemoveRedundantCallsOfConversionMethods", + "REDUNDANT_CALL_OF_CONVERSION_METHOD", + "RedundantUnitReturnType", + "RemoveEmptyClassBody", + "UnnecessaryVariable", + "UnusedImport", + "UnnecessaryVariable", + "unused" +) + package org.openapitools.client.apis -import org.openapitools.client.models.ApiResponse +import java.io.IOException +import okhttp3.Call +import okhttp3.HttpUrl + +import org.openapitools.client.models.ModelApiResponse import org.openapitools.client.models.Pet +import com.squareup.moshi.Json + import org.openapitools.client.infrastructure.ApiClient +import org.openapitools.client.infrastructure.ApiResponse import org.openapitools.client.infrastructure.ClientException import org.openapitools.client.infrastructure.ClientError import org.openapitools.client.infrastructure.ServerException import org.openapitools.client.infrastructure.ServerError import org.openapitools.client.infrastructure.MultiValueMap +import org.openapitools.client.infrastructure.PartConfig import org.openapitools.client.infrastructure.RequestConfig import org.openapitools.client.infrastructure.RequestMethod import org.openapitools.client.infrastructure.ResponseType import org.openapitools.client.infrastructure.Success import org.openapitools.client.infrastructure.toMultiValue -class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { +open class PetApi(basePath: kotlin.String = defaultBasePath, client: Call.Factory = ApiClient.defaultClient) : ApiClient(basePath, client) { companion object { @JvmStatic val defaultBasePath: String by lazy { - System.getProperties().getProperty("org.openapitools.client.baseUrl", "http://petstore.swagger.io:80/v2") + System.getProperties().getProperty(ApiClient.BASE_URL_KEY, "http://petstore.swagger.io:80/v2") } } /** - * Add a new pet to the store - * - * @param pet Pet object that needs to be added to the store - * @return void - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + * POST /pet + * Add a new pet to the store + * + * @param pet Pet object that needs to be added to the store + * @return void + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception + * @throws UnsupportedOperationException If the API returns an informational or redirection response + * @throws ClientException If the API returns a client error response + * @throws ServerException If the API returns a server error response + */ + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun addPet(pet: Pet) : Unit { - val localVariableBody: kotlin.Any? = pet - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - val localVariableConfig = RequestConfig( - RequestMethod.POST, - "/pet", - query = localVariableQuery, - headers = localVariableHeaders - ) - val localVarResponse = request( - localVariableConfig, - localVariableBody - ) + val localVarResponse = addPetWithHttpInfo(pet = pet) return when (localVarResponse.responseType) { ResponseType.Success -> Unit @@ -69,37 +80,67 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { } ResponseType.ServerError -> { val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) + throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()} ${localVarError.body}", localVarError.statusCode, localVarResponse) } } } /** - * Deletes a pet - * - * @param petId Pet id to delete - * @param apiKey (optional) - * @return void - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun deletePet(petId: kotlin.Long, apiKey: kotlin.String?) : Unit { - val localVariableBody: kotlin.Any? = null + * POST /pet + * Add a new pet to the store + * + * @param pet Pet object that needs to be added to the store + * @return ApiResponse + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception + */ + @Throws(IllegalStateException::class, IOException::class) + fun addPetWithHttpInfo(pet: Pet) : ApiResponse { + val localVariableConfig = addPetRequestConfig(pet = pet) + + return request( + localVariableConfig + ) + } + + /** + * To obtain the request config of the operation addPet + * + * @param pet Pet object that needs to be added to the store + * @return RequestConfig + */ + fun addPetRequestConfig(pet: Pet) : RequestConfig { + val localVariableBody = pet val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf() - apiKey?.apply { localVariableHeaders["api_key"] = this.toString() } - val localVariableConfig = RequestConfig( - RequestMethod.DELETE, - "/pet/{petId}".replace("{"+"petId"+"}", "$petId"), + localVariableHeaders["Content-Type"] = "application/json" + + return RequestConfig( + method = RequestMethod.POST, + path = "/pet", query = localVariableQuery, - headers = localVariableHeaders - ) - val localVarResponse = request( - localVariableConfig, - localVariableBody + headers = localVariableHeaders, + requiresAuthentication = true, + body = localVariableBody ) + } + + /** + * DELETE /pet/{petId} + * Deletes a pet + * + * @param petId Pet id to delete + * @param apiKey (optional) + * @return void + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception + * @throws UnsupportedOperationException If the API returns an informational or redirection response + * @throws ClientException If the API returns a client error response + * @throws ServerException If the API returns a server error response + */ + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) + fun deletePet(petId: kotlin.Long, apiKey: kotlin.String? = null) : Unit { + val localVarResponse = deletePetWithHttpInfo(petId = petId, apiKey = apiKey) return when (localVarResponse.responseType) { ResponseType.Success -> Unit @@ -111,39 +152,87 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { } ResponseType.ServerError -> { val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) + throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()} ${localVarError.body}", localVarError.statusCode, localVarResponse) } } } /** - * Finds Pets by status - * Multiple status values can be provided with comma separated strings - * @param status Status values that need to be considered for filter - * @return kotlin.collections.List - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun findPetsByStatus(status: kotlin.collections.List) : kotlin.collections.List { - val localVariableBody: kotlin.Any? = null - val localVariableQuery: MultiValueMap = mutableMapOf>() - .apply { - put("status", toMultiValue(status.toList(), "csv")) - } + * DELETE /pet/{petId} + * Deletes a pet + * + * @param petId Pet id to delete + * @param apiKey (optional) + * @return ApiResponse + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception + */ + @Throws(IllegalStateException::class, IOException::class) + fun deletePetWithHttpInfo(petId: kotlin.Long, apiKey: kotlin.String?) : ApiResponse { + val localVariableConfig = deletePetRequestConfig(petId = petId, apiKey = apiKey) + + return request( + localVariableConfig + ) + } + + /** + * To obtain the request config of the operation deletePet + * + * @param petId Pet id to delete + * @param apiKey (optional) + * @return RequestConfig + */ + fun deletePetRequestConfig(petId: kotlin.Long, apiKey: kotlin.String?) : RequestConfig { + val localVariableBody = null + val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf() - val localVariableConfig = RequestConfig( - RequestMethod.GET, - "/pet/findByStatus", + apiKey?.apply { localVariableHeaders["api_key"] = this.toString() } + + return RequestConfig( + method = RequestMethod.DELETE, + path = "/pet/{petId}".replace("{"+"petId"+"}", encodeURIComponent(petId.toString())), query = localVariableQuery, - headers = localVariableHeaders - ) - val localVarResponse = request>( - localVariableConfig, - localVariableBody + headers = localVariableHeaders, + requiresAuthentication = true, + body = localVariableBody ) + } + + /** + * enum for parameter status + */ + enum class StatusFindPetsByStatus(val value: kotlin.String) { + @Json(name = "available") available("available"), + @Json(name = "pending") pending("pending"), + @Json(name = "sold") sold("sold"); + + /** + * Override [toString()] to avoid using the enum variable name as the value, and instead use + * the actual value defined in the API spec file. + * + * This solves a problem when the variable name and its value are different, and ensures that + * the client sends the correct enum values to the server always. + */ + override fun toString(): kotlin.String = "$value" + } + + /** + * GET /pet/findByStatus + * Finds Pets by status + * Multiple status values can be provided with comma separated strings + * @param status Status values that need to be considered for filter + * @return kotlin.collections.List + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception + * @throws UnsupportedOperationException If the API returns an informational or redirection response + * @throws ClientException If the API returns a client error response + * @throws ServerException If the API returns a server error response + */ + @Suppress("UNCHECKED_CAST") + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) + fun findPetsByStatus(status: kotlin.collections.List) : kotlin.collections.List { + val localVarResponse = findPetsByStatusWithHttpInfo(status = status) return when (localVarResponse.responseType) { ResponseType.Success -> (localVarResponse as Success<*>).data as kotlin.collections.List @@ -155,43 +244,76 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { } ResponseType.ServerError -> { val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) + throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()} ${localVarError.body}", localVarError.statusCode, localVarResponse) } } } /** - * Finds Pets by tags - * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. - * @param tags Tags to filter by - * @return kotlin.collections.List - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ + * GET /pet/findByStatus + * Finds Pets by status + * Multiple status values can be provided with comma separated strings + * @param status Status values that need to be considered for filter + * @return ApiResponse?> + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception + */ @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - @Deprecated(message = "This operation is deprecated.") - fun findPetsByTags(tags: kotlin.collections.List) : kotlin.collections.List { - val localVariableBody: kotlin.Any? = null - val localVariableQuery: MultiValueMap = mutableMapOf>() + @Throws(IllegalStateException::class, IOException::class) + fun findPetsByStatusWithHttpInfo(status: kotlin.collections.List) : ApiResponse?> { + val localVariableConfig = findPetsByStatusRequestConfig(status = status) + + return request>( + localVariableConfig + ) + } + + /** + * To obtain the request config of the operation findPetsByStatus + * + * @param status Status values that need to be considered for filter + * @return RequestConfig + */ + fun findPetsByStatusRequestConfig(status: kotlin.collections.List) : RequestConfig { + val localVariableBody = null + val localVariableQuery: MultiValueMap = mutableMapOf>() .apply { - put("tags", toMultiValue(tags.toList(), "csv")) + put("status", toMultiValue(status.toList(), "csv")) } val localVariableHeaders: MutableMap = mutableMapOf() - val localVariableConfig = RequestConfig( - RequestMethod.GET, - "/pet/findByTags", + localVariableHeaders["Accept"] = "application/json" + + return RequestConfig( + method = RequestMethod.GET, + path = "/pet/findByStatus", query = localVariableQuery, - headers = localVariableHeaders - ) - val localVarResponse = request>( - localVariableConfig, - localVariableBody + headers = localVariableHeaders, + requiresAuthentication = true, + body = localVariableBody ) + } + + /** + * GET /pet/findByTags + * Finds Pets by tags + * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + * @param tags Tags to filter by + * @return kotlin.collections.Set + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception + * @throws UnsupportedOperationException If the API returns an informational or redirection response + * @throws ClientException If the API returns a client error response + * @throws ServerException If the API returns a server error response + */ + @Suppress("UNCHECKED_CAST") + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Deprecated(message = "This operation is deprecated.") + fun findPetsByTags(tags: kotlin.collections.Set) : kotlin.collections.Set { + @Suppress("DEPRECATION") + val localVarResponse = findPetsByTagsWithHttpInfo(tags = tags) return when (localVarResponse.responseType) { - ResponseType.Success -> (localVarResponse as Success<*>).data as kotlin.collections.List + ResponseType.Success -> (localVarResponse as Success<*>).data as kotlin.collections.Set ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") ResponseType.ClientError -> { @@ -200,36 +322,74 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { } ResponseType.ServerError -> { val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) + throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()} ${localVarError.body}", localVarError.statusCode, localVarResponse) } } } /** - * Find pet by ID - * Returns a single pet - * @param petId ID of pet to return - * @return Pet - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ + * GET /pet/findByTags + * Finds Pets by tags + * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + * @param tags Tags to filter by + * @return ApiResponse?> + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception + */ @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun getPetById(petId: kotlin.Long) : Pet { - val localVariableBody: kotlin.Any? = null - val localVariableQuery: MultiValueMap = mutableMapOf() + @Throws(IllegalStateException::class, IOException::class) + @Deprecated(message = "This operation is deprecated.") + fun findPetsByTagsWithHttpInfo(tags: kotlin.collections.Set) : ApiResponse?> { + @Suppress("DEPRECATION") + val localVariableConfig = findPetsByTagsRequestConfig(tags = tags) + + return request>( + localVariableConfig + ) + } + + /** + * To obtain the request config of the operation findPetsByTags + * + * @param tags Tags to filter by + * @return RequestConfig + */ + @Deprecated(message = "This operation is deprecated.") + fun findPetsByTagsRequestConfig(tags: kotlin.collections.Set) : RequestConfig { + val localVariableBody = null + val localVariableQuery: MultiValueMap = mutableMapOf>() + .apply { + put("tags", toMultiValue(tags.toList(), "csv")) + } val localVariableHeaders: MutableMap = mutableMapOf() - val localVariableConfig = RequestConfig( - RequestMethod.GET, - "/pet/{petId}".replace("{"+"petId"+"}", "$petId"), + localVariableHeaders["Accept"] = "application/json" + + return RequestConfig( + method = RequestMethod.GET, + path = "/pet/findByTags", query = localVariableQuery, - headers = localVariableHeaders - ) - val localVarResponse = request( - localVariableConfig, - localVariableBody + headers = localVariableHeaders, + requiresAuthentication = true, + body = localVariableBody ) + } + + /** + * GET /pet/{petId} + * Find pet by ID + * Returns a single pet + * @param petId ID of pet to return + * @return Pet + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception + * @throws UnsupportedOperationException If the API returns an informational or redirection response + * @throws ClientException If the API returns a client error response + * @throws ServerException If the API returns a server error response + */ + @Suppress("UNCHECKED_CAST") + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) + fun getPetById(petId: kotlin.Long) : Pet { + val localVarResponse = getPetByIdWithHttpInfo(petId = petId) return when (localVarResponse.responseType) { ResponseType.Success -> (localVarResponse as Success<*>).data as Pet @@ -241,35 +401,67 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { } ResponseType.ServerError -> { val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) + throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()} ${localVarError.body}", localVarError.statusCode, localVarResponse) } } } /** - * Update an existing pet - * - * @param pet Pet object that needs to be added to the store - * @return void - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun updatePet(pet: Pet) : Unit { - val localVariableBody: kotlin.Any? = pet + * GET /pet/{petId} + * Find pet by ID + * Returns a single pet + * @param petId ID of pet to return + * @return ApiResponse + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception + */ + @Suppress("UNCHECKED_CAST") + @Throws(IllegalStateException::class, IOException::class) + fun getPetByIdWithHttpInfo(petId: kotlin.Long) : ApiResponse { + val localVariableConfig = getPetByIdRequestConfig(petId = petId) + + return request( + localVariableConfig + ) + } + + /** + * To obtain the request config of the operation getPetById + * + * @param petId ID of pet to return + * @return RequestConfig + */ + fun getPetByIdRequestConfig(petId: kotlin.Long) : RequestConfig { + val localVariableBody = null val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf() - val localVariableConfig = RequestConfig( - RequestMethod.PUT, - "/pet", + localVariableHeaders["Accept"] = "application/json" + + return RequestConfig( + method = RequestMethod.GET, + path = "/pet/{petId}".replace("{"+"petId"+"}", encodeURIComponent(petId.toString())), query = localVariableQuery, - headers = localVariableHeaders - ) - val localVarResponse = request( - localVariableConfig, - localVariableBody + headers = localVariableHeaders, + requiresAuthentication = true, + body = localVariableBody ) + } + + /** + * PUT /pet + * Update an existing pet + * + * @param pet Pet object that needs to be added to the store + * @return void + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception + * @throws UnsupportedOperationException If the API returns an informational or redirection response + * @throws ClientException If the API returns a client error response + * @throws ServerException If the API returns a server error response + */ + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) + fun updatePet(pet: Pet) : Unit { + val localVarResponse = updatePetWithHttpInfo(pet = pet) return when (localVarResponse.responseType) { ResponseType.Success -> Unit @@ -281,37 +473,68 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { } ResponseType.ServerError -> { val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) + throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()} ${localVarError.body}", localVarError.statusCode, localVarResponse) } } } /** - * Updates a pet in the store with form data - * - * @param petId ID of pet that needs to be updated - * @param name Updated name of the pet (optional) - * @param status Updated status of the pet (optional) - * @return void - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun updatePetWithForm(petId: kotlin.Long, name: kotlin.String?, status: kotlin.String?) : Unit { - val localVariableBody: kotlin.Any? = mapOf("name" to name, "status" to status) + * PUT /pet + * Update an existing pet + * + * @param pet Pet object that needs to be added to the store + * @return ApiResponse + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception + */ + @Throws(IllegalStateException::class, IOException::class) + fun updatePetWithHttpInfo(pet: Pet) : ApiResponse { + val localVariableConfig = updatePetRequestConfig(pet = pet) + + return request( + localVariableConfig + ) + } + + /** + * To obtain the request config of the operation updatePet + * + * @param pet Pet object that needs to be added to the store + * @return RequestConfig + */ + fun updatePetRequestConfig(pet: Pet) : RequestConfig { + val localVariableBody = pet val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf("Content-Type" to "application/x-www-form-urlencoded") - val localVariableConfig = RequestConfig( - RequestMethod.POST, - "/pet/{petId}".replace("{"+"petId"+"}", "$petId"), + val localVariableHeaders: MutableMap = mutableMapOf() + localVariableHeaders["Content-Type"] = "application/json" + + return RequestConfig( + method = RequestMethod.PUT, + path = "/pet", query = localVariableQuery, - headers = localVariableHeaders - ) - val localVarResponse = request( - localVariableConfig, - localVariableBody + headers = localVariableHeaders, + requiresAuthentication = true, + body = localVariableBody ) + } + + /** + * POST /pet/{petId} + * Updates a pet in the store with form data + * + * @param petId ID of pet that needs to be updated + * @param name Updated name of the pet (optional) + * @param status Updated status of the pet (optional) + * @return void + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception + * @throws UnsupportedOperationException If the API returns an informational or redirection response + * @throws ClientException If the API returns a client error response + * @throws ServerException If the API returns a server error response + */ + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) + fun updatePetWithForm(petId: kotlin.Long, name: kotlin.String? = null, status: kotlin.String? = null) : Unit { + val localVarResponse = updatePetWithFormWithHttpInfo(petId = petId, name = name, status = status) return when (localVarResponse.responseType) { ResponseType.Success -> Unit @@ -323,41 +546,77 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { } ResponseType.ServerError -> { val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) + throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()} ${localVarError.body}", localVarError.statusCode, localVarResponse) } } } /** - * uploads an image - * - * @param petId ID of pet to update - * @param additionalMetadata Additional data to pass to server (optional) - * @param file file to upload (optional) - * @return ApiResponse - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun uploadFile(petId: kotlin.Long, additionalMetadata: kotlin.String?, file: java.io.File?) : ApiResponse { - val localVariableBody: kotlin.Any? = mapOf("additionalMetadata" to additionalMetadata, "file" to file) + * POST /pet/{petId} + * Updates a pet in the store with form data + * + * @param petId ID of pet that needs to be updated + * @param name Updated name of the pet (optional) + * @param status Updated status of the pet (optional) + * @return ApiResponse + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception + */ + @Throws(IllegalStateException::class, IOException::class) + fun updatePetWithFormWithHttpInfo(petId: kotlin.Long, name: kotlin.String?, status: kotlin.String?) : ApiResponse { + val localVariableConfig = updatePetWithFormRequestConfig(petId = petId, name = name, status = status) + + return request>, Unit>( + localVariableConfig + ) + } + + /** + * To obtain the request config of the operation updatePetWithForm + * + * @param petId ID of pet that needs to be updated + * @param name Updated name of the pet (optional) + * @param status Updated status of the pet (optional) + * @return RequestConfig + */ + fun updatePetWithFormRequestConfig(petId: kotlin.Long, name: kotlin.String?, status: kotlin.String?) : RequestConfig>> { + val localVariableBody = mapOf( + "name" to PartConfig(body = name, headers = mutableMapOf()), + "status" to PartConfig(body = status, headers = mutableMapOf()),) val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf("Content-Type" to "multipart/form-data") - val localVariableConfig = RequestConfig( - RequestMethod.POST, - "/pet/{petId}/uploadImage".replace("{"+"petId"+"}", "$petId"), + val localVariableHeaders: MutableMap = mutableMapOf("Content-Type" to "application/x-www-form-urlencoded") + + return RequestConfig( + method = RequestMethod.POST, + path = "/pet/{petId}".replace("{"+"petId"+"}", encodeURIComponent(petId.toString())), query = localVariableQuery, - headers = localVariableHeaders - ) - val localVarResponse = request( - localVariableConfig, - localVariableBody + headers = localVariableHeaders, + requiresAuthentication = true, + body = localVariableBody ) + } + + /** + * POST /pet/{petId}/uploadImage + * uploads an image + * + * @param petId ID of pet to update + * @param additionalMetadata Additional data to pass to server (optional) + * @param file file to upload (optional) + * @return ModelApiResponse + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception + * @throws UnsupportedOperationException If the API returns an informational or redirection response + * @throws ClientException If the API returns a client error response + * @throws ServerException If the API returns a server error response + */ + @Suppress("UNCHECKED_CAST") + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) + fun uploadFile(petId: kotlin.Long, additionalMetadata: kotlin.String? = null, file: java.io.File? = null) : ModelApiResponse { + val localVarResponse = uploadFileWithHttpInfo(petId = petId, additionalMetadata = additionalMetadata, file = file) return when (localVarResponse.responseType) { - ResponseType.Success -> (localVarResponse as Success<*>).data as ApiResponse + ResponseType.Success -> (localVarResponse as Success<*>).data as ModelApiResponse ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") ResponseType.ClientError -> { @@ -366,41 +625,79 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { } ResponseType.ServerError -> { val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) + throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()} ${localVarError.body}", localVarError.statusCode, localVarResponse) } } } /** - * uploads an image (required) - * - * @param petId ID of pet to update - * @param requiredFile file to upload - * @param additionalMetadata Additional data to pass to server (optional) - * @return ApiResponse - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ + * POST /pet/{petId}/uploadImage + * uploads an image + * + * @param petId ID of pet to update + * @param additionalMetadata Additional data to pass to server (optional) + * @param file file to upload (optional) + * @return ApiResponse + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception + */ @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun uploadFileWithRequiredFile(petId: kotlin.Long, requiredFile: java.io.File, additionalMetadata: kotlin.String?) : ApiResponse { - val localVariableBody: kotlin.Any? = mapOf("additionalMetadata" to additionalMetadata, "requiredFile" to requiredFile) + @Throws(IllegalStateException::class, IOException::class) + fun uploadFileWithHttpInfo(petId: kotlin.Long, additionalMetadata: kotlin.String?, file: java.io.File?) : ApiResponse { + val localVariableConfig = uploadFileRequestConfig(petId = petId, additionalMetadata = additionalMetadata, file = file) + + return request>, ModelApiResponse>( + localVariableConfig + ) + } + + /** + * To obtain the request config of the operation uploadFile + * + * @param petId ID of pet to update + * @param additionalMetadata Additional data to pass to server (optional) + * @param file file to upload (optional) + * @return RequestConfig + */ + fun uploadFileRequestConfig(petId: kotlin.Long, additionalMetadata: kotlin.String?, file: java.io.File?) : RequestConfig>> { + val localVariableBody = mapOf( + "additionalMetadata" to PartConfig(body = additionalMetadata, headers = mutableMapOf()), + "file" to PartConfig(body = file, headers = mutableMapOf()),) val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf("Content-Type" to "multipart/form-data") - val localVariableConfig = RequestConfig( - RequestMethod.POST, - "/fake/{petId}/uploadImageWithRequiredFile".replace("{"+"petId"+"}", "$petId"), + localVariableHeaders["Accept"] = "application/json" + + return RequestConfig( + method = RequestMethod.POST, + path = "/pet/{petId}/uploadImage".replace("{"+"petId"+"}", encodeURIComponent(petId.toString())), query = localVariableQuery, - headers = localVariableHeaders - ) - val localVarResponse = request( - localVariableConfig, - localVariableBody + headers = localVariableHeaders, + requiresAuthentication = true, + body = localVariableBody ) + } + + /** + * POST /fake/{petId}/uploadImageWithRequiredFile + * uploads an image (required) + * + * @param petId ID of pet to update + * @param requiredFile file to upload + * @param additionalMetadata Additional data to pass to server (optional) + * @return ModelApiResponse + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception + * @throws UnsupportedOperationException If the API returns an informational or redirection response + * @throws ClientException If the API returns a client error response + * @throws ServerException If the API returns a server error response + */ + @Suppress("UNCHECKED_CAST") + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) + fun uploadFileWithRequiredFile(petId: kotlin.Long, requiredFile: java.io.File, additionalMetadata: kotlin.String? = null) : ModelApiResponse { + val localVarResponse = uploadFileWithRequiredFileWithHttpInfo(petId = petId, requiredFile = requiredFile, additionalMetadata = additionalMetadata) return when (localVarResponse.responseType) { - ResponseType.Success -> (localVarResponse as Success<*>).data as ApiResponse + ResponseType.Success -> (localVarResponse as Success<*>).data as ModelApiResponse ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") ResponseType.ClientError -> { @@ -409,9 +706,59 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { } ResponseType.ServerError -> { val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) + throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()} ${localVarError.body}", localVarError.statusCode, localVarResponse) } } } + /** + * POST /fake/{petId}/uploadImageWithRequiredFile + * uploads an image (required) + * + * @param petId ID of pet to update + * @param requiredFile file to upload + * @param additionalMetadata Additional data to pass to server (optional) + * @return ApiResponse + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception + */ + @Suppress("UNCHECKED_CAST") + @Throws(IllegalStateException::class, IOException::class) + fun uploadFileWithRequiredFileWithHttpInfo(petId: kotlin.Long, requiredFile: java.io.File, additionalMetadata: kotlin.String?) : ApiResponse { + val localVariableConfig = uploadFileWithRequiredFileRequestConfig(petId = petId, requiredFile = requiredFile, additionalMetadata = additionalMetadata) + + return request>, ModelApiResponse>( + localVariableConfig + ) + } + + /** + * To obtain the request config of the operation uploadFileWithRequiredFile + * + * @param petId ID of pet to update + * @param requiredFile file to upload + * @param additionalMetadata Additional data to pass to server (optional) + * @return RequestConfig + */ + fun uploadFileWithRequiredFileRequestConfig(petId: kotlin.Long, requiredFile: java.io.File, additionalMetadata: kotlin.String?) : RequestConfig>> { + val localVariableBody = mapOf( + "additionalMetadata" to PartConfig(body = additionalMetadata, headers = mutableMapOf()), + "requiredFile" to PartConfig(body = requiredFile, headers = mutableMapOf()),) + val localVariableQuery: MultiValueMap = mutableMapOf() + val localVariableHeaders: MutableMap = mutableMapOf("Content-Type" to "multipart/form-data") + localVariableHeaders["Accept"] = "application/json" + + return RequestConfig( + method = RequestMethod.POST, + path = "/fake/{petId}/uploadImageWithRequiredFile".replace("{"+"petId"+"}", encodeURIComponent(petId.toString())), + query = localVariableQuery, + headers = localVariableHeaders, + requiresAuthentication = true, + body = localVariableBody + ) + } + + + private fun encodeURIComponent(uriComponent: kotlin.String): kotlin.String = + HttpUrl.Builder().scheme("http").host("localhost").addPathSegment(uriComponent).build().encodedPathSegments[0] } diff --git a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt index 5bcbf030dba1..4154ae8883c3 100644 --- a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt +++ b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt @@ -1,62 +1,73 @@ /** -* OpenAPI Petstore -* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ -* -* The version of the OpenAPI document: 1.0.0 -* -* -* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). -* https://openapi-generator.tech -* Do not edit the class manually. -*/ + * + * Please note: + * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * Do not edit this file manually. + * + */ + +@file:Suppress( + "ArrayInDataClass", + "DuplicatedCode", + "EnumEntryName", + "RemoveRedundantQualifierName", + "RemoveRedundantCallsOfConversionMethods", + "REDUNDANT_CALL_OF_CONVERSION_METHOD", + "RedundantUnitReturnType", + "RemoveEmptyClassBody", + "UnnecessaryVariable", + "UnusedImport", + "UnnecessaryVariable", + "unused" +) + package org.openapitools.client.apis +import java.io.IOException +import okhttp3.Call +import okhttp3.HttpUrl + import org.openapitools.client.models.Order +import com.squareup.moshi.Json + import org.openapitools.client.infrastructure.ApiClient +import org.openapitools.client.infrastructure.ApiResponse import org.openapitools.client.infrastructure.ClientException import org.openapitools.client.infrastructure.ClientError import org.openapitools.client.infrastructure.ServerException import org.openapitools.client.infrastructure.ServerError import org.openapitools.client.infrastructure.MultiValueMap +import org.openapitools.client.infrastructure.PartConfig import org.openapitools.client.infrastructure.RequestConfig import org.openapitools.client.infrastructure.RequestMethod import org.openapitools.client.infrastructure.ResponseType import org.openapitools.client.infrastructure.Success import org.openapitools.client.infrastructure.toMultiValue -class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { +open class StoreApi(basePath: kotlin.String = defaultBasePath, client: Call.Factory = ApiClient.defaultClient) : ApiClient(basePath, client) { companion object { @JvmStatic val defaultBasePath: String by lazy { - System.getProperties().getProperty("org.openapitools.client.baseUrl", "http://petstore.swagger.io:80/v2") + System.getProperties().getProperty(ApiClient.BASE_URL_KEY, "http://petstore.swagger.io:80/v2") } } /** - * Delete purchase order by ID - * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors - * @param orderId ID of the order that needs to be deleted - * @return void - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + * DELETE /store/order/{order_id} + * Delete purchase order by ID + * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + * @param orderId ID of the order that needs to be deleted + * @return void + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception + * @throws UnsupportedOperationException If the API returns an informational or redirection response + * @throws ClientException If the API returns a client error response + * @throws ServerException If the API returns a server error response + */ + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun deleteOrder(orderId: kotlin.String) : Unit { - val localVariableBody: kotlin.Any? = null - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - val localVariableConfig = RequestConfig( - RequestMethod.DELETE, - "/store/order/{order_id}".replace("{"+"order_id"+"}", "$orderId"), - query = localVariableQuery, - headers = localVariableHeaders - ) - val localVarResponse = request( - localVariableConfig, - localVariableBody - ) + val localVarResponse = deleteOrderWithHttpInfo(orderId = orderId) return when (localVarResponse.responseType) { ResponseType.Success -> Unit @@ -68,35 +79,65 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) } ResponseType.ServerError -> { val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) + throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()} ${localVarError.body}", localVarError.statusCode, localVarResponse) } } } /** - * Returns pet inventories by status - * Returns a map of status codes to quantities - * @return kotlin.collections.Map - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun getInventory() : kotlin.collections.Map { - val localVariableBody: kotlin.Any? = null + * DELETE /store/order/{order_id} + * Delete purchase order by ID + * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + * @param orderId ID of the order that needs to be deleted + * @return ApiResponse + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception + */ + @Throws(IllegalStateException::class, IOException::class) + fun deleteOrderWithHttpInfo(orderId: kotlin.String) : ApiResponse { + val localVariableConfig = deleteOrderRequestConfig(orderId = orderId) + + return request( + localVariableConfig + ) + } + + /** + * To obtain the request config of the operation deleteOrder + * + * @param orderId ID of the order that needs to be deleted + * @return RequestConfig + */ + fun deleteOrderRequestConfig(orderId: kotlin.String) : RequestConfig { + val localVariableBody = null val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf() - val localVariableConfig = RequestConfig( - RequestMethod.GET, - "/store/inventory", + + return RequestConfig( + method = RequestMethod.DELETE, + path = "/store/order/{order_id}".replace("{"+"order_id"+"}", encodeURIComponent(orderId.toString())), query = localVariableQuery, - headers = localVariableHeaders - ) - val localVarResponse = request>( - localVariableConfig, - localVariableBody + headers = localVariableHeaders, + requiresAuthentication = false, + body = localVariableBody ) + } + + /** + * GET /store/inventory + * Returns pet inventories by status + * Returns a map of status codes to quantities + * @return kotlin.collections.Map + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception + * @throws UnsupportedOperationException If the API returns an informational or redirection response + * @throws ClientException If the API returns a client error response + * @throws ServerException If the API returns a server error response + */ + @Suppress("UNCHECKED_CAST") + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) + fun getInventory() : kotlin.collections.Map { + val localVarResponse = getInventoryWithHttpInfo() return when (localVarResponse.responseType) { ResponseType.Success -> (localVarResponse as Success<*>).data as kotlin.collections.Map @@ -108,36 +149,66 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) } ResponseType.ServerError -> { val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) + throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()} ${localVarError.body}", localVarError.statusCode, localVarResponse) } } } /** - * Find purchase order by ID - * For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions - * @param orderId ID of pet that needs to be fetched - * @return Order - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ + * GET /store/inventory + * Returns pet inventories by status + * Returns a map of status codes to quantities + * @return ApiResponse?> + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception + */ @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun getOrderById(orderId: kotlin.Long) : Order { - val localVariableBody: kotlin.Any? = null + @Throws(IllegalStateException::class, IOException::class) + fun getInventoryWithHttpInfo() : ApiResponse?> { + val localVariableConfig = getInventoryRequestConfig() + + return request>( + localVariableConfig + ) + } + + /** + * To obtain the request config of the operation getInventory + * + * @return RequestConfig + */ + fun getInventoryRequestConfig() : RequestConfig { + val localVariableBody = null val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf() - val localVariableConfig = RequestConfig( - RequestMethod.GET, - "/store/order/{order_id}".replace("{"+"order_id"+"}", "$orderId"), + localVariableHeaders["Accept"] = "application/json" + + return RequestConfig( + method = RequestMethod.GET, + path = "/store/inventory", query = localVariableQuery, - headers = localVariableHeaders - ) - val localVarResponse = request( - localVariableConfig, - localVariableBody + headers = localVariableHeaders, + requiresAuthentication = true, + body = localVariableBody ) + } + + /** + * GET /store/order/{order_id} + * Find purchase order by ID + * For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions + * @param orderId ID of pet that needs to be fetched + * @return Order + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception + * @throws UnsupportedOperationException If the API returns an informational or redirection response + * @throws ClientException If the API returns a client error response + * @throws ServerException If the API returns a server error response + */ + @Suppress("UNCHECKED_CAST") + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) + fun getOrderById(orderId: kotlin.Long) : Order { + val localVarResponse = getOrderByIdWithHttpInfo(orderId = orderId) return when (localVarResponse.responseType) { ResponseType.Success -> (localVarResponse as Success<*>).data as Order @@ -149,36 +220,68 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) } ResponseType.ServerError -> { val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) + throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()} ${localVarError.body}", localVarError.statusCode, localVarResponse) } } } /** - * Place an order for a pet - * - * @param order order placed for purchasing the pet - * @return Order - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ + * GET /store/order/{order_id} + * Find purchase order by ID + * For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions + * @param orderId ID of pet that needs to be fetched + * @return ApiResponse + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception + */ @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun placeOrder(order: Order) : Order { - val localVariableBody: kotlin.Any? = order + @Throws(IllegalStateException::class, IOException::class) + fun getOrderByIdWithHttpInfo(orderId: kotlin.Long) : ApiResponse { + val localVariableConfig = getOrderByIdRequestConfig(orderId = orderId) + + return request( + localVariableConfig + ) + } + + /** + * To obtain the request config of the operation getOrderById + * + * @param orderId ID of pet that needs to be fetched + * @return RequestConfig + */ + fun getOrderByIdRequestConfig(orderId: kotlin.Long) : RequestConfig { + val localVariableBody = null val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf() - val localVariableConfig = RequestConfig( - RequestMethod.POST, - "/store/order", + localVariableHeaders["Accept"] = "application/json" + + return RequestConfig( + method = RequestMethod.GET, + path = "/store/order/{order_id}".replace("{"+"order_id"+"}", encodeURIComponent(orderId.toString())), query = localVariableQuery, - headers = localVariableHeaders - ) - val localVarResponse = request( - localVariableConfig, - localVariableBody + headers = localVariableHeaders, + requiresAuthentication = false, + body = localVariableBody ) + } + + /** + * POST /store/order + * Place an order for a pet + * + * @param order order placed for purchasing the pet + * @return Order + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception + * @throws UnsupportedOperationException If the API returns an informational or redirection response + * @throws ClientException If the API returns a client error response + * @throws ServerException If the API returns a server error response + */ + @Suppress("UNCHECKED_CAST") + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) + fun placeOrder(order: Order) : Order { + val localVarResponse = placeOrderWithHttpInfo(order = order) return when (localVarResponse.responseType) { ResponseType.Success -> (localVarResponse as Success<*>).data as Order @@ -190,9 +293,54 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) } ResponseType.ServerError -> { val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) + throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()} ${localVarError.body}", localVarError.statusCode, localVarResponse) } } } + /** + * POST /store/order + * Place an order for a pet + * + * @param order order placed for purchasing the pet + * @return ApiResponse + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception + */ + @Suppress("UNCHECKED_CAST") + @Throws(IllegalStateException::class, IOException::class) + fun placeOrderWithHttpInfo(order: Order) : ApiResponse { + val localVariableConfig = placeOrderRequestConfig(order = order) + + return request( + localVariableConfig + ) + } + + /** + * To obtain the request config of the operation placeOrder + * + * @param order order placed for purchasing the pet + * @return RequestConfig + */ + fun placeOrderRequestConfig(order: Order) : RequestConfig { + val localVariableBody = order + val localVariableQuery: MultiValueMap = mutableMapOf() + val localVariableHeaders: MutableMap = mutableMapOf() + localVariableHeaders["Content-Type"] = "application/json" + localVariableHeaders["Accept"] = "application/json" + + return RequestConfig( + method = RequestMethod.POST, + path = "/store/order", + query = localVariableQuery, + headers = localVariableHeaders, + requiresAuthentication = false, + body = localVariableBody + ) + } + + + private fun encodeURIComponent(uriComponent: kotlin.String): kotlin.String = + HttpUrl.Builder().scheme("http").host("localhost").addPathSegment(uriComponent).build().encodedPathSegments[0] } diff --git a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/apis/UserApi.kt b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/apis/UserApi.kt index 1ed6f6bc16b3..5d64fef00cd1 100644 --- a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/apis/UserApi.kt +++ b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/apis/UserApi.kt @@ -1,62 +1,73 @@ /** -* OpenAPI Petstore -* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ -* -* The version of the OpenAPI document: 1.0.0 -* -* -* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). -* https://openapi-generator.tech -* Do not edit the class manually. -*/ + * + * Please note: + * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * Do not edit this file manually. + * + */ + +@file:Suppress( + "ArrayInDataClass", + "DuplicatedCode", + "EnumEntryName", + "RemoveRedundantQualifierName", + "RemoveRedundantCallsOfConversionMethods", + "REDUNDANT_CALL_OF_CONVERSION_METHOD", + "RedundantUnitReturnType", + "RemoveEmptyClassBody", + "UnnecessaryVariable", + "UnusedImport", + "UnnecessaryVariable", + "unused" +) + package org.openapitools.client.apis +import java.io.IOException +import okhttp3.Call +import okhttp3.HttpUrl + import org.openapitools.client.models.User +import com.squareup.moshi.Json + import org.openapitools.client.infrastructure.ApiClient +import org.openapitools.client.infrastructure.ApiResponse import org.openapitools.client.infrastructure.ClientException import org.openapitools.client.infrastructure.ClientError import org.openapitools.client.infrastructure.ServerException import org.openapitools.client.infrastructure.ServerError import org.openapitools.client.infrastructure.MultiValueMap +import org.openapitools.client.infrastructure.PartConfig import org.openapitools.client.infrastructure.RequestConfig import org.openapitools.client.infrastructure.RequestMethod import org.openapitools.client.infrastructure.ResponseType import org.openapitools.client.infrastructure.Success import org.openapitools.client.infrastructure.toMultiValue -class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { +open class UserApi(basePath: kotlin.String = defaultBasePath, client: Call.Factory = ApiClient.defaultClient) : ApiClient(basePath, client) { companion object { @JvmStatic val defaultBasePath: String by lazy { - System.getProperties().getProperty("org.openapitools.client.baseUrl", "http://petstore.swagger.io:80/v2") + System.getProperties().getProperty(ApiClient.BASE_URL_KEY, "http://petstore.swagger.io:80/v2") } } /** - * Create user - * This can only be done by the logged in user. - * @param user Created user object - * @return void - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + * POST /user + * Create user + * This can only be done by the logged in user. + * @param user Created user object + * @return void + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception + * @throws UnsupportedOperationException If the API returns an informational or redirection response + * @throws ClientException If the API returns a client error response + * @throws ServerException If the API returns a server error response + */ + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun createUser(user: User) : Unit { - val localVariableBody: kotlin.Any? = user - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - val localVariableConfig = RequestConfig( - RequestMethod.POST, - "/user", - query = localVariableQuery, - headers = localVariableHeaders - ) - val localVarResponse = request( - localVariableConfig, - localVariableBody - ) + val localVarResponse = createUserWithHttpInfo(user = user) return when (localVarResponse.responseType) { ResponseType.Success -> Unit @@ -68,35 +79,66 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { } ResponseType.ServerError -> { val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) + throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()} ${localVarError.body}", localVarError.statusCode, localVarResponse) } } } /** - * Creates list of users with given input array - * - * @param user List of user object - * @return void - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun createUsersWithArrayInput(user: kotlin.collections.List) : Unit { - val localVariableBody: kotlin.Any? = user + * POST /user + * Create user + * This can only be done by the logged in user. + * @param user Created user object + * @return ApiResponse + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception + */ + @Throws(IllegalStateException::class, IOException::class) + fun createUserWithHttpInfo(user: User) : ApiResponse { + val localVariableConfig = createUserRequestConfig(user = user) + + return request( + localVariableConfig + ) + } + + /** + * To obtain the request config of the operation createUser + * + * @param user Created user object + * @return RequestConfig + */ + fun createUserRequestConfig(user: User) : RequestConfig { + val localVariableBody = user val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf() - val localVariableConfig = RequestConfig( - RequestMethod.POST, - "/user/createWithArray", + localVariableHeaders["Content-Type"] = "application/json" + + return RequestConfig( + method = RequestMethod.POST, + path = "/user", query = localVariableQuery, - headers = localVariableHeaders - ) - val localVarResponse = request( - localVariableConfig, - localVariableBody + headers = localVariableHeaders, + requiresAuthentication = false, + body = localVariableBody ) + } + + /** + * POST /user/createWithArray + * Creates list of users with given input array + * + * @param user List of user object + * @return void + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception + * @throws UnsupportedOperationException If the API returns an informational or redirection response + * @throws ClientException If the API returns a client error response + * @throws ServerException If the API returns a server error response + */ + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) + fun createUsersWithArrayInput(user: kotlin.collections.List) : Unit { + val localVarResponse = createUsersWithArrayInputWithHttpInfo(user = user) return when (localVarResponse.responseType) { ResponseType.Success -> Unit @@ -108,35 +150,66 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { } ResponseType.ServerError -> { val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) + throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()} ${localVarError.body}", localVarError.statusCode, localVarResponse) } } } /** - * Creates list of users with given input array - * - * @param user List of user object - * @return void - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun createUsersWithListInput(user: kotlin.collections.List) : Unit { - val localVariableBody: kotlin.Any? = user + * POST /user/createWithArray + * Creates list of users with given input array + * + * @param user List of user object + * @return ApiResponse + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception + */ + @Throws(IllegalStateException::class, IOException::class) + fun createUsersWithArrayInputWithHttpInfo(user: kotlin.collections.List) : ApiResponse { + val localVariableConfig = createUsersWithArrayInputRequestConfig(user = user) + + return request, Unit>( + localVariableConfig + ) + } + + /** + * To obtain the request config of the operation createUsersWithArrayInput + * + * @param user List of user object + * @return RequestConfig + */ + fun createUsersWithArrayInputRequestConfig(user: kotlin.collections.List) : RequestConfig> { + val localVariableBody = user val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf() - val localVariableConfig = RequestConfig( - RequestMethod.POST, - "/user/createWithList", + localVariableHeaders["Content-Type"] = "application/json" + + return RequestConfig( + method = RequestMethod.POST, + path = "/user/createWithArray", query = localVariableQuery, - headers = localVariableHeaders - ) - val localVarResponse = request( - localVariableConfig, - localVariableBody + headers = localVariableHeaders, + requiresAuthentication = false, + body = localVariableBody ) + } + + /** + * POST /user/createWithList + * Creates list of users with given input array + * + * @param user List of user object + * @return void + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception + * @throws UnsupportedOperationException If the API returns an informational or redirection response + * @throws ClientException If the API returns a client error response + * @throws ServerException If the API returns a server error response + */ + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) + fun createUsersWithListInput(user: kotlin.collections.List) : Unit { + val localVarResponse = createUsersWithListInputWithHttpInfo(user = user) return when (localVarResponse.responseType) { ResponseType.Success -> Unit @@ -148,35 +221,66 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { } ResponseType.ServerError -> { val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) + throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()} ${localVarError.body}", localVarError.statusCode, localVarResponse) } } } /** - * Delete user - * This can only be done by the logged in user. - * @param username The name that needs to be deleted - * @return void - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun deleteUser(username: kotlin.String) : Unit { - val localVariableBody: kotlin.Any? = null + * POST /user/createWithList + * Creates list of users with given input array + * + * @param user List of user object + * @return ApiResponse + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception + */ + @Throws(IllegalStateException::class, IOException::class) + fun createUsersWithListInputWithHttpInfo(user: kotlin.collections.List) : ApiResponse { + val localVariableConfig = createUsersWithListInputRequestConfig(user = user) + + return request, Unit>( + localVariableConfig + ) + } + + /** + * To obtain the request config of the operation createUsersWithListInput + * + * @param user List of user object + * @return RequestConfig + */ + fun createUsersWithListInputRequestConfig(user: kotlin.collections.List) : RequestConfig> { + val localVariableBody = user val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf() - val localVariableConfig = RequestConfig( - RequestMethod.DELETE, - "/user/{username}".replace("{"+"username"+"}", "$username"), + localVariableHeaders["Content-Type"] = "application/json" + + return RequestConfig( + method = RequestMethod.POST, + path = "/user/createWithList", query = localVariableQuery, - headers = localVariableHeaders - ) - val localVarResponse = request( - localVariableConfig, - localVariableBody + headers = localVariableHeaders, + requiresAuthentication = false, + body = localVariableBody ) + } + + /** + * DELETE /user/{username} + * Delete user + * This can only be done by the logged in user. + * @param username The name that needs to be deleted + * @return void + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception + * @throws UnsupportedOperationException If the API returns an informational or redirection response + * @throws ClientException If the API returns a client error response + * @throws ServerException If the API returns a server error response + */ + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) + fun deleteUser(username: kotlin.String) : Unit { + val localVarResponse = deleteUserWithHttpInfo(username = username) return when (localVarResponse.responseType) { ResponseType.Success -> Unit @@ -188,36 +292,66 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { } ResponseType.ServerError -> { val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) + throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()} ${localVarError.body}", localVarError.statusCode, localVarResponse) } } } /** - * Get user by user name - * - * @param username The name that needs to be fetched. Use user1 for testing. - * @return User - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun getUserByName(username: kotlin.String) : User { - val localVariableBody: kotlin.Any? = null + * DELETE /user/{username} + * Delete user + * This can only be done by the logged in user. + * @param username The name that needs to be deleted + * @return ApiResponse + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception + */ + @Throws(IllegalStateException::class, IOException::class) + fun deleteUserWithHttpInfo(username: kotlin.String) : ApiResponse { + val localVariableConfig = deleteUserRequestConfig(username = username) + + return request( + localVariableConfig + ) + } + + /** + * To obtain the request config of the operation deleteUser + * + * @param username The name that needs to be deleted + * @return RequestConfig + */ + fun deleteUserRequestConfig(username: kotlin.String) : RequestConfig { + val localVariableBody = null val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf() - val localVariableConfig = RequestConfig( - RequestMethod.GET, - "/user/{username}".replace("{"+"username"+"}", "$username"), + + return RequestConfig( + method = RequestMethod.DELETE, + path = "/user/{username}".replace("{"+"username"+"}", encodeURIComponent(username.toString())), query = localVariableQuery, - headers = localVariableHeaders - ) - val localVarResponse = request( - localVariableConfig, - localVariableBody + headers = localVariableHeaders, + requiresAuthentication = false, + body = localVariableBody ) + } + + /** + * GET /user/{username} + * Get user by user name + * + * @param username The name that needs to be fetched. Use user1 for testing. + * @return User + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception + * @throws UnsupportedOperationException If the API returns an informational or redirection response + * @throws ClientException If the API returns a client error response + * @throws ServerException If the API returns a server error response + */ + @Suppress("UNCHECKED_CAST") + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) + fun getUserByName(username: kotlin.String) : User { + val localVarResponse = getUserByNameWithHttpInfo(username = username) return when (localVarResponse.responseType) { ResponseType.Success -> (localVarResponse as Success<*>).data as User @@ -229,41 +363,69 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { } ResponseType.ServerError -> { val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) + throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()} ${localVarError.body}", localVarError.statusCode, localVarResponse) } } } /** - * Logs user into the system - * - * @param username The user name for login - * @param password The password for login in clear text - * @return kotlin.String - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ + * GET /user/{username} + * Get user by user name + * + * @param username The name that needs to be fetched. Use user1 for testing. + * @return ApiResponse + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception + */ @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun loginUser(username: kotlin.String, password: kotlin.String) : kotlin.String { - val localVariableBody: kotlin.Any? = null - val localVariableQuery: MultiValueMap = mutableMapOf>() - .apply { - put("username", listOf(username.toString())) - put("password", listOf(password.toString())) - } + @Throws(IllegalStateException::class, IOException::class) + fun getUserByNameWithHttpInfo(username: kotlin.String) : ApiResponse { + val localVariableConfig = getUserByNameRequestConfig(username = username) + + return request( + localVariableConfig + ) + } + + /** + * To obtain the request config of the operation getUserByName + * + * @param username The name that needs to be fetched. Use user1 for testing. + * @return RequestConfig + */ + fun getUserByNameRequestConfig(username: kotlin.String) : RequestConfig { + val localVariableBody = null + val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf() - val localVariableConfig = RequestConfig( - RequestMethod.GET, - "/user/login", + localVariableHeaders["Accept"] = "application/json" + + return RequestConfig( + method = RequestMethod.GET, + path = "/user/{username}".replace("{"+"username"+"}", encodeURIComponent(username.toString())), query = localVariableQuery, - headers = localVariableHeaders - ) - val localVarResponse = request( - localVariableConfig, - localVariableBody + headers = localVariableHeaders, + requiresAuthentication = false, + body = localVariableBody ) + } + + /** + * GET /user/login + * Logs user into the system + * + * @param username The user name for login + * @param password The password for login in clear text + * @return kotlin.String + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception + * @throws UnsupportedOperationException If the API returns an informational or redirection response + * @throws ClientException If the API returns a client error response + * @throws ServerException If the API returns a server error response + */ + @Suppress("UNCHECKED_CAST") + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) + fun loginUser(username: kotlin.String, password: kotlin.String) : kotlin.String { + val localVarResponse = loginUserWithHttpInfo(username = username, password = password) return when (localVarResponse.responseType) { ResponseType.Success -> (localVarResponse as Success<*>).data as kotlin.String @@ -275,34 +437,72 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { } ResponseType.ServerError -> { val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) + throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()} ${localVarError.body}", localVarError.statusCode, localVarResponse) } } } /** - * Logs out current logged in user session - * - * @return void - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun logoutUser() : Unit { - val localVariableBody: kotlin.Any? = null - val localVariableQuery: MultiValueMap = mutableMapOf() + * GET /user/login + * Logs user into the system + * + * @param username The user name for login + * @param password The password for login in clear text + * @return ApiResponse + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception + */ + @Suppress("UNCHECKED_CAST") + @Throws(IllegalStateException::class, IOException::class) + fun loginUserWithHttpInfo(username: kotlin.String, password: kotlin.String) : ApiResponse { + val localVariableConfig = loginUserRequestConfig(username = username, password = password) + + return request( + localVariableConfig + ) + } + + /** + * To obtain the request config of the operation loginUser + * + * @param username The user name for login + * @param password The password for login in clear text + * @return RequestConfig + */ + fun loginUserRequestConfig(username: kotlin.String, password: kotlin.String) : RequestConfig { + val localVariableBody = null + val localVariableQuery: MultiValueMap = mutableMapOf>() + .apply { + put("username", listOf(username.toString())) + put("password", listOf(password.toString())) + } val localVariableHeaders: MutableMap = mutableMapOf() - val localVariableConfig = RequestConfig( - RequestMethod.GET, - "/user/logout", + localVariableHeaders["Accept"] = "application/json" + + return RequestConfig( + method = RequestMethod.GET, + path = "/user/login", query = localVariableQuery, - headers = localVariableHeaders - ) - val localVarResponse = request( - localVariableConfig, - localVariableBody + headers = localVariableHeaders, + requiresAuthentication = false, + body = localVariableBody ) + } + + /** + * GET /user/logout + * Logs out current logged in user session + * + * @return void + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception + * @throws UnsupportedOperationException If the API returns an informational or redirection response + * @throws ClientException If the API returns a client error response + * @throws ServerException If the API returns a server error response + */ + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) + fun logoutUser() : Unit { + val localVarResponse = logoutUserWithHttpInfo() return when (localVarResponse.responseType) { ResponseType.Success -> Unit @@ -314,36 +514,64 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { } ResponseType.ServerError -> { val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) + throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()} ${localVarError.body}", localVarError.statusCode, localVarResponse) } } } /** - * Updated user - * This can only be done by the logged in user. - * @param username name that need to be deleted - * @param user Updated user object - * @return void - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun updateUser(username: kotlin.String, user: User) : Unit { - val localVariableBody: kotlin.Any? = user + * GET /user/logout + * Logs out current logged in user session + * + * @return ApiResponse + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception + */ + @Throws(IllegalStateException::class, IOException::class) + fun logoutUserWithHttpInfo() : ApiResponse { + val localVariableConfig = logoutUserRequestConfig() + + return request( + localVariableConfig + ) + } + + /** + * To obtain the request config of the operation logoutUser + * + * @return RequestConfig + */ + fun logoutUserRequestConfig() : RequestConfig { + val localVariableBody = null val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf() - val localVariableConfig = RequestConfig( - RequestMethod.PUT, - "/user/{username}".replace("{"+"username"+"}", "$username"), + + return RequestConfig( + method = RequestMethod.GET, + path = "/user/logout", query = localVariableQuery, - headers = localVariableHeaders - ) - val localVarResponse = request( - localVariableConfig, - localVariableBody + headers = localVariableHeaders, + requiresAuthentication = false, + body = localVariableBody ) + } + + /** + * PUT /user/{username} + * Updated user + * This can only be done by the logged in user. + * @param username name that need to be deleted + * @param user Updated user object + * @return void + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception + * @throws UnsupportedOperationException If the API returns an informational or redirection response + * @throws ClientException If the API returns a client error response + * @throws ServerException If the API returns a server error response + */ + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) + fun updateUser(username: kotlin.String, user: User) : Unit { + val localVarResponse = updateUserWithHttpInfo(username = username, user = user) return when (localVarResponse.responseType) { ResponseType.Success -> Unit @@ -355,9 +583,54 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { } ResponseType.ServerError -> { val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) + throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()} ${localVarError.body}", localVarError.statusCode, localVarResponse) } } } + /** + * PUT /user/{username} + * Updated user + * This can only be done by the logged in user. + * @param username name that need to be deleted + * @param user Updated user object + * @return ApiResponse + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception + */ + @Throws(IllegalStateException::class, IOException::class) + fun updateUserWithHttpInfo(username: kotlin.String, user: User) : ApiResponse { + val localVariableConfig = updateUserRequestConfig(username = username, user = user) + + return request( + localVariableConfig + ) + } + + /** + * To obtain the request config of the operation updateUser + * + * @param username name that need to be deleted + * @param user Updated user object + * @return RequestConfig + */ + fun updateUserRequestConfig(username: kotlin.String, user: User) : RequestConfig { + val localVariableBody = user + val localVariableQuery: MultiValueMap = mutableMapOf() + val localVariableHeaders: MutableMap = mutableMapOf() + localVariableHeaders["Content-Type"] = "application/json" + + return RequestConfig( + method = RequestMethod.PUT, + path = "/user/{username}".replace("{"+"username"+"}", encodeURIComponent(username.toString())), + query = localVariableQuery, + headers = localVariableHeaders, + requiresAuthentication = false, + body = localVariableBody + ) + } + + + private fun encodeURIComponent(uriComponent: kotlin.String): kotlin.String = + HttpUrl.Builder().scheme("http").host("localhost").addPathSegment(uriComponent).build().encodedPathSegments[0] } diff --git a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/infrastructure/ApiAbstractions.kt b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/infrastructure/ApiAbstractions.kt index ef7a8f1e1a62..7fe8da468374 100644 --- a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/infrastructure/ApiAbstractions.kt +++ b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/infrastructure/ApiAbstractions.kt @@ -2,7 +2,7 @@ package org.openapitools.client.infrastructure typealias MultiValueMap = MutableMap> -fun collectionDelimiter(collectionFormat: String) = when(collectionFormat) { +fun collectionDelimiter(collectionFormat: String): String = when(collectionFormat) { "csv" -> "," "tsv" -> "\t" "pipe" -> "|" @@ -12,7 +12,7 @@ fun collectionDelimiter(collectionFormat: String) = when(collectionFormat) { val defaultMultiValueConverter: (item: Any?) -> String = { item -> "$item" } -fun toMultiValue(items: Array, collectionFormat: String, map: (item: T) -> String = defaultMultiValueConverter) +fun toMultiValue(items: Array, collectionFormat: String, map: (item: T) -> String = defaultMultiValueConverter): List = toMultiValue(items.asIterable(), collectionFormat, map) fun toMultiValue(items: Iterable, collectionFormat: String, map: (item: T) -> String = defaultMultiValueConverter): List { @@ -20,4 +20,4 @@ fun toMultiValue(items: Iterable, collectionFormat: String, map: ( "multi" -> items.map(map) else -> listOf(items.joinToString(separator = collectionDelimiter(collectionFormat), transform = map)) } -} \ No newline at end of file +} diff --git a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt index d3ca9efeadca..801c22ee29dc 100644 --- a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt +++ b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt @@ -1,6 +1,5 @@ package org.openapitools.client.infrastructure -import okhttp3.Credentials import okhttp3.OkHttpClient import okhttp3.RequestBody import okhttp3.RequestBody.Companion.asRequestBody @@ -11,25 +10,99 @@ import okhttp3.ResponseBody import okhttp3.MediaType.Companion.toMediaTypeOrNull import okhttp3.Request import okhttp3.Headers +import okhttp3.Headers.Builder +import okhttp3.Headers.Companion.toHeaders import okhttp3.MultipartBody +import okhttp3.Call +import okhttp3.Callback +import okhttp3.Response +import java.io.BufferedWriter import java.io.File +import java.io.FileWriter +import java.io.IOException import java.net.URLConnection -import java.util.Date import java.time.LocalDate import java.time.LocalDateTime import java.time.LocalTime import java.time.OffsetDateTime import java.time.OffsetTime +import java.util.Locale +import java.util.regex.Pattern +import com.squareup.moshi.adapter -open class ApiClient(val baseUrl: String) { +val EMPTY_REQUEST: RequestBody = ByteArray(0).toRequestBody() + +open class ApiClient(val baseUrl: String, val client: Call.Factory = defaultClient) { companion object { - protected const val ContentType = "Content-Type" - protected const val Accept = "Accept" - protected const val Authorization = "Authorization" - protected const val JsonMediaType = "application/json" - protected const val FormDataMediaType = "multipart/form-data" - protected const val FormUrlEncMediaType = "application/x-www-form-urlencoded" - protected const val XmlMediaType = "application/xml" + protected const val CONTENT_TYPE: String = "Content-Type" + @Deprecated( + message = "Please use the capitalized constant `CONTENT_TYPE` instead.", + replaceWith = ReplaceWith("CONTENT_TYPE") + ) + protected const val ContentType: String = CONTENT_TYPE + + protected const val ACCEPT: String = "Accept" + @Deprecated( + message = "Please use the capitalized constant `ACCEPT` instead.", + replaceWith = ReplaceWith("ACCEPT") + ) + protected const val Accept: String = ACCEPT + + protected const val AUTHORIZATION: String = "Authorization" + @Deprecated( + message = "Please use the capitalized constant `AUTHORIZATION` instead.", + replaceWith = ReplaceWith("AUTHORIZATION") + ) + protected const val Authorization: String = AUTHORIZATION + + protected const val JSON_MEDIA_TYPE: String = "application/json" + @Deprecated( + message = "Please use the capitalized constant `JSON_MEDIA_TYPE` instead.", + replaceWith = ReplaceWith("JSON_MEDIA_TYPE") + ) + protected const val JsonMediaType: String = JSON_MEDIA_TYPE + + protected const val FORM_DATA_MEDIA_TYPE: String = "multipart/form-data" + @Deprecated( + message = "Please use the capitalized constant `FORM_DATA_MEDIA_TYPE` instead.", + replaceWith = ReplaceWith("FORM_DATA_MEDIA_TYPE") + ) + protected const val FormDataMediaType: String = FORM_DATA_MEDIA_TYPE + + protected const val FORM_URL_ENC_MEDIA_TYPE: String = "application/x-www-form-urlencoded" + @Deprecated( + message = "Please use the capitalized constant `FORM_URL_ENC_MEDIA_TYPE` instead.", + replaceWith = ReplaceWith("FORM_URL_ENC_MEDIA_TYPE") + ) + protected const val FormUrlEncMediaType: String = FORM_URL_ENC_MEDIA_TYPE + + protected const val XML_MEDIA_TYPE: String = "application/xml" + @Deprecated( + message = "Please use the capitalized constant `XML_MEDIA_TYPE` instead.", + replaceWith = ReplaceWith("XML_MEDIA_TYPE") + ) + protected const val XmlMediaType: String = XML_MEDIA_TYPE + + protected const val OCTET_MEDIA_TYPE: String = "application/octet-stream" + @Deprecated( + message = "Please use the capitalized constant `OCTET_MEDIA_TYPE` instead.", + replaceWith = ReplaceWith("OCTET_MEDIA_TYPE") + ) + protected const val OctetMediaType: String = OCTET_MEDIA_TYPE + + protected const val TEXT_MEDIA_TYPE: String = "text/plain" + @Deprecated( + message = "Please use the capitalized constant `TEXT_MEDIA_TYPE` instead.", + replaceWith = ReplaceWith("TEXT_MEDIA_TYPE") + ) + protected const val TextMediaType: String = TEXT_MEDIA_TYPE + + const val BASE_URL_KEY: String = "org.openapitools.client.baseUrl" + @Deprecated( + message = "Please use the capitalized constant `BASE_URL_KEY` instead.", + replaceWith = ReplaceWith("BASE_URL_KEY") + ) + const val baseUrlKey: String = BASE_URL_KEY val apiKey: MutableMap = mutableMapOf() val apiKeyPrefix: MutableMap = mutableMapOf() @@ -38,7 +111,7 @@ open class ApiClient(val baseUrl: String) { var accessToken: String? = null @JvmStatic - val client: OkHttpClient by lazy { + val defaultClient: OkHttpClient by lazy { builder.build() } @@ -46,6 +119,21 @@ open class ApiClient(val baseUrl: String) { val builder: OkHttpClient.Builder = OkHttpClient.Builder() } + /** + * Guess Content-Type header from the given byteArray (defaults to "application/octet-stream"). + * + * @param byteArray The given file + * @return The guessed Content-Type + */ + protected fun guessContentTypeFromByteArray(byteArray: ByteArray): String { + val contentType = try { + URLConnection.guessContentTypeFromStream(byteArray.inputStream()) + } catch (_: IOException) { + "application/octet-stream" + } + return contentType + } + /** * Guess Content-Type header from the given file (defaults to "application/octet-stream"). * @@ -57,70 +145,222 @@ open class ApiClient(val baseUrl: String) { return contentType ?: "application/octet-stream" } - protected inline fun requestBody(content: T, mediaType: String = JsonMediaType): RequestBody = + /** + * Builds headers for a multipart form-data part. + * OkHttp requires Content-Type to be passed via the RequestBody parameter, not in headers. + * This function filters out Content-Type and builds the appropriate Content-Disposition header. + * + * @param name The field name + * @param headers The headers from the PartConfig (may include Content-Type) + * @param filename Optional filename for file uploads + * @return Headers object ready for addPart() + */ + protected fun buildPartHeaders(name: String, headers: Map, filename: String? = null): Headers { + val disposition = if (filename != null) { + "form-data; name=\"$name\"; filename=\"$filename\"" + } else { + "form-data; name=\"$name\"" + } + return (headers.filterKeys { it != "Content-Type" } + ("Content-Disposition" to disposition)).toHeaders() + } + + /** + * Adds a File to a MultipartBody.Builder + * Defined a helper in the requestBody method to not duplicate code + * It will be used when the content is a `FORM_DATA_MEDIA_TYPE` and the body of the PartConfig is a File + * + * @param name The field name to add in the request + * @param headers The headers that are in the PartConfig + * @param file The file that will be added as the field value + * @return The method returns Unit but the new Part is added to the Builder that the extension function is applying on + * @see requestBody + */ + protected fun MultipartBody.Builder.addPartToMultiPart(name: String, headers: Map, file: File) { + val fileMediaType = guessContentTypeFromFile(file).toMediaTypeOrNull() + addPart( + buildPartHeaders(name, headers, file.name), + file.asRequestBody(fileMediaType) + ) + } + + /** + * Serializes a multipart body part based on its content type. + * Uses JSON serialization for application/json content types, otherwise converts to string. + * + * @param obj The object to serialize + * @param contentType The Content-Type header value, if any + * @param serializer Optional custom serializer (used for kotlinx.serialization to preserve type info) + * @return The serialized string representation + */ + protected fun serializePartBody(obj: Any?, contentType: String?, serializer: ((Any?) -> String)?): String { + // Use custom serializer if provided (for kotlinx.serialization with captured type info) + if (serializer != null) { + return serializer(obj) + } + + return if (contentType?.contains("json") == true) { + Serializer.moshi.adapter(Any::class.java).toJson(obj) + } else { + parameterToString(obj) + } + } + + /** + * Adds any type to a MultipartBody.Builder + * Defined a helper in the requestBody method to not duplicate code + * It will be used when the content is a `FORM_DATA_MEDIA_TYPE` and the body of the PartConfig is not a File. + * + * @param name The field name to add in the request + * @param headers The headers that are in the PartConfig + * @param obj The field name to add in the request + * @param serializer Optional custom serializer for this part + * @return The method returns Unit but the new Part is added to the Builder that the extension function is applying on + * @see requestBody + */ + protected fun MultipartBody.Builder.addPartToMultiPart(name: String, headers: Map, obj: Any?, serializer: ((Any?) -> String)? = null) { + val partContentType = headers["Content-Type"] + val partMediaType = partContentType?.toMediaTypeOrNull() + val partBody = serializePartBody(obj, partContentType, serializer) + addPart( + buildPartHeaders(name, headers), + partBody.toRequestBody(partMediaType) + ) + } + + protected inline fun requestBody(content: T, mediaType: String?): RequestBody = when { - content is File -> content.asRequestBody( - mediaType.toMediaTypeOrNull() - ) - mediaType == FormDataMediaType -> { + content is ByteArray -> content.toRequestBody((mediaType ?: guessContentTypeFromByteArray(content)).toMediaTypeOrNull()) + content is File -> content.asRequestBody((mediaType ?: guessContentTypeFromFile(content)).toMediaTypeOrNull()) + mediaType == FORM_DATA_MEDIA_TYPE -> MultipartBody.Builder() .setType(MultipartBody.FORM) .apply { - // content's type *must* be Map + // content's type *must* be Map> @Suppress("UNCHECKED_CAST") - (content as Map).forEach { (key, value) -> - if (value is File) { - val partHeaders = Headers.headersOf( - "Content-Disposition", - "form-data; name=\"$key\"; filename=\"${value.name}\"" - ) - val fileMediaType = guessContentTypeFromFile(value).toMediaTypeOrNull() - addPart(partHeaders, value.asRequestBody(fileMediaType)) - } else { - val partHeaders = Headers.headersOf( - "Content-Disposition", - "form-data; name=\"$key\"" - ) - addPart( - partHeaders, - parameterToString(value).toRequestBody(null) - ) + (content as Map>).forEach { (name, part) -> + when (part.body) { + is File -> addPartToMultiPart(name, part.headers, part.body) + is List<*> -> { + part.body.forEach { + if (it is File) { + addPartToMultiPart(name, part.headers, it) + } else { + addPartToMultiPart(name, part.headers, it, part.serializer) + } + } + } + else -> addPartToMultiPart(name, part.headers, part.body, part.serializer) } } }.build() - } - mediaType == FormUrlEncMediaType -> { + mediaType == FORM_URL_ENC_MEDIA_TYPE -> { FormBody.Builder().apply { - // content's type *must* be Map + // content's type *must* be Map> @Suppress("UNCHECKED_CAST") - (content as Map).forEach { (key, value) -> - add(key, parameterToString(value)) + (content as Map>).forEach { (name, part) -> + add(name, parameterToString(part.body)) } }.build() } - mediaType == JsonMediaType -> Serializer.moshi.adapter(T::class.java).toJson(content).toRequestBody( - mediaType.toMediaTypeOrNull() - ) - mediaType == XmlMediaType -> throw UnsupportedOperationException("xml not currently supported.") + mediaType == null || mediaType.startsWith("application/") && mediaType.endsWith("json") -> + if (content == null) { + EMPTY_REQUEST + } else { + Serializer.moshi.adapter(T::class.java).toJson(content) + .toRequestBody((mediaType ?: JSON_MEDIA_TYPE).toMediaTypeOrNull()) + } + mediaType == XML_MEDIA_TYPE -> throw UnsupportedOperationException("xml not currently supported.") + mediaType == TEXT_MEDIA_TYPE -> { + val textualContent = when (content) { + is Char, is CharSequence -> content.toString() + is Number -> content.toString() + is Boolean -> content.toString() + else -> throw UnsupportedOperationException("requestBody currently only supports text body containing primitive types: characters, numbers, or booleans.") + } + textualContent.toRequestBody(mediaType.toMediaTypeOrNull()) + } // TODO: this should be extended with other serializers - else -> throw UnsupportedOperationException("requestBody currently only supports JSON body and File body.") + else -> throw UnsupportedOperationException("requestBody currently only supports JSON body, text body, byte body and File body.") } - protected inline fun responseBody(body: ResponseBody?, mediaType: String? = JsonMediaType): T? { - if(body == null) { - return null - } - val bodyContent = body.string() - if (bodyContent.isEmpty()) { + @OptIn(ExperimentalStdlibApi::class) + protected inline fun responseBody(response: Response, mediaType: String? = JSON_MEDIA_TYPE): T? { + val body = response.body ?: return null + + if (T::class.java == Unit::class.java) { + // No need to parse the body when we're not interested in the body + // Useful when API is returning other Content-Type return null + } else if (T::class.java == File::class.java) { + // return tempFile + val contentDisposition = response.header("Content-Disposition") + + val fileName = if (contentDisposition != null) { + // Get filename from the Content-Disposition header. + val pattern = Pattern.compile("filename=['\"]?([^'\"\\s]+)['\"]?") + val matcher = pattern.matcher(contentDisposition) + if (matcher.find()) { + matcher.group(1) + ?.replace(".*[/\\\\]", "") + ?.replace(";", "") + } else { + null + } + } else { + null + } + + var prefix: String? + val suffix: String? + if (fileName == null) { + prefix = "download" + suffix = "" + } else { + val pos = fileName.lastIndexOf(".") + if (pos == -1) { + prefix = fileName + suffix = null + } else { + prefix = fileName.substring(0, pos) + suffix = fileName.substring(pos) + } + // Files.createTempFile requires the prefix to be at least three characters long + if (prefix.length < 3) { + prefix = "download" + } + } + + // Attention: if you are developing an android app that supports API Level 25 and below, please check flag supportAndroidApiLevel25AndBelow in https://openapi-generator.tech/docs/generators/kotlin#config-options + val tempFile = java.nio.file.Files.createTempFile(prefix, suffix).toFile() + tempFile.deleteOnExit() + body.byteStream().use { inputStream -> + tempFile.outputStream().use { tempFileOutputStream -> + inputStream.copyTo(tempFileOutputStream) + } + } + return tempFile as T } - return when(mediaType) { - JsonMediaType -> Serializer.moshi.adapter(T::class.java).fromJson(bodyContent) - else -> throw UnsupportedOperationException("responseBody currently only supports JSON body.") + + return when { + mediaType == null || (mediaType.startsWith("application/") && mediaType.endsWith("json")) -> { + val bodyContent = body.string() + if (bodyContent.isEmpty()) { + return null + } + Serializer.moshi.adapter().fromJson(bodyContent) + } + mediaType == OCTET_MEDIA_TYPE -> body.bytes() as? T + mediaType == TEXT_MEDIA_TYPE -> body.string() as? T + else -> throw UnsupportedOperationException("responseBody currently only supports JSON body, text body and byte body.") } } - protected fun updateAuthParams(requestConfig: RequestConfig) { + protected fun updateAuthParams(requestConfig: RequestConfig) { + if (requestConfig.headers[AUTHORIZATION].isNullOrEmpty()) { + accessToken?.let { accessToken -> + requestConfig.headers[AUTHORIZATION] = "Bearer $accessToken " + } + } if (requestConfig.headers["api_key"].isNullOrEmpty()) { if (apiKey["api_key"] != null) { if (apiKeyPrefix["api_key"] != null) { @@ -133,39 +373,34 @@ open class ApiClient(val baseUrl: String) { if (requestConfig.query["api_key_query"].isNullOrEmpty()) { if (apiKey["api_key_query"] != null) { if (apiKeyPrefix["api_key_query"] != null) { - requestConfig.query["api_key_query"] = apiKeyPrefix["api_key_query"]!! + " " + apiKey["api_key_query"]!! + requestConfig.query["api_key_query"] = listOf(apiKeyPrefix["api_key_query"]!! + " " + apiKey["api_key_query"]!!) } else { - requestConfig.query["api_key_query"] = apiKey["api_key_query"]!! + requestConfig.query["api_key_query"] = listOf(apiKey["api_key_query"]!!) } } } - if (requestConfig.headers[Authorization].isNullOrEmpty()) { - accessToken?.let { accessToken -> - requestConfig.headers[Authorization] = "Bearer $accessToken" - } - } - if (requestConfig.headers[Authorization].isNullOrEmpty()) { + if (requestConfig.headers[AUTHORIZATION].isNullOrEmpty()) { username?.let { username -> password?.let { password -> - requestConfig.headers[Authorization] = Credentials.basic(username, password) + requestConfig.headers[AUTHORIZATION] = okhttp3.Credentials.basic(username, password) } } } - if (requestConfig.headers[Authorization].isNullOrEmpty()) { + if (requestConfig.headers[AUTHORIZATION].isNullOrEmpty()) { accessToken?.let { accessToken -> - requestConfig.headers[Authorization] = "Bearer $accessToken " + requestConfig.headers[AUTHORIZATION] = "Bearer $accessToken" } } } - protected inline fun request(requestConfig: RequestConfig, body : Any? = null): ApiInfrastructureResponse { + protected inline fun request(requestConfig: RequestConfig): ApiResponse { val httpUrl = baseUrl.toHttpUrlOrNull() ?: throw IllegalStateException("baseUrl is invalid.") // take authMethod from operation updateAuthParams(requestConfig) val url = httpUrl.newBuilder() - .addPathSegments(requestConfig.path.trimStart('/')) + .addEncodedPathSegments(requestConfig.path.trimStart('/')) .apply { requestConfig.query.forEach { query -> query.value.forEach { queryValue -> @@ -175,89 +410,89 @@ open class ApiClient(val baseUrl: String) { }.build() // take content-type/accept from spec or set to default (application/json) if not defined - if (requestConfig.headers[ContentType].isNullOrEmpty()) { - requestConfig.headers[ContentType] = JsonMediaType + if (requestConfig.body != null && requestConfig.headers[CONTENT_TYPE].isNullOrEmpty()) { + requestConfig.headers[CONTENT_TYPE] = JSON_MEDIA_TYPE } - if (requestConfig.headers[Accept].isNullOrEmpty()) { - requestConfig.headers[Accept] = JsonMediaType + if (requestConfig.headers[ACCEPT].isNullOrEmpty()) { + requestConfig.headers[ACCEPT] = JSON_MEDIA_TYPE } val headers = requestConfig.headers - if(headers[ContentType] ?: "" == "") { - throw kotlin.IllegalStateException("Missing Content-Type header. This is required.") + if (headers[ACCEPT].isNullOrEmpty()) { + throw kotlin.IllegalStateException("Missing ACCEPT header. This is required.") } - if(headers[Accept] ?: "" == "") { - throw kotlin.IllegalStateException("Missing Accept header. This is required.") + val contentType = if (headers[CONTENT_TYPE] != null) { + // TODO: support multiple contentType options here. + (headers[CONTENT_TYPE] as String).substringBefore(";").lowercase(Locale.US) + } else { + null } - // TODO: support multiple contentType options here. - val contentType = (headers[ContentType] as String).substringBefore(";").toLowerCase() - val request = when (requestConfig.method) { - RequestMethod.DELETE -> Request.Builder().url(url).delete(requestBody(body, contentType)) + RequestMethod.DELETE -> Request.Builder().url(url).delete(requestBody(requestConfig.body, contentType)) RequestMethod.GET -> Request.Builder().url(url) RequestMethod.HEAD -> Request.Builder().url(url).head() - RequestMethod.PATCH -> Request.Builder().url(url).patch(requestBody(body, contentType)) - RequestMethod.PUT -> Request.Builder().url(url).put(requestBody(body, contentType)) - RequestMethod.POST -> Request.Builder().url(url).post(requestBody(body, contentType)) + RequestMethod.PATCH -> Request.Builder().url(url).patch(requestBody(requestConfig.body, contentType)) + RequestMethod.PUT -> Request.Builder().url(url).put(requestBody(requestConfig.body, contentType)) + RequestMethod.POST -> Request.Builder().url(url).post(requestBody(requestConfig.body, contentType)) RequestMethod.OPTIONS -> Request.Builder().url(url).method("OPTIONS", null) }.apply { - headers.forEach { header -> addHeader(header.key, header.value) } + val headersBuilder = Headers.Builder() + headers.forEach { header -> + headersBuilder.add(header.key, header.value) + } + this.headers(headersBuilder.build()) }.build() val response = client.newCall(request).execute() - val accept = response.header(ContentType)?.substringBefore(";")?.toLowerCase() + + val accept = response.header(CONTENT_TYPE)?.substringBefore(";")?.lowercase(Locale.US) // TODO: handle specific mapping types. e.g. Map> - when { - response.isRedirect -> return Redirection( - response.code, - response.headers.toMultimap() - ) - response.isInformational -> return Informational( - response.message, - response.code, - response.headers.toMultimap() - ) - response.isSuccessful -> return Success( - responseBody(response.body, accept), - response.code, - response.headers.toMultimap() - ) - response.isClientError -> return ClientError( - response.message, - response.body?.string(), - response.code, - response.headers.toMultimap() - ) - else -> return ServerError( - response.message, - response.body?.string(), - response.code, - response.headers.toMultimap() - ) + @Suppress("UNNECESSARY_SAFE_CALL") + return response.use { + when { + it.isRedirect -> Redirection( + it.code, + it.headers.toMultimap() + ) + it.isInformational -> Informational( + it.message, + it.code, + it.headers.toMultimap() + ) + it.isSuccessful -> Success( + responseBody(it, accept), + it.code, + it.headers.toMultimap() + ) + it.isClientError -> ClientError( + it.message, + it.body?.string(), + it.code, + it.headers.toMultimap() + ) + else -> ServerError( + it.message, + it.body?.string(), + it.code, + it.headers.toMultimap() + ) + } } } - protected fun parameterToString(value: Any?): String { - when (value) { - null -> { - return "" - } - is Array<*> -> { - return toMultiValue(value, "csv").toString() - } - is Iterable<*> -> { - return toMultiValue(value, "csv").toString() - } - is OffsetDateTime, is OffsetTime, is LocalDateTime, is LocalDate, is LocalTime, is Date -> { - return parseDateToQueryString(value) - } - else -> { - return value.toString() - } - } + protected fun parameterToString(value: Any?): String = when (value) { + null -> "" + is Array<*> -> toMultiValue(value, "csv").toString() + is Iterable<*> -> toMultiValue(value, "csv").toString() + is OffsetDateTime -> parseDateToQueryString(value) + is OffsetTime -> parseDateToQueryString(value) + is LocalDateTime -> parseDateToQueryString(value) + is LocalDate -> parseDateToQueryString(value) + is LocalTime -> parseDateToQueryString(value) + else -> value.toString() } protected inline fun parseDateToQueryString(value : T): String { diff --git a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/infrastructure/ApiResponse.kt b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/infrastructure/ApiResponse.kt new file mode 100644 index 000000000000..689fb03cd7ae --- /dev/null +++ b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/infrastructure/ApiResponse.kt @@ -0,0 +1,43 @@ +package org.openapitools.client.infrastructure + +enum class ResponseType { + Success, Informational, Redirection, ClientError, ServerError +} + +interface Response + +abstract class ApiResponse(val responseType: ResponseType): Response { + abstract val statusCode: Int + abstract val headers: Map> +} + +class Success( + val data: T, + override val statusCode: Int = -1, + override val headers: Map> = mapOf() +): ApiResponse(ResponseType.Success) + +class Informational( + val statusText: String, + override val statusCode: Int = -1, + override val headers: Map> = mapOf() +) : ApiResponse(ResponseType.Informational) + +class Redirection( + override val statusCode: Int = -1, + override val headers: Map> = mapOf() +) : ApiResponse(ResponseType.Redirection) + +class ClientError( + val message: String? = null, + val body: Any? = null, + override val statusCode: Int = -1, + override val headers: Map> = mapOf() +) : ApiResponse(ResponseType.ClientError) + +class ServerError( + val message: String? = null, + val body: Any? = null, + override val statusCode: Int = -1, + override val headers: Map> = mapOf() +): ApiResponse(ResponseType.ServerError) diff --git a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/infrastructure/BigDecimalAdapter.kt b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/infrastructure/BigDecimalAdapter.kt new file mode 100644 index 000000000000..064b57fc6b82 --- /dev/null +++ b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/infrastructure/BigDecimalAdapter.kt @@ -0,0 +1,17 @@ +package org.openapitools.client.infrastructure + +import com.squareup.moshi.FromJson +import com.squareup.moshi.ToJson +import java.math.BigDecimal + +class BigDecimalAdapter { + @ToJson + fun toJson(value: BigDecimal): String { + return value.toPlainString() + } + + @FromJson + fun fromJson(value: String): BigDecimal { + return BigDecimal(value) + } +} diff --git a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/infrastructure/BigIntegerAdapter.kt b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/infrastructure/BigIntegerAdapter.kt new file mode 100644 index 000000000000..7df6057b4503 --- /dev/null +++ b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/infrastructure/BigIntegerAdapter.kt @@ -0,0 +1,17 @@ +package org.openapitools.client.infrastructure + +import com.squareup.moshi.FromJson +import com.squareup.moshi.ToJson +import java.math.BigInteger + +class BigIntegerAdapter { + @ToJson + fun toJson(value: BigInteger): String { + return value.toString() + } + + @FromJson + fun fromJson(value: String): BigInteger { + return BigInteger(value) + } +} diff --git a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/infrastructure/Errors.kt b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/infrastructure/Errors.kt index b5310e71f13c..c83993b9055c 100644 --- a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/infrastructure/Errors.kt +++ b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/infrastructure/Errors.kt @@ -15,4 +15,4 @@ open class ServerException(message: kotlin.String? = null, val statusCode: Int = companion object { private const val serialVersionUID: Long = 456L } -} \ No newline at end of file +} diff --git a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/infrastructure/PartConfig.kt b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/infrastructure/PartConfig.kt new file mode 100644 index 000000000000..c2a5c99ec7e6 --- /dev/null +++ b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/infrastructure/PartConfig.kt @@ -0,0 +1,19 @@ +package org.openapitools.client.infrastructure + +/** + * Defines a config object for a given part of a multi-part request. + * NOTE: Headers is a Map because rfc2616 defines + * multi-valued headers as csv-only. + * + * @property headers The headers for this part + * @property body The body content for this part + * @property serializer Optional custom serializer for JSON content. When provided, this will be + * used instead of the default serialization for parts with application/json + * content-type. This allows capturing type information at the call site to + * avoid issues with type erasure in kotlinx.serialization. + */ +data class PartConfig( + val headers: MutableMap = mutableMapOf(), + val body: T? = null, + val serializer: ((Any?) -> String)? = null +) diff --git a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/infrastructure/RequestConfig.kt b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/infrastructure/RequestConfig.kt index 9c22257e223a..6578b9381b78 100644 --- a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/infrastructure/RequestConfig.kt +++ b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/infrastructure/RequestConfig.kt @@ -8,9 +8,12 @@ package org.openapitools.client.infrastructure * NOTE: Headers is a Map because rfc2616 defines * multi-valued headers as csv-only. */ -data class RequestConfig( +data class RequestConfig( val method: RequestMethod, val path: String, val headers: MutableMap = mutableMapOf(), - val query: MutableMap> = mutableMapOf() -) \ No newline at end of file + val params: MutableMap = mutableMapOf(), + val query: MutableMap> = mutableMapOf(), + val requiresAuthentication: Boolean, + val body: T? = null +) diff --git a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/infrastructure/RequestMethod.kt b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/infrastructure/RequestMethod.kt index 931b12b8bd7a..beb56f07cdde 100644 --- a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/infrastructure/RequestMethod.kt +++ b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/infrastructure/RequestMethod.kt @@ -5,4 +5,4 @@ package org.openapitools.client.infrastructure */ enum class RequestMethod { GET, DELETE, HEAD, OPTIONS, PATCH, POST, PUT -} \ No newline at end of file +} diff --git a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/infrastructure/Serializer.kt b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/infrastructure/Serializer.kt index 9a45b67d9b1a..e22592e47d74 100644 --- a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/infrastructure/Serializer.kt +++ b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/infrastructure/Serializer.kt @@ -2,7 +2,6 @@ package org.openapitools.client.infrastructure import com.squareup.moshi.Moshi import com.squareup.moshi.kotlin.reflect.KotlinJsonAdapterFactory -import java.util.Date object Serializer { @JvmStatic @@ -12,7 +11,10 @@ object Serializer { .add(LocalDateAdapter()) .add(UUIDAdapter()) .add(ByteArrayAdapter()) + .add(URIAdapter()) .add(KotlinJsonAdapterFactory()) + .add(BigDecimalAdapter()) + .add(BigIntegerAdapter()) @JvmStatic val moshi: Moshi by lazy { diff --git a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/infrastructure/URIAdapter.kt b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/infrastructure/URIAdapter.kt new file mode 100644 index 000000000000..979301f7a030 --- /dev/null +++ b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/infrastructure/URIAdapter.kt @@ -0,0 +1,13 @@ +package org.openapitools.client.infrastructure + +import com.squareup.moshi.FromJson +import com.squareup.moshi.ToJson +import java.net.URI + +class URIAdapter { + @ToJson + fun toJson(uri: URI): String = uri.toString() + + @FromJson + fun fromJson(s: String): URI = URI.create(s) +} diff --git a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/infrastructure/UUIDAdapter.kt b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/infrastructure/UUIDAdapter.kt index a4a44cc18b73..d050ce08f76f 100644 --- a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/infrastructure/UUIDAdapter.kt +++ b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/infrastructure/UUIDAdapter.kt @@ -6,8 +6,8 @@ import java.util.UUID class UUIDAdapter { @ToJson - fun toJson(uuid: UUID) = uuid.toString() + fun toJson(uuid: UUID): String = uuid.toString() @FromJson - fun fromJson(s: String) = UUID.fromString(s) + fun fromJson(s: String): UUID = UUID.fromString(s) } diff --git a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/AdditionalPropertiesClass.kt b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/AdditionalPropertiesClass.kt index e481b1a34243..ca39d2e61f91 100644 --- a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/AdditionalPropertiesClass.kt +++ b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/AdditionalPropertiesClass.kt @@ -1,35 +1,54 @@ /** -* OpenAPI Petstore -* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ -* -* The version of the OpenAPI document: 1.0.0 -* -* -* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). -* https://openapi-generator.tech -* Do not edit the class manually. -*/ + * + * Please note: + * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * Do not edit this file manually. + * + */ + +@file:Suppress( + "ArrayInDataClass", + "DuplicatedCode", + "EnumEntryName", + "RemoveRedundantQualifierName", + "RemoveRedundantCallsOfConversionMethods", + "REDUNDANT_CALL_OF_CONVERSION_METHOD", + "RedundantUnitReturnType", + "RemoveEmptyClassBody", + "UnnecessaryVariable", + "UnusedImport", + "UnnecessaryVariable", + "unused" +) + package org.openapitools.client.models import com.squareup.moshi.Json +import com.squareup.moshi.JsonClass import java.io.Serializable /** * + * * @param mapProperty * @param mapOfMapProperty */ + data class AdditionalPropertiesClass ( + @Json(name = "map_property") val mapProperty: kotlin.collections.Map? = null, + @Json(name = "map_of_map_property") val mapOfMapProperty: kotlin.collections.Map>? = null + ) : Serializable { companion object { private const val serialVersionUID: Long = 123 } + } diff --git a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/AllOfWithSingleRef.kt b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/AllOfWithSingleRef.kt new file mode 100644 index 000000000000..f78845b257ff --- /dev/null +++ b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/AllOfWithSingleRef.kt @@ -0,0 +1,55 @@ +/** + * + * Please note: + * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * Do not edit this file manually. + * + */ + +@file:Suppress( + "ArrayInDataClass", + "DuplicatedCode", + "EnumEntryName", + "RemoveRedundantQualifierName", + "RemoveRedundantCallsOfConversionMethods", + "REDUNDANT_CALL_OF_CONVERSION_METHOD", + "RedundantUnitReturnType", + "RemoveEmptyClassBody", + "UnnecessaryVariable", + "UnusedImport", + "UnnecessaryVariable", + "unused" +) + +package org.openapitools.client.models + +import org.openapitools.client.models.SingleRefType + +import com.squareup.moshi.Json +import com.squareup.moshi.JsonClass +import java.io.Serializable + +/** + * + * + * @param username + * @param singleRefType + */ + + +data class AllOfWithSingleRef ( + + @Json(name = "username") + val username: kotlin.String? = null, + + @Json(name = "SingleRefType") + val singleRefType: SingleRefType? = null + +) : Serializable { + companion object { + private const val serialVersionUID: Long = 123 + } + + +} + diff --git a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/Animal.kt b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/Animal.kt index 8ce8fccc6fea..ee14a3e89514 100644 --- a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/Animal.kt +++ b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/Animal.kt @@ -1,26 +1,41 @@ /** -* OpenAPI Petstore -* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ -* -* The version of the OpenAPI document: 1.0.0 -* -* -* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). -* https://openapi-generator.tech -* Do not edit the class manually. -*/ + * + * Please note: + * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * Do not edit this file manually. + * + */ + +@file:Suppress( + "ArrayInDataClass", + "DuplicatedCode", + "EnumEntryName", + "RemoveRedundantQualifierName", + "RemoveRedundantCallsOfConversionMethods", + "REDUNDANT_CALL_OF_CONVERSION_METHOD", + "RedundantUnitReturnType", + "RemoveEmptyClassBody", + "UnnecessaryVariable", + "UnusedImport", + "UnnecessaryVariable", + "unused" +) + package org.openapitools.client.models import com.squareup.moshi.Json +import com.squareup.moshi.JsonClass import java.io.Serializable /** * + * * @param className * @param color */ + interface Animal : Serializable { companion object { private const val serialVersionUID: Long = 123 @@ -30,5 +45,6 @@ interface Animal : Serializable { val className: kotlin.String @Json(name = "color") val color: kotlin.String? + } diff --git a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/ArrayOfArrayOfNumberOnly.kt b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/ArrayOfArrayOfNumberOnly.kt index 7e4228001541..a379882d99cd 100644 --- a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/ArrayOfArrayOfNumberOnly.kt +++ b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/ArrayOfArrayOfNumberOnly.kt @@ -1,32 +1,50 @@ /** -* OpenAPI Petstore -* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ -* -* The version of the OpenAPI document: 1.0.0 -* -* -* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). -* https://openapi-generator.tech -* Do not edit the class manually. -*/ + * + * Please note: + * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * Do not edit this file manually. + * + */ + +@file:Suppress( + "ArrayInDataClass", + "DuplicatedCode", + "EnumEntryName", + "RemoveRedundantQualifierName", + "RemoveRedundantCallsOfConversionMethods", + "REDUNDANT_CALL_OF_CONVERSION_METHOD", + "RedundantUnitReturnType", + "RemoveEmptyClassBody", + "UnnecessaryVariable", + "UnusedImport", + "UnnecessaryVariable", + "unused" +) + package org.openapitools.client.models import com.squareup.moshi.Json +import com.squareup.moshi.JsonClass import java.io.Serializable /** * + * * @param arrayArrayNumber */ + data class ArrayOfArrayOfNumberOnly ( + @Json(name = "ArrayArrayNumber") val arrayArrayNumber: kotlin.collections.List>? = null + ) : Serializable { companion object { private const val serialVersionUID: Long = 123 } + } diff --git a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/ArrayOfNumberOnly.kt b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/ArrayOfNumberOnly.kt index f2da9373e835..7838ddd1d63f 100644 --- a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/ArrayOfNumberOnly.kt +++ b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/ArrayOfNumberOnly.kt @@ -1,32 +1,50 @@ /** -* OpenAPI Petstore -* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ -* -* The version of the OpenAPI document: 1.0.0 -* -* -* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). -* https://openapi-generator.tech -* Do not edit the class manually. -*/ + * + * Please note: + * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * Do not edit this file manually. + * + */ + +@file:Suppress( + "ArrayInDataClass", + "DuplicatedCode", + "EnumEntryName", + "RemoveRedundantQualifierName", + "RemoveRedundantCallsOfConversionMethods", + "REDUNDANT_CALL_OF_CONVERSION_METHOD", + "RedundantUnitReturnType", + "RemoveEmptyClassBody", + "UnnecessaryVariable", + "UnusedImport", + "UnnecessaryVariable", + "unused" +) + package org.openapitools.client.models import com.squareup.moshi.Json +import com.squareup.moshi.JsonClass import java.io.Serializable /** * + * * @param arrayNumber */ + data class ArrayOfNumberOnly ( + @Json(name = "ArrayNumber") val arrayNumber: kotlin.collections.List? = null + ) : Serializable { companion object { private const val serialVersionUID: Long = 123 } + } diff --git a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/ArrayTest.kt b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/ArrayTest.kt index a2e6e72c2c7c..cf3f75571abc 100644 --- a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/ArrayTest.kt +++ b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/ArrayTest.kt @@ -1,39 +1,59 @@ /** -* OpenAPI Petstore -* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ -* -* The version of the OpenAPI document: 1.0.0 -* -* -* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). -* https://openapi-generator.tech -* Do not edit the class manually. -*/ + * + * Please note: + * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * Do not edit this file manually. + * + */ + +@file:Suppress( + "ArrayInDataClass", + "DuplicatedCode", + "EnumEntryName", + "RemoveRedundantQualifierName", + "RemoveRedundantCallsOfConversionMethods", + "REDUNDANT_CALL_OF_CONVERSION_METHOD", + "RedundantUnitReturnType", + "RemoveEmptyClassBody", + "UnnecessaryVariable", + "UnusedImport", + "UnnecessaryVariable", + "unused" +) + package org.openapitools.client.models import org.openapitools.client.models.ReadOnlyFirst import com.squareup.moshi.Json +import com.squareup.moshi.JsonClass import java.io.Serializable /** * + * * @param arrayOfString * @param arrayArrayOfInteger * @param arrayArrayOfModel */ + data class ArrayTest ( + @Json(name = "array_of_string") val arrayOfString: kotlin.collections.List? = null, + @Json(name = "array_array_of_integer") val arrayArrayOfInteger: kotlin.collections.List>? = null, + @Json(name = "array_array_of_model") val arrayArrayOfModel: kotlin.collections.List>? = null + ) : Serializable { companion object { private const val serialVersionUID: Long = 123 } + } diff --git a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/Capitalization.kt b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/Capitalization.kt index 3a549ed7917a..ed29fd85341f 100644 --- a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/Capitalization.kt +++ b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/Capitalization.kt @@ -1,22 +1,36 @@ /** -* OpenAPI Petstore -* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ -* -* The version of the OpenAPI document: 1.0.0 -* -* -* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). -* https://openapi-generator.tech -* Do not edit the class manually. -*/ + * + * Please note: + * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * Do not edit this file manually. + * + */ + +@file:Suppress( + "ArrayInDataClass", + "DuplicatedCode", + "EnumEntryName", + "RemoveRedundantQualifierName", + "RemoveRedundantCallsOfConversionMethods", + "REDUNDANT_CALL_OF_CONVERSION_METHOD", + "RedundantUnitReturnType", + "RemoveEmptyClassBody", + "UnnecessaryVariable", + "UnusedImport", + "UnnecessaryVariable", + "unused" +) + package org.openapitools.client.models import com.squareup.moshi.Json +import com.squareup.moshi.JsonClass import java.io.Serializable /** * + * * @param smallCamel * @param capitalCamel * @param smallSnake @@ -25,24 +39,33 @@ import java.io.Serializable * @param ATT_NAME Name of the pet */ + data class Capitalization ( + @Json(name = "smallCamel") val smallCamel: kotlin.String? = null, + @Json(name = "CapitalCamel") val capitalCamel: kotlin.String? = null, + @Json(name = "small_Snake") val smallSnake: kotlin.String? = null, + @Json(name = "Capital_Snake") val capitalSnake: kotlin.String? = null, + @Json(name = "SCA_ETH_Flow_Points") val scAETHFlowPoints: kotlin.String? = null, + /* Name of the pet */ @Json(name = "ATT_NAME") val ATT_NAME: kotlin.String? = null + ) : Serializable { companion object { private const val serialVersionUID: Long = 123 } + } diff --git a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/Cat.kt b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/Cat.kt index 2de64da9e1a9..e59b48368d8f 100644 --- a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/Cat.kt +++ b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/Cat.kt @@ -1,40 +1,59 @@ /** -* OpenAPI Petstore -* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ -* -* The version of the OpenAPI document: 1.0.0 -* -* -* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). -* https://openapi-generator.tech -* Do not edit the class manually. -*/ + * + * Please note: + * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * Do not edit this file manually. + * + */ + +@file:Suppress( + "ArrayInDataClass", + "DuplicatedCode", + "EnumEntryName", + "RemoveRedundantQualifierName", + "RemoveRedundantCallsOfConversionMethods", + "REDUNDANT_CALL_OF_CONVERSION_METHOD", + "RedundantUnitReturnType", + "RemoveEmptyClassBody", + "UnnecessaryVariable", + "UnusedImport", + "UnnecessaryVariable", + "unused" +) + package org.openapitools.client.models import org.openapitools.client.models.Animal -import org.openapitools.client.models.CatAllOf import com.squareup.moshi.Json +import com.squareup.moshi.JsonClass import java.io.Serializable /** * + * * @param className * @param color * @param declawed */ + data class Cat ( + @Json(name = "className") override val className: kotlin.String, + @Json(name = "color") - override val color: kotlin.String? = null, + override val color: kotlin.String? = "red", + @Json(name = "declawed") val declawed: kotlin.Boolean? = null + ) : Animal, Serializable { companion object { private const val serialVersionUID: Long = 123 } + } diff --git a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/Category.kt b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/Category.kt index b7c8249e3785..161e93f0891a 100644 --- a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/Category.kt +++ b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/Category.kt @@ -1,35 +1,54 @@ /** -* OpenAPI Petstore -* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ -* -* The version of the OpenAPI document: 1.0.0 -* -* -* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). -* https://openapi-generator.tech -* Do not edit the class manually. -*/ + * + * Please note: + * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * Do not edit this file manually. + * + */ + +@file:Suppress( + "ArrayInDataClass", + "DuplicatedCode", + "EnumEntryName", + "RemoveRedundantQualifierName", + "RemoveRedundantCallsOfConversionMethods", + "REDUNDANT_CALL_OF_CONVERSION_METHOD", + "RedundantUnitReturnType", + "RemoveEmptyClassBody", + "UnnecessaryVariable", + "UnusedImport", + "UnnecessaryVariable", + "unused" +) + package org.openapitools.client.models import com.squareup.moshi.Json +import com.squareup.moshi.JsonClass import java.io.Serializable /** * + * * @param name * @param id */ + data class Category ( + @Json(name = "name") - val name: kotlin.String, + val name: kotlin.String = "default-name", + @Json(name = "id") val id: kotlin.Long? = null + ) : Serializable { companion object { private const val serialVersionUID: Long = 123 } + } diff --git a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/ChildWithNullable.kt b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/ChildWithNullable.kt new file mode 100644 index 000000000000..7700360a3cf7 --- /dev/null +++ b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/ChildWithNullable.kt @@ -0,0 +1,59 @@ +/** + * + * Please note: + * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * Do not edit this file manually. + * + */ + +@file:Suppress( + "ArrayInDataClass", + "DuplicatedCode", + "EnumEntryName", + "RemoveRedundantQualifierName", + "RemoveRedundantCallsOfConversionMethods", + "REDUNDANT_CALL_OF_CONVERSION_METHOD", + "RedundantUnitReturnType", + "RemoveEmptyClassBody", + "UnnecessaryVariable", + "UnusedImport", + "UnnecessaryVariable", + "unused" +) + +package org.openapitools.client.models + +import org.openapitools.client.models.ParentWithNullable + +import com.squareup.moshi.Json +import com.squareup.moshi.JsonClass +import java.io.Serializable + +/** + * + * + * @param type + * @param nullableProperty + * @param otherProperty + */ + + +data class ChildWithNullable ( + + @Json(name = "type") + override val type: ChildWithNullable.Type? = null, + + @Json(name = "nullableProperty") + override val nullableProperty: kotlin.String? = null, + + @Json(name = "otherProperty") + val otherProperty: kotlin.String? = null + +) : ParentWithNullable, Serializable { + companion object { + private const val serialVersionUID: Long = 123 + } + + +} + diff --git a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/ClassModel.kt b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/ClassModel.kt index 82f273940446..27cf5c21e1bd 100644 --- a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/ClassModel.kt +++ b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/ClassModel.kt @@ -1,32 +1,50 @@ /** -* OpenAPI Petstore -* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ -* -* The version of the OpenAPI document: 1.0.0 -* -* -* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). -* https://openapi-generator.tech -* Do not edit the class manually. -*/ + * + * Please note: + * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * Do not edit this file manually. + * + */ + +@file:Suppress( + "ArrayInDataClass", + "DuplicatedCode", + "EnumEntryName", + "RemoveRedundantQualifierName", + "RemoveRedundantCallsOfConversionMethods", + "REDUNDANT_CALL_OF_CONVERSION_METHOD", + "RedundantUnitReturnType", + "RemoveEmptyClassBody", + "UnnecessaryVariable", + "UnusedImport", + "UnnecessaryVariable", + "unused" +) + package org.openapitools.client.models import com.squareup.moshi.Json +import com.squareup.moshi.JsonClass import java.io.Serializable /** * Model for testing model with \"_class\" property + * * @param propertyClass */ + data class ClassModel ( + @Json(name = "_class") val propertyClass: kotlin.String? = null + ) : Serializable { companion object { private const val serialVersionUID: Long = 123 } + } diff --git a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/Client.kt b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/Client.kt index f6efaab5fe82..acdad6ec1330 100644 --- a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/Client.kt +++ b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/Client.kt @@ -1,32 +1,50 @@ /** -* OpenAPI Petstore -* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ -* -* The version of the OpenAPI document: 1.0.0 -* -* -* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). -* https://openapi-generator.tech -* Do not edit the class manually. -*/ + * + * Please note: + * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * Do not edit this file manually. + * + */ + +@file:Suppress( + "ArrayInDataClass", + "DuplicatedCode", + "EnumEntryName", + "RemoveRedundantQualifierName", + "RemoveRedundantCallsOfConversionMethods", + "REDUNDANT_CALL_OF_CONVERSION_METHOD", + "RedundantUnitReturnType", + "RemoveEmptyClassBody", + "UnnecessaryVariable", + "UnusedImport", + "UnnecessaryVariable", + "unused" +) + package org.openapitools.client.models import com.squareup.moshi.Json +import com.squareup.moshi.JsonClass import java.io.Serializable /** * + * * @param client */ + data class Client ( + @Json(name = "client") val client: kotlin.String? = null + ) : Serializable { companion object { private const val serialVersionUID: Long = 123 } + } diff --git a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/DeprecatedObject.kt b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/DeprecatedObject.kt new file mode 100644 index 000000000000..2371fb9dc092 --- /dev/null +++ b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/DeprecatedObject.kt @@ -0,0 +1,51 @@ +/** + * + * Please note: + * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * Do not edit this file manually. + * + */ + +@file:Suppress( + "ArrayInDataClass", + "DuplicatedCode", + "EnumEntryName", + "RemoveRedundantQualifierName", + "RemoveRedundantCallsOfConversionMethods", + "REDUNDANT_CALL_OF_CONVERSION_METHOD", + "RedundantUnitReturnType", + "RemoveEmptyClassBody", + "UnnecessaryVariable", + "UnusedImport", + "UnnecessaryVariable", + "unused" +) + +package org.openapitools.client.models + + +import com.squareup.moshi.Json +import com.squareup.moshi.JsonClass +import java.io.Serializable + +/** + * + * + * @param name + */ + +@Deprecated(message = "This schema is deprecated.") + +data class DeprecatedObject ( + + @Json(name = "name") + val name: kotlin.String? = null + +) : Serializable { + companion object { + private const val serialVersionUID: Long = 123 + } + + +} + diff --git a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/Dog.kt b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/Dog.kt index 58bf1dbfa4b6..dd126b38994d 100644 --- a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/Dog.kt +++ b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/Dog.kt @@ -1,40 +1,59 @@ /** -* OpenAPI Petstore -* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ -* -* The version of the OpenAPI document: 1.0.0 -* -* -* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). -* https://openapi-generator.tech -* Do not edit the class manually. -*/ + * + * Please note: + * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * Do not edit this file manually. + * + */ + +@file:Suppress( + "ArrayInDataClass", + "DuplicatedCode", + "EnumEntryName", + "RemoveRedundantQualifierName", + "RemoveRedundantCallsOfConversionMethods", + "REDUNDANT_CALL_OF_CONVERSION_METHOD", + "RedundantUnitReturnType", + "RemoveEmptyClassBody", + "UnnecessaryVariable", + "UnusedImport", + "UnnecessaryVariable", + "unused" +) + package org.openapitools.client.models import org.openapitools.client.models.Animal -import org.openapitools.client.models.DogAllOf import com.squareup.moshi.Json +import com.squareup.moshi.JsonClass import java.io.Serializable /** * + * * @param className * @param color * @param breed */ + data class Dog ( + @Json(name = "className") override val className: kotlin.String, + @Json(name = "color") - override val color: kotlin.String? = null, + override val color: kotlin.String? = "red", + @Json(name = "breed") val breed: kotlin.String? = null + ) : Animal, Serializable { companion object { private const val serialVersionUID: Long = 123 } + } diff --git a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/EnumArrays.kt b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/EnumArrays.kt index 53dd0b396ae2..d2d9bd802308 100644 --- a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/EnumArrays.kt +++ b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/EnumArrays.kt @@ -1,53 +1,74 @@ /** -* OpenAPI Petstore -* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ -* -* The version of the OpenAPI document: 1.0.0 -* -* -* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). -* https://openapi-generator.tech -* Do not edit the class manually. -*/ + * + * Please note: + * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * Do not edit this file manually. + * + */ + +@file:Suppress( + "ArrayInDataClass", + "DuplicatedCode", + "EnumEntryName", + "RemoveRedundantQualifierName", + "RemoveRedundantCallsOfConversionMethods", + "REDUNDANT_CALL_OF_CONVERSION_METHOD", + "RedundantUnitReturnType", + "RemoveEmptyClassBody", + "UnnecessaryVariable", + "UnusedImport", + "UnnecessaryVariable", + "unused" +) + package org.openapitools.client.models import com.squareup.moshi.Json +import com.squareup.moshi.JsonClass import java.io.Serializable /** * + * * @param justSymbol * @param arrayEnum */ + data class EnumArrays ( + @Json(name = "just_symbol") val justSymbol: EnumArrays.JustSymbol? = null, + @Json(name = "array_enum") val arrayEnum: kotlin.collections.List? = null + ) : Serializable { companion object { private const val serialVersionUID: Long = 123 } /** - * - * Values: greaterThanEqual,dollar - */ - - enum class JustSymbol(val value: kotlin.String){ - @Json(name = ">=") greaterThanEqual(">="), - @Json(name = "$") dollar("$"); + * + * + * Values: Greater_ThanEqual,Dollar + */ + @JsonClass(generateAdapter = false) + enum class JustSymbol(val value: kotlin.String) { + @Json(name = ">=") Greater_ThanEqual(">="), + @Json(name = "$") Dollar("$"); } /** - * - * Values: fish,crab - */ - - enum class ArrayEnum(val value: kotlin.String){ + * + * + * Values: fish,crab + */ + @JsonClass(generateAdapter = false) + enum class ArrayEnum(val value: kotlin.String) { @Json(name = "fish") fish("fish"), @Json(name = "crab") crab("crab"); } + } diff --git a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/EnumClass.kt b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/EnumClass.kt index c8090bb00c9a..ab4559feb335 100644 --- a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/EnumClass.kt +++ b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/EnumClass.kt @@ -1,47 +1,74 @@ /** -* OpenAPI Petstore -* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ -* -* The version of the OpenAPI document: 1.0.0 -* -* -* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). -* https://openapi-generator.tech -* Do not edit the class manually. -*/ + * + * Please note: + * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * Do not edit this file manually. + * + */ + +@file:Suppress( + "ArrayInDataClass", + "DuplicatedCode", + "EnumEntryName", + "RemoveRedundantQualifierName", + "RemoveRedundantCallsOfConversionMethods", + "REDUNDANT_CALL_OF_CONVERSION_METHOD", + "RedundantUnitReturnType", + "RemoveEmptyClassBody", + "UnnecessaryVariable", + "UnusedImport", + "UnnecessaryVariable", + "unused" +) + package org.openapitools.client.models import com.squareup.moshi.Json +import com.squareup.moshi.JsonClass /** -* -* Values: abc,minusEfg,leftParenthesisXyzRightParenthesis -*/ - -enum class EnumClass(val value: kotlin.String){ + * + * + * Values: _abc,MinusEfg,Left_ParenthesisXyzRight_Parenthesis + */ +@JsonClass(generateAdapter = false) +enum class EnumClass(val value: kotlin.String) { @Json(name = "_abc") - abc("_abc"), - + _abc("_abc"), @Json(name = "-efg") - minusEfg("-efg"), - + MinusEfg("-efg"), @Json(name = "(xyz)") - leftParenthesisXyzRightParenthesis("(xyz)"); + Left_ParenthesisXyzRight_Parenthesis("(xyz)"); + /** + * Override [toString()] to avoid using the enum variable name as the value, and instead use + * the actual value defined in the API spec file. + * + * This solves a problem when the variable name and its value are different, and ensures that + * the client sends the correct enum values to the server always. + */ + override fun toString(): kotlin.String = value + companion object { + /** + * Converts the provided [data] to a [String] on success, null otherwise. + */ + fun encode(data: kotlin.Any?): kotlin.String? = if (data is EnumClass) "$data" else null - /** - This override toString avoids using the enum var name and uses the actual api value instead. - In cases the var name and value are different, the client would send incorrect enums to the server. - **/ - override fun toString(): String { - return value + /** + * Returns a valid [EnumClass] for [data], null otherwise. + */ + fun decode(data: kotlin.Any?): EnumClass? = data?.let { + val normalizedData = "$it".lowercase() + entries.firstOrNull { value -> + it == value || normalizedData == "$value".lowercase() + } + } } - } diff --git a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/EnumTest.kt b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/EnumTest.kt index 25dc81a7e7f3..1802cef5396e 100644 --- a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/EnumTest.kt +++ b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/EnumTest.kt @@ -1,14 +1,26 @@ /** -* OpenAPI Petstore -* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ -* -* The version of the OpenAPI document: 1.0.0 -* -* -* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). -* https://openapi-generator.tech -* Do not edit the class manually. -*/ + * + * Please note: + * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * Do not edit this file manually. + * + */ + +@file:Suppress( + "ArrayInDataClass", + "DuplicatedCode", + "EnumEntryName", + "RemoveRedundantQualifierName", + "RemoveRedundantCallsOfConversionMethods", + "REDUNDANT_CALL_OF_CONVERSION_METHOD", + "RedundantUnitReturnType", + "RemoveEmptyClassBody", + "UnnecessaryVariable", + "UnusedImport", + "UnnecessaryVariable", + "unused" +) + package org.openapitools.client.models import org.openapitools.client.models.OuterEnum @@ -17,10 +29,12 @@ import org.openapitools.client.models.OuterEnumInteger import org.openapitools.client.models.OuterEnumIntegerDefaultValue import com.squareup.moshi.Json +import com.squareup.moshi.JsonClass import java.io.Serializable /** * + * * @param enumStringRequired * @param enumString * @param enumInteger @@ -31,65 +45,80 @@ import java.io.Serializable * @param outerEnumIntegerDefaultValue */ + data class EnumTest ( + @Json(name = "enum_string_required") val enumStringRequired: EnumTest.EnumStringRequired, + @Json(name = "enum_string") val enumString: EnumTest.EnumString? = null, + @Json(name = "enum_integer") val enumInteger: EnumTest.EnumInteger? = null, + @Json(name = "enum_number") val enumNumber: EnumTest.EnumNumber? = null, + @Json(name = "outerEnum") val outerEnum: OuterEnum? = null, + @Json(name = "outerEnumInteger") val outerEnumInteger: OuterEnumInteger? = null, + @Json(name = "outerEnumDefaultValue") - val outerEnumDefaultValue: OuterEnumDefaultValue? = null, + val outerEnumDefaultValue: OuterEnumDefaultValue? = OuterEnumDefaultValue.placed, + @Json(name = "outerEnumIntegerDefaultValue") - val outerEnumIntegerDefaultValue: OuterEnumIntegerDefaultValue? = null + val outerEnumIntegerDefaultValue: OuterEnumIntegerDefaultValue? = OuterEnumIntegerDefaultValue._0 + ) : Serializable { companion object { private const val serialVersionUID: Long = 123 } /** - * - * Values: uPPER,lower,eMPTY - */ - - enum class EnumStringRequired(val value: kotlin.String){ - @Json(name = "UPPER") uPPER("UPPER"), + * + * + * Values: UPPER,lower, + */ + @JsonClass(generateAdapter = false) + enum class EnumStringRequired(val value: kotlin.String) { + @Json(name = "UPPER") UPPER("UPPER"), @Json(name = "lower") lower("lower"), - @Json(name = "") eMPTY(""); + @Json(name = "") (""); } /** - * - * Values: uPPER,lower,eMPTY - */ - - enum class EnumString(val value: kotlin.String){ - @Json(name = "UPPER") uPPER("UPPER"), + * + * + * Values: UPPER,lower, + */ + @JsonClass(generateAdapter = false) + enum class EnumString(val value: kotlin.String) { + @Json(name = "UPPER") UPPER("UPPER"), @Json(name = "lower") lower("lower"), - @Json(name = "") eMPTY(""); + @Json(name = "") (""); } /** - * - * Values: _1,minus1 - */ - - enum class EnumInteger(val value: kotlin.Int){ + * + * + * Values: _1,Minus1 + */ + @JsonClass(generateAdapter = false) + enum class EnumInteger(val value: kotlin.Int) { @Json(name = "1") _1(1), - @Json(name = "-1") minus1(-1); + @Json(name = "-1") Minus1(-1); } /** - * - * Values: _1period1,minus1Period2 - */ - - enum class EnumNumber(val value: kotlin.Double){ - @Json(name = "1.1") _1period1(1.1), - @Json(name = "-1.2") minus1Period2(-1.2); + * + * + * Values: _1Period1,Minus1Period2 + */ + @JsonClass(generateAdapter = false) + enum class EnumNumber(val value: kotlin.Double) { + @Json(name = "1.1") _1Period1(1.1), + @Json(name = "-1.2") Minus1Period2(-1.2); } + } diff --git a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/FakeBigDecimalMap200Response.kt b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/FakeBigDecimalMap200Response.kt new file mode 100644 index 000000000000..60ce6d824d21 --- /dev/null +++ b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/FakeBigDecimalMap200Response.kt @@ -0,0 +1,54 @@ +/** + * + * Please note: + * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * Do not edit this file manually. + * + */ + +@file:Suppress( + "ArrayInDataClass", + "DuplicatedCode", + "EnumEntryName", + "RemoveRedundantQualifierName", + "RemoveRedundantCallsOfConversionMethods", + "REDUNDANT_CALL_OF_CONVERSION_METHOD", + "RedundantUnitReturnType", + "RemoveEmptyClassBody", + "UnnecessaryVariable", + "UnusedImport", + "UnnecessaryVariable", + "unused" +) + +package org.openapitools.client.models + + +import com.squareup.moshi.Json +import com.squareup.moshi.JsonClass +import java.io.Serializable + +/** + * + * + * @param someId + * @param someMap + */ + + +data class FakeBigDecimalMap200Response ( + + @Json(name = "someId") + val someId: java.math.BigDecimal? = null, + + @Json(name = "someMap") + val someMap: kotlin.collections.Map? = null + +) : Serializable { + companion object { + private const val serialVersionUID: Long = 123 + } + + +} + diff --git a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/FileSchemaTestClass.kt b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/FileSchemaTestClass.kt index b6f4bc5e334a..2acb94e2ea0f 100644 --- a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/FileSchemaTestClass.kt +++ b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/FileSchemaTestClass.kt @@ -1,35 +1,54 @@ /** -* OpenAPI Petstore -* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ -* -* The version of the OpenAPI document: 1.0.0 -* -* -* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). -* https://openapi-generator.tech -* Do not edit the class manually. -*/ + * + * Please note: + * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * Do not edit this file manually. + * + */ + +@file:Suppress( + "ArrayInDataClass", + "DuplicatedCode", + "EnumEntryName", + "RemoveRedundantQualifierName", + "RemoveRedundantCallsOfConversionMethods", + "REDUNDANT_CALL_OF_CONVERSION_METHOD", + "RedundantUnitReturnType", + "RemoveEmptyClassBody", + "UnnecessaryVariable", + "UnusedImport", + "UnnecessaryVariable", + "unused" +) + package org.openapitools.client.models import com.squareup.moshi.Json +import com.squareup.moshi.JsonClass import java.io.Serializable /** * + * * @param file * @param files */ + data class FileSchemaTestClass ( + @Json(name = "file") val file: java.io.File? = null, + @Json(name = "files") val files: kotlin.collections.List? = null + ) : Serializable { companion object { private const val serialVersionUID: Long = 123 } + } diff --git a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/Foo.kt b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/Foo.kt index e0870d3f50bf..4462b757749f 100644 --- a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/Foo.kt +++ b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/Foo.kt @@ -1,32 +1,50 @@ /** -* OpenAPI Petstore -* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ -* -* The version of the OpenAPI document: 1.0.0 -* -* -* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). -* https://openapi-generator.tech -* Do not edit the class manually. -*/ + * + * Please note: + * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * Do not edit this file manually. + * + */ + +@file:Suppress( + "ArrayInDataClass", + "DuplicatedCode", + "EnumEntryName", + "RemoveRedundantQualifierName", + "RemoveRedundantCallsOfConversionMethods", + "REDUNDANT_CALL_OF_CONVERSION_METHOD", + "RedundantUnitReturnType", + "RemoveEmptyClassBody", + "UnnecessaryVariable", + "UnusedImport", + "UnnecessaryVariable", + "unused" +) + package org.openapitools.client.models import com.squareup.moshi.Json +import com.squareup.moshi.JsonClass import java.io.Serializable /** * + * * @param bar */ + data class Foo ( + @Json(name = "bar") - val bar: kotlin.String? = null + val bar: kotlin.String? = "bar" + ) : Serializable { companion object { private const val serialVersionUID: Long = 123 } + } diff --git a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/FooGetDefaultResponse.kt b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/FooGetDefaultResponse.kt new file mode 100644 index 000000000000..283996a556d9 --- /dev/null +++ b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/FooGetDefaultResponse.kt @@ -0,0 +1,51 @@ +/** + * + * Please note: + * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * Do not edit this file manually. + * + */ + +@file:Suppress( + "ArrayInDataClass", + "DuplicatedCode", + "EnumEntryName", + "RemoveRedundantQualifierName", + "RemoveRedundantCallsOfConversionMethods", + "REDUNDANT_CALL_OF_CONVERSION_METHOD", + "RedundantUnitReturnType", + "RemoveEmptyClassBody", + "UnnecessaryVariable", + "UnusedImport", + "UnnecessaryVariable", + "unused" +) + +package org.openapitools.client.models + +import org.openapitools.client.models.Foo + +import com.squareup.moshi.Json +import com.squareup.moshi.JsonClass +import java.io.Serializable + +/** + * + * + * @param string + */ + + +data class FooGetDefaultResponse ( + + @Json(name = "string") + val string: Foo? = null + +) : Serializable { + companion object { + private const val serialVersionUID: Long = 123 + } + + +} + diff --git a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/FormatTest.kt b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/FormatTest.kt index d0bbef4836c9..572e700b6aa6 100644 --- a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/FormatTest.kt +++ b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/FormatTest.kt @@ -1,22 +1,36 @@ /** -* OpenAPI Petstore -* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ -* -* The version of the OpenAPI document: 1.0.0 -* -* -* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). -* https://openapi-generator.tech -* Do not edit the class manually. -*/ + * + * Please note: + * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * Do not edit this file manually. + * + */ + +@file:Suppress( + "ArrayInDataClass", + "DuplicatedCode", + "EnumEntryName", + "RemoveRedundantQualifierName", + "RemoveRedundantCallsOfConversionMethods", + "REDUNDANT_CALL_OF_CONVERSION_METHOD", + "RedundantUnitReturnType", + "RemoveEmptyClassBody", + "UnnecessaryVariable", + "UnusedImport", + "UnnecessaryVariable", + "unused" +) + package org.openapitools.client.models import com.squareup.moshi.Json +import com.squareup.moshi.JsonClass import java.io.Serializable /** * + * * @param number * @param byte * @param date @@ -35,45 +49,64 @@ import java.io.Serializable * @param patternWithDigitsAndDelimiter A string starting with 'image_' (case insensitive) and one to three digits following i.e. Image_01. */ + data class FormatTest ( + @Json(name = "number") val number: java.math.BigDecimal, + @Json(name = "byte") val byte: kotlin.ByteArray, + @Json(name = "date") val date: java.time.LocalDate, + @Json(name = "password") val password: kotlin.String, + @Json(name = "integer") val integer: kotlin.Int? = null, + @Json(name = "int32") val int32: kotlin.Int? = null, + @Json(name = "int64") val int64: kotlin.Long? = null, + @Json(name = "float") val float: kotlin.Float? = null, + @Json(name = "double") val double: kotlin.Double? = null, + @Json(name = "decimal") val decimal: java.math.BigDecimal? = null, + @Json(name = "string") val string: kotlin.String? = null, + @Json(name = "binary") val binary: java.io.File? = null, + @Json(name = "dateTime") val dateTime: java.time.OffsetDateTime? = null, + @Json(name = "uuid") val uuid: java.util.UUID? = null, + /* A string that is a 10 digit number. Can have leading zeros. */ @Json(name = "pattern_with_digits") val patternWithDigits: kotlin.String? = null, + /* A string starting with 'image_' (case insensitive) and one to three digits following i.e. Image_01. */ @Json(name = "pattern_with_digits_and_delimiter") val patternWithDigitsAndDelimiter: kotlin.String? = null + ) : Serializable { companion object { private const val serialVersionUID: Long = 123 } + } diff --git a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/HasOnlyReadOnly.kt b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/HasOnlyReadOnly.kt index b746c64caa41..bd75074c933a 100644 --- a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/HasOnlyReadOnly.kt +++ b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/HasOnlyReadOnly.kt @@ -1,35 +1,54 @@ /** -* OpenAPI Petstore -* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ -* -* The version of the OpenAPI document: 1.0.0 -* -* -* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). -* https://openapi-generator.tech -* Do not edit the class manually. -*/ + * + * Please note: + * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * Do not edit this file manually. + * + */ + +@file:Suppress( + "ArrayInDataClass", + "DuplicatedCode", + "EnumEntryName", + "RemoveRedundantQualifierName", + "RemoveRedundantCallsOfConversionMethods", + "REDUNDANT_CALL_OF_CONVERSION_METHOD", + "RedundantUnitReturnType", + "RemoveEmptyClassBody", + "UnnecessaryVariable", + "UnusedImport", + "UnnecessaryVariable", + "unused" +) + package org.openapitools.client.models import com.squareup.moshi.Json +import com.squareup.moshi.JsonClass import java.io.Serializable /** * + * * @param bar * @param foo */ + data class HasOnlyReadOnly ( + @Json(name = "bar") val bar: kotlin.String? = null, + @Json(name = "foo") val foo: kotlin.String? = null + ) : Serializable { companion object { private const val serialVersionUID: Long = 123 } + } diff --git a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/HealthCheckResult.kt b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/HealthCheckResult.kt index a9c8db3f0280..b535012f1981 100644 --- a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/HealthCheckResult.kt +++ b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/HealthCheckResult.kt @@ -1,32 +1,50 @@ /** -* OpenAPI Petstore -* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ -* -* The version of the OpenAPI document: 1.0.0 -* -* -* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). -* https://openapi-generator.tech -* Do not edit the class manually. -*/ + * + * Please note: + * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * Do not edit this file manually. + * + */ + +@file:Suppress( + "ArrayInDataClass", + "DuplicatedCode", + "EnumEntryName", + "RemoveRedundantQualifierName", + "RemoveRedundantCallsOfConversionMethods", + "REDUNDANT_CALL_OF_CONVERSION_METHOD", + "RedundantUnitReturnType", + "RemoveEmptyClassBody", + "UnnecessaryVariable", + "UnusedImport", + "UnnecessaryVariable", + "unused" +) + package org.openapitools.client.models import com.squareup.moshi.Json +import com.squareup.moshi.JsonClass import java.io.Serializable /** * Just a string to inform instance is up and running. Make it nullable in hope to get it as pointer in generated model. + * * @param nullableMessage */ + data class HealthCheckResult ( + @Json(name = "NullableMessage") val nullableMessage: kotlin.String? = null + ) : Serializable { companion object { private const val serialVersionUID: Long = 123 } + } diff --git a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/List.kt b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/List.kt index bb3f49c6984e..b601ee96011a 100644 --- a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/List.kt +++ b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/List.kt @@ -1,32 +1,50 @@ /** -* OpenAPI Petstore -* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ -* -* The version of the OpenAPI document: 1.0.0 -* -* -* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). -* https://openapi-generator.tech -* Do not edit the class manually. -*/ + * + * Please note: + * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * Do not edit this file manually. + * + */ + +@file:Suppress( + "ArrayInDataClass", + "DuplicatedCode", + "EnumEntryName", + "RemoveRedundantQualifierName", + "RemoveRedundantCallsOfConversionMethods", + "REDUNDANT_CALL_OF_CONVERSION_METHOD", + "RedundantUnitReturnType", + "RemoveEmptyClassBody", + "UnnecessaryVariable", + "UnusedImport", + "UnnecessaryVariable", + "unused" +) + package org.openapitools.client.models import com.squareup.moshi.Json +import com.squareup.moshi.JsonClass import java.io.Serializable /** * + * * @param `123list` */ + data class List ( + @Json(name = "123-list") val `123list`: kotlin.String? = null + ) : Serializable { companion object { private const val serialVersionUID: Long = 123 } + } diff --git a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/MapTest.kt b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/MapTest.kt index c5eb455d5a10..af8515c0ebcb 100644 --- a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/MapTest.kt +++ b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/MapTest.kt @@ -1,50 +1,72 @@ /** -* OpenAPI Petstore -* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ -* -* The version of the OpenAPI document: 1.0.0 -* -* -* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). -* https://openapi-generator.tech -* Do not edit the class manually. -*/ + * + * Please note: + * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * Do not edit this file manually. + * + */ + +@file:Suppress( + "ArrayInDataClass", + "DuplicatedCode", + "EnumEntryName", + "RemoveRedundantQualifierName", + "RemoveRedundantCallsOfConversionMethods", + "REDUNDANT_CALL_OF_CONVERSION_METHOD", + "RedundantUnitReturnType", + "RemoveEmptyClassBody", + "UnnecessaryVariable", + "UnusedImport", + "UnnecessaryVariable", + "unused" +) + package org.openapitools.client.models import com.squareup.moshi.Json +import com.squareup.moshi.JsonClass import java.io.Serializable /** * + * * @param mapMapOfString * @param mapOfEnumString * @param directMap * @param indirectMap */ + data class MapTest ( + @Json(name = "map_map_of_string") val mapMapOfString: kotlin.collections.Map>? = null, + @Json(name = "map_of_enum_string") val mapOfEnumString: MapTest.MapOfEnumString? = null, + @Json(name = "direct_map") val directMap: kotlin.collections.Map? = null, + @Json(name = "indirect_map") val indirectMap: kotlin.collections.Map? = null + ) : Serializable { companion object { private const val serialVersionUID: Long = 123 } /** - * - * Values: uPPER,lower - */ - - enum class MapOfEnumString(val value: kotlin.String){ - @Json(name = "UPPER") uPPER("UPPER"), + * + * + * Values: UPPER,lower + */ + @JsonClass(generateAdapter = false) + enum class MapOfEnumString(val value: kotlin.String) { + @Json(name = "UPPER") UPPER("UPPER"), @Json(name = "lower") lower("lower"); } + } diff --git a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/MixedPropertiesAndAdditionalPropertiesClass.kt b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/MixedPropertiesAndAdditionalPropertiesClass.kt index 70e60cd60497..9fca78f0b401 100644 --- a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/MixedPropertiesAndAdditionalPropertiesClass.kt +++ b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/MixedPropertiesAndAdditionalPropertiesClass.kt @@ -1,39 +1,59 @@ /** -* OpenAPI Petstore -* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ -* -* The version of the OpenAPI document: 1.0.0 -* -* -* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). -* https://openapi-generator.tech -* Do not edit the class manually. -*/ + * + * Please note: + * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * Do not edit this file manually. + * + */ + +@file:Suppress( + "ArrayInDataClass", + "DuplicatedCode", + "EnumEntryName", + "RemoveRedundantQualifierName", + "RemoveRedundantCallsOfConversionMethods", + "REDUNDANT_CALL_OF_CONVERSION_METHOD", + "RedundantUnitReturnType", + "RemoveEmptyClassBody", + "UnnecessaryVariable", + "UnusedImport", + "UnnecessaryVariable", + "unused" +) + package org.openapitools.client.models import org.openapitools.client.models.Animal import com.squareup.moshi.Json +import com.squareup.moshi.JsonClass import java.io.Serializable /** * + * * @param uuid * @param dateTime * @param map */ + data class MixedPropertiesAndAdditionalPropertiesClass ( + @Json(name = "uuid") val uuid: java.util.UUID? = null, + @Json(name = "dateTime") val dateTime: java.time.OffsetDateTime? = null, + @Json(name = "map") val map: kotlin.collections.Map? = null + ) : Serializable { companion object { private const val serialVersionUID: Long = 123 } + } diff --git a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/Model200Response.kt b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/Model200Response.kt index 887f220608da..d119230429f6 100644 --- a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/Model200Response.kt +++ b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/Model200Response.kt @@ -1,35 +1,54 @@ /** -* OpenAPI Petstore -* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ -* -* The version of the OpenAPI document: 1.0.0 -* -* -* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). -* https://openapi-generator.tech -* Do not edit the class manually. -*/ + * + * Please note: + * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * Do not edit this file manually. + * + */ + +@file:Suppress( + "ArrayInDataClass", + "DuplicatedCode", + "EnumEntryName", + "RemoveRedundantQualifierName", + "RemoveRedundantCallsOfConversionMethods", + "REDUNDANT_CALL_OF_CONVERSION_METHOD", + "RedundantUnitReturnType", + "RemoveEmptyClassBody", + "UnnecessaryVariable", + "UnusedImport", + "UnnecessaryVariable", + "unused" +) + package org.openapitools.client.models import com.squareup.moshi.Json +import com.squareup.moshi.JsonClass import java.io.Serializable /** * Model for testing model name starting with number + * * @param name * @param propertyClass */ + data class Model200Response ( + @Json(name = "name") val name: kotlin.Int? = null, + @Json(name = "class") val propertyClass: kotlin.String? = null + ) : Serializable { companion object { private const val serialVersionUID: Long = 123 } + } diff --git a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/ModelApiResponse.kt b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/ModelApiResponse.kt new file mode 100644 index 000000000000..1060a256dcbc --- /dev/null +++ b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/ModelApiResponse.kt @@ -0,0 +1,58 @@ +/** + * + * Please note: + * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * Do not edit this file manually. + * + */ + +@file:Suppress( + "ArrayInDataClass", + "DuplicatedCode", + "EnumEntryName", + "RemoveRedundantQualifierName", + "RemoveRedundantCallsOfConversionMethods", + "REDUNDANT_CALL_OF_CONVERSION_METHOD", + "RedundantUnitReturnType", + "RemoveEmptyClassBody", + "UnnecessaryVariable", + "UnusedImport", + "UnnecessaryVariable", + "unused" +) + +package org.openapitools.client.models + + +import com.squareup.moshi.Json +import com.squareup.moshi.JsonClass +import java.io.Serializable + +/** + * + * + * @param code + * @param type + * @param message + */ + + +data class ModelApiResponse ( + + @Json(name = "code") + val code: kotlin.Int? = null, + + @Json(name = "type") + val type: kotlin.String? = null, + + @Json(name = "message") + val message: kotlin.String? = null + +) : Serializable { + companion object { + private const val serialVersionUID: Long = 123 + } + + +} + diff --git a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/Name.kt b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/Name.kt index 66fef7eefdc4..51c3fd43824d 100644 --- a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/Name.kt +++ b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/Name.kt @@ -1,41 +1,62 @@ /** -* OpenAPI Petstore -* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ -* -* The version of the OpenAPI document: 1.0.0 -* -* -* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). -* https://openapi-generator.tech -* Do not edit the class manually. -*/ + * + * Please note: + * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * Do not edit this file manually. + * + */ + +@file:Suppress( + "ArrayInDataClass", + "DuplicatedCode", + "EnumEntryName", + "RemoveRedundantQualifierName", + "RemoveRedundantCallsOfConversionMethods", + "REDUNDANT_CALL_OF_CONVERSION_METHOD", + "RedundantUnitReturnType", + "RemoveEmptyClassBody", + "UnnecessaryVariable", + "UnusedImport", + "UnnecessaryVariable", + "unused" +) + package org.openapitools.client.models import com.squareup.moshi.Json +import com.squareup.moshi.JsonClass import java.io.Serializable /** * Model for testing model name same as property name + * * @param name * @param snakeCase - * @param property + * @param `property` * @param `123number` */ + data class Name ( + @Json(name = "name") val name: kotlin.Int, + @Json(name = "snake_case") val snakeCase: kotlin.Int? = null, + @Json(name = "property") - val property: kotlin.String? = null, + val `property`: kotlin.String? = null, + @Json(name = "123Number") val `123number`: kotlin.Int? = null + ) : Serializable { companion object { private const val serialVersionUID: Long = 123 } + } diff --git a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/NullableClass.kt b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/NullableClass.kt index eb54c7967e49..0ec8cd2ed9e3 100644 --- a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/NullableClass.kt +++ b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/NullableClass.kt @@ -1,22 +1,36 @@ /** -* OpenAPI Petstore -* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ -* -* The version of the OpenAPI document: 1.0.0 -* -* -* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). -* https://openapi-generator.tech -* Do not edit the class manually. -*/ + * + * Please note: + * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * Do not edit this file manually. + * + */ + +@file:Suppress( + "ArrayInDataClass", + "DuplicatedCode", + "EnumEntryName", + "RemoveRedundantQualifierName", + "RemoveRedundantCallsOfConversionMethods", + "REDUNDANT_CALL_OF_CONVERSION_METHOD", + "RedundantUnitReturnType", + "RemoveEmptyClassBody", + "UnnecessaryVariable", + "UnusedImport", + "UnnecessaryVariable", + "unused" +) + package org.openapitools.client.models import com.squareup.moshi.Json +import com.squareup.moshi.JsonClass import java.io.Serializable /** * + * * @param integerProp * @param numberProp * @param booleanProp @@ -31,35 +45,50 @@ import java.io.Serializable * @param objectItemsNullable */ + data class NullableClass ( + @Json(name = "integer_prop") val integerProp: kotlin.Int? = null, + @Json(name = "number_prop") val numberProp: java.math.BigDecimal? = null, + @Json(name = "boolean_prop") val booleanProp: kotlin.Boolean? = null, + @Json(name = "string_prop") val stringProp: kotlin.String? = null, + @Json(name = "date_prop") val dateProp: java.time.LocalDate? = null, + @Json(name = "datetime_prop") val datetimeProp: java.time.OffsetDateTime? = null, + @Json(name = "array_nullable_prop") val arrayNullableProp: kotlin.collections.List? = null, + @Json(name = "array_and_items_nullable_prop") val arrayAndItemsNullableProp: kotlin.collections.List? = null, + @Json(name = "array_items_nullable") val arrayItemsNullable: kotlin.collections.List? = null, + @Json(name = "object_nullable_prop") val objectNullableProp: kotlin.collections.Map? = null, + @Json(name = "object_and_items_nullable_prop") - val objectAndItemsNullableProp: kotlin.collections.Map? = null, + val objectAndItemsNullableProp: kotlin.collections.Map? = null, + @Json(name = "object_items_nullable") - val objectItemsNullable: kotlin.collections.Map? = null + val objectItemsNullable: kotlin.collections.Map? = null + ) : kotlin.collections.HashMap(), Serializable { companion object { private const val serialVersionUID: Long = 123 } + } diff --git a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/NumberOnly.kt b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/NumberOnly.kt index 315938760220..e54e708237a6 100644 --- a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/NumberOnly.kt +++ b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/NumberOnly.kt @@ -1,32 +1,50 @@ /** -* OpenAPI Petstore -* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ -* -* The version of the OpenAPI document: 1.0.0 -* -* -* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). -* https://openapi-generator.tech -* Do not edit the class manually. -*/ + * + * Please note: + * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * Do not edit this file manually. + * + */ + +@file:Suppress( + "ArrayInDataClass", + "DuplicatedCode", + "EnumEntryName", + "RemoveRedundantQualifierName", + "RemoveRedundantCallsOfConversionMethods", + "REDUNDANT_CALL_OF_CONVERSION_METHOD", + "RedundantUnitReturnType", + "RemoveEmptyClassBody", + "UnnecessaryVariable", + "UnusedImport", + "UnnecessaryVariable", + "unused" +) + package org.openapitools.client.models import com.squareup.moshi.Json +import com.squareup.moshi.JsonClass import java.io.Serializable /** * + * * @param justNumber */ + data class NumberOnly ( + @Json(name = "JustNumber") val justNumber: java.math.BigDecimal? = null + ) : Serializable { companion object { private const val serialVersionUID: Long = 123 } + } diff --git a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/ObjectWithDeprecatedFields.kt b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/ObjectWithDeprecatedFields.kt new file mode 100644 index 000000000000..a402c37ad82a --- /dev/null +++ b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/ObjectWithDeprecatedFields.kt @@ -0,0 +1,66 @@ +/** + * + * Please note: + * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * Do not edit this file manually. + * + */ + +@file:Suppress( + "ArrayInDataClass", + "DuplicatedCode", + "EnumEntryName", + "RemoveRedundantQualifierName", + "RemoveRedundantCallsOfConversionMethods", + "REDUNDANT_CALL_OF_CONVERSION_METHOD", + "RedundantUnitReturnType", + "RemoveEmptyClassBody", + "UnnecessaryVariable", + "UnusedImport", + "UnnecessaryVariable", + "unused" +) + +package org.openapitools.client.models + +import org.openapitools.client.models.DeprecatedObject + +import com.squareup.moshi.Json +import com.squareup.moshi.JsonClass +import java.io.Serializable + +/** + * + * + * @param uuid + * @param id + * @param deprecatedRef + * @param bars + */ + + +data class ObjectWithDeprecatedFields ( + + @Json(name = "uuid") + val uuid: kotlin.String? = null, + + @Json(name = "id") + @Deprecated(message = "This property is deprecated.") + val id: java.math.BigDecimal? = null, + + @Json(name = "deprecatedRef") + @Deprecated(message = "This property is deprecated.") + val deprecatedRef: DeprecatedObject? = null, + + @Json(name = "bars") + @Deprecated(message = "This property is deprecated.") + val bars: kotlin.collections.List? = null + +) : Serializable { + companion object { + private const val serialVersionUID: Long = 123 + } + + +} + diff --git a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/Order.kt b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/Order.kt index a312ce70e1ca..c7fbf8ed45a2 100644 --- a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/Order.kt +++ b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/Order.kt @@ -1,22 +1,36 @@ /** -* OpenAPI Petstore -* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ -* -* The version of the OpenAPI document: 1.0.0 -* -* -* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). -* https://openapi-generator.tech -* Do not edit the class manually. -*/ + * + * Please note: + * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * Do not edit this file manually. + * + */ + +@file:Suppress( + "ArrayInDataClass", + "DuplicatedCode", + "EnumEntryName", + "RemoveRedundantQualifierName", + "RemoveRedundantCallsOfConversionMethods", + "REDUNDANT_CALL_OF_CONVERSION_METHOD", + "RedundantUnitReturnType", + "RemoveEmptyClassBody", + "UnnecessaryVariable", + "UnusedImport", + "UnnecessaryVariable", + "unused" +) + package org.openapitools.client.models import com.squareup.moshi.Json +import com.squareup.moshi.JsonClass import java.io.Serializable /** * + * * @param id * @param petId * @param quantity @@ -25,34 +39,44 @@ import java.io.Serializable * @param complete */ + data class Order ( + @Json(name = "id") val id: kotlin.Long? = null, + @Json(name = "petId") val petId: kotlin.Long? = null, + @Json(name = "quantity") val quantity: kotlin.Int? = null, + @Json(name = "shipDate") val shipDate: java.time.OffsetDateTime? = null, + /* Order Status */ @Json(name = "status") val status: Order.Status? = null, + @Json(name = "complete") - val complete: kotlin.Boolean? = null + val complete: kotlin.Boolean? = false + ) : Serializable { companion object { private const val serialVersionUID: Long = 123 } /** - * Order Status - * Values: placed,approved,delivered - */ - - enum class Status(val value: kotlin.String){ + * Order Status + * + * Values: placed,approved,delivered + */ + @JsonClass(generateAdapter = false) + enum class Status(val value: kotlin.String) { @Json(name = "placed") placed("placed"), @Json(name = "approved") approved("approved"), @Json(name = "delivered") delivered("delivered"); } + } diff --git a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/OuterComposite.kt b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/OuterComposite.kt index cda1982e496c..c5b831f6b92e 100644 --- a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/OuterComposite.kt +++ b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/OuterComposite.kt @@ -1,38 +1,58 @@ /** -* OpenAPI Petstore -* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ -* -* The version of the OpenAPI document: 1.0.0 -* -* -* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). -* https://openapi-generator.tech -* Do not edit the class manually. -*/ + * + * Please note: + * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * Do not edit this file manually. + * + */ + +@file:Suppress( + "ArrayInDataClass", + "DuplicatedCode", + "EnumEntryName", + "RemoveRedundantQualifierName", + "RemoveRedundantCallsOfConversionMethods", + "REDUNDANT_CALL_OF_CONVERSION_METHOD", + "RedundantUnitReturnType", + "RemoveEmptyClassBody", + "UnnecessaryVariable", + "UnusedImport", + "UnnecessaryVariable", + "unused" +) + package org.openapitools.client.models import com.squareup.moshi.Json +import com.squareup.moshi.JsonClass import java.io.Serializable /** * + * * @param myNumber * @param myString * @param myBoolean */ + data class OuterComposite ( + @Json(name = "my_number") val myNumber: java.math.BigDecimal? = null, + @Json(name = "my_string") val myString: kotlin.String? = null, + @Json(name = "my_boolean") val myBoolean: kotlin.Boolean? = null + ) : Serializable { companion object { private const val serialVersionUID: Long = 123 } + } diff --git a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/OuterEnum.kt b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/OuterEnum.kt index ad7e1434a209..c934964d3f7a 100644 --- a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/OuterEnum.kt +++ b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/OuterEnum.kt @@ -1,47 +1,74 @@ /** -* OpenAPI Petstore -* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ -* -* The version of the OpenAPI document: 1.0.0 -* -* -* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). -* https://openapi-generator.tech -* Do not edit the class manually. -*/ + * + * Please note: + * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * Do not edit this file manually. + * + */ + +@file:Suppress( + "ArrayInDataClass", + "DuplicatedCode", + "EnumEntryName", + "RemoveRedundantQualifierName", + "RemoveRedundantCallsOfConversionMethods", + "REDUNDANT_CALL_OF_CONVERSION_METHOD", + "RedundantUnitReturnType", + "RemoveEmptyClassBody", + "UnnecessaryVariable", + "UnusedImport", + "UnnecessaryVariable", + "unused" +) + package org.openapitools.client.models import com.squareup.moshi.Json +import com.squareup.moshi.JsonClass /** -* -* Values: placed,approved,delivered -*/ - -enum class OuterEnum(val value: kotlin.String){ + * + * + * Values: placed,approved,delivered + */ +@JsonClass(generateAdapter = false) +enum class OuterEnum(val value: kotlin.String) { @Json(name = "placed") placed("placed"), - @Json(name = "approved") approved("approved"), - @Json(name = "delivered") delivered("delivered"); + /** + * Override [toString()] to avoid using the enum variable name as the value, and instead use + * the actual value defined in the API spec file. + * + * This solves a problem when the variable name and its value are different, and ensures that + * the client sends the correct enum values to the server always. + */ + override fun toString(): kotlin.String = value + companion object { + /** + * Converts the provided [data] to a [String] on success, null otherwise. + */ + fun encode(data: kotlin.Any?): kotlin.String? = if (data is OuterEnum) "$data" else null - /** - This override toString avoids using the enum var name and uses the actual api value instead. - In cases the var name and value are different, the client would send incorrect enums to the server. - **/ - override fun toString(): String { - return value + /** + * Returns a valid [OuterEnum] for [data], null otherwise. + */ + fun decode(data: kotlin.Any?): OuterEnum? = data?.let { + val normalizedData = "$it".lowercase() + entries.firstOrNull { value -> + it == value || normalizedData == "$value".lowercase() + } + } } - } diff --git a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/OuterEnumDefaultValue.kt b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/OuterEnumDefaultValue.kt index 939ee4cb95c9..05fdd4f59112 100644 --- a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/OuterEnumDefaultValue.kt +++ b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/OuterEnumDefaultValue.kt @@ -1,47 +1,74 @@ /** -* OpenAPI Petstore -* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ -* -* The version of the OpenAPI document: 1.0.0 -* -* -* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). -* https://openapi-generator.tech -* Do not edit the class manually. -*/ + * + * Please note: + * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * Do not edit this file manually. + * + */ + +@file:Suppress( + "ArrayInDataClass", + "DuplicatedCode", + "EnumEntryName", + "RemoveRedundantQualifierName", + "RemoveRedundantCallsOfConversionMethods", + "REDUNDANT_CALL_OF_CONVERSION_METHOD", + "RedundantUnitReturnType", + "RemoveEmptyClassBody", + "UnnecessaryVariable", + "UnusedImport", + "UnnecessaryVariable", + "unused" +) + package org.openapitools.client.models import com.squareup.moshi.Json +import com.squareup.moshi.JsonClass /** -* -* Values: placed,approved,delivered -*/ - -enum class OuterEnumDefaultValue(val value: kotlin.String){ + * + * + * Values: placed,approved,delivered + */ +@JsonClass(generateAdapter = false) +enum class OuterEnumDefaultValue(val value: kotlin.String) { @Json(name = "placed") placed("placed"), - @Json(name = "approved") approved("approved"), - @Json(name = "delivered") delivered("delivered"); + /** + * Override [toString()] to avoid using the enum variable name as the value, and instead use + * the actual value defined in the API spec file. + * + * This solves a problem when the variable name and its value are different, and ensures that + * the client sends the correct enum values to the server always. + */ + override fun toString(): kotlin.String = value + companion object { + /** + * Converts the provided [data] to a [String] on success, null otherwise. + */ + fun encode(data: kotlin.Any?): kotlin.String? = if (data is OuterEnumDefaultValue) "$data" else null - /** - This override toString avoids using the enum var name and uses the actual api value instead. - In cases the var name and value are different, the client would send incorrect enums to the server. - **/ - override fun toString(): String { - return value + /** + * Returns a valid [OuterEnumDefaultValue] for [data], null otherwise. + */ + fun decode(data: kotlin.Any?): OuterEnumDefaultValue? = data?.let { + val normalizedData = "$it".lowercase() + entries.firstOrNull { value -> + it == value || normalizedData == "$value".lowercase() + } + } } - } diff --git a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/OuterEnumInteger.kt b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/OuterEnumInteger.kt index 447872e5353d..7e5d4f16a91a 100644 --- a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/OuterEnumInteger.kt +++ b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/OuterEnumInteger.kt @@ -1,47 +1,74 @@ /** -* OpenAPI Petstore -* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ -* -* The version of the OpenAPI document: 1.0.0 -* -* -* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). -* https://openapi-generator.tech -* Do not edit the class manually. -*/ + * + * Please note: + * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * Do not edit this file manually. + * + */ + +@file:Suppress( + "ArrayInDataClass", + "DuplicatedCode", + "EnumEntryName", + "RemoveRedundantQualifierName", + "RemoveRedundantCallsOfConversionMethods", + "REDUNDANT_CALL_OF_CONVERSION_METHOD", + "RedundantUnitReturnType", + "RemoveEmptyClassBody", + "UnnecessaryVariable", + "UnusedImport", + "UnnecessaryVariable", + "unused" +) + package org.openapitools.client.models import com.squareup.moshi.Json +import com.squareup.moshi.JsonClass /** -* -* Values: _0,_1,_2 -*/ - -enum class OuterEnumInteger(val value: kotlin.Int){ + * + * + * Values: _0,_1,_2 + */ +@JsonClass(generateAdapter = false) +enum class OuterEnumInteger(val value: kotlin.Int) { @Json(name = "0") _0(0), - @Json(name = "1") _1(1), - @Json(name = "2") _2(2); + /** + * Override [toString()] to avoid using the enum variable name as the value, and instead use + * the actual value defined in the API spec file. + * + * This solves a problem when the variable name and its value are different, and ensures that + * the client sends the correct enum values to the server always. + */ + override fun toString(): kotlin.String = value.toString() + companion object { + /** + * Converts the provided [data] to a [String] on success, null otherwise. + */ + fun encode(data: kotlin.Any?): kotlin.String? = if (data is OuterEnumInteger) "$data" else null - /** - This override toString avoids using the enum var name and uses the actual api value instead. - In cases the var name and value are different, the client would send incorrect enums to the server. - **/ - override fun toString(): String { - return value.toString() + /** + * Returns a valid [OuterEnumInteger] for [data], null otherwise. + */ + fun decode(data: kotlin.Any?): OuterEnumInteger? = data?.let { + val normalizedData = "$it".lowercase() + entries.firstOrNull { value -> + it == value || normalizedData == "$value".lowercase() + } + } } - } diff --git a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/OuterEnumIntegerDefaultValue.kt b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/OuterEnumIntegerDefaultValue.kt index a98bd861c5ea..9fed31e81344 100644 --- a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/OuterEnumIntegerDefaultValue.kt +++ b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/OuterEnumIntegerDefaultValue.kt @@ -1,47 +1,74 @@ /** -* OpenAPI Petstore -* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ -* -* The version of the OpenAPI document: 1.0.0 -* -* -* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). -* https://openapi-generator.tech -* Do not edit the class manually. -*/ + * + * Please note: + * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * Do not edit this file manually. + * + */ + +@file:Suppress( + "ArrayInDataClass", + "DuplicatedCode", + "EnumEntryName", + "RemoveRedundantQualifierName", + "RemoveRedundantCallsOfConversionMethods", + "REDUNDANT_CALL_OF_CONVERSION_METHOD", + "RedundantUnitReturnType", + "RemoveEmptyClassBody", + "UnnecessaryVariable", + "UnusedImport", + "UnnecessaryVariable", + "unused" +) + package org.openapitools.client.models import com.squareup.moshi.Json +import com.squareup.moshi.JsonClass /** -* -* Values: _0,_1,_2 -*/ - -enum class OuterEnumIntegerDefaultValue(val value: kotlin.Int){ + * + * + * Values: _0,_1,_2 + */ +@JsonClass(generateAdapter = false) +enum class OuterEnumIntegerDefaultValue(val value: kotlin.Int) { @Json(name = "0") _0(0), - @Json(name = "1") _1(1), - @Json(name = "2") _2(2); + /** + * Override [toString()] to avoid using the enum variable name as the value, and instead use + * the actual value defined in the API spec file. + * + * This solves a problem when the variable name and its value are different, and ensures that + * the client sends the correct enum values to the server always. + */ + override fun toString(): kotlin.String = value.toString() + companion object { + /** + * Converts the provided [data] to a [String] on success, null otherwise. + */ + fun encode(data: kotlin.Any?): kotlin.String? = if (data is OuterEnumIntegerDefaultValue) "$data" else null - /** - This override toString avoids using the enum var name and uses the actual api value instead. - In cases the var name and value are different, the client would send incorrect enums to the server. - **/ - override fun toString(): String { - return value.toString() + /** + * Returns a valid [OuterEnumIntegerDefaultValue] for [data], null otherwise. + */ + fun decode(data: kotlin.Any?): OuterEnumIntegerDefaultValue? = data?.let { + val normalizedData = "$it".lowercase() + entries.firstOrNull { value -> + it == value || normalizedData == "$value".lowercase() + } + } } - } diff --git a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/OuterObjectWithEnumProperty.kt b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/OuterObjectWithEnumProperty.kt new file mode 100644 index 000000000000..9edbcaabc6e6 --- /dev/null +++ b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/OuterObjectWithEnumProperty.kt @@ -0,0 +1,51 @@ +/** + * + * Please note: + * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * Do not edit this file manually. + * + */ + +@file:Suppress( + "ArrayInDataClass", + "DuplicatedCode", + "EnumEntryName", + "RemoveRedundantQualifierName", + "RemoveRedundantCallsOfConversionMethods", + "REDUNDANT_CALL_OF_CONVERSION_METHOD", + "RedundantUnitReturnType", + "RemoveEmptyClassBody", + "UnnecessaryVariable", + "UnusedImport", + "UnnecessaryVariable", + "unused" +) + +package org.openapitools.client.models + +import org.openapitools.client.models.OuterEnumInteger + +import com.squareup.moshi.Json +import com.squareup.moshi.JsonClass +import java.io.Serializable + +/** + * + * + * @param `value` + */ + + +data class OuterObjectWithEnumProperty ( + + @Json(name = "value") + val `value`: OuterEnumInteger + +) : Serializable { + companion object { + private const val serialVersionUID: Long = 123 + } + + +} + diff --git a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/ParentWithNullable.kt b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/ParentWithNullable.kt new file mode 100644 index 000000000000..b1d23de2365c --- /dev/null +++ b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/ParentWithNullable.kt @@ -0,0 +1,59 @@ +/** + * + * Please note: + * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * Do not edit this file manually. + * + */ + +@file:Suppress( + "ArrayInDataClass", + "DuplicatedCode", + "EnumEntryName", + "RemoveRedundantQualifierName", + "RemoveRedundantCallsOfConversionMethods", + "REDUNDANT_CALL_OF_CONVERSION_METHOD", + "RedundantUnitReturnType", + "RemoveEmptyClassBody", + "UnnecessaryVariable", + "UnusedImport", + "UnnecessaryVariable", + "unused" +) + +package org.openapitools.client.models + + +import com.squareup.moshi.Json +import com.squareup.moshi.JsonClass +import java.io.Serializable + +/** + * + * + * @param type + * @param nullableProperty + */ + + +interface ParentWithNullable : Serializable { + companion object { + private const val serialVersionUID: Long = 123 + } + + @Json(name = "type") + val type: ParentWithNullable.Type? + @Json(name = "nullableProperty") + val nullableProperty: kotlin.String? + /** + * + * + * Values: ChildWithNullable + */ + @JsonClass(generateAdapter = false) + enum class Type(val value: kotlin.String) { + @Json(name = "ChildWithNullable") ChildWithNullable("ChildWithNullable"); + } + +} + diff --git a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/Pet.kt b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/Pet.kt index 614bf90a6da4..8740d1e8e185 100644 --- a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/Pet.kt +++ b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/Pet.kt @@ -1,24 +1,38 @@ /** -* OpenAPI Petstore -* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ -* -* The version of the OpenAPI document: 1.0.0 -* -* -* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). -* https://openapi-generator.tech -* Do not edit the class manually. -*/ + * + * Please note: + * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * Do not edit this file manually. + * + */ + +@file:Suppress( + "ArrayInDataClass", + "DuplicatedCode", + "EnumEntryName", + "RemoveRedundantQualifierName", + "RemoveRedundantCallsOfConversionMethods", + "REDUNDANT_CALL_OF_CONVERSION_METHOD", + "RedundantUnitReturnType", + "RemoveEmptyClassBody", + "UnnecessaryVariable", + "UnusedImport", + "UnnecessaryVariable", + "unused" +) + package org.openapitools.client.models import org.openapitools.client.models.Category import org.openapitools.client.models.Tag import com.squareup.moshi.Json +import com.squareup.moshi.JsonClass import java.io.Serializable /** * + * * @param name * @param photoUrls * @param id @@ -27,34 +41,44 @@ import java.io.Serializable * @param status pet status in the store */ + data class Pet ( + @Json(name = "name") val name: kotlin.String, + @Json(name = "photoUrls") - val photoUrls: kotlin.collections.List, + val photoUrls: kotlin.collections.Set, + @Json(name = "id") val id: kotlin.Long? = null, + @Json(name = "category") val category: Category? = null, + @Json(name = "tags") val tags: kotlin.collections.List? = null, + /* pet status in the store */ @Json(name = "status") val status: Pet.Status? = null + ) : Serializable { companion object { private const val serialVersionUID: Long = 123 } /** - * pet status in the store - * Values: available,pending,sold - */ - - enum class Status(val value: kotlin.String){ + * pet status in the store + * + * Values: available,pending,sold + */ + @JsonClass(generateAdapter = false) + enum class Status(val value: kotlin.String) { @Json(name = "available") available("available"), @Json(name = "pending") pending("pending"), @Json(name = "sold") sold("sold"); } + } diff --git a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/ReadOnlyFirst.kt b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/ReadOnlyFirst.kt index f513c291b79e..7305c1383158 100644 --- a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/ReadOnlyFirst.kt +++ b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/ReadOnlyFirst.kt @@ -1,35 +1,54 @@ /** -* OpenAPI Petstore -* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ -* -* The version of the OpenAPI document: 1.0.0 -* -* -* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). -* https://openapi-generator.tech -* Do not edit the class manually. -*/ + * + * Please note: + * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * Do not edit this file manually. + * + */ + +@file:Suppress( + "ArrayInDataClass", + "DuplicatedCode", + "EnumEntryName", + "RemoveRedundantQualifierName", + "RemoveRedundantCallsOfConversionMethods", + "REDUNDANT_CALL_OF_CONVERSION_METHOD", + "RedundantUnitReturnType", + "RemoveEmptyClassBody", + "UnnecessaryVariable", + "UnusedImport", + "UnnecessaryVariable", + "unused" +) + package org.openapitools.client.models import com.squareup.moshi.Json +import com.squareup.moshi.JsonClass import java.io.Serializable /** * + * * @param bar * @param baz */ + data class ReadOnlyFirst ( + @Json(name = "bar") val bar: kotlin.String? = null, + @Json(name = "baz") val baz: kotlin.String? = null + ) : Serializable { companion object { private const val serialVersionUID: Long = 123 } + } diff --git a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/Return.kt b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/Return.kt index 7d6454e5580e..ac0864b26cca 100644 --- a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/Return.kt +++ b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/Return.kt @@ -1,32 +1,50 @@ /** -* OpenAPI Petstore -* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ -* -* The version of the OpenAPI document: 1.0.0 -* -* -* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). -* https://openapi-generator.tech -* Do not edit the class manually. -*/ + * + * Please note: + * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * Do not edit this file manually. + * + */ + +@file:Suppress( + "ArrayInDataClass", + "DuplicatedCode", + "EnumEntryName", + "RemoveRedundantQualifierName", + "RemoveRedundantCallsOfConversionMethods", + "REDUNDANT_CALL_OF_CONVERSION_METHOD", + "RedundantUnitReturnType", + "RemoveEmptyClassBody", + "UnnecessaryVariable", + "UnusedImport", + "UnnecessaryVariable", + "unused" +) + package org.openapitools.client.models import com.squareup.moshi.Json +import com.squareup.moshi.JsonClass import java.io.Serializable /** * Model for testing reserved words + * * @param `return` */ + data class Return ( + @Json(name = "return") val `return`: kotlin.Int? = null + ) : Serializable { companion object { private const val serialVersionUID: Long = 123 } + } diff --git a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/SingleRefType.kt b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/SingleRefType.kt new file mode 100644 index 000000000000..d6603acd3f65 --- /dev/null +++ b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/SingleRefType.kt @@ -0,0 +1,71 @@ +/** + * + * Please note: + * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * Do not edit this file manually. + * + */ + +@file:Suppress( + "ArrayInDataClass", + "DuplicatedCode", + "EnumEntryName", + "RemoveRedundantQualifierName", + "RemoveRedundantCallsOfConversionMethods", + "REDUNDANT_CALL_OF_CONVERSION_METHOD", + "RedundantUnitReturnType", + "RemoveEmptyClassBody", + "UnnecessaryVariable", + "UnusedImport", + "UnnecessaryVariable", + "unused" +) + +package org.openapitools.client.models + + +import com.squareup.moshi.Json +import com.squareup.moshi.JsonClass + +/** + * + * + * Values: admin,user + */ + +@JsonClass(generateAdapter = false) +enum class SingleRefType(val value: kotlin.String) { + + @Json(name = "admin") + admin("admin"), + + @Json(name = "user") + user("user"); + + /** + * Override [toString()] to avoid using the enum variable name as the value, and instead use + * the actual value defined in the API spec file. + * + * This solves a problem when the variable name and its value are different, and ensures that + * the client sends the correct enum values to the server always. + */ + override fun toString(): kotlin.String = value + + companion object { + /** + * Converts the provided [data] to a [String] on success, null otherwise. + */ + fun encode(data: kotlin.Any?): kotlin.String? = if (data is SingleRefType) "$data" else null + + /** + * Returns a valid [SingleRefType] for [data], null otherwise. + */ + fun decode(data: kotlin.Any?): SingleRefType? = data?.let { + val normalizedData = "$it".lowercase() + entries.firstOrNull { value -> + it == value || normalizedData == "$value".lowercase() + } + } + } +} + diff --git a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/SpecialModelname.kt b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/SpecialModelname.kt index a315761a8f8f..9d98c4c5f88a 100644 --- a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/SpecialModelname.kt +++ b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/SpecialModelname.kt @@ -1,32 +1,50 @@ /** -* OpenAPI Petstore -* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ -* -* The version of the OpenAPI document: 1.0.0 -* -* -* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). -* https://openapi-generator.tech -* Do not edit the class manually. -*/ + * + * Please note: + * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * Do not edit this file manually. + * + */ + +@file:Suppress( + "ArrayInDataClass", + "DuplicatedCode", + "EnumEntryName", + "RemoveRedundantQualifierName", + "RemoveRedundantCallsOfConversionMethods", + "REDUNDANT_CALL_OF_CONVERSION_METHOD", + "RedundantUnitReturnType", + "RemoveEmptyClassBody", + "UnnecessaryVariable", + "UnusedImport", + "UnnecessaryVariable", + "unused" +) + package org.openapitools.client.models import com.squareup.moshi.Json +import com.squareup.moshi.JsonClass import java.io.Serializable /** * + * * @param dollarSpecialPropertyName */ + data class SpecialModelname ( + @Json(name = "\$special[property.name]") val dollarSpecialPropertyName: kotlin.Long? = null + ) : Serializable { companion object { private const val serialVersionUID: Long = 123 } + } diff --git a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/Tag.kt b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/Tag.kt index 71aa199ee0ca..668b78f8cb5d 100644 --- a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/Tag.kt +++ b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/Tag.kt @@ -1,35 +1,54 @@ /** -* OpenAPI Petstore -* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ -* -* The version of the OpenAPI document: 1.0.0 -* -* -* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). -* https://openapi-generator.tech -* Do not edit the class manually. -*/ + * + * Please note: + * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * Do not edit this file manually. + * + */ + +@file:Suppress( + "ArrayInDataClass", + "DuplicatedCode", + "EnumEntryName", + "RemoveRedundantQualifierName", + "RemoveRedundantCallsOfConversionMethods", + "REDUNDANT_CALL_OF_CONVERSION_METHOD", + "RedundantUnitReturnType", + "RemoveEmptyClassBody", + "UnnecessaryVariable", + "UnusedImport", + "UnnecessaryVariable", + "unused" +) + package org.openapitools.client.models import com.squareup.moshi.Json +import com.squareup.moshi.JsonClass import java.io.Serializable /** * + * * @param id * @param name */ + data class Tag ( + @Json(name = "id") val id: kotlin.Long? = null, + @Json(name = "name") val name: kotlin.String? = null + ) : Serializable { companion object { private const val serialVersionUID: Long = 123 } + } diff --git a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/TestInlineFreeformAdditionalPropertiesRequest.kt b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/TestInlineFreeformAdditionalPropertiesRequest.kt new file mode 100644 index 000000000000..27d29c512205 --- /dev/null +++ b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/TestInlineFreeformAdditionalPropertiesRequest.kt @@ -0,0 +1,50 @@ +/** + * + * Please note: + * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * Do not edit this file manually. + * + */ + +@file:Suppress( + "ArrayInDataClass", + "DuplicatedCode", + "EnumEntryName", + "RemoveRedundantQualifierName", + "RemoveRedundantCallsOfConversionMethods", + "REDUNDANT_CALL_OF_CONVERSION_METHOD", + "RedundantUnitReturnType", + "RemoveEmptyClassBody", + "UnnecessaryVariable", + "UnusedImport", + "UnnecessaryVariable", + "unused" +) + +package org.openapitools.client.models + + +import com.squareup.moshi.Json +import com.squareup.moshi.JsonClass +import java.io.Serializable + +/** + * + * + * @param someProperty + */ + + +data class TestInlineFreeformAdditionalPropertiesRequest ( + + @Json(name = "someProperty") + val someProperty: kotlin.String? = null + +) : kotlin.collections.HashMap(), Serializable { + companion object { + private const val serialVersionUID: Long = 123 + } + + +} + diff --git a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/User.kt b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/User.kt index c83cff139a83..b1ea2d78ddf9 100644 --- a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/User.kt +++ b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/User.kt @@ -1,22 +1,36 @@ /** -* OpenAPI Petstore -* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ -* -* The version of the OpenAPI document: 1.0.0 -* -* -* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). -* https://openapi-generator.tech -* Do not edit the class manually. -*/ + * + * Please note: + * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * Do not edit this file manually. + * + */ + +@file:Suppress( + "ArrayInDataClass", + "DuplicatedCode", + "EnumEntryName", + "RemoveRedundantQualifierName", + "RemoveRedundantCallsOfConversionMethods", + "REDUNDANT_CALL_OF_CONVERSION_METHOD", + "RedundantUnitReturnType", + "RemoveEmptyClassBody", + "UnnecessaryVariable", + "UnusedImport", + "UnnecessaryVariable", + "unused" +) + package org.openapitools.client.models import com.squareup.moshi.Json +import com.squareup.moshi.JsonClass import java.io.Serializable /** * + * * @param id * @param username * @param firstName @@ -27,28 +41,39 @@ import java.io.Serializable * @param userStatus User Status */ + data class User ( + @Json(name = "id") val id: kotlin.Long? = null, + @Json(name = "username") val username: kotlin.String? = null, + @Json(name = "firstName") val firstName: kotlin.String? = null, + @Json(name = "lastName") val lastName: kotlin.String? = null, + @Json(name = "email") val email: kotlin.String? = null, + @Json(name = "password") val password: kotlin.String? = null, + @Json(name = "phone") val phone: kotlin.String? = null, + /* User Status */ @Json(name = "userStatus") val userStatus: kotlin.Int? = null + ) : Serializable { companion object { private const val serialVersionUID: Long = 123 } + } diff --git a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/java.io.File.kt b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/java.io.File.kt new file mode 100644 index 000000000000..7ca3e14bed29 --- /dev/null +++ b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/java.io.File.kt @@ -0,0 +1,51 @@ +/** + * + * Please note: + * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * Do not edit this file manually. + * + */ + +@file:Suppress( + "ArrayInDataClass", + "DuplicatedCode", + "EnumEntryName", + "RemoveRedundantQualifierName", + "RemoveRedundantCallsOfConversionMethods", + "REDUNDANT_CALL_OF_CONVERSION_METHOD", + "RedundantUnitReturnType", + "RemoveEmptyClassBody", + "UnnecessaryVariable", + "UnusedImport", + "UnnecessaryVariable", + "unused" +) + +package org.openapitools.client.models + + +import com.squareup.moshi.Json +import com.squareup.moshi.JsonClass +import java.io.Serializable + +/** + * Must be named `File` for test. + * + * @param sourceURI Test capitalization + */ + + +data class java.io.File ( + + /* Test capitalization */ + @Json(name = "sourceURI") + val sourceURI: kotlin.String? = null + +) : Serializable { + companion object { + private const val serialVersionUID: Long = 123 + } + + +} + diff --git a/samples/openapi3/client/petstore/kotlin/src/test/kotlin/org/openapitools/client/apis/AnotherFakeApiTest.kt b/samples/openapi3/client/petstore/kotlin/src/test/kotlin/org/openapitools/client/apis/AnotherFakeApiTest.kt new file mode 100644 index 000000000000..6f1d2378046a --- /dev/null +++ b/samples/openapi3/client/petstore/kotlin/src/test/kotlin/org/openapitools/client/apis/AnotherFakeApiTest.kt @@ -0,0 +1,46 @@ +/** + * + * Please note: + * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * Do not edit this file manually. + * + */ + +@file:Suppress( + "ArrayInDataClass", + "DuplicatedCode", + "EnumEntryName", + "RemoveRedundantQualifierName", + "RemoveRedundantCallsOfConversionMethods", + "REDUNDANT_CALL_OF_CONVERSION_METHOD", + "RedundantUnitReturnType", + "RemoveEmptyClassBody", + "UnnecessaryVariable", + "UnusedImport", + "UnnecessaryVariable", + "unused" +) + +package org.openapitools.client.apis + +import io.kotlintest.shouldBe +import io.kotlintest.specs.ShouldSpec + +import org.openapitools.client.apis.AnotherFakeApi +import org.openapitools.client.models.Client + +class AnotherFakeApiTest : ShouldSpec() { + init { + // uncomment below to create an instance of AnotherFakeApi + //val apiInstance = AnotherFakeApi() + + // to test call123testSpecialTags + should("test call123testSpecialTags") { + // uncomment below to test call123testSpecialTags + //val client : Client = // Client | client model + //val result : Client = apiInstance.call123testSpecialTags(client) + //result shouldBe ("TODO") + } + + } +} diff --git a/samples/openapi3/client/petstore/kotlin/src/test/kotlin/org/openapitools/client/apis/DefaultApiTest.kt b/samples/openapi3/client/petstore/kotlin/src/test/kotlin/org/openapitools/client/apis/DefaultApiTest.kt new file mode 100644 index 000000000000..6a70b66ced54 --- /dev/null +++ b/samples/openapi3/client/petstore/kotlin/src/test/kotlin/org/openapitools/client/apis/DefaultApiTest.kt @@ -0,0 +1,45 @@ +/** + * + * Please note: + * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * Do not edit this file manually. + * + */ + +@file:Suppress( + "ArrayInDataClass", + "DuplicatedCode", + "EnumEntryName", + "RemoveRedundantQualifierName", + "RemoveRedundantCallsOfConversionMethods", + "REDUNDANT_CALL_OF_CONVERSION_METHOD", + "RedundantUnitReturnType", + "RemoveEmptyClassBody", + "UnnecessaryVariable", + "UnusedImport", + "UnnecessaryVariable", + "unused" +) + +package org.openapitools.client.apis + +import io.kotlintest.shouldBe +import io.kotlintest.specs.ShouldSpec + +import org.openapitools.client.apis.DefaultApi +import org.openapitools.client.models.FooGetDefaultResponse + +class DefaultApiTest : ShouldSpec() { + init { + // uncomment below to create an instance of DefaultApi + //val apiInstance = DefaultApi() + + // to test fooGet + should("test fooGet") { + // uncomment below to test fooGet + //val result : FooGetDefaultResponse = apiInstance.fooGet() + //result shouldBe ("TODO") + } + + } +} diff --git a/samples/openapi3/client/petstore/kotlin/src/test/kotlin/org/openapitools/client/apis/FakeApiTest.kt b/samples/openapi3/client/petstore/kotlin/src/test/kotlin/org/openapitools/client/apis/FakeApiTest.kt new file mode 100644 index 000000000000..7d0e1bc36db1 --- /dev/null +++ b/samples/openapi3/client/petstore/kotlin/src/test/kotlin/org/openapitools/client/apis/FakeApiTest.kt @@ -0,0 +1,244 @@ +/** + * + * Please note: + * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * Do not edit this file manually. + * + */ + +@file:Suppress( + "ArrayInDataClass", + "DuplicatedCode", + "EnumEntryName", + "RemoveRedundantQualifierName", + "RemoveRedundantCallsOfConversionMethods", + "REDUNDANT_CALL_OF_CONVERSION_METHOD", + "RedundantUnitReturnType", + "RemoveEmptyClassBody", + "UnnecessaryVariable", + "UnusedImport", + "UnnecessaryVariable", + "unused" +) + +package org.openapitools.client.apis + +import io.kotlintest.shouldBe +import io.kotlintest.specs.ShouldSpec + +import org.openapitools.client.apis.FakeApi +import org.openapitools.client.models.ChildWithNullable +import org.openapitools.client.models.Client +import org.openapitools.client.models.EnumClass +import org.openapitools.client.models.FakeBigDecimalMap200Response +import org.openapitools.client.models.FileSchemaTestClass +import org.openapitools.client.models.HealthCheckResult +import org.openapitools.client.models.OuterComposite +import org.openapitools.client.models.OuterObjectWithEnumProperty +import org.openapitools.client.models.Pet +import org.openapitools.client.models.TestInlineFreeformAdditionalPropertiesRequest +import org.openapitools.client.models.User + +class FakeApiTest : ShouldSpec() { + init { + // uncomment below to create an instance of FakeApi + //val apiInstance = FakeApi() + + // to test fakeBigDecimalMap + should("test fakeBigDecimalMap") { + // uncomment below to test fakeBigDecimalMap + //val result : FakeBigDecimalMap200Response = apiInstance.fakeBigDecimalMap() + //result shouldBe ("TODO") + } + + // to test fakeHealthGet + should("test fakeHealthGet") { + // uncomment below to test fakeHealthGet + //val result : HealthCheckResult = apiInstance.fakeHealthGet() + //result shouldBe ("TODO") + } + + // to test fakeHttpSignatureTest + should("test fakeHttpSignatureTest") { + // uncomment below to test fakeHttpSignatureTest + //val pet : Pet = // Pet | Pet object that needs to be added to the store + //val query1 : kotlin.String = query1_example // kotlin.String | query parameter + //val header1 : kotlin.String = header1_example // kotlin.String | header parameter + //apiInstance.fakeHttpSignatureTest(pet, query1, header1) + } + + // to test fakeOuterBooleanSerialize + should("test fakeOuterBooleanSerialize") { + // uncomment below to test fakeOuterBooleanSerialize + //val body : kotlin.Boolean = true // kotlin.Boolean | Input boolean as post body + //val result : kotlin.Boolean = apiInstance.fakeOuterBooleanSerialize(body) + //result shouldBe ("TODO") + } + + // to test fakeOuterCompositeSerialize + should("test fakeOuterCompositeSerialize") { + // uncomment below to test fakeOuterCompositeSerialize + //val outerComposite : OuterComposite = // OuterComposite | Input composite as post body + //val result : OuterComposite = apiInstance.fakeOuterCompositeSerialize(outerComposite) + //result shouldBe ("TODO") + } + + // to test fakeOuterNumberSerialize + should("test fakeOuterNumberSerialize") { + // uncomment below to test fakeOuterNumberSerialize + //val body : java.math.BigDecimal = 8.14 // java.math.BigDecimal | Input number as post body + //val result : java.math.BigDecimal = apiInstance.fakeOuterNumberSerialize(body) + //result shouldBe ("TODO") + } + + // to test fakeOuterStringSerialize + should("test fakeOuterStringSerialize") { + // uncomment below to test fakeOuterStringSerialize + //val body : kotlin.String = body_example // kotlin.String | Input string as post body + //val result : kotlin.String = apiInstance.fakeOuterStringSerialize(body) + //result shouldBe ("TODO") + } + + // to test fakePropertyEnumIntegerSerialize + should("test fakePropertyEnumIntegerSerialize") { + // uncomment below to test fakePropertyEnumIntegerSerialize + //val outerObjectWithEnumProperty : OuterObjectWithEnumProperty = // OuterObjectWithEnumProperty | Input enum (int) as post body + //val result : OuterObjectWithEnumProperty = apiInstance.fakePropertyEnumIntegerSerialize(outerObjectWithEnumProperty) + //result shouldBe ("TODO") + } + + // to test testAdditionalPropertiesReference + should("test testAdditionalPropertiesReference") { + // uncomment below to test testAdditionalPropertiesReference + //val requestBody : kotlin.collections.Map = Object // kotlin.collections.Map | request body + //apiInstance.testAdditionalPropertiesReference(requestBody) + } + + // to test testBodyWithBinary + should("test testBodyWithBinary") { + // uncomment below to test testBodyWithBinary + //val body : java.io.File = BINARY_DATA_HERE // java.io.File | image to upload + //apiInstance.testBodyWithBinary(body) + } + + // to test testBodyWithFileSchema + should("test testBodyWithFileSchema") { + // uncomment below to test testBodyWithFileSchema + //val fileSchemaTestClass : FileSchemaTestClass = // FileSchemaTestClass | + //apiInstance.testBodyWithFileSchema(fileSchemaTestClass) + } + + // to test testBodyWithQueryParams + should("test testBodyWithQueryParams") { + // uncomment below to test testBodyWithQueryParams + //val query : kotlin.String = query_example // kotlin.String | + //val user : User = // User | + //apiInstance.testBodyWithQueryParams(query, user) + } + + // to test testClientModel + should("test testClientModel") { + // uncomment below to test testClientModel + //val client : Client = // Client | client model + //val result : Client = apiInstance.testClientModel(client) + //result shouldBe ("TODO") + } + + // to test testEndpointParameters + should("test testEndpointParameters") { + // uncomment below to test testEndpointParameters + //val number : java.math.BigDecimal = 8.14 // java.math.BigDecimal | None + //val double : kotlin.Double = 1.2 // kotlin.Double | None + //val patternWithoutDelimiter : kotlin.String = patternWithoutDelimiter_example // kotlin.String | None + //val byte : kotlin.ByteArray = BYTE_ARRAY_DATA_HERE // kotlin.ByteArray | None + //val integer : kotlin.Int = 56 // kotlin.Int | None + //val int32 : kotlin.Int = 56 // kotlin.Int | None + //val int64 : kotlin.Long = 789 // kotlin.Long | None + //val float : kotlin.Float = 3.4 // kotlin.Float | None + //val string : kotlin.String = string_example // kotlin.String | None + //val binary : java.io.File = BINARY_DATA_HERE // java.io.File | None + //val date : java.time.LocalDate = 2013-10-20 // java.time.LocalDate | None + //val dateTime : java.time.OffsetDateTime = 2013-10-20T19:20:30+01:00 // java.time.OffsetDateTime | None + //val password : kotlin.String = password_example // kotlin.String | None + //val paramCallback : kotlin.String = paramCallback_example // kotlin.String | None + //apiInstance.testEndpointParameters(number, double, patternWithoutDelimiter, byte, integer, int32, int64, float, string, binary, date, dateTime, password, paramCallback) + } + + // to test testEnumParameters + should("test testEnumParameters") { + // uncomment below to test testEnumParameters + //val enumHeaderStringArray : kotlin.collections.List = // kotlin.collections.List | Header parameter enum test (string array) + //val enumHeaderString : kotlin.String = enumHeaderString_example // kotlin.String | Header parameter enum test (string) + //val enumQueryStringArray : kotlin.collections.List = // kotlin.collections.List | Query parameter enum test (string array) + //val enumQueryString : kotlin.String = enumQueryString_example // kotlin.String | Query parameter enum test (string) + //val enumQueryInteger : kotlin.Int = 56 // kotlin.Int | Query parameter enum test (double) + //val enumQueryDouble : kotlin.Double = 1.2 // kotlin.Double | Query parameter enum test (double) + //val enumQueryModelArray : kotlin.collections.List = // kotlin.collections.List | + //val enumFormStringArray : kotlin.collections.List = // kotlin.collections.List | Form parameter enum test (string array) + //val enumFormString : kotlin.String = enumFormString_example // kotlin.String | Form parameter enum test (string) + //apiInstance.testEnumParameters(enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble, enumQueryModelArray, enumFormStringArray, enumFormString) + } + + // to test testGroupParameters + should("test testGroupParameters") { + // uncomment below to test testGroupParameters + //val requiredStringGroup : kotlin.Int = 56 // kotlin.Int | Required String in group parameters + //val requiredBooleanGroup : kotlin.Boolean = true // kotlin.Boolean | Required Boolean in group parameters + //val requiredInt64Group : kotlin.Long = 789 // kotlin.Long | Required Integer in group parameters + //val stringGroup : kotlin.Int = 56 // kotlin.Int | String in group parameters + //val booleanGroup : kotlin.Boolean = true // kotlin.Boolean | Boolean in group parameters + //val int64Group : kotlin.Long = 789 // kotlin.Long | Integer in group parameters + //apiInstance.testGroupParameters(requiredStringGroup, requiredBooleanGroup, requiredInt64Group, stringGroup, booleanGroup, int64Group) + } + + // to test testInlineAdditionalProperties + should("test testInlineAdditionalProperties") { + // uncomment below to test testInlineAdditionalProperties + //val requestBody : kotlin.collections.Map = // kotlin.collections.Map | request body + //apiInstance.testInlineAdditionalProperties(requestBody) + } + + // to test testInlineFreeformAdditionalProperties + should("test testInlineFreeformAdditionalProperties") { + // uncomment below to test testInlineFreeformAdditionalProperties + //val testInlineFreeformAdditionalPropertiesRequest : TestInlineFreeformAdditionalPropertiesRequest = // TestInlineFreeformAdditionalPropertiesRequest | request body + //apiInstance.testInlineFreeformAdditionalProperties(testInlineFreeformAdditionalPropertiesRequest) + } + + // to test testJsonFormData + should("test testJsonFormData") { + // uncomment below to test testJsonFormData + //val `param` : kotlin.String = `param`_example // kotlin.String | field1 + //val param2 : kotlin.String = param2_example // kotlin.String | field2 + //apiInstance.testJsonFormData(`param`, param2) + } + + // to test testNullable + should("test testNullable") { + // uncomment below to test testNullable + //val childWithNullable : ChildWithNullable = // ChildWithNullable | request body + //apiInstance.testNullable(childWithNullable) + } + + // to test testQueryParameterCollectionFormat + should("test testQueryParameterCollectionFormat") { + // uncomment below to test testQueryParameterCollectionFormat + //val pipe : kotlin.collections.List = // kotlin.collections.List | + //val ioutil : kotlin.collections.List = // kotlin.collections.List | + //val http : kotlin.collections.List = // kotlin.collections.List | + //val url : kotlin.collections.List = // kotlin.collections.List | + //val context : kotlin.collections.List = // kotlin.collections.List | + //val allowEmpty : kotlin.String = allowEmpty_example // kotlin.String | + //val language : kotlin.collections.Map = // kotlin.collections.Map | + //apiInstance.testQueryParameterCollectionFormat(pipe, ioutil, http, url, context, allowEmpty, language) + } + + // to test testStringMapReference + should("test testStringMapReference") { + // uncomment below to test testStringMapReference + //val requestBody : kotlin.collections.Map = // kotlin.collections.Map | request body + //apiInstance.testStringMapReference(requestBody) + } + + } +} diff --git a/samples/openapi3/client/petstore/kotlin/src/test/kotlin/org/openapitools/client/apis/FakeClassnameTags123ApiTest.kt b/samples/openapi3/client/petstore/kotlin/src/test/kotlin/org/openapitools/client/apis/FakeClassnameTags123ApiTest.kt new file mode 100644 index 000000000000..21a50b1aae08 --- /dev/null +++ b/samples/openapi3/client/petstore/kotlin/src/test/kotlin/org/openapitools/client/apis/FakeClassnameTags123ApiTest.kt @@ -0,0 +1,46 @@ +/** + * + * Please note: + * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * Do not edit this file manually. + * + */ + +@file:Suppress( + "ArrayInDataClass", + "DuplicatedCode", + "EnumEntryName", + "RemoveRedundantQualifierName", + "RemoveRedundantCallsOfConversionMethods", + "REDUNDANT_CALL_OF_CONVERSION_METHOD", + "RedundantUnitReturnType", + "RemoveEmptyClassBody", + "UnnecessaryVariable", + "UnusedImport", + "UnnecessaryVariable", + "unused" +) + +package org.openapitools.client.apis + +import io.kotlintest.shouldBe +import io.kotlintest.specs.ShouldSpec + +import org.openapitools.client.apis.FakeClassnameTags123Api +import org.openapitools.client.models.Client + +class FakeClassnameTags123ApiTest : ShouldSpec() { + init { + // uncomment below to create an instance of FakeClassnameTags123Api + //val apiInstance = FakeClassnameTags123Api() + + // to test testClassname + should("test testClassname") { + // uncomment below to test testClassname + //val client : Client = // Client | client model + //val result : Client = apiInstance.testClassname(client) + //result shouldBe ("TODO") + } + + } +} diff --git a/samples/openapi3/client/petstore/kotlin/src/test/kotlin/org/openapitools/client/apis/PetApiTest.kt b/samples/openapi3/client/petstore/kotlin/src/test/kotlin/org/openapitools/client/apis/PetApiTest.kt new file mode 100644 index 000000000000..1577c748aab5 --- /dev/null +++ b/samples/openapi3/client/petstore/kotlin/src/test/kotlin/org/openapitools/client/apis/PetApiTest.kt @@ -0,0 +1,114 @@ +/** + * + * Please note: + * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * Do not edit this file manually. + * + */ + +@file:Suppress( + "ArrayInDataClass", + "DuplicatedCode", + "EnumEntryName", + "RemoveRedundantQualifierName", + "RemoveRedundantCallsOfConversionMethods", + "REDUNDANT_CALL_OF_CONVERSION_METHOD", + "RedundantUnitReturnType", + "RemoveEmptyClassBody", + "UnnecessaryVariable", + "UnusedImport", + "UnnecessaryVariable", + "unused" +) + +package org.openapitools.client.apis + +import io.kotlintest.shouldBe +import io.kotlintest.specs.ShouldSpec + +import org.openapitools.client.apis.PetApi +import org.openapitools.client.models.ModelApiResponse +import org.openapitools.client.models.Pet + +class PetApiTest : ShouldSpec() { + init { + // uncomment below to create an instance of PetApi + //val apiInstance = PetApi() + + // to test addPet + should("test addPet") { + // uncomment below to test addPet + //val pet : Pet = // Pet | Pet object that needs to be added to the store + //apiInstance.addPet(pet) + } + + // to test deletePet + should("test deletePet") { + // uncomment below to test deletePet + //val petId : kotlin.Long = 789 // kotlin.Long | Pet id to delete + //val apiKey : kotlin.String = apiKey_example // kotlin.String | + //apiInstance.deletePet(petId, apiKey) + } + + // to test findPetsByStatus + should("test findPetsByStatus") { + // uncomment below to test findPetsByStatus + //val status : kotlin.collections.List = // kotlin.collections.List | Status values that need to be considered for filter + //val result : kotlin.collections.List = apiInstance.findPetsByStatus(status) + //result shouldBe ("TODO") + } + + // to test findPetsByTags + should("test findPetsByTags") { + // uncomment below to test findPetsByTags + //val tags : kotlin.collections.Set = // kotlin.collections.Set | Tags to filter by + //val result : kotlin.collections.Set = apiInstance.findPetsByTags(tags) + //result shouldBe ("TODO") + } + + // to test getPetById + should("test getPetById") { + // uncomment below to test getPetById + //val petId : kotlin.Long = 789 // kotlin.Long | ID of pet to return + //val result : Pet = apiInstance.getPetById(petId) + //result shouldBe ("TODO") + } + + // to test updatePet + should("test updatePet") { + // uncomment below to test updatePet + //val pet : Pet = // Pet | Pet object that needs to be added to the store + //apiInstance.updatePet(pet) + } + + // to test updatePetWithForm + should("test updatePetWithForm") { + // uncomment below to test updatePetWithForm + //val petId : kotlin.Long = 789 // kotlin.Long | ID of pet that needs to be updated + //val name : kotlin.String = name_example // kotlin.String | Updated name of the pet + //val status : kotlin.String = status_example // kotlin.String | Updated status of the pet + //apiInstance.updatePetWithForm(petId, name, status) + } + + // to test uploadFile + should("test uploadFile") { + // uncomment below to test uploadFile + //val petId : kotlin.Long = 789 // kotlin.Long | ID of pet to update + //val additionalMetadata : kotlin.String = additionalMetadata_example // kotlin.String | Additional data to pass to server + //val file : java.io.File = BINARY_DATA_HERE // java.io.File | file to upload + //val result : ModelApiResponse = apiInstance.uploadFile(petId, additionalMetadata, file) + //result shouldBe ("TODO") + } + + // to test uploadFileWithRequiredFile + should("test uploadFileWithRequiredFile") { + // uncomment below to test uploadFileWithRequiredFile + //val petId : kotlin.Long = 789 // kotlin.Long | ID of pet to update + //val requiredFile : java.io.File = BINARY_DATA_HERE // java.io.File | file to upload + //val additionalMetadata : kotlin.String = additionalMetadata_example // kotlin.String | Additional data to pass to server + //val result : ModelApiResponse = apiInstance.uploadFileWithRequiredFile(petId, requiredFile, additionalMetadata) + //result shouldBe ("TODO") + } + + } +} diff --git a/samples/openapi3/client/petstore/kotlin/src/test/kotlin/org/openapitools/client/apis/StoreApiTest.kt b/samples/openapi3/client/petstore/kotlin/src/test/kotlin/org/openapitools/client/apis/StoreApiTest.kt new file mode 100644 index 000000000000..3e7cac38bcb1 --- /dev/null +++ b/samples/openapi3/client/petstore/kotlin/src/test/kotlin/org/openapitools/client/apis/StoreApiTest.kt @@ -0,0 +1,68 @@ +/** + * + * Please note: + * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * Do not edit this file manually. + * + */ + +@file:Suppress( + "ArrayInDataClass", + "DuplicatedCode", + "EnumEntryName", + "RemoveRedundantQualifierName", + "RemoveRedundantCallsOfConversionMethods", + "REDUNDANT_CALL_OF_CONVERSION_METHOD", + "RedundantUnitReturnType", + "RemoveEmptyClassBody", + "UnnecessaryVariable", + "UnusedImport", + "UnnecessaryVariable", + "unused" +) + +package org.openapitools.client.apis + +import io.kotlintest.shouldBe +import io.kotlintest.specs.ShouldSpec + +import org.openapitools.client.apis.StoreApi +import org.openapitools.client.models.Order + +class StoreApiTest : ShouldSpec() { + init { + // uncomment below to create an instance of StoreApi + //val apiInstance = StoreApi() + + // to test deleteOrder + should("test deleteOrder") { + // uncomment below to test deleteOrder + //val orderId : kotlin.String = orderId_example // kotlin.String | ID of the order that needs to be deleted + //apiInstance.deleteOrder(orderId) + } + + // to test getInventory + should("test getInventory") { + // uncomment below to test getInventory + //val result : kotlin.collections.Map = apiInstance.getInventory() + //result shouldBe ("TODO") + } + + // to test getOrderById + should("test getOrderById") { + // uncomment below to test getOrderById + //val orderId : kotlin.Long = 789 // kotlin.Long | ID of pet that needs to be fetched + //val result : Order = apiInstance.getOrderById(orderId) + //result shouldBe ("TODO") + } + + // to test placeOrder + should("test placeOrder") { + // uncomment below to test placeOrder + //val order : Order = // Order | order placed for purchasing the pet + //val result : Order = apiInstance.placeOrder(order) + //result shouldBe ("TODO") + } + + } +} diff --git a/samples/openapi3/client/petstore/kotlin/src/test/kotlin/org/openapitools/client/apis/UserApiTest.kt b/samples/openapi3/client/petstore/kotlin/src/test/kotlin/org/openapitools/client/apis/UserApiTest.kt new file mode 100644 index 000000000000..b705e1b0beba --- /dev/null +++ b/samples/openapi3/client/petstore/kotlin/src/test/kotlin/org/openapitools/client/apis/UserApiTest.kt @@ -0,0 +1,97 @@ +/** + * + * Please note: + * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * Do not edit this file manually. + * + */ + +@file:Suppress( + "ArrayInDataClass", + "DuplicatedCode", + "EnumEntryName", + "RemoveRedundantQualifierName", + "RemoveRedundantCallsOfConversionMethods", + "REDUNDANT_CALL_OF_CONVERSION_METHOD", + "RedundantUnitReturnType", + "RemoveEmptyClassBody", + "UnnecessaryVariable", + "UnusedImport", + "UnnecessaryVariable", + "unused" +) + +package org.openapitools.client.apis + +import io.kotlintest.shouldBe +import io.kotlintest.specs.ShouldSpec + +import org.openapitools.client.apis.UserApi +import org.openapitools.client.models.User + +class UserApiTest : ShouldSpec() { + init { + // uncomment below to create an instance of UserApi + //val apiInstance = UserApi() + + // to test createUser + should("test createUser") { + // uncomment below to test createUser + //val user : User = // User | Created user object + //apiInstance.createUser(user) + } + + // to test createUsersWithArrayInput + should("test createUsersWithArrayInput") { + // uncomment below to test createUsersWithArrayInput + //val user : kotlin.collections.List = // kotlin.collections.List | List of user object + //apiInstance.createUsersWithArrayInput(user) + } + + // to test createUsersWithListInput + should("test createUsersWithListInput") { + // uncomment below to test createUsersWithListInput + //val user : kotlin.collections.List = // kotlin.collections.List | List of user object + //apiInstance.createUsersWithListInput(user) + } + + // to test deleteUser + should("test deleteUser") { + // uncomment below to test deleteUser + //val username : kotlin.String = username_example // kotlin.String | The name that needs to be deleted + //apiInstance.deleteUser(username) + } + + // to test getUserByName + should("test getUserByName") { + // uncomment below to test getUserByName + //val username : kotlin.String = username_example // kotlin.String | The name that needs to be fetched. Use user1 for testing. + //val result : User = apiInstance.getUserByName(username) + //result shouldBe ("TODO") + } + + // to test loginUser + should("test loginUser") { + // uncomment below to test loginUser + //val username : kotlin.String = username_example // kotlin.String | The user name for login + //val password : kotlin.String = password_example // kotlin.String | The password for login in clear text + //val result : kotlin.String = apiInstance.loginUser(username, password) + //result shouldBe ("TODO") + } + + // to test logoutUser + should("test logoutUser") { + // uncomment below to test logoutUser + //apiInstance.logoutUser() + } + + // to test updateUser + should("test updateUser") { + // uncomment below to test updateUser + //val username : kotlin.String = username_example // kotlin.String | name that need to be deleted + //val user : User = // User | Updated user object + //apiInstance.updateUser(username, user) + } + + } +} diff --git a/samples/openapi3/client/petstore/kotlin/src/test/kotlin/org/openapitools/client/models/200ResponseTest.kt b/samples/openapi3/client/petstore/kotlin/src/test/kotlin/org/openapitools/client/models/200ResponseTest.kt new file mode 100644 index 000000000000..b19268faf63e --- /dev/null +++ b/samples/openapi3/client/petstore/kotlin/src/test/kotlin/org/openapitools/client/models/200ResponseTest.kt @@ -0,0 +1,49 @@ +/** + * + * Please note: + * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * Do not edit this file manually. + * + */ + +@file:Suppress( + "ArrayInDataClass", + "DuplicatedCode", + "EnumEntryName", + "RemoveRedundantQualifierName", + "RemoveRedundantCallsOfConversionMethods", + "REDUNDANT_CALL_OF_CONVERSION_METHOD", + "RedundantUnitReturnType", + "RemoveEmptyClassBody", + "UnnecessaryVariable", + "UnusedImport", + "UnnecessaryVariable", + "unused" +) + +package org.openapitools.client.models + +import io.kotlintest.shouldBe +import io.kotlintest.specs.ShouldSpec + +import org.openapitools.client.models.Model200Response + +class Model200ResponseTest : ShouldSpec() { + init { + // uncomment below to create an instance of Model200Response + //val modelInstance = Model200Response() + + // to test the property `name` + should("test name") { + // uncomment below to test the property + //modelInstance.name shouldBe ("TODO") + } + + // to test the property `propertyClass` + should("test propertyClass") { + // uncomment below to test the property + //modelInstance.propertyClass shouldBe ("TODO") + } + + } +} diff --git a/samples/openapi3/client/petstore/kotlin/src/test/kotlin/org/openapitools/client/models/AdditionalPropertiesClassTest.kt b/samples/openapi3/client/petstore/kotlin/src/test/kotlin/org/openapitools/client/models/AdditionalPropertiesClassTest.kt new file mode 100644 index 000000000000..4224b9d35e43 --- /dev/null +++ b/samples/openapi3/client/petstore/kotlin/src/test/kotlin/org/openapitools/client/models/AdditionalPropertiesClassTest.kt @@ -0,0 +1,49 @@ +/** + * + * Please note: + * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * Do not edit this file manually. + * + */ + +@file:Suppress( + "ArrayInDataClass", + "DuplicatedCode", + "EnumEntryName", + "RemoveRedundantQualifierName", + "RemoveRedundantCallsOfConversionMethods", + "REDUNDANT_CALL_OF_CONVERSION_METHOD", + "RedundantUnitReturnType", + "RemoveEmptyClassBody", + "UnnecessaryVariable", + "UnusedImport", + "UnnecessaryVariable", + "unused" +) + +package org.openapitools.client.models + +import io.kotlintest.shouldBe +import io.kotlintest.specs.ShouldSpec + +import org.openapitools.client.models.AdditionalPropertiesClass + +class AdditionalPropertiesClassTest : ShouldSpec() { + init { + // uncomment below to create an instance of AdditionalPropertiesClass + //val modelInstance = AdditionalPropertiesClass() + + // to test the property `mapProperty` + should("test mapProperty") { + // uncomment below to test the property + //modelInstance.mapProperty shouldBe ("TODO") + } + + // to test the property `mapOfMapProperty` + should("test mapOfMapProperty") { + // uncomment below to test the property + //modelInstance.mapOfMapProperty shouldBe ("TODO") + } + + } +} diff --git a/samples/openapi3/client/petstore/kotlin/src/test/kotlin/org/openapitools/client/models/AllOfWithSingleRefTest.kt b/samples/openapi3/client/petstore/kotlin/src/test/kotlin/org/openapitools/client/models/AllOfWithSingleRefTest.kt new file mode 100644 index 000000000000..d7de6b36c8ed --- /dev/null +++ b/samples/openapi3/client/petstore/kotlin/src/test/kotlin/org/openapitools/client/models/AllOfWithSingleRefTest.kt @@ -0,0 +1,50 @@ +/** + * + * Please note: + * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * Do not edit this file manually. + * + */ + +@file:Suppress( + "ArrayInDataClass", + "DuplicatedCode", + "EnumEntryName", + "RemoveRedundantQualifierName", + "RemoveRedundantCallsOfConversionMethods", + "REDUNDANT_CALL_OF_CONVERSION_METHOD", + "RedundantUnitReturnType", + "RemoveEmptyClassBody", + "UnnecessaryVariable", + "UnusedImport", + "UnnecessaryVariable", + "unused" +) + +package org.openapitools.client.models + +import io.kotlintest.shouldBe +import io.kotlintest.specs.ShouldSpec + +import org.openapitools.client.models.AllOfWithSingleRef +import org.openapitools.client.models.SingleRefType + +class AllOfWithSingleRefTest : ShouldSpec() { + init { + // uncomment below to create an instance of AllOfWithSingleRef + //val modelInstance = AllOfWithSingleRef() + + // to test the property `username` + should("test username") { + // uncomment below to test the property + //modelInstance.username shouldBe ("TODO") + } + + // to test the property `singleRefType` + should("test singleRefType") { + // uncomment below to test the property + //modelInstance.singleRefType shouldBe ("TODO") + } + + } +} diff --git a/samples/openapi3/client/petstore/kotlin/src/test/kotlin/org/openapitools/client/models/AnimalTest.kt b/samples/openapi3/client/petstore/kotlin/src/test/kotlin/org/openapitools/client/models/AnimalTest.kt new file mode 100644 index 000000000000..a8bff08dbf1d --- /dev/null +++ b/samples/openapi3/client/petstore/kotlin/src/test/kotlin/org/openapitools/client/models/AnimalTest.kt @@ -0,0 +1,49 @@ +/** + * + * Please note: + * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * Do not edit this file manually. + * + */ + +@file:Suppress( + "ArrayInDataClass", + "DuplicatedCode", + "EnumEntryName", + "RemoveRedundantQualifierName", + "RemoveRedundantCallsOfConversionMethods", + "REDUNDANT_CALL_OF_CONVERSION_METHOD", + "RedundantUnitReturnType", + "RemoveEmptyClassBody", + "UnnecessaryVariable", + "UnusedImport", + "UnnecessaryVariable", + "unused" +) + +package org.openapitools.client.models + +import io.kotlintest.shouldBe +import io.kotlintest.specs.ShouldSpec + +import org.openapitools.client.models.Animal + +class AnimalTest : ShouldSpec() { + init { + // uncomment below to create an instance of Animal + //val modelInstance = Animal() + + // to test the property `className` + should("test className") { + // uncomment below to test the property + //modelInstance.className shouldBe ("TODO") + } + + // to test the property `color` + should("test color") { + // uncomment below to test the property + //modelInstance.color shouldBe ("TODO") + } + + } +} diff --git a/samples/openapi3/client/petstore/kotlin/src/test/kotlin/org/openapitools/client/models/ApiResponseTest.kt b/samples/openapi3/client/petstore/kotlin/src/test/kotlin/org/openapitools/client/models/ApiResponseTest.kt new file mode 100644 index 000000000000..37b5d18024a5 --- /dev/null +++ b/samples/openapi3/client/petstore/kotlin/src/test/kotlin/org/openapitools/client/models/ApiResponseTest.kt @@ -0,0 +1,55 @@ +/** + * + * Please note: + * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * Do not edit this file manually. + * + */ + +@file:Suppress( + "ArrayInDataClass", + "DuplicatedCode", + "EnumEntryName", + "RemoveRedundantQualifierName", + "RemoveRedundantCallsOfConversionMethods", + "REDUNDANT_CALL_OF_CONVERSION_METHOD", + "RedundantUnitReturnType", + "RemoveEmptyClassBody", + "UnnecessaryVariable", + "UnusedImport", + "UnnecessaryVariable", + "unused" +) + +package org.openapitools.client.models + +import io.kotlintest.shouldBe +import io.kotlintest.specs.ShouldSpec + +import org.openapitools.client.models.ModelApiResponse + +class ModelApiResponseTest : ShouldSpec() { + init { + // uncomment below to create an instance of ModelApiResponse + //val modelInstance = ModelApiResponse() + + // to test the property `code` + should("test code") { + // uncomment below to test the property + //modelInstance.code shouldBe ("TODO") + } + + // to test the property `type` + should("test type") { + // uncomment below to test the property + //modelInstance.type shouldBe ("TODO") + } + + // to test the property `message` + should("test message") { + // uncomment below to test the property + //modelInstance.message shouldBe ("TODO") + } + + } +} diff --git a/samples/openapi3/client/petstore/kotlin/src/test/kotlin/org/openapitools/client/models/ArrayOfArrayOfNumberOnlyTest.kt b/samples/openapi3/client/petstore/kotlin/src/test/kotlin/org/openapitools/client/models/ArrayOfArrayOfNumberOnlyTest.kt new file mode 100644 index 000000000000..2345e9ec3d6f --- /dev/null +++ b/samples/openapi3/client/petstore/kotlin/src/test/kotlin/org/openapitools/client/models/ArrayOfArrayOfNumberOnlyTest.kt @@ -0,0 +1,43 @@ +/** + * + * Please note: + * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * Do not edit this file manually. + * + */ + +@file:Suppress( + "ArrayInDataClass", + "DuplicatedCode", + "EnumEntryName", + "RemoveRedundantQualifierName", + "RemoveRedundantCallsOfConversionMethods", + "REDUNDANT_CALL_OF_CONVERSION_METHOD", + "RedundantUnitReturnType", + "RemoveEmptyClassBody", + "UnnecessaryVariable", + "UnusedImport", + "UnnecessaryVariable", + "unused" +) + +package org.openapitools.client.models + +import io.kotlintest.shouldBe +import io.kotlintest.specs.ShouldSpec + +import org.openapitools.client.models.ArrayOfArrayOfNumberOnly + +class ArrayOfArrayOfNumberOnlyTest : ShouldSpec() { + init { + // uncomment below to create an instance of ArrayOfArrayOfNumberOnly + //val modelInstance = ArrayOfArrayOfNumberOnly() + + // to test the property `arrayArrayNumber` + should("test arrayArrayNumber") { + // uncomment below to test the property + //modelInstance.arrayArrayNumber shouldBe ("TODO") + } + + } +} diff --git a/samples/openapi3/client/petstore/kotlin/src/test/kotlin/org/openapitools/client/models/ArrayOfNumberOnlyTest.kt b/samples/openapi3/client/petstore/kotlin/src/test/kotlin/org/openapitools/client/models/ArrayOfNumberOnlyTest.kt new file mode 100644 index 000000000000..0fac7c821ffc --- /dev/null +++ b/samples/openapi3/client/petstore/kotlin/src/test/kotlin/org/openapitools/client/models/ArrayOfNumberOnlyTest.kt @@ -0,0 +1,43 @@ +/** + * + * Please note: + * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * Do not edit this file manually. + * + */ + +@file:Suppress( + "ArrayInDataClass", + "DuplicatedCode", + "EnumEntryName", + "RemoveRedundantQualifierName", + "RemoveRedundantCallsOfConversionMethods", + "REDUNDANT_CALL_OF_CONVERSION_METHOD", + "RedundantUnitReturnType", + "RemoveEmptyClassBody", + "UnnecessaryVariable", + "UnusedImport", + "UnnecessaryVariable", + "unused" +) + +package org.openapitools.client.models + +import io.kotlintest.shouldBe +import io.kotlintest.specs.ShouldSpec + +import org.openapitools.client.models.ArrayOfNumberOnly + +class ArrayOfNumberOnlyTest : ShouldSpec() { + init { + // uncomment below to create an instance of ArrayOfNumberOnly + //val modelInstance = ArrayOfNumberOnly() + + // to test the property `arrayNumber` + should("test arrayNumber") { + // uncomment below to test the property + //modelInstance.arrayNumber shouldBe ("TODO") + } + + } +} diff --git a/samples/openapi3/client/petstore/kotlin/src/test/kotlin/org/openapitools/client/models/ArrayTestTest.kt b/samples/openapi3/client/petstore/kotlin/src/test/kotlin/org/openapitools/client/models/ArrayTestTest.kt new file mode 100644 index 000000000000..c4967484f464 --- /dev/null +++ b/samples/openapi3/client/petstore/kotlin/src/test/kotlin/org/openapitools/client/models/ArrayTestTest.kt @@ -0,0 +1,56 @@ +/** + * + * Please note: + * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * Do not edit this file manually. + * + */ + +@file:Suppress( + "ArrayInDataClass", + "DuplicatedCode", + "EnumEntryName", + "RemoveRedundantQualifierName", + "RemoveRedundantCallsOfConversionMethods", + "REDUNDANT_CALL_OF_CONVERSION_METHOD", + "RedundantUnitReturnType", + "RemoveEmptyClassBody", + "UnnecessaryVariable", + "UnusedImport", + "UnnecessaryVariable", + "unused" +) + +package org.openapitools.client.models + +import io.kotlintest.shouldBe +import io.kotlintest.specs.ShouldSpec + +import org.openapitools.client.models.ArrayTest +import org.openapitools.client.models.ReadOnlyFirst + +class ArrayTestTest : ShouldSpec() { + init { + // uncomment below to create an instance of ArrayTest + //val modelInstance = ArrayTest() + + // to test the property `arrayOfString` + should("test arrayOfString") { + // uncomment below to test the property + //modelInstance.arrayOfString shouldBe ("TODO") + } + + // to test the property `arrayArrayOfInteger` + should("test arrayArrayOfInteger") { + // uncomment below to test the property + //modelInstance.arrayArrayOfInteger shouldBe ("TODO") + } + + // to test the property `arrayArrayOfModel` + should("test arrayArrayOfModel") { + // uncomment below to test the property + //modelInstance.arrayArrayOfModel shouldBe ("TODO") + } + + } +} diff --git a/samples/openapi3/client/petstore/kotlin/src/test/kotlin/org/openapitools/client/models/CapitalizationTest.kt b/samples/openapi3/client/petstore/kotlin/src/test/kotlin/org/openapitools/client/models/CapitalizationTest.kt new file mode 100644 index 000000000000..b9366c2643c8 --- /dev/null +++ b/samples/openapi3/client/petstore/kotlin/src/test/kotlin/org/openapitools/client/models/CapitalizationTest.kt @@ -0,0 +1,73 @@ +/** + * + * Please note: + * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * Do not edit this file manually. + * + */ + +@file:Suppress( + "ArrayInDataClass", + "DuplicatedCode", + "EnumEntryName", + "RemoveRedundantQualifierName", + "RemoveRedundantCallsOfConversionMethods", + "REDUNDANT_CALL_OF_CONVERSION_METHOD", + "RedundantUnitReturnType", + "RemoveEmptyClassBody", + "UnnecessaryVariable", + "UnusedImport", + "UnnecessaryVariable", + "unused" +) + +package org.openapitools.client.models + +import io.kotlintest.shouldBe +import io.kotlintest.specs.ShouldSpec + +import org.openapitools.client.models.Capitalization + +class CapitalizationTest : ShouldSpec() { + init { + // uncomment below to create an instance of Capitalization + //val modelInstance = Capitalization() + + // to test the property `smallCamel` + should("test smallCamel") { + // uncomment below to test the property + //modelInstance.smallCamel shouldBe ("TODO") + } + + // to test the property `capitalCamel` + should("test capitalCamel") { + // uncomment below to test the property + //modelInstance.capitalCamel shouldBe ("TODO") + } + + // to test the property `smallSnake` + should("test smallSnake") { + // uncomment below to test the property + //modelInstance.smallSnake shouldBe ("TODO") + } + + // to test the property `capitalSnake` + should("test capitalSnake") { + // uncomment below to test the property + //modelInstance.capitalSnake shouldBe ("TODO") + } + + // to test the property `scAETHFlowPoints` + should("test scAETHFlowPoints") { + // uncomment below to test the property + //modelInstance.scAETHFlowPoints shouldBe ("TODO") + } + + // to test the property `ATT_NAME` - Name of the pet + should("test ATT_NAME") { + // uncomment below to test the property + //modelInstance.ATT_NAME shouldBe ("TODO") + } + + } +} diff --git a/samples/openapi3/client/petstore/kotlin/src/test/kotlin/org/openapitools/client/models/CatTest.kt b/samples/openapi3/client/petstore/kotlin/src/test/kotlin/org/openapitools/client/models/CatTest.kt new file mode 100644 index 000000000000..bc7052d2ecb9 --- /dev/null +++ b/samples/openapi3/client/petstore/kotlin/src/test/kotlin/org/openapitools/client/models/CatTest.kt @@ -0,0 +1,44 @@ +/** + * + * Please note: + * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * Do not edit this file manually. + * + */ + +@file:Suppress( + "ArrayInDataClass", + "DuplicatedCode", + "EnumEntryName", + "RemoveRedundantQualifierName", + "RemoveRedundantCallsOfConversionMethods", + "REDUNDANT_CALL_OF_CONVERSION_METHOD", + "RedundantUnitReturnType", + "RemoveEmptyClassBody", + "UnnecessaryVariable", + "UnusedImport", + "UnnecessaryVariable", + "unused" +) + +package org.openapitools.client.models + +import io.kotlintest.shouldBe +import io.kotlintest.specs.ShouldSpec + +import org.openapitools.client.models.Cat +import org.openapitools.client.models.Animal + +class CatTest : ShouldSpec() { + init { + // uncomment below to create an instance of Cat + //val modelInstance = Cat() + + // to test the property `declawed` + should("test declawed") { + // uncomment below to test the property + //modelInstance.declawed shouldBe ("TODO") + } + + } +} diff --git a/samples/openapi3/client/petstore/kotlin/src/test/kotlin/org/openapitools/client/models/CategoryTest.kt b/samples/openapi3/client/petstore/kotlin/src/test/kotlin/org/openapitools/client/models/CategoryTest.kt new file mode 100644 index 000000000000..494320683550 --- /dev/null +++ b/samples/openapi3/client/petstore/kotlin/src/test/kotlin/org/openapitools/client/models/CategoryTest.kt @@ -0,0 +1,49 @@ +/** + * + * Please note: + * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * Do not edit this file manually. + * + */ + +@file:Suppress( + "ArrayInDataClass", + "DuplicatedCode", + "EnumEntryName", + "RemoveRedundantQualifierName", + "RemoveRedundantCallsOfConversionMethods", + "REDUNDANT_CALL_OF_CONVERSION_METHOD", + "RedundantUnitReturnType", + "RemoveEmptyClassBody", + "UnnecessaryVariable", + "UnusedImport", + "UnnecessaryVariable", + "unused" +) + +package org.openapitools.client.models + +import io.kotlintest.shouldBe +import io.kotlintest.specs.ShouldSpec + +import org.openapitools.client.models.Category + +class CategoryTest : ShouldSpec() { + init { + // uncomment below to create an instance of Category + //val modelInstance = Category() + + // to test the property `name` + should("test name") { + // uncomment below to test the property + //modelInstance.name shouldBe ("TODO") + } + + // to test the property `id` + should("test id") { + // uncomment below to test the property + //modelInstance.id shouldBe ("TODO") + } + + } +} diff --git a/samples/openapi3/client/petstore/kotlin/src/test/kotlin/org/openapitools/client/models/ChildWithNullableTest.kt b/samples/openapi3/client/petstore/kotlin/src/test/kotlin/org/openapitools/client/models/ChildWithNullableTest.kt new file mode 100644 index 000000000000..4d8952916e7f --- /dev/null +++ b/samples/openapi3/client/petstore/kotlin/src/test/kotlin/org/openapitools/client/models/ChildWithNullableTest.kt @@ -0,0 +1,44 @@ +/** + * + * Please note: + * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * Do not edit this file manually. + * + */ + +@file:Suppress( + "ArrayInDataClass", + "DuplicatedCode", + "EnumEntryName", + "RemoveRedundantQualifierName", + "RemoveRedundantCallsOfConversionMethods", + "REDUNDANT_CALL_OF_CONVERSION_METHOD", + "RedundantUnitReturnType", + "RemoveEmptyClassBody", + "UnnecessaryVariable", + "UnusedImport", + "UnnecessaryVariable", + "unused" +) + +package org.openapitools.client.models + +import io.kotlintest.shouldBe +import io.kotlintest.specs.ShouldSpec + +import org.openapitools.client.models.ChildWithNullable +import org.openapitools.client.models.ParentWithNullable + +class ChildWithNullableTest : ShouldSpec() { + init { + // uncomment below to create an instance of ChildWithNullable + //val modelInstance = ChildWithNullable() + + // to test the property `otherProperty` + should("test otherProperty") { + // uncomment below to test the property + //modelInstance.otherProperty shouldBe ("TODO") + } + + } +} diff --git a/samples/openapi3/client/petstore/kotlin/src/test/kotlin/org/openapitools/client/models/ClassModelTest.kt b/samples/openapi3/client/petstore/kotlin/src/test/kotlin/org/openapitools/client/models/ClassModelTest.kt new file mode 100644 index 000000000000..f8617f32a4e1 --- /dev/null +++ b/samples/openapi3/client/petstore/kotlin/src/test/kotlin/org/openapitools/client/models/ClassModelTest.kt @@ -0,0 +1,43 @@ +/** + * + * Please note: + * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * Do not edit this file manually. + * + */ + +@file:Suppress( + "ArrayInDataClass", + "DuplicatedCode", + "EnumEntryName", + "RemoveRedundantQualifierName", + "RemoveRedundantCallsOfConversionMethods", + "REDUNDANT_CALL_OF_CONVERSION_METHOD", + "RedundantUnitReturnType", + "RemoveEmptyClassBody", + "UnnecessaryVariable", + "UnusedImport", + "UnnecessaryVariable", + "unused" +) + +package org.openapitools.client.models + +import io.kotlintest.shouldBe +import io.kotlintest.specs.ShouldSpec + +import org.openapitools.client.models.ClassModel + +class ClassModelTest : ShouldSpec() { + init { + // uncomment below to create an instance of ClassModel + //val modelInstance = ClassModel() + + // to test the property `propertyClass` + should("test propertyClass") { + // uncomment below to test the property + //modelInstance.propertyClass shouldBe ("TODO") + } + + } +} diff --git a/samples/openapi3/client/petstore/kotlin/src/test/kotlin/org/openapitools/client/models/ClientTest.kt b/samples/openapi3/client/petstore/kotlin/src/test/kotlin/org/openapitools/client/models/ClientTest.kt new file mode 100644 index 000000000000..0879e5731711 --- /dev/null +++ b/samples/openapi3/client/petstore/kotlin/src/test/kotlin/org/openapitools/client/models/ClientTest.kt @@ -0,0 +1,43 @@ +/** + * + * Please note: + * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * Do not edit this file manually. + * + */ + +@file:Suppress( + "ArrayInDataClass", + "DuplicatedCode", + "EnumEntryName", + "RemoveRedundantQualifierName", + "RemoveRedundantCallsOfConversionMethods", + "REDUNDANT_CALL_OF_CONVERSION_METHOD", + "RedundantUnitReturnType", + "RemoveEmptyClassBody", + "UnnecessaryVariable", + "UnusedImport", + "UnnecessaryVariable", + "unused" +) + +package org.openapitools.client.models + +import io.kotlintest.shouldBe +import io.kotlintest.specs.ShouldSpec + +import org.openapitools.client.models.Client + +class ClientTest : ShouldSpec() { + init { + // uncomment below to create an instance of Client + //val modelInstance = Client() + + // to test the property `client` + should("test client") { + // uncomment below to test the property + //modelInstance.client shouldBe ("TODO") + } + + } +} diff --git a/samples/openapi3/client/petstore/kotlin/src/test/kotlin/org/openapitools/client/models/DeprecatedObjectTest.kt b/samples/openapi3/client/petstore/kotlin/src/test/kotlin/org/openapitools/client/models/DeprecatedObjectTest.kt new file mode 100644 index 000000000000..3e22ee97a8cd --- /dev/null +++ b/samples/openapi3/client/petstore/kotlin/src/test/kotlin/org/openapitools/client/models/DeprecatedObjectTest.kt @@ -0,0 +1,43 @@ +/** + * + * Please note: + * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * Do not edit this file manually. + * + */ + +@file:Suppress( + "ArrayInDataClass", + "DuplicatedCode", + "EnumEntryName", + "RemoveRedundantQualifierName", + "RemoveRedundantCallsOfConversionMethods", + "REDUNDANT_CALL_OF_CONVERSION_METHOD", + "RedundantUnitReturnType", + "RemoveEmptyClassBody", + "UnnecessaryVariable", + "UnusedImport", + "UnnecessaryVariable", + "unused" +) + +package org.openapitools.client.models + +import io.kotlintest.shouldBe +import io.kotlintest.specs.ShouldSpec + +import org.openapitools.client.models.DeprecatedObject + +class DeprecatedObjectTest : ShouldSpec() { + init { + // uncomment below to create an instance of DeprecatedObject + //val modelInstance = DeprecatedObject() + + // to test the property `name` + should("test name") { + // uncomment below to test the property + //modelInstance.name shouldBe ("TODO") + } + + } +} diff --git a/samples/openapi3/client/petstore/kotlin/src/test/kotlin/org/openapitools/client/models/DogTest.kt b/samples/openapi3/client/petstore/kotlin/src/test/kotlin/org/openapitools/client/models/DogTest.kt new file mode 100644 index 000000000000..76af918dbd32 --- /dev/null +++ b/samples/openapi3/client/petstore/kotlin/src/test/kotlin/org/openapitools/client/models/DogTest.kt @@ -0,0 +1,44 @@ +/** + * + * Please note: + * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * Do not edit this file manually. + * + */ + +@file:Suppress( + "ArrayInDataClass", + "DuplicatedCode", + "EnumEntryName", + "RemoveRedundantQualifierName", + "RemoveRedundantCallsOfConversionMethods", + "REDUNDANT_CALL_OF_CONVERSION_METHOD", + "RedundantUnitReturnType", + "RemoveEmptyClassBody", + "UnnecessaryVariable", + "UnusedImport", + "UnnecessaryVariable", + "unused" +) + +package org.openapitools.client.models + +import io.kotlintest.shouldBe +import io.kotlintest.specs.ShouldSpec + +import org.openapitools.client.models.Dog +import org.openapitools.client.models.Animal + +class DogTest : ShouldSpec() { + init { + // uncomment below to create an instance of Dog + //val modelInstance = Dog() + + // to test the property `breed` + should("test breed") { + // uncomment below to test the property + //modelInstance.breed shouldBe ("TODO") + } + + } +} diff --git a/samples/openapi3/client/petstore/kotlin/src/test/kotlin/org/openapitools/client/models/EnumArraysTest.kt b/samples/openapi3/client/petstore/kotlin/src/test/kotlin/org/openapitools/client/models/EnumArraysTest.kt new file mode 100644 index 000000000000..66595f2c46d5 --- /dev/null +++ b/samples/openapi3/client/petstore/kotlin/src/test/kotlin/org/openapitools/client/models/EnumArraysTest.kt @@ -0,0 +1,49 @@ +/** + * + * Please note: + * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * Do not edit this file manually. + * + */ + +@file:Suppress( + "ArrayInDataClass", + "DuplicatedCode", + "EnumEntryName", + "RemoveRedundantQualifierName", + "RemoveRedundantCallsOfConversionMethods", + "REDUNDANT_CALL_OF_CONVERSION_METHOD", + "RedundantUnitReturnType", + "RemoveEmptyClassBody", + "UnnecessaryVariable", + "UnusedImport", + "UnnecessaryVariable", + "unused" +) + +package org.openapitools.client.models + +import io.kotlintest.shouldBe +import io.kotlintest.specs.ShouldSpec + +import org.openapitools.client.models.EnumArrays + +class EnumArraysTest : ShouldSpec() { + init { + // uncomment below to create an instance of EnumArrays + //val modelInstance = EnumArrays() + + // to test the property `justSymbol` + should("test justSymbol") { + // uncomment below to test the property + //modelInstance.justSymbol shouldBe ("TODO") + } + + // to test the property `arrayEnum` + should("test arrayEnum") { + // uncomment below to test the property + //modelInstance.arrayEnum shouldBe ("TODO") + } + + } +} diff --git a/samples/openapi3/client/petstore/kotlin/src/test/kotlin/org/openapitools/client/models/EnumClassTest.kt b/samples/openapi3/client/petstore/kotlin/src/test/kotlin/org/openapitools/client/models/EnumClassTest.kt new file mode 100644 index 000000000000..b4a9109b9f4c --- /dev/null +++ b/samples/openapi3/client/petstore/kotlin/src/test/kotlin/org/openapitools/client/models/EnumClassTest.kt @@ -0,0 +1,37 @@ +/** + * + * Please note: + * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * Do not edit this file manually. + * + */ + +@file:Suppress( + "ArrayInDataClass", + "DuplicatedCode", + "EnumEntryName", + "RemoveRedundantQualifierName", + "RemoveRedundantCallsOfConversionMethods", + "REDUNDANT_CALL_OF_CONVERSION_METHOD", + "RedundantUnitReturnType", + "RemoveEmptyClassBody", + "UnnecessaryVariable", + "UnusedImport", + "UnnecessaryVariable", + "unused" +) + +package org.openapitools.client.models + +import io.kotlintest.shouldBe +import io.kotlintest.specs.ShouldSpec + +import org.openapitools.client.models.EnumClass + +class EnumClassTest : ShouldSpec() { + init { + // uncomment below to create an instance of EnumClass + //val modelInstance = EnumClass() + + } +} diff --git a/samples/openapi3/client/petstore/kotlin/src/test/kotlin/org/openapitools/client/models/EnumTestTest.kt b/samples/openapi3/client/petstore/kotlin/src/test/kotlin/org/openapitools/client/models/EnumTestTest.kt new file mode 100644 index 000000000000..cb48b0d3360c --- /dev/null +++ b/samples/openapi3/client/petstore/kotlin/src/test/kotlin/org/openapitools/client/models/EnumTestTest.kt @@ -0,0 +1,89 @@ +/** + * + * Please note: + * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * Do not edit this file manually. + * + */ + +@file:Suppress( + "ArrayInDataClass", + "DuplicatedCode", + "EnumEntryName", + "RemoveRedundantQualifierName", + "RemoveRedundantCallsOfConversionMethods", + "REDUNDANT_CALL_OF_CONVERSION_METHOD", + "RedundantUnitReturnType", + "RemoveEmptyClassBody", + "UnnecessaryVariable", + "UnusedImport", + "UnnecessaryVariable", + "unused" +) + +package org.openapitools.client.models + +import io.kotlintest.shouldBe +import io.kotlintest.specs.ShouldSpec + +import org.openapitools.client.models.EnumTest +import org.openapitools.client.models.OuterEnum +import org.openapitools.client.models.OuterEnumDefaultValue +import org.openapitools.client.models.OuterEnumInteger +import org.openapitools.client.models.OuterEnumIntegerDefaultValue + +class EnumTestTest : ShouldSpec() { + init { + // uncomment below to create an instance of EnumTest + //val modelInstance = EnumTest() + + // to test the property `enumStringRequired` + should("test enumStringRequired") { + // uncomment below to test the property + //modelInstance.enumStringRequired shouldBe ("TODO") + } + + // to test the property `enumString` + should("test enumString") { + // uncomment below to test the property + //modelInstance.enumString shouldBe ("TODO") + } + + // to test the property `enumInteger` + should("test enumInteger") { + // uncomment below to test the property + //modelInstance.enumInteger shouldBe ("TODO") + } + + // to test the property `enumNumber` + should("test enumNumber") { + // uncomment below to test the property + //modelInstance.enumNumber shouldBe ("TODO") + } + + // to test the property `outerEnum` + should("test outerEnum") { + // uncomment below to test the property + //modelInstance.outerEnum shouldBe ("TODO") + } + + // to test the property `outerEnumInteger` + should("test outerEnumInteger") { + // uncomment below to test the property + //modelInstance.outerEnumInteger shouldBe ("TODO") + } + + // to test the property `outerEnumDefaultValue` + should("test outerEnumDefaultValue") { + // uncomment below to test the property + //modelInstance.outerEnumDefaultValue shouldBe ("TODO") + } + + // to test the property `outerEnumIntegerDefaultValue` + should("test outerEnumIntegerDefaultValue") { + // uncomment below to test the property + //modelInstance.outerEnumIntegerDefaultValue shouldBe ("TODO") + } + + } +} diff --git a/samples/openapi3/client/petstore/kotlin/src/test/kotlin/org/openapitools/client/models/FakeBigDecimalMap200ResponseTest.kt b/samples/openapi3/client/petstore/kotlin/src/test/kotlin/org/openapitools/client/models/FakeBigDecimalMap200ResponseTest.kt new file mode 100644 index 000000000000..c6148b94b09b --- /dev/null +++ b/samples/openapi3/client/petstore/kotlin/src/test/kotlin/org/openapitools/client/models/FakeBigDecimalMap200ResponseTest.kt @@ -0,0 +1,49 @@ +/** + * + * Please note: + * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * Do not edit this file manually. + * + */ + +@file:Suppress( + "ArrayInDataClass", + "DuplicatedCode", + "EnumEntryName", + "RemoveRedundantQualifierName", + "RemoveRedundantCallsOfConversionMethods", + "REDUNDANT_CALL_OF_CONVERSION_METHOD", + "RedundantUnitReturnType", + "RemoveEmptyClassBody", + "UnnecessaryVariable", + "UnusedImport", + "UnnecessaryVariable", + "unused" +) + +package org.openapitools.client.models + +import io.kotlintest.shouldBe +import io.kotlintest.specs.ShouldSpec + +import org.openapitools.client.models.FakeBigDecimalMap200Response + +class FakeBigDecimalMap200ResponseTest : ShouldSpec() { + init { + // uncomment below to create an instance of FakeBigDecimalMap200Response + //val modelInstance = FakeBigDecimalMap200Response() + + // to test the property `someId` + should("test someId") { + // uncomment below to test the property + //modelInstance.someId shouldBe ("TODO") + } + + // to test the property `someMap` + should("test someMap") { + // uncomment below to test the property + //modelInstance.someMap shouldBe ("TODO") + } + + } +} diff --git a/samples/openapi3/client/petstore/kotlin/src/test/kotlin/org/openapitools/client/models/FileSchemaTestClassTest.kt b/samples/openapi3/client/petstore/kotlin/src/test/kotlin/org/openapitools/client/models/FileSchemaTestClassTest.kt new file mode 100644 index 000000000000..bfc4143c7ed9 --- /dev/null +++ b/samples/openapi3/client/petstore/kotlin/src/test/kotlin/org/openapitools/client/models/FileSchemaTestClassTest.kt @@ -0,0 +1,49 @@ +/** + * + * Please note: + * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * Do not edit this file manually. + * + */ + +@file:Suppress( + "ArrayInDataClass", + "DuplicatedCode", + "EnumEntryName", + "RemoveRedundantQualifierName", + "RemoveRedundantCallsOfConversionMethods", + "REDUNDANT_CALL_OF_CONVERSION_METHOD", + "RedundantUnitReturnType", + "RemoveEmptyClassBody", + "UnnecessaryVariable", + "UnusedImport", + "UnnecessaryVariable", + "unused" +) + +package org.openapitools.client.models + +import io.kotlintest.shouldBe +import io.kotlintest.specs.ShouldSpec + +import org.openapitools.client.models.FileSchemaTestClass + +class FileSchemaTestClassTest : ShouldSpec() { + init { + // uncomment below to create an instance of FileSchemaTestClass + //val modelInstance = FileSchemaTestClass() + + // to test the property `file` + should("test file") { + // uncomment below to test the property + //modelInstance.file shouldBe ("TODO") + } + + // to test the property `files` + should("test files") { + // uncomment below to test the property + //modelInstance.files shouldBe ("TODO") + } + + } +} diff --git a/samples/openapi3/client/petstore/kotlin/src/test/kotlin/org/openapitools/client/models/FileTest.kt b/samples/openapi3/client/petstore/kotlin/src/test/kotlin/org/openapitools/client/models/FileTest.kt new file mode 100644 index 000000000000..801c4a851121 --- /dev/null +++ b/samples/openapi3/client/petstore/kotlin/src/test/kotlin/org/openapitools/client/models/FileTest.kt @@ -0,0 +1,43 @@ +/** + * + * Please note: + * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * Do not edit this file manually. + * + */ + +@file:Suppress( + "ArrayInDataClass", + "DuplicatedCode", + "EnumEntryName", + "RemoveRedundantQualifierName", + "RemoveRedundantCallsOfConversionMethods", + "REDUNDANT_CALL_OF_CONVERSION_METHOD", + "RedundantUnitReturnType", + "RemoveEmptyClassBody", + "UnnecessaryVariable", + "UnusedImport", + "UnnecessaryVariable", + "unused" +) + +package org.openapitools.client.models + +import io.kotlintest.shouldBe +import io.kotlintest.specs.ShouldSpec + +import org.openapitools.client.models.java.io.File + +class java.io.FileTest : ShouldSpec() { + init { + // uncomment below to create an instance of java.io.File + //val modelInstance = java.io.File() + + // to test the property `sourceURI` - Test capitalization + should("test sourceURI") { + // uncomment below to test the property + //modelInstance.sourceURI shouldBe ("TODO") + } + + } +} diff --git a/samples/openapi3/client/petstore/kotlin/src/test/kotlin/org/openapitools/client/models/FooGetDefaultResponseTest.kt b/samples/openapi3/client/petstore/kotlin/src/test/kotlin/org/openapitools/client/models/FooGetDefaultResponseTest.kt new file mode 100644 index 000000000000..cde271de241e --- /dev/null +++ b/samples/openapi3/client/petstore/kotlin/src/test/kotlin/org/openapitools/client/models/FooGetDefaultResponseTest.kt @@ -0,0 +1,44 @@ +/** + * + * Please note: + * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * Do not edit this file manually. + * + */ + +@file:Suppress( + "ArrayInDataClass", + "DuplicatedCode", + "EnumEntryName", + "RemoveRedundantQualifierName", + "RemoveRedundantCallsOfConversionMethods", + "REDUNDANT_CALL_OF_CONVERSION_METHOD", + "RedundantUnitReturnType", + "RemoveEmptyClassBody", + "UnnecessaryVariable", + "UnusedImport", + "UnnecessaryVariable", + "unused" +) + +package org.openapitools.client.models + +import io.kotlintest.shouldBe +import io.kotlintest.specs.ShouldSpec + +import org.openapitools.client.models.FooGetDefaultResponse +import org.openapitools.client.models.Foo + +class FooGetDefaultResponseTest : ShouldSpec() { + init { + // uncomment below to create an instance of FooGetDefaultResponse + //val modelInstance = FooGetDefaultResponse() + + // to test the property `string` + should("test string") { + // uncomment below to test the property + //modelInstance.string shouldBe ("TODO") + } + + } +} diff --git a/samples/openapi3/client/petstore/kotlin/src/test/kotlin/org/openapitools/client/models/FooTest.kt b/samples/openapi3/client/petstore/kotlin/src/test/kotlin/org/openapitools/client/models/FooTest.kt new file mode 100644 index 000000000000..8c6df4317e81 --- /dev/null +++ b/samples/openapi3/client/petstore/kotlin/src/test/kotlin/org/openapitools/client/models/FooTest.kt @@ -0,0 +1,43 @@ +/** + * + * Please note: + * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * Do not edit this file manually. + * + */ + +@file:Suppress( + "ArrayInDataClass", + "DuplicatedCode", + "EnumEntryName", + "RemoveRedundantQualifierName", + "RemoveRedundantCallsOfConversionMethods", + "REDUNDANT_CALL_OF_CONVERSION_METHOD", + "RedundantUnitReturnType", + "RemoveEmptyClassBody", + "UnnecessaryVariable", + "UnusedImport", + "UnnecessaryVariable", + "unused" +) + +package org.openapitools.client.models + +import io.kotlintest.shouldBe +import io.kotlintest.specs.ShouldSpec + +import org.openapitools.client.models.Foo + +class FooTest : ShouldSpec() { + init { + // uncomment below to create an instance of Foo + //val modelInstance = Foo() + + // to test the property `bar` + should("test bar") { + // uncomment below to test the property + //modelInstance.bar shouldBe ("TODO") + } + + } +} diff --git a/samples/openapi3/client/petstore/kotlin/src/test/kotlin/org/openapitools/client/models/FormatTestTest.kt b/samples/openapi3/client/petstore/kotlin/src/test/kotlin/org/openapitools/client/models/FormatTestTest.kt new file mode 100644 index 000000000000..853c240d934c --- /dev/null +++ b/samples/openapi3/client/petstore/kotlin/src/test/kotlin/org/openapitools/client/models/FormatTestTest.kt @@ -0,0 +1,133 @@ +/** + * + * Please note: + * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * Do not edit this file manually. + * + */ + +@file:Suppress( + "ArrayInDataClass", + "DuplicatedCode", + "EnumEntryName", + "RemoveRedundantQualifierName", + "RemoveRedundantCallsOfConversionMethods", + "REDUNDANT_CALL_OF_CONVERSION_METHOD", + "RedundantUnitReturnType", + "RemoveEmptyClassBody", + "UnnecessaryVariable", + "UnusedImport", + "UnnecessaryVariable", + "unused" +) + +package org.openapitools.client.models + +import io.kotlintest.shouldBe +import io.kotlintest.specs.ShouldSpec + +import org.openapitools.client.models.FormatTest + +class FormatTestTest : ShouldSpec() { + init { + // uncomment below to create an instance of FormatTest + //val modelInstance = FormatTest() + + // to test the property `number` + should("test number") { + // uncomment below to test the property + //modelInstance.number shouldBe ("TODO") + } + + // to test the property `byte` + should("test byte") { + // uncomment below to test the property + //modelInstance.byte shouldBe ("TODO") + } + + // to test the property `date` + should("test date") { + // uncomment below to test the property + //modelInstance.date shouldBe ("TODO") + } + + // to test the property `password` + should("test password") { + // uncomment below to test the property + //modelInstance.password shouldBe ("TODO") + } + + // to test the property `integer` + should("test integer") { + // uncomment below to test the property + //modelInstance.integer shouldBe ("TODO") + } + + // to test the property `int32` + should("test int32") { + // uncomment below to test the property + //modelInstance.int32 shouldBe ("TODO") + } + + // to test the property `int64` + should("test int64") { + // uncomment below to test the property + //modelInstance.int64 shouldBe ("TODO") + } + + // to test the property `float` + should("test float") { + // uncomment below to test the property + //modelInstance.float shouldBe ("TODO") + } + + // to test the property `double` + should("test double") { + // uncomment below to test the property + //modelInstance.double shouldBe ("TODO") + } + + // to test the property `decimal` + should("test decimal") { + // uncomment below to test the property + //modelInstance.decimal shouldBe ("TODO") + } + + // to test the property `string` + should("test string") { + // uncomment below to test the property + //modelInstance.string shouldBe ("TODO") + } + + // to test the property `binary` + should("test binary") { + // uncomment below to test the property + //modelInstance.binary shouldBe ("TODO") + } + + // to test the property `dateTime` + should("test dateTime") { + // uncomment below to test the property + //modelInstance.dateTime shouldBe ("TODO") + } + + // to test the property `uuid` + should("test uuid") { + // uncomment below to test the property + //modelInstance.uuid shouldBe ("TODO") + } + + // to test the property `patternWithDigits` - A string that is a 10 digit number. Can have leading zeros. + should("test patternWithDigits") { + // uncomment below to test the property + //modelInstance.patternWithDigits shouldBe ("TODO") + } + + // to test the property `patternWithDigitsAndDelimiter` - A string starting with 'image_' (case insensitive) and one to three digits following i.e. Image_01. + should("test patternWithDigitsAndDelimiter") { + // uncomment below to test the property + //modelInstance.patternWithDigitsAndDelimiter shouldBe ("TODO") + } + + } +} diff --git a/samples/openapi3/client/petstore/kotlin/src/test/kotlin/org/openapitools/client/models/HasOnlyReadOnlyTest.kt b/samples/openapi3/client/petstore/kotlin/src/test/kotlin/org/openapitools/client/models/HasOnlyReadOnlyTest.kt new file mode 100644 index 000000000000..689ab280072c --- /dev/null +++ b/samples/openapi3/client/petstore/kotlin/src/test/kotlin/org/openapitools/client/models/HasOnlyReadOnlyTest.kt @@ -0,0 +1,49 @@ +/** + * + * Please note: + * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * Do not edit this file manually. + * + */ + +@file:Suppress( + "ArrayInDataClass", + "DuplicatedCode", + "EnumEntryName", + "RemoveRedundantQualifierName", + "RemoveRedundantCallsOfConversionMethods", + "REDUNDANT_CALL_OF_CONVERSION_METHOD", + "RedundantUnitReturnType", + "RemoveEmptyClassBody", + "UnnecessaryVariable", + "UnusedImport", + "UnnecessaryVariable", + "unused" +) + +package org.openapitools.client.models + +import io.kotlintest.shouldBe +import io.kotlintest.specs.ShouldSpec + +import org.openapitools.client.models.HasOnlyReadOnly + +class HasOnlyReadOnlyTest : ShouldSpec() { + init { + // uncomment below to create an instance of HasOnlyReadOnly + //val modelInstance = HasOnlyReadOnly() + + // to test the property `bar` + should("test bar") { + // uncomment below to test the property + //modelInstance.bar shouldBe ("TODO") + } + + // to test the property `foo` + should("test foo") { + // uncomment below to test the property + //modelInstance.foo shouldBe ("TODO") + } + + } +} diff --git a/samples/openapi3/client/petstore/kotlin/src/test/kotlin/org/openapitools/client/models/HealthCheckResultTest.kt b/samples/openapi3/client/petstore/kotlin/src/test/kotlin/org/openapitools/client/models/HealthCheckResultTest.kt new file mode 100644 index 000000000000..83ccfff2d844 --- /dev/null +++ b/samples/openapi3/client/petstore/kotlin/src/test/kotlin/org/openapitools/client/models/HealthCheckResultTest.kt @@ -0,0 +1,43 @@ +/** + * + * Please note: + * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * Do not edit this file manually. + * + */ + +@file:Suppress( + "ArrayInDataClass", + "DuplicatedCode", + "EnumEntryName", + "RemoveRedundantQualifierName", + "RemoveRedundantCallsOfConversionMethods", + "REDUNDANT_CALL_OF_CONVERSION_METHOD", + "RedundantUnitReturnType", + "RemoveEmptyClassBody", + "UnnecessaryVariable", + "UnusedImport", + "UnnecessaryVariable", + "unused" +) + +package org.openapitools.client.models + +import io.kotlintest.shouldBe +import io.kotlintest.specs.ShouldSpec + +import org.openapitools.client.models.HealthCheckResult + +class HealthCheckResultTest : ShouldSpec() { + init { + // uncomment below to create an instance of HealthCheckResult + //val modelInstance = HealthCheckResult() + + // to test the property `nullableMessage` + should("test nullableMessage") { + // uncomment below to test the property + //modelInstance.nullableMessage shouldBe ("TODO") + } + + } +} diff --git a/samples/openapi3/client/petstore/kotlin/src/test/kotlin/org/openapitools/client/models/ListTest.kt b/samples/openapi3/client/petstore/kotlin/src/test/kotlin/org/openapitools/client/models/ListTest.kt new file mode 100644 index 000000000000..8f804220ad49 --- /dev/null +++ b/samples/openapi3/client/petstore/kotlin/src/test/kotlin/org/openapitools/client/models/ListTest.kt @@ -0,0 +1,43 @@ +/** + * + * Please note: + * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * Do not edit this file manually. + * + */ + +@file:Suppress( + "ArrayInDataClass", + "DuplicatedCode", + "EnumEntryName", + "RemoveRedundantQualifierName", + "RemoveRedundantCallsOfConversionMethods", + "REDUNDANT_CALL_OF_CONVERSION_METHOD", + "RedundantUnitReturnType", + "RemoveEmptyClassBody", + "UnnecessaryVariable", + "UnusedImport", + "UnnecessaryVariable", + "unused" +) + +package org.openapitools.client.models + +import io.kotlintest.shouldBe +import io.kotlintest.specs.ShouldSpec + +import org.openapitools.client.models.List + +class ListTest : ShouldSpec() { + init { + // uncomment below to create an instance of List + //val modelInstance = List() + + // to test the property ``123list`` + should("test `123list`") { + // uncomment below to test the property + //modelInstance.`123list` shouldBe ("TODO") + } + + } +} diff --git a/samples/openapi3/client/petstore/kotlin/src/test/kotlin/org/openapitools/client/models/MapTestTest.kt b/samples/openapi3/client/petstore/kotlin/src/test/kotlin/org/openapitools/client/models/MapTestTest.kt new file mode 100644 index 000000000000..a17a95e32fe0 --- /dev/null +++ b/samples/openapi3/client/petstore/kotlin/src/test/kotlin/org/openapitools/client/models/MapTestTest.kt @@ -0,0 +1,61 @@ +/** + * + * Please note: + * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * Do not edit this file manually. + * + */ + +@file:Suppress( + "ArrayInDataClass", + "DuplicatedCode", + "EnumEntryName", + "RemoveRedundantQualifierName", + "RemoveRedundantCallsOfConversionMethods", + "REDUNDANT_CALL_OF_CONVERSION_METHOD", + "RedundantUnitReturnType", + "RemoveEmptyClassBody", + "UnnecessaryVariable", + "UnusedImport", + "UnnecessaryVariable", + "unused" +) + +package org.openapitools.client.models + +import io.kotlintest.shouldBe +import io.kotlintest.specs.ShouldSpec + +import org.openapitools.client.models.MapTest + +class MapTestTest : ShouldSpec() { + init { + // uncomment below to create an instance of MapTest + //val modelInstance = MapTest() + + // to test the property `mapMapOfString` + should("test mapMapOfString") { + // uncomment below to test the property + //modelInstance.mapMapOfString shouldBe ("TODO") + } + + // to test the property `mapOfEnumString` + should("test mapOfEnumString") { + // uncomment below to test the property + //modelInstance.mapOfEnumString shouldBe ("TODO") + } + + // to test the property `directMap` + should("test directMap") { + // uncomment below to test the property + //modelInstance.directMap shouldBe ("TODO") + } + + // to test the property `indirectMap` + should("test indirectMap") { + // uncomment below to test the property + //modelInstance.indirectMap shouldBe ("TODO") + } + + } +} diff --git a/samples/openapi3/client/petstore/kotlin/src/test/kotlin/org/openapitools/client/models/MixedPropertiesAndAdditionalPropertiesClassTest.kt b/samples/openapi3/client/petstore/kotlin/src/test/kotlin/org/openapitools/client/models/MixedPropertiesAndAdditionalPropertiesClassTest.kt new file mode 100644 index 000000000000..33cc906f1b2c --- /dev/null +++ b/samples/openapi3/client/petstore/kotlin/src/test/kotlin/org/openapitools/client/models/MixedPropertiesAndAdditionalPropertiesClassTest.kt @@ -0,0 +1,56 @@ +/** + * + * Please note: + * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * Do not edit this file manually. + * + */ + +@file:Suppress( + "ArrayInDataClass", + "DuplicatedCode", + "EnumEntryName", + "RemoveRedundantQualifierName", + "RemoveRedundantCallsOfConversionMethods", + "REDUNDANT_CALL_OF_CONVERSION_METHOD", + "RedundantUnitReturnType", + "RemoveEmptyClassBody", + "UnnecessaryVariable", + "UnusedImport", + "UnnecessaryVariable", + "unused" +) + +package org.openapitools.client.models + +import io.kotlintest.shouldBe +import io.kotlintest.specs.ShouldSpec + +import org.openapitools.client.models.MixedPropertiesAndAdditionalPropertiesClass +import org.openapitools.client.models.Animal + +class MixedPropertiesAndAdditionalPropertiesClassTest : ShouldSpec() { + init { + // uncomment below to create an instance of MixedPropertiesAndAdditionalPropertiesClass + //val modelInstance = MixedPropertiesAndAdditionalPropertiesClass() + + // to test the property `uuid` + should("test uuid") { + // uncomment below to test the property + //modelInstance.uuid shouldBe ("TODO") + } + + // to test the property `dateTime` + should("test dateTime") { + // uncomment below to test the property + //modelInstance.dateTime shouldBe ("TODO") + } + + // to test the property `map` + should("test map") { + // uncomment below to test the property + //modelInstance.map shouldBe ("TODO") + } + + } +} diff --git a/samples/openapi3/client/petstore/kotlin/src/test/kotlin/org/openapitools/client/models/NameTest.kt b/samples/openapi3/client/petstore/kotlin/src/test/kotlin/org/openapitools/client/models/NameTest.kt new file mode 100644 index 000000000000..832940190db6 --- /dev/null +++ b/samples/openapi3/client/petstore/kotlin/src/test/kotlin/org/openapitools/client/models/NameTest.kt @@ -0,0 +1,61 @@ +/** + * + * Please note: + * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * Do not edit this file manually. + * + */ + +@file:Suppress( + "ArrayInDataClass", + "DuplicatedCode", + "EnumEntryName", + "RemoveRedundantQualifierName", + "RemoveRedundantCallsOfConversionMethods", + "REDUNDANT_CALL_OF_CONVERSION_METHOD", + "RedundantUnitReturnType", + "RemoveEmptyClassBody", + "UnnecessaryVariable", + "UnusedImport", + "UnnecessaryVariable", + "unused" +) + +package org.openapitools.client.models + +import io.kotlintest.shouldBe +import io.kotlintest.specs.ShouldSpec + +import org.openapitools.client.models.Name + +class NameTest : ShouldSpec() { + init { + // uncomment below to create an instance of Name + //val modelInstance = Name() + + // to test the property `name` + should("test name") { + // uncomment below to test the property + //modelInstance.name shouldBe ("TODO") + } + + // to test the property `snakeCase` + should("test snakeCase") { + // uncomment below to test the property + //modelInstance.snakeCase shouldBe ("TODO") + } + + // to test the property ``property`` + should("test `property`") { + // uncomment below to test the property + //modelInstance.`property` shouldBe ("TODO") + } + + // to test the property ``123number`` + should("test `123number`") { + // uncomment below to test the property + //modelInstance.`123number` shouldBe ("TODO") + } + + } +} diff --git a/samples/openapi3/client/petstore/kotlin/src/test/kotlin/org/openapitools/client/models/NullableClassTest.kt b/samples/openapi3/client/petstore/kotlin/src/test/kotlin/org/openapitools/client/models/NullableClassTest.kt new file mode 100644 index 000000000000..3fe494f4c688 --- /dev/null +++ b/samples/openapi3/client/petstore/kotlin/src/test/kotlin/org/openapitools/client/models/NullableClassTest.kt @@ -0,0 +1,109 @@ +/** + * + * Please note: + * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * Do not edit this file manually. + * + */ + +@file:Suppress( + "ArrayInDataClass", + "DuplicatedCode", + "EnumEntryName", + "RemoveRedundantQualifierName", + "RemoveRedundantCallsOfConversionMethods", + "REDUNDANT_CALL_OF_CONVERSION_METHOD", + "RedundantUnitReturnType", + "RemoveEmptyClassBody", + "UnnecessaryVariable", + "UnusedImport", + "UnnecessaryVariable", + "unused" +) + +package org.openapitools.client.models + +import io.kotlintest.shouldBe +import io.kotlintest.specs.ShouldSpec + +import org.openapitools.client.models.NullableClass + +class NullableClassTest : ShouldSpec() { + init { + // uncomment below to create an instance of NullableClass + //val modelInstance = NullableClass() + + // to test the property `integerProp` + should("test integerProp") { + // uncomment below to test the property + //modelInstance.integerProp shouldBe ("TODO") + } + + // to test the property `numberProp` + should("test numberProp") { + // uncomment below to test the property + //modelInstance.numberProp shouldBe ("TODO") + } + + // to test the property `booleanProp` + should("test booleanProp") { + // uncomment below to test the property + //modelInstance.booleanProp shouldBe ("TODO") + } + + // to test the property `stringProp` + should("test stringProp") { + // uncomment below to test the property + //modelInstance.stringProp shouldBe ("TODO") + } + + // to test the property `dateProp` + should("test dateProp") { + // uncomment below to test the property + //modelInstance.dateProp shouldBe ("TODO") + } + + // to test the property `datetimeProp` + should("test datetimeProp") { + // uncomment below to test the property + //modelInstance.datetimeProp shouldBe ("TODO") + } + + // to test the property `arrayNullableProp` + should("test arrayNullableProp") { + // uncomment below to test the property + //modelInstance.arrayNullableProp shouldBe ("TODO") + } + + // to test the property `arrayAndItemsNullableProp` + should("test arrayAndItemsNullableProp") { + // uncomment below to test the property + //modelInstance.arrayAndItemsNullableProp shouldBe ("TODO") + } + + // to test the property `arrayItemsNullable` + should("test arrayItemsNullable") { + // uncomment below to test the property + //modelInstance.arrayItemsNullable shouldBe ("TODO") + } + + // to test the property `objectNullableProp` + should("test objectNullableProp") { + // uncomment below to test the property + //modelInstance.objectNullableProp shouldBe ("TODO") + } + + // to test the property `objectAndItemsNullableProp` + should("test objectAndItemsNullableProp") { + // uncomment below to test the property + //modelInstance.objectAndItemsNullableProp shouldBe ("TODO") + } + + // to test the property `objectItemsNullable` + should("test objectItemsNullable") { + // uncomment below to test the property + //modelInstance.objectItemsNullable shouldBe ("TODO") + } + + } +} diff --git a/samples/openapi3/client/petstore/kotlin/src/test/kotlin/org/openapitools/client/models/NumberOnlyTest.kt b/samples/openapi3/client/petstore/kotlin/src/test/kotlin/org/openapitools/client/models/NumberOnlyTest.kt new file mode 100644 index 000000000000..ac72fafbe733 --- /dev/null +++ b/samples/openapi3/client/petstore/kotlin/src/test/kotlin/org/openapitools/client/models/NumberOnlyTest.kt @@ -0,0 +1,43 @@ +/** + * + * Please note: + * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * Do not edit this file manually. + * + */ + +@file:Suppress( + "ArrayInDataClass", + "DuplicatedCode", + "EnumEntryName", + "RemoveRedundantQualifierName", + "RemoveRedundantCallsOfConversionMethods", + "REDUNDANT_CALL_OF_CONVERSION_METHOD", + "RedundantUnitReturnType", + "RemoveEmptyClassBody", + "UnnecessaryVariable", + "UnusedImport", + "UnnecessaryVariable", + "unused" +) + +package org.openapitools.client.models + +import io.kotlintest.shouldBe +import io.kotlintest.specs.ShouldSpec + +import org.openapitools.client.models.NumberOnly + +class NumberOnlyTest : ShouldSpec() { + init { + // uncomment below to create an instance of NumberOnly + //val modelInstance = NumberOnly() + + // to test the property `justNumber` + should("test justNumber") { + // uncomment below to test the property + //modelInstance.justNumber shouldBe ("TODO") + } + + } +} diff --git a/samples/openapi3/client/petstore/kotlin/src/test/kotlin/org/openapitools/client/models/ObjectWithDeprecatedFieldsTest.kt b/samples/openapi3/client/petstore/kotlin/src/test/kotlin/org/openapitools/client/models/ObjectWithDeprecatedFieldsTest.kt new file mode 100644 index 000000000000..f10fecdd9d71 --- /dev/null +++ b/samples/openapi3/client/petstore/kotlin/src/test/kotlin/org/openapitools/client/models/ObjectWithDeprecatedFieldsTest.kt @@ -0,0 +1,62 @@ +/** + * + * Please note: + * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * Do not edit this file manually. + * + */ + +@file:Suppress( + "ArrayInDataClass", + "DuplicatedCode", + "EnumEntryName", + "RemoveRedundantQualifierName", + "RemoveRedundantCallsOfConversionMethods", + "REDUNDANT_CALL_OF_CONVERSION_METHOD", + "RedundantUnitReturnType", + "RemoveEmptyClassBody", + "UnnecessaryVariable", + "UnusedImport", + "UnnecessaryVariable", + "unused" +) + +package org.openapitools.client.models + +import io.kotlintest.shouldBe +import io.kotlintest.specs.ShouldSpec + +import org.openapitools.client.models.ObjectWithDeprecatedFields +import org.openapitools.client.models.DeprecatedObject + +class ObjectWithDeprecatedFieldsTest : ShouldSpec() { + init { + // uncomment below to create an instance of ObjectWithDeprecatedFields + //val modelInstance = ObjectWithDeprecatedFields() + + // to test the property `uuid` + should("test uuid") { + // uncomment below to test the property + //modelInstance.uuid shouldBe ("TODO") + } + + // to test the property `id` + should("test id") { + // uncomment below to test the property + //modelInstance.id shouldBe ("TODO") + } + + // to test the property `deprecatedRef` + should("test deprecatedRef") { + // uncomment below to test the property + //modelInstance.deprecatedRef shouldBe ("TODO") + } + + // to test the property `bars` + should("test bars") { + // uncomment below to test the property + //modelInstance.bars shouldBe ("TODO") + } + + } +} diff --git a/samples/openapi3/client/petstore/kotlin/src/test/kotlin/org/openapitools/client/models/OrderTest.kt b/samples/openapi3/client/petstore/kotlin/src/test/kotlin/org/openapitools/client/models/OrderTest.kt new file mode 100644 index 000000000000..4ddc2126f629 --- /dev/null +++ b/samples/openapi3/client/petstore/kotlin/src/test/kotlin/org/openapitools/client/models/OrderTest.kt @@ -0,0 +1,73 @@ +/** + * + * Please note: + * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * Do not edit this file manually. + * + */ + +@file:Suppress( + "ArrayInDataClass", + "DuplicatedCode", + "EnumEntryName", + "RemoveRedundantQualifierName", + "RemoveRedundantCallsOfConversionMethods", + "REDUNDANT_CALL_OF_CONVERSION_METHOD", + "RedundantUnitReturnType", + "RemoveEmptyClassBody", + "UnnecessaryVariable", + "UnusedImport", + "UnnecessaryVariable", + "unused" +) + +package org.openapitools.client.models + +import io.kotlintest.shouldBe +import io.kotlintest.specs.ShouldSpec + +import org.openapitools.client.models.Order + +class OrderTest : ShouldSpec() { + init { + // uncomment below to create an instance of Order + //val modelInstance = Order() + + // to test the property `id` + should("test id") { + // uncomment below to test the property + //modelInstance.id shouldBe ("TODO") + } + + // to test the property `petId` + should("test petId") { + // uncomment below to test the property + //modelInstance.petId shouldBe ("TODO") + } + + // to test the property `quantity` + should("test quantity") { + // uncomment below to test the property + //modelInstance.quantity shouldBe ("TODO") + } + + // to test the property `shipDate` + should("test shipDate") { + // uncomment below to test the property + //modelInstance.shipDate shouldBe ("TODO") + } + + // to test the property `status` - Order Status + should("test status") { + // uncomment below to test the property + //modelInstance.status shouldBe ("TODO") + } + + // to test the property `complete` + should("test complete") { + // uncomment below to test the property + //modelInstance.complete shouldBe ("TODO") + } + + } +} diff --git a/samples/openapi3/client/petstore/kotlin/src/test/kotlin/org/openapitools/client/models/OuterCompositeTest.kt b/samples/openapi3/client/petstore/kotlin/src/test/kotlin/org/openapitools/client/models/OuterCompositeTest.kt new file mode 100644 index 000000000000..75cc904b8a31 --- /dev/null +++ b/samples/openapi3/client/petstore/kotlin/src/test/kotlin/org/openapitools/client/models/OuterCompositeTest.kt @@ -0,0 +1,55 @@ +/** + * + * Please note: + * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * Do not edit this file manually. + * + */ + +@file:Suppress( + "ArrayInDataClass", + "DuplicatedCode", + "EnumEntryName", + "RemoveRedundantQualifierName", + "RemoveRedundantCallsOfConversionMethods", + "REDUNDANT_CALL_OF_CONVERSION_METHOD", + "RedundantUnitReturnType", + "RemoveEmptyClassBody", + "UnnecessaryVariable", + "UnusedImport", + "UnnecessaryVariable", + "unused" +) + +package org.openapitools.client.models + +import io.kotlintest.shouldBe +import io.kotlintest.specs.ShouldSpec + +import org.openapitools.client.models.OuterComposite + +class OuterCompositeTest : ShouldSpec() { + init { + // uncomment below to create an instance of OuterComposite + //val modelInstance = OuterComposite() + + // to test the property `myNumber` + should("test myNumber") { + // uncomment below to test the property + //modelInstance.myNumber shouldBe ("TODO") + } + + // to test the property `myString` + should("test myString") { + // uncomment below to test the property + //modelInstance.myString shouldBe ("TODO") + } + + // to test the property `myBoolean` + should("test myBoolean") { + // uncomment below to test the property + //modelInstance.myBoolean shouldBe ("TODO") + } + + } +} diff --git a/samples/openapi3/client/petstore/kotlin/src/test/kotlin/org/openapitools/client/models/OuterEnumDefaultValueTest.kt b/samples/openapi3/client/petstore/kotlin/src/test/kotlin/org/openapitools/client/models/OuterEnumDefaultValueTest.kt new file mode 100644 index 000000000000..4a4e81ca176e --- /dev/null +++ b/samples/openapi3/client/petstore/kotlin/src/test/kotlin/org/openapitools/client/models/OuterEnumDefaultValueTest.kt @@ -0,0 +1,37 @@ +/** + * + * Please note: + * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * Do not edit this file manually. + * + */ + +@file:Suppress( + "ArrayInDataClass", + "DuplicatedCode", + "EnumEntryName", + "RemoveRedundantQualifierName", + "RemoveRedundantCallsOfConversionMethods", + "REDUNDANT_CALL_OF_CONVERSION_METHOD", + "RedundantUnitReturnType", + "RemoveEmptyClassBody", + "UnnecessaryVariable", + "UnusedImport", + "UnnecessaryVariable", + "unused" +) + +package org.openapitools.client.models + +import io.kotlintest.shouldBe +import io.kotlintest.specs.ShouldSpec + +import org.openapitools.client.models.OuterEnumDefaultValue + +class OuterEnumDefaultValueTest : ShouldSpec() { + init { + // uncomment below to create an instance of OuterEnumDefaultValue + //val modelInstance = OuterEnumDefaultValue() + + } +} diff --git a/samples/openapi3/client/petstore/kotlin/src/test/kotlin/org/openapitools/client/models/OuterEnumIntegerDefaultValueTest.kt b/samples/openapi3/client/petstore/kotlin/src/test/kotlin/org/openapitools/client/models/OuterEnumIntegerDefaultValueTest.kt new file mode 100644 index 000000000000..66bf46834269 --- /dev/null +++ b/samples/openapi3/client/petstore/kotlin/src/test/kotlin/org/openapitools/client/models/OuterEnumIntegerDefaultValueTest.kt @@ -0,0 +1,37 @@ +/** + * + * Please note: + * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * Do not edit this file manually. + * + */ + +@file:Suppress( + "ArrayInDataClass", + "DuplicatedCode", + "EnumEntryName", + "RemoveRedundantQualifierName", + "RemoveRedundantCallsOfConversionMethods", + "REDUNDANT_CALL_OF_CONVERSION_METHOD", + "RedundantUnitReturnType", + "RemoveEmptyClassBody", + "UnnecessaryVariable", + "UnusedImport", + "UnnecessaryVariable", + "unused" +) + +package org.openapitools.client.models + +import io.kotlintest.shouldBe +import io.kotlintest.specs.ShouldSpec + +import org.openapitools.client.models.OuterEnumIntegerDefaultValue + +class OuterEnumIntegerDefaultValueTest : ShouldSpec() { + init { + // uncomment below to create an instance of OuterEnumIntegerDefaultValue + //val modelInstance = OuterEnumIntegerDefaultValue() + + } +} diff --git a/samples/openapi3/client/petstore/kotlin/src/test/kotlin/org/openapitools/client/models/OuterEnumIntegerTest.kt b/samples/openapi3/client/petstore/kotlin/src/test/kotlin/org/openapitools/client/models/OuterEnumIntegerTest.kt new file mode 100644 index 000000000000..5cb4b7f4f4f2 --- /dev/null +++ b/samples/openapi3/client/petstore/kotlin/src/test/kotlin/org/openapitools/client/models/OuterEnumIntegerTest.kt @@ -0,0 +1,37 @@ +/** + * + * Please note: + * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * Do not edit this file manually. + * + */ + +@file:Suppress( + "ArrayInDataClass", + "DuplicatedCode", + "EnumEntryName", + "RemoveRedundantQualifierName", + "RemoveRedundantCallsOfConversionMethods", + "REDUNDANT_CALL_OF_CONVERSION_METHOD", + "RedundantUnitReturnType", + "RemoveEmptyClassBody", + "UnnecessaryVariable", + "UnusedImport", + "UnnecessaryVariable", + "unused" +) + +package org.openapitools.client.models + +import io.kotlintest.shouldBe +import io.kotlintest.specs.ShouldSpec + +import org.openapitools.client.models.OuterEnumInteger + +class OuterEnumIntegerTest : ShouldSpec() { + init { + // uncomment below to create an instance of OuterEnumInteger + //val modelInstance = OuterEnumInteger() + + } +} diff --git a/samples/openapi3/client/petstore/kotlin/src/test/kotlin/org/openapitools/client/models/OuterEnumTest.kt b/samples/openapi3/client/petstore/kotlin/src/test/kotlin/org/openapitools/client/models/OuterEnumTest.kt new file mode 100644 index 000000000000..e41ca0df5744 --- /dev/null +++ b/samples/openapi3/client/petstore/kotlin/src/test/kotlin/org/openapitools/client/models/OuterEnumTest.kt @@ -0,0 +1,37 @@ +/** + * + * Please note: + * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * Do not edit this file manually. + * + */ + +@file:Suppress( + "ArrayInDataClass", + "DuplicatedCode", + "EnumEntryName", + "RemoveRedundantQualifierName", + "RemoveRedundantCallsOfConversionMethods", + "REDUNDANT_CALL_OF_CONVERSION_METHOD", + "RedundantUnitReturnType", + "RemoveEmptyClassBody", + "UnnecessaryVariable", + "UnusedImport", + "UnnecessaryVariable", + "unused" +) + +package org.openapitools.client.models + +import io.kotlintest.shouldBe +import io.kotlintest.specs.ShouldSpec + +import org.openapitools.client.models.OuterEnum + +class OuterEnumTest : ShouldSpec() { + init { + // uncomment below to create an instance of OuterEnum + //val modelInstance = OuterEnum() + + } +} diff --git a/samples/openapi3/client/petstore/kotlin/src/test/kotlin/org/openapitools/client/models/OuterObjectWithEnumPropertyTest.kt b/samples/openapi3/client/petstore/kotlin/src/test/kotlin/org/openapitools/client/models/OuterObjectWithEnumPropertyTest.kt new file mode 100644 index 000000000000..f89b72bc04df --- /dev/null +++ b/samples/openapi3/client/petstore/kotlin/src/test/kotlin/org/openapitools/client/models/OuterObjectWithEnumPropertyTest.kt @@ -0,0 +1,44 @@ +/** + * + * Please note: + * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * Do not edit this file manually. + * + */ + +@file:Suppress( + "ArrayInDataClass", + "DuplicatedCode", + "EnumEntryName", + "RemoveRedundantQualifierName", + "RemoveRedundantCallsOfConversionMethods", + "REDUNDANT_CALL_OF_CONVERSION_METHOD", + "RedundantUnitReturnType", + "RemoveEmptyClassBody", + "UnnecessaryVariable", + "UnusedImport", + "UnnecessaryVariable", + "unused" +) + +package org.openapitools.client.models + +import io.kotlintest.shouldBe +import io.kotlintest.specs.ShouldSpec + +import org.openapitools.client.models.OuterObjectWithEnumProperty +import org.openapitools.client.models.OuterEnumInteger + +class OuterObjectWithEnumPropertyTest : ShouldSpec() { + init { + // uncomment below to create an instance of OuterObjectWithEnumProperty + //val modelInstance = OuterObjectWithEnumProperty() + + // to test the property ``value`` + should("test `value`") { + // uncomment below to test the property + //modelInstance.`value` shouldBe ("TODO") + } + + } +} diff --git a/samples/openapi3/client/petstore/kotlin/src/test/kotlin/org/openapitools/client/models/ParentWithNullableTest.kt b/samples/openapi3/client/petstore/kotlin/src/test/kotlin/org/openapitools/client/models/ParentWithNullableTest.kt new file mode 100644 index 000000000000..74e59239f54d --- /dev/null +++ b/samples/openapi3/client/petstore/kotlin/src/test/kotlin/org/openapitools/client/models/ParentWithNullableTest.kt @@ -0,0 +1,49 @@ +/** + * + * Please note: + * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * Do not edit this file manually. + * + */ + +@file:Suppress( + "ArrayInDataClass", + "DuplicatedCode", + "EnumEntryName", + "RemoveRedundantQualifierName", + "RemoveRedundantCallsOfConversionMethods", + "REDUNDANT_CALL_OF_CONVERSION_METHOD", + "RedundantUnitReturnType", + "RemoveEmptyClassBody", + "UnnecessaryVariable", + "UnusedImport", + "UnnecessaryVariable", + "unused" +) + +package org.openapitools.client.models + +import io.kotlintest.shouldBe +import io.kotlintest.specs.ShouldSpec + +import org.openapitools.client.models.ParentWithNullable + +class ParentWithNullableTest : ShouldSpec() { + init { + // uncomment below to create an instance of ParentWithNullable + //val modelInstance = ParentWithNullable() + + // to test the property `type` + should("test type") { + // uncomment below to test the property + //modelInstance.type shouldBe ("TODO") + } + + // to test the property `nullableProperty` + should("test nullableProperty") { + // uncomment below to test the property + //modelInstance.nullableProperty shouldBe ("TODO") + } + + } +} diff --git a/samples/openapi3/client/petstore/kotlin/src/test/kotlin/org/openapitools/client/models/PetTest.kt b/samples/openapi3/client/petstore/kotlin/src/test/kotlin/org/openapitools/client/models/PetTest.kt new file mode 100644 index 000000000000..1c0fee46bdc5 --- /dev/null +++ b/samples/openapi3/client/petstore/kotlin/src/test/kotlin/org/openapitools/client/models/PetTest.kt @@ -0,0 +1,75 @@ +/** + * + * Please note: + * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * Do not edit this file manually. + * + */ + +@file:Suppress( + "ArrayInDataClass", + "DuplicatedCode", + "EnumEntryName", + "RemoveRedundantQualifierName", + "RemoveRedundantCallsOfConversionMethods", + "REDUNDANT_CALL_OF_CONVERSION_METHOD", + "RedundantUnitReturnType", + "RemoveEmptyClassBody", + "UnnecessaryVariable", + "UnusedImport", + "UnnecessaryVariable", + "unused" +) + +package org.openapitools.client.models + +import io.kotlintest.shouldBe +import io.kotlintest.specs.ShouldSpec + +import org.openapitools.client.models.Pet +import org.openapitools.client.models.Category +import org.openapitools.client.models.Tag + +class PetTest : ShouldSpec() { + init { + // uncomment below to create an instance of Pet + //val modelInstance = Pet() + + // to test the property `name` + should("test name") { + // uncomment below to test the property + //modelInstance.name shouldBe ("TODO") + } + + // to test the property `photoUrls` + should("test photoUrls") { + // uncomment below to test the property + //modelInstance.photoUrls shouldBe ("TODO") + } + + // to test the property `id` + should("test id") { + // uncomment below to test the property + //modelInstance.id shouldBe ("TODO") + } + + // to test the property `category` + should("test category") { + // uncomment below to test the property + //modelInstance.category shouldBe ("TODO") + } + + // to test the property `tags` + should("test tags") { + // uncomment below to test the property + //modelInstance.tags shouldBe ("TODO") + } + + // to test the property `status` - pet status in the store + should("test status") { + // uncomment below to test the property + //modelInstance.status shouldBe ("TODO") + } + + } +} diff --git a/samples/openapi3/client/petstore/kotlin/src/test/kotlin/org/openapitools/client/models/ReadOnlyFirstTest.kt b/samples/openapi3/client/petstore/kotlin/src/test/kotlin/org/openapitools/client/models/ReadOnlyFirstTest.kt new file mode 100644 index 000000000000..2c5934f3e3ee --- /dev/null +++ b/samples/openapi3/client/petstore/kotlin/src/test/kotlin/org/openapitools/client/models/ReadOnlyFirstTest.kt @@ -0,0 +1,49 @@ +/** + * + * Please note: + * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * Do not edit this file manually. + * + */ + +@file:Suppress( + "ArrayInDataClass", + "DuplicatedCode", + "EnumEntryName", + "RemoveRedundantQualifierName", + "RemoveRedundantCallsOfConversionMethods", + "REDUNDANT_CALL_OF_CONVERSION_METHOD", + "RedundantUnitReturnType", + "RemoveEmptyClassBody", + "UnnecessaryVariable", + "UnusedImport", + "UnnecessaryVariable", + "unused" +) + +package org.openapitools.client.models + +import io.kotlintest.shouldBe +import io.kotlintest.specs.ShouldSpec + +import org.openapitools.client.models.ReadOnlyFirst + +class ReadOnlyFirstTest : ShouldSpec() { + init { + // uncomment below to create an instance of ReadOnlyFirst + //val modelInstance = ReadOnlyFirst() + + // to test the property `bar` + should("test bar") { + // uncomment below to test the property + //modelInstance.bar shouldBe ("TODO") + } + + // to test the property `baz` + should("test baz") { + // uncomment below to test the property + //modelInstance.baz shouldBe ("TODO") + } + + } +} diff --git a/samples/openapi3/client/petstore/kotlin/src/test/kotlin/org/openapitools/client/models/ReturnTest.kt b/samples/openapi3/client/petstore/kotlin/src/test/kotlin/org/openapitools/client/models/ReturnTest.kt new file mode 100644 index 000000000000..a8110f7637a8 --- /dev/null +++ b/samples/openapi3/client/petstore/kotlin/src/test/kotlin/org/openapitools/client/models/ReturnTest.kt @@ -0,0 +1,43 @@ +/** + * + * Please note: + * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * Do not edit this file manually. + * + */ + +@file:Suppress( + "ArrayInDataClass", + "DuplicatedCode", + "EnumEntryName", + "RemoveRedundantQualifierName", + "RemoveRedundantCallsOfConversionMethods", + "REDUNDANT_CALL_OF_CONVERSION_METHOD", + "RedundantUnitReturnType", + "RemoveEmptyClassBody", + "UnnecessaryVariable", + "UnusedImport", + "UnnecessaryVariable", + "unused" +) + +package org.openapitools.client.models + +import io.kotlintest.shouldBe +import io.kotlintest.specs.ShouldSpec + +import org.openapitools.client.models.Return + +class ReturnTest : ShouldSpec() { + init { + // uncomment below to create an instance of Return + //val modelInstance = Return() + + // to test the property ``return`` + should("test `return`") { + // uncomment below to test the property + //modelInstance.`return` shouldBe ("TODO") + } + + } +} diff --git a/samples/openapi3/client/petstore/kotlin/src/test/kotlin/org/openapitools/client/models/SingleRefTypeTest.kt b/samples/openapi3/client/petstore/kotlin/src/test/kotlin/org/openapitools/client/models/SingleRefTypeTest.kt new file mode 100644 index 000000000000..abf9b7a6fe1c --- /dev/null +++ b/samples/openapi3/client/petstore/kotlin/src/test/kotlin/org/openapitools/client/models/SingleRefTypeTest.kt @@ -0,0 +1,37 @@ +/** + * + * Please note: + * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * Do not edit this file manually. + * + */ + +@file:Suppress( + "ArrayInDataClass", + "DuplicatedCode", + "EnumEntryName", + "RemoveRedundantQualifierName", + "RemoveRedundantCallsOfConversionMethods", + "REDUNDANT_CALL_OF_CONVERSION_METHOD", + "RedundantUnitReturnType", + "RemoveEmptyClassBody", + "UnnecessaryVariable", + "UnusedImport", + "UnnecessaryVariable", + "unused" +) + +package org.openapitools.client.models + +import io.kotlintest.shouldBe +import io.kotlintest.specs.ShouldSpec + +import org.openapitools.client.models.SingleRefType + +class SingleRefTypeTest : ShouldSpec() { + init { + // uncomment below to create an instance of SingleRefType + //val modelInstance = SingleRefType() + + } +} diff --git a/samples/openapi3/client/petstore/kotlin/src/test/kotlin/org/openapitools/client/models/SpecialModelNameTest.kt b/samples/openapi3/client/petstore/kotlin/src/test/kotlin/org/openapitools/client/models/SpecialModelNameTest.kt new file mode 100644 index 000000000000..8dc9d9332304 --- /dev/null +++ b/samples/openapi3/client/petstore/kotlin/src/test/kotlin/org/openapitools/client/models/SpecialModelNameTest.kt @@ -0,0 +1,43 @@ +/** + * + * Please note: + * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * Do not edit this file manually. + * + */ + +@file:Suppress( + "ArrayInDataClass", + "DuplicatedCode", + "EnumEntryName", + "RemoveRedundantQualifierName", + "RemoveRedundantCallsOfConversionMethods", + "REDUNDANT_CALL_OF_CONVERSION_METHOD", + "RedundantUnitReturnType", + "RemoveEmptyClassBody", + "UnnecessaryVariable", + "UnusedImport", + "UnnecessaryVariable", + "unused" +) + +package org.openapitools.client.models + +import io.kotlintest.shouldBe +import io.kotlintest.specs.ShouldSpec + +import org.openapitools.client.models.SpecialModelname + +class SpecialModelnameTest : ShouldSpec() { + init { + // uncomment below to create an instance of SpecialModelname + //val modelInstance = SpecialModelname() + + // to test the property `dollarSpecialPropertyName` + should("test dollarSpecialPropertyName") { + // uncomment below to test the property + //modelInstance.dollarSpecialPropertyName shouldBe ("TODO") + } + + } +} diff --git a/samples/openapi3/client/petstore/kotlin/src/test/kotlin/org/openapitools/client/models/TagTest.kt b/samples/openapi3/client/petstore/kotlin/src/test/kotlin/org/openapitools/client/models/TagTest.kt new file mode 100644 index 000000000000..3163ef613ae6 --- /dev/null +++ b/samples/openapi3/client/petstore/kotlin/src/test/kotlin/org/openapitools/client/models/TagTest.kt @@ -0,0 +1,49 @@ +/** + * + * Please note: + * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * Do not edit this file manually. + * + */ + +@file:Suppress( + "ArrayInDataClass", + "DuplicatedCode", + "EnumEntryName", + "RemoveRedundantQualifierName", + "RemoveRedundantCallsOfConversionMethods", + "REDUNDANT_CALL_OF_CONVERSION_METHOD", + "RedundantUnitReturnType", + "RemoveEmptyClassBody", + "UnnecessaryVariable", + "UnusedImport", + "UnnecessaryVariable", + "unused" +) + +package org.openapitools.client.models + +import io.kotlintest.shouldBe +import io.kotlintest.specs.ShouldSpec + +import org.openapitools.client.models.Tag + +class TagTest : ShouldSpec() { + init { + // uncomment below to create an instance of Tag + //val modelInstance = Tag() + + // to test the property `id` + should("test id") { + // uncomment below to test the property + //modelInstance.id shouldBe ("TODO") + } + + // to test the property `name` + should("test name") { + // uncomment below to test the property + //modelInstance.name shouldBe ("TODO") + } + + } +} diff --git a/samples/openapi3/client/petstore/kotlin/src/test/kotlin/org/openapitools/client/models/TestInlineFreeformAdditionalPropertiesRequestTest.kt b/samples/openapi3/client/petstore/kotlin/src/test/kotlin/org/openapitools/client/models/TestInlineFreeformAdditionalPropertiesRequestTest.kt new file mode 100644 index 000000000000..cc36065f4864 --- /dev/null +++ b/samples/openapi3/client/petstore/kotlin/src/test/kotlin/org/openapitools/client/models/TestInlineFreeformAdditionalPropertiesRequestTest.kt @@ -0,0 +1,43 @@ +/** + * + * Please note: + * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * Do not edit this file manually. + * + */ + +@file:Suppress( + "ArrayInDataClass", + "DuplicatedCode", + "EnumEntryName", + "RemoveRedundantQualifierName", + "RemoveRedundantCallsOfConversionMethods", + "REDUNDANT_CALL_OF_CONVERSION_METHOD", + "RedundantUnitReturnType", + "RemoveEmptyClassBody", + "UnnecessaryVariable", + "UnusedImport", + "UnnecessaryVariable", + "unused" +) + +package org.openapitools.client.models + +import io.kotlintest.shouldBe +import io.kotlintest.specs.ShouldSpec + +import org.openapitools.client.models.TestInlineFreeformAdditionalPropertiesRequest + +class TestInlineFreeformAdditionalPropertiesRequestTest : ShouldSpec() { + init { + // uncomment below to create an instance of TestInlineFreeformAdditionalPropertiesRequest + //val modelInstance = TestInlineFreeformAdditionalPropertiesRequest() + + // to test the property `someProperty` + should("test someProperty") { + // uncomment below to test the property + //modelInstance.someProperty shouldBe ("TODO") + } + + } +} diff --git a/samples/openapi3/client/petstore/kotlin/src/test/kotlin/org/openapitools/client/models/UserTest.kt b/samples/openapi3/client/petstore/kotlin/src/test/kotlin/org/openapitools/client/models/UserTest.kt new file mode 100644 index 000000000000..0878794ef4d2 --- /dev/null +++ b/samples/openapi3/client/petstore/kotlin/src/test/kotlin/org/openapitools/client/models/UserTest.kt @@ -0,0 +1,85 @@ +/** + * + * Please note: + * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * Do not edit this file manually. + * + */ + +@file:Suppress( + "ArrayInDataClass", + "DuplicatedCode", + "EnumEntryName", + "RemoveRedundantQualifierName", + "RemoveRedundantCallsOfConversionMethods", + "REDUNDANT_CALL_OF_CONVERSION_METHOD", + "RedundantUnitReturnType", + "RemoveEmptyClassBody", + "UnnecessaryVariable", + "UnusedImport", + "UnnecessaryVariable", + "unused" +) + +package org.openapitools.client.models + +import io.kotlintest.shouldBe +import io.kotlintest.specs.ShouldSpec + +import org.openapitools.client.models.User + +class UserTest : ShouldSpec() { + init { + // uncomment below to create an instance of User + //val modelInstance = User() + + // to test the property `id` + should("test id") { + // uncomment below to test the property + //modelInstance.id shouldBe ("TODO") + } + + // to test the property `username` + should("test username") { + // uncomment below to test the property + //modelInstance.username shouldBe ("TODO") + } + + // to test the property `firstName` + should("test firstName") { + // uncomment below to test the property + //modelInstance.firstName shouldBe ("TODO") + } + + // to test the property `lastName` + should("test lastName") { + // uncomment below to test the property + //modelInstance.lastName shouldBe ("TODO") + } + + // to test the property `email` + should("test email") { + // uncomment below to test the property + //modelInstance.email shouldBe ("TODO") + } + + // to test the property `password` + should("test password") { + // uncomment below to test the property + //modelInstance.password shouldBe ("TODO") + } + + // to test the property `phone` + should("test phone") { + // uncomment below to test the property + //modelInstance.phone shouldBe ("TODO") + } + + // to test the property `userStatus` - User Status + should("test userStatus") { + // uncomment below to test the property + //modelInstance.userStatus shouldBe ("TODO") + } + + } +} diff --git a/samples/server/echo_api/kotlin-wiremock/.openapi-generator/FILES b/samples/server/echo_api/kotlin-wiremock/.openapi-generator/FILES index 762b52754833..6a523b2d684d 100644 --- a/samples/server/echo_api/kotlin-wiremock/.openapi-generator/FILES +++ b/samples/server/echo_api/kotlin-wiremock/.openapi-generator/FILES @@ -10,6 +10,8 @@ src/main/kotlin/org/openapitools/apis/AuthApiStubBuilders.kt src/main/kotlin/org/openapitools/apis/AuthApiStubs.kt src/main/kotlin/org/openapitools/apis/BodyApiStubBuilders.kt src/main/kotlin/org/openapitools/apis/BodyApiStubs.kt +src/main/kotlin/org/openapitools/apis/EchoApiStubBuilders.kt +src/main/kotlin/org/openapitools/apis/EchoApiStubs.kt src/main/kotlin/org/openapitools/apis/FormApiStubBuilders.kt src/main/kotlin/org/openapitools/apis/FormApiStubs.kt src/main/kotlin/org/openapitools/apis/HeaderApiStubBuilders.kt @@ -25,5 +27,6 @@ src/main/kotlin/org/openapitools/models/NumberPropertiesOnly.kt src/main/kotlin/org/openapitools/models/Pet.kt src/main/kotlin/org/openapitools/models/Query.kt src/main/kotlin/org/openapitools/models/StringEnumRef.kt +src/main/kotlin/org/openapitools/models/StringEscapingEdgeCases.kt src/main/kotlin/org/openapitools/models/Tag.kt src/main/kotlin/org/openapitools/models/TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter.kt diff --git a/samples/server/echo_api/kotlin-wiremock/src/main/kotlin/org/openapitools/apis/EchoApiStubBuilders.kt b/samples/server/echo_api/kotlin-wiremock/src/main/kotlin/org/openapitools/apis/EchoApiStubBuilders.kt new file mode 100644 index 000000000000..f8909ad27e79 --- /dev/null +++ b/samples/server/echo_api/kotlin-wiremock/src/main/kotlin/org/openapitools/apis/EchoApiStubBuilders.kt @@ -0,0 +1,63 @@ +@file:Suppress( + "RemoveRedundantQualifierName", + "UnusedImport", + "unused", +) + +package org.openapitools.apis + +import com.fasterxml.jackson.databind.ObjectMapper +import com.github.tomakehurst.wiremock.client.MappingBuilder +import com.github.tomakehurst.wiremock.client.ResponseDefinitionBuilder +import com.github.tomakehurst.wiremock.client.WireMock.* +import com.github.tomakehurst.wiremock.matching.StringValuePattern +import org.openapitools.models.* + +/** + * Builder for WireMock stubs of operation testsEchoStringEscapingParamName. + */ +class TestsEchoStringEscapingParamNameStubBuilder internal constructor(private val objectMapper: ObjectMapper, private val stub: MappingBuilder) { + + /** + * Let the stub for testsEchoStringEscapingParamName respond with HTTP status code 200. + * + * @param body response body for the [MappingBuilder]. + * @param configurer configurer for the [MappingBuilder], allowing for arbitrary changes. + * @return a [MappingBuilder] to be registered with a WireMock instance. + */ + fun respondWith200( + body: kotlin.String, + configurer: ResponseDefinitionBuilder.() -> ResponseDefinitionBuilder = { this }, + ): MappingBuilder = + stub.willReturn(aResponse() + .withStatus(200) + .withHeader("Content-Type", "application/json") + .withBody(objectMapper.writeValueAsString(body)) + .configurer() + ) + + /** + * Let the stub for testsEchoStringEscapingParamName respond with HTTP status code [code]. + * + * @param code the response code. + * @param body response body for the [MappingBuilder]. + * @param configurer configurer for the [MappingBuilder], allowing for arbitrary changes. + * @return a [MappingBuilder] to be registered with a WireMock instance. + */ + fun respondWith( + code: Int, + body: Any? = null, + configurer: ResponseDefinitionBuilder.() -> ResponseDefinitionBuilder = { this } + ): MappingBuilder = + stub.willReturn(aResponse() + .withStatus(code) + .apply { + body?.let { + withHeader("Content-Type", "application/json") + withBody(objectMapper.writeValueAsString(it)) + } + } + .configurer() + ) +} + diff --git a/samples/server/echo_api/kotlin-wiremock/src/main/kotlin/org/openapitools/apis/EchoApiStubs.kt b/samples/server/echo_api/kotlin-wiremock/src/main/kotlin/org/openapitools/apis/EchoApiStubs.kt new file mode 100644 index 000000000000..e49d15cc9941 --- /dev/null +++ b/samples/server/echo_api/kotlin-wiremock/src/main/kotlin/org/openapitools/apis/EchoApiStubs.kt @@ -0,0 +1,35 @@ +@file:Suppress( + "RemoveRedundantQualifierName", + "UnusedImport", + "unused", +) + +package org.openapitools.apis + +import com.fasterxml.jackson.databind.ObjectMapper +import com.github.tomakehurst.wiremock.client.MappingBuilder +import com.github.tomakehurst.wiremock.client.ResponseDefinitionBuilder +import com.github.tomakehurst.wiremock.client.WireMock.* +import com.github.tomakehurst.wiremock.matching.StringValuePattern +import org.openapitools.models.* + +/** + * WireMock stub request builder. + */ +open class EchoApiStubs(private val objectMapper: ObjectMapper) { + + /** + * Construct a stub for the operation testsEchoStringEscapingParamName. + * + * @param dollarParamName path parameter dollarParamName pattern. + * @param filterDollarType query parameter filterDollarType pattern. + * @param configurer configurer for the [MappingBuilder], allowing for arbitrary changes. + * @return A [TestsEchoStringEscapingParamNameStubBuilder] to configure the response, and the final [MappingBuilder]. + */ + fun testsEchoStringEscapingParamName(dollarParamName: StringValuePattern, filterDollarType: StringValuePattern? = null, configurer: MappingBuilder.() -> MappingBuilder = { this }): TestsEchoStringEscapingParamNameStubBuilder = + TestsEchoStringEscapingParamNameStubBuilder(objectMapper, get(urlPathTemplate("/echo/string-escaping/{\$paramName}")) + .withPathParam("\$paramName", dollarParamName) + .apply { filterDollarType?.let { withQueryParam("filter\$Type", it) } } + .configurer() + ) +} diff --git a/samples/server/echo_api/kotlin-wiremock/src/main/kotlin/org/openapitools/models/StringEscapingEdgeCases.kt b/samples/server/echo_api/kotlin-wiremock/src/main/kotlin/org/openapitools/models/StringEscapingEdgeCases.kt new file mode 100644 index 000000000000..15499fb02a19 --- /dev/null +++ b/samples/server/echo_api/kotlin-wiremock/src/main/kotlin/org/openapitools/models/StringEscapingEdgeCases.kt @@ -0,0 +1,17 @@ +@file:Suppress( + "RemoveRedundantQualifierName", + "unused", +) + +package org.openapitools.models + +import com.fasterxml.jackson.annotation.JsonProperty + +data class StringEscapingEdgeCases( + @field:JsonProperty("dollarDefault") + val dollarDefault: kotlin.String? = "hello \$world, backslash=\\, quote=\", end */", + + @field:JsonProperty("regularProp") + val regularProp: kotlin.String? = null, + +) diff --git a/samples/server/petstore/kotlin-misk-config/.openapi-generator/FILES b/samples/server/petstore/kotlin-misk-config/.openapi-generator/FILES index 594e5efd5ba2..9ef76d5d361c 100644 --- a/samples/server/petstore/kotlin-misk-config/.openapi-generator/FILES +++ b/samples/server/petstore/kotlin-misk-config/.openapi-generator/FILES @@ -2,6 +2,7 @@ README.md build.gradle.kts docs/ApiResponse.md docs/Category.md +docs/EscapingEdgeCases.md docs/Order.md docs/Pet.md docs/PetApi.md @@ -15,6 +16,7 @@ src/main/kotlin/org/openapitools/server/api/api/PetStoreModule.kt src/main/kotlin/org/openapitools/server/api/api/StoreApiAction.kt src/main/kotlin/org/openapitools/server/api/api/UserApiAction.kt src/main/kotlin/org/openapitools/server/api/model/Category.kt +src/main/kotlin/org/openapitools/server/api/model/EscapingEdgeCases.kt src/main/kotlin/org/openapitools/server/api/model/ModelApiResponse.kt src/main/kotlin/org/openapitools/server/api/model/Order.kt src/main/kotlin/org/openapitools/server/api/model/Pet.kt diff --git a/samples/server/petstore/kotlin-misk-config/README.md b/samples/server/petstore/kotlin-misk-config/README.md index 8fc27a719a91..a681a02dae40 100644 --- a/samples/server/petstore/kotlin-misk-config/README.md +++ b/samples/server/petstore/kotlin-misk-config/README.md @@ -11,6 +11,7 @@ *PetApi* | [**deletePet**](Apis/docs/PetApi.md#deletepet) | **Delete** /pet/{petId} | Deletes a pet *PetApi* | [**findPetsByStatus**](Apis/docs/PetApi.md#findpetsbystatus) | **Get** /pet/findByStatus | Finds Pets by status *PetApi* | [**findPetsByTags**](Apis/docs/PetApi.md#findpetsbytags) | **Get** /pet/findByTags | Finds Pets by tags + *PetApi* | [**getEscapingEdgeCases**](Apis/docs/PetApi.md#getescapingedgecases) | **Get** /pet/escaping | Test escaping: $dollar, backslash \\ and quote \" *PetApi* | [**getPetById**](Apis/docs/PetApi.md#getpetbyid) | **Get** /pet/{petId} | Find pet by ID *PetApi* | [**updatePet**](Apis/docs/PetApi.md#updatepet) | **Put** /pet | Update an existing pet *PetApi* | [**updatePetWithForm**](Apis/docs/PetApi.md#updatepetwithform) | **Post** /pet/{petId} | Updates a pet in the store with form data @@ -33,6 +34,7 @@ ## Documentation for Models - [org.openapitools.server.api.model.Category](Models/docs/Category.md) + - [org.openapitools.server.api.model.EscapingEdgeCases](Models/docs/EscapingEdgeCases.md) - [org.openapitools.server.api.model.ModelApiResponse](Models/docs/ModelApiResponse.md) - [org.openapitools.server.api.model.Order](Models/docs/Order.md) - [org.openapitools.server.api.model.Pet](Models/docs/Pet.md) diff --git a/samples/server/petstore/kotlin-misk-config/docs/EscapingEdgeCases.md b/samples/server/petstore/kotlin-misk-config/docs/EscapingEdgeCases.md new file mode 100644 index 000000000000..4ab2399cccc8 --- /dev/null +++ b/samples/server/petstore/kotlin-misk-config/docs/EscapingEdgeCases.md @@ -0,0 +1,11 @@ + +# EscapingEdgeCases + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**dollarDefault** | **kotlin.String** | A string whose default has \$dollar, backslash \\, quote " and comment-close */ | [optional] +**regularProp** | **kotlin.String** | Regular property for baseline comparison | [optional] + + + diff --git a/samples/server/petstore/kotlin-misk-config/docs/PetApi.md b/samples/server/petstore/kotlin-misk-config/docs/PetApi.md index 99dbe788edb0..5e073104a909 100644 --- a/samples/server/petstore/kotlin-misk-config/docs/PetApi.md +++ b/samples/server/petstore/kotlin-misk-config/docs/PetApi.md @@ -8,6 +8,7 @@ Method | HTTP request | Description [**deletePet**](PetApi.md#deletePet) | **Delete** /pet/{petId} | Deletes a pet [**findPetsByStatus**](PetApi.md#findPetsByStatus) | **Get** /pet/findByStatus | Finds Pets by status [**findPetsByTags**](PetApi.md#findPetsByTags) | **Get** /pet/findByTags | Finds Pets by tags +[**getEscapingEdgeCases**](PetApi.md#getEscapingEdgeCases) | **Get** /pet/escaping | Test escaping: \$dollar, backslash \\ and quote " [**getPetById**](PetApi.md#getPetById) | **Get** /pet/{petId} | Find pet by ID [**updatePet**](PetApi.md#updatePet) | **Put** /pet | Update an existing pet [**updatePetWithForm**](PetApi.md#updatePetWithForm) | **Post** /pet/{petId} | Updates a pet in the store with form data @@ -203,6 +204,49 @@ Name | Type | Description | Notes - **Content-Type**: Not defined - **Accept**: APPLICATION_XML, APPLICATION_JSON + +# **getEscapingEdgeCases** +> EscapingEdgeCases getEscapingEdgeCases() + +Test escaping: \$dollar, backslash \\ and quote " + +Retrieves edge-cases for escaping: \$var, \\, ", */ + +### Example +```kotlin +// Import classes: +//import org.openapitools.infrastructure.* +//import org.openapitools.server.api.model.* + +val apiInstance = PetApi() +try { + val result : EscapingEdgeCases = apiInstance.getEscapingEdgeCases() + println(result) +} catch (e: ClientException) { + println("4xx response calling PetApi#getEscapingEdgeCases") + e.printStackTrace() +} catch (e: ServerException) { + println("5xx response calling PetApi#getEscapingEdgeCases") + e.printStackTrace() +} +``` + +### Parameters +This endpoint does not need any parameter. + +### Return type + +[**EscapingEdgeCases**](EscapingEdgeCases.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: APPLICATION_JSON + # **getPetById** > Pet getPetById(petId) diff --git a/samples/server/petstore/kotlin-misk-config/docs/StoreApi.md b/samples/server/petstore/kotlin-misk-config/docs/StoreApi.md index d3add9f5776a..8170140ea27d 100644 --- a/samples/server/petstore/kotlin-misk-config/docs/StoreApi.md +++ b/samples/server/petstore/kotlin-misk-config/docs/StoreApi.md @@ -105,7 +105,7 @@ This endpoint does not need any parameter. Find purchase order by ID -For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions +For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions ### Example ```kotlin diff --git a/samples/server/petstore/kotlin-misk-config/src/main/kotlin/org/openapitools/server/api/api/PetApiAction.kt b/samples/server/petstore/kotlin-misk-config/src/main/kotlin/org/openapitools/server/api/api/PetApiAction.kt index f98d5a463e85..611c58b0c9e4 100644 --- a/samples/server/petstore/kotlin-misk-config/src/main/kotlin/org/openapitools/server/api/api/PetApiAction.kt +++ b/samples/server/petstore/kotlin-misk-config/src/main/kotlin/org/openapitools/server/api/api/PetApiAction.kt @@ -28,6 +28,7 @@ import misk.web.RequestHeader import misk.web.Response import misk.web.ResponseContentType import misk.web.mediatype.MediaTypes +import org.openapitools.server.api.model.EscapingEdgeCases import org.openapitools.server.api.model.ModelApiResponse import org.openapitools.server.api.model.Pet @@ -83,6 +84,16 @@ class PetApiAction @Inject constructor( TODO() } + @Get("samplePrefix/pet/escaping") + @Description("Test escaping: \$dollar, backslash \\ and quote \"") + @ResponseContentType(MediaTypes.APPLICATION_JSON) + @LogRequestResponse(bodySampling = 1.0, errorBodySampling = 2.0) + @Suppress("unused") + fun getEscapingEdgeCases( + ): EscapingEdgeCases { + TODO() + } + @Get("samplePrefix/pet/{petId}") @Description("Find pet by ID") @ResponseContentType(MediaTypes.APPLICATION_XML, MediaTypes.APPLICATION_JSON) diff --git a/samples/server/petstore/kotlin-misk-config/src/main/kotlin/org/openapitools/server/api/model/EscapingEdgeCases.kt b/samples/server/petstore/kotlin-misk-config/src/main/kotlin/org/openapitools/server/api/model/EscapingEdgeCases.kt new file mode 100644 index 000000000000..bdc5d466d1e5 --- /dev/null +++ b/samples/server/petstore/kotlin-misk-config/src/main/kotlin/org/openapitools/server/api/model/EscapingEdgeCases.kt @@ -0,0 +1,11 @@ +package org.openapitools.server.api.model + +import com.squareup.moshi.JsonClass + +@JsonClass(generateAdapter = true) +data class EscapingEdgeCases( + /** A string whose default has $dollar, backslash \\, quote \" and comment-close *_/ */ + val dollarDefault: kotlin.String? = "hello \$world, backslash=\\, quote=\", end */", + /** Regular property for baseline comparison */ + val regularProp: kotlin.String? = null +) diff --git a/samples/server/petstore/kotlin-misk/.openapi-generator/FILES b/samples/server/petstore/kotlin-misk/.openapi-generator/FILES index 594e5efd5ba2..9ef76d5d361c 100644 --- a/samples/server/petstore/kotlin-misk/.openapi-generator/FILES +++ b/samples/server/petstore/kotlin-misk/.openapi-generator/FILES @@ -2,6 +2,7 @@ README.md build.gradle.kts docs/ApiResponse.md docs/Category.md +docs/EscapingEdgeCases.md docs/Order.md docs/Pet.md docs/PetApi.md @@ -15,6 +16,7 @@ src/main/kotlin/org/openapitools/server/api/api/PetStoreModule.kt src/main/kotlin/org/openapitools/server/api/api/StoreApiAction.kt src/main/kotlin/org/openapitools/server/api/api/UserApiAction.kt src/main/kotlin/org/openapitools/server/api/model/Category.kt +src/main/kotlin/org/openapitools/server/api/model/EscapingEdgeCases.kt src/main/kotlin/org/openapitools/server/api/model/ModelApiResponse.kt src/main/kotlin/org/openapitools/server/api/model/Order.kt src/main/kotlin/org/openapitools/server/api/model/Pet.kt diff --git a/samples/server/petstore/kotlin-misk/README.md b/samples/server/petstore/kotlin-misk/README.md index 8fc27a719a91..a681a02dae40 100644 --- a/samples/server/petstore/kotlin-misk/README.md +++ b/samples/server/petstore/kotlin-misk/README.md @@ -11,6 +11,7 @@ *PetApi* | [**deletePet**](Apis/docs/PetApi.md#deletepet) | **Delete** /pet/{petId} | Deletes a pet *PetApi* | [**findPetsByStatus**](Apis/docs/PetApi.md#findpetsbystatus) | **Get** /pet/findByStatus | Finds Pets by status *PetApi* | [**findPetsByTags**](Apis/docs/PetApi.md#findpetsbytags) | **Get** /pet/findByTags | Finds Pets by tags + *PetApi* | [**getEscapingEdgeCases**](Apis/docs/PetApi.md#getescapingedgecases) | **Get** /pet/escaping | Test escaping: $dollar, backslash \\ and quote \" *PetApi* | [**getPetById**](Apis/docs/PetApi.md#getpetbyid) | **Get** /pet/{petId} | Find pet by ID *PetApi* | [**updatePet**](Apis/docs/PetApi.md#updatepet) | **Put** /pet | Update an existing pet *PetApi* | [**updatePetWithForm**](Apis/docs/PetApi.md#updatepetwithform) | **Post** /pet/{petId} | Updates a pet in the store with form data @@ -33,6 +34,7 @@ ## Documentation for Models - [org.openapitools.server.api.model.Category](Models/docs/Category.md) + - [org.openapitools.server.api.model.EscapingEdgeCases](Models/docs/EscapingEdgeCases.md) - [org.openapitools.server.api.model.ModelApiResponse](Models/docs/ModelApiResponse.md) - [org.openapitools.server.api.model.Order](Models/docs/Order.md) - [org.openapitools.server.api.model.Pet](Models/docs/Pet.md) diff --git a/samples/server/petstore/kotlin-misk/docs/EscapingEdgeCases.md b/samples/server/petstore/kotlin-misk/docs/EscapingEdgeCases.md new file mode 100644 index 000000000000..4ab2399cccc8 --- /dev/null +++ b/samples/server/petstore/kotlin-misk/docs/EscapingEdgeCases.md @@ -0,0 +1,11 @@ + +# EscapingEdgeCases + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**dollarDefault** | **kotlin.String** | A string whose default has \$dollar, backslash \\, quote " and comment-close */ | [optional] +**regularProp** | **kotlin.String** | Regular property for baseline comparison | [optional] + + + diff --git a/samples/server/petstore/kotlin-misk/docs/PetApi.md b/samples/server/petstore/kotlin-misk/docs/PetApi.md index 99dbe788edb0..5e073104a909 100644 --- a/samples/server/petstore/kotlin-misk/docs/PetApi.md +++ b/samples/server/petstore/kotlin-misk/docs/PetApi.md @@ -8,6 +8,7 @@ Method | HTTP request | Description [**deletePet**](PetApi.md#deletePet) | **Delete** /pet/{petId} | Deletes a pet [**findPetsByStatus**](PetApi.md#findPetsByStatus) | **Get** /pet/findByStatus | Finds Pets by status [**findPetsByTags**](PetApi.md#findPetsByTags) | **Get** /pet/findByTags | Finds Pets by tags +[**getEscapingEdgeCases**](PetApi.md#getEscapingEdgeCases) | **Get** /pet/escaping | Test escaping: \$dollar, backslash \\ and quote " [**getPetById**](PetApi.md#getPetById) | **Get** /pet/{petId} | Find pet by ID [**updatePet**](PetApi.md#updatePet) | **Put** /pet | Update an existing pet [**updatePetWithForm**](PetApi.md#updatePetWithForm) | **Post** /pet/{petId} | Updates a pet in the store with form data @@ -203,6 +204,49 @@ Name | Type | Description | Notes - **Content-Type**: Not defined - **Accept**: APPLICATION_XML, APPLICATION_JSON + +# **getEscapingEdgeCases** +> EscapingEdgeCases getEscapingEdgeCases() + +Test escaping: \$dollar, backslash \\ and quote " + +Retrieves edge-cases for escaping: \$var, \\, ", */ + +### Example +```kotlin +// Import classes: +//import org.openapitools.infrastructure.* +//import org.openapitools.server.api.model.* + +val apiInstance = PetApi() +try { + val result : EscapingEdgeCases = apiInstance.getEscapingEdgeCases() + println(result) +} catch (e: ClientException) { + println("4xx response calling PetApi#getEscapingEdgeCases") + e.printStackTrace() +} catch (e: ServerException) { + println("5xx response calling PetApi#getEscapingEdgeCases") + e.printStackTrace() +} +``` + +### Parameters +This endpoint does not need any parameter. + +### Return type + +[**EscapingEdgeCases**](EscapingEdgeCases.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: APPLICATION_JSON + # **getPetById** > Pet getPetById(petId) diff --git a/samples/server/petstore/kotlin-misk/docs/StoreApi.md b/samples/server/petstore/kotlin-misk/docs/StoreApi.md index d3add9f5776a..8170140ea27d 100644 --- a/samples/server/petstore/kotlin-misk/docs/StoreApi.md +++ b/samples/server/petstore/kotlin-misk/docs/StoreApi.md @@ -105,7 +105,7 @@ This endpoint does not need any parameter. Find purchase order by ID -For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions +For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions ### Example ```kotlin diff --git a/samples/server/petstore/kotlin-misk/src/main/kotlin/org/openapitools/server/api/api/PetApiAction.kt b/samples/server/petstore/kotlin-misk/src/main/kotlin/org/openapitools/server/api/api/PetApiAction.kt index 1a8c806566d5..5c9e639ac479 100644 --- a/samples/server/petstore/kotlin-misk/src/main/kotlin/org/openapitools/server/api/api/PetApiAction.kt +++ b/samples/server/petstore/kotlin-misk/src/main/kotlin/org/openapitools/server/api/api/PetApiAction.kt @@ -28,6 +28,7 @@ import misk.web.RequestHeader import misk.web.Response import misk.web.ResponseContentType import misk.web.mediatype.MediaTypes +import org.openapitools.server.api.model.EscapingEdgeCases import org.openapitools.server.api.model.ModelApiResponse import org.openapitools.server.api.model.Pet @@ -79,6 +80,15 @@ class PetApiAction @Inject constructor( TODO() } + @Get("/pet/escaping") + @Description("Test escaping: \$dollar, backslash \\ and quote \"") + @ResponseContentType(MediaTypes.APPLICATION_JSON) + @LogRequestResponse(bodySampling = 1.0, errorBodySampling = 1.0) + fun getEscapingEdgeCases( + ): EscapingEdgeCases { + TODO() + } + @Get("/pet/{petId}") @Description("Find pet by ID") @ResponseContentType(MediaTypes.APPLICATION_XML, MediaTypes.APPLICATION_JSON) diff --git a/samples/server/petstore/kotlin-misk/src/main/kotlin/org/openapitools/server/api/model/EscapingEdgeCases.kt b/samples/server/petstore/kotlin-misk/src/main/kotlin/org/openapitools/server/api/model/EscapingEdgeCases.kt new file mode 100644 index 000000000000..bdc5d466d1e5 --- /dev/null +++ b/samples/server/petstore/kotlin-misk/src/main/kotlin/org/openapitools/server/api/model/EscapingEdgeCases.kt @@ -0,0 +1,11 @@ +package org.openapitools.server.api.model + +import com.squareup.moshi.JsonClass + +@JsonClass(generateAdapter = true) +data class EscapingEdgeCases( + /** A string whose default has $dollar, backslash \\, quote \" and comment-close *_/ */ + val dollarDefault: kotlin.String? = "hello \$world, backslash=\\, quote=\", end */", + /** Regular property for baseline comparison */ + val regularProp: kotlin.String? = null +) diff --git a/samples/server/petstore/kotlin-spring-default/.openapi-generator/FILES b/samples/server/petstore/kotlin-spring-default/.openapi-generator/FILES index 98932e549209..6000fcacc452 100644 --- a/samples/server/petstore/kotlin-spring-default/.openapi-generator/FILES +++ b/samples/server/petstore/kotlin-spring-default/.openapi-generator/FILES @@ -22,6 +22,7 @@ src/main/kotlin/org/openapitools/model/Category.kt src/main/kotlin/org/openapitools/model/ModelApiResponse.kt src/main/kotlin/org/openapitools/model/Order.kt src/main/kotlin/org/openapitools/model/Pet.kt +src/main/kotlin/org/openapitools/model/PetWithSpecialProps.kt src/main/kotlin/org/openapitools/model/Tag.kt src/main/kotlin/org/openapitools/model/User.kt src/main/kotlin/org/openapitools/model/UserOrPet.kt diff --git a/samples/server/petstore/kotlin-spring-default/src/main/kotlin/org/openapitools/model/PetWithSpecialProps.kt b/samples/server/petstore/kotlin-spring-default/src/main/kotlin/org/openapitools/model/PetWithSpecialProps.kt new file mode 100644 index 000000000000..39a4dba2dd86 --- /dev/null +++ b/samples/server/petstore/kotlin-spring-default/src/main/kotlin/org/openapitools/model/PetWithSpecialProps.kt @@ -0,0 +1,31 @@ +package org.openapitools.model + +import java.util.Objects +import com.fasterxml.jackson.annotation.JsonProperty +import javax.validation.constraints.DecimalMax +import javax.validation.constraints.DecimalMin +import javax.validation.constraints.Email +import javax.validation.constraints.Max +import javax.validation.constraints.Min +import javax.validation.constraints.NotNull +import javax.validation.constraints.Pattern +import javax.validation.constraints.Size +import javax.validation.Valid +import io.swagger.v3.oas.annotations.media.Schema + +/** + * Model with $-prefixed property names for escaping tests (Issue 20502) + * @param dollarId Property with $-prefix in name; default has $dollar and backslash \\ + * @param nameDollarSuffix Property with $ mid-name; description has backslash \\ and quote \" + */ +data class PetWithSpecialProps( + + @Schema(example = "null", description = "Property with \$-prefix in name; default has \$dollar and backslash \\") + @get:JsonProperty("\$id") val dollarId: kotlin.String? = "hello \$world", + + @Schema(example = "null", description = "Property with \$ mid-name; description has backslash \\ and quote \"") + @get:JsonProperty("name\$Suffix") val nameDollarSuffix: kotlin.String? = null +) { + +} + diff --git a/samples/server/petstore/kotlin-spring-default/src/main/resources/openapi.yaml b/samples/server/petstore/kotlin-spring-default/src/main/resources/openapi.yaml index 1f2e34812c4b..cba7c9c31e12 100644 --- a/samples/server/petstore/kotlin-spring-default/src/main/resources/openapi.yaml +++ b/samples/server/petstore/kotlin-spring-default/src/main/resources/openapi.yaml @@ -856,6 +856,20 @@ components: - items: type: string type: array + PetWithSpecialProps: + description: Model with $-prefixed property names for escaping tests (Issue + 20502) + properties: + $id: + default: hello $world + description: Property with $-prefix in name; default has $dollar and backslash + \ + type: string + name$Suffix: + description: Property with $ mid-name; description has backslash \ and quote + " + type: string + type: object updatePetWithForm_request: properties: name: diff --git a/samples/server/petstore/kotlin-springboot-delegate/src/main/kotlin/org/openapitools/api/PetApiDelegate.kt b/samples/server/petstore/kotlin-springboot-delegate/src/main/kotlin/org/openapitools/api/PetApiDelegate.kt index 2068bb223f68..7d5bc6297631 100644 --- a/samples/server/petstore/kotlin-springboot-delegate/src/main/kotlin/org/openapitools/api/PetApiDelegate.kt +++ b/samples/server/petstore/kotlin-springboot-delegate/src/main/kotlin/org/openapitools/api/PetApiDelegate.kt @@ -26,11 +26,11 @@ interface PetApiDelegate { getRequest().ifPresent { request -> for (mediaType in MediaType.parseMediaTypes(request.getHeader("Accept"))) { if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { - ApiUtil.setExampleResponse(request, "application/json", "{ \"photoUrls\" : [ \"photoUrls\", \"photoUrls\" ], \"name\" : \"doggie\", \"id\" : 0, \"category\" : { \"name\" : \"name\", \"id\" : 6 }, \"tags\" : [ { \"name\" : \"name\", \"id\" : 1 }, { \"name\" : \"name\", \"id\" : 1 } ], \"status\" : \"available\"}") + ApiUtil.setExampleResponse(request, "application/json", "{\n \"photoUrls\" : [ \"photoUrls\", \"photoUrls\" ],\n \"name\" : \"doggie\",\n \"id\" : 0,\n \"category\" : {\n \"name\" : \"name\",\n \"id\" : 6\n },\n \"tags\" : [ {\n \"name\" : \"name\",\n \"id\" : 1\n }, {\n \"name\" : \"name\",\n \"id\" : 1\n } ],\n \"status\" : \"available\"\n}") break } if (mediaType.isCompatibleWith(MediaType.valueOf("application/xml"))) { - ApiUtil.setExampleResponse(request, "application/xml", " 123456789 123456789 aeiou doggie aeiou 123456789 aeiou aeiou") + ApiUtil.setExampleResponse(request, "application/xml", "\n 123456789\n \n 123456789\n aeiou\n \n doggie\n \n aeiou\n \n \n \n 123456789\n aeiou\n \n \n aeiou\n") break } } @@ -57,11 +57,11 @@ interface PetApiDelegate { getRequest().ifPresent { request -> for (mediaType in MediaType.parseMediaTypes(request.getHeader("Accept"))) { if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { - ApiUtil.setExampleResponse(request, "application/json", "[ { \"photoUrls\" : [ \"photoUrls\", \"photoUrls\" ], \"name\" : \"doggie\", \"id\" : 0, \"category\" : { \"name\" : \"name\", \"id\" : 6 }, \"tags\" : [ { \"name\" : \"name\", \"id\" : 1 }, { \"name\" : \"name\", \"id\" : 1 } ], \"status\" : \"available\"}, { \"photoUrls\" : [ \"photoUrls\", \"photoUrls\" ], \"name\" : \"doggie\", \"id\" : 0, \"category\" : { \"name\" : \"name\", \"id\" : 6 }, \"tags\" : [ { \"name\" : \"name\", \"id\" : 1 }, { \"name\" : \"name\", \"id\" : 1 } ], \"status\" : \"available\"} ]") + ApiUtil.setExampleResponse(request, "application/json", "[ {\n \"photoUrls\" : [ \"photoUrls\", \"photoUrls\" ],\n \"name\" : \"doggie\",\n \"id\" : 0,\n \"category\" : {\n \"name\" : \"name\",\n \"id\" : 6\n },\n \"tags\" : [ {\n \"name\" : \"name\",\n \"id\" : 1\n }, {\n \"name\" : \"name\",\n \"id\" : 1\n } ],\n \"status\" : \"available\"\n}, {\n \"photoUrls\" : [ \"photoUrls\", \"photoUrls\" ],\n \"name\" : \"doggie\",\n \"id\" : 0,\n \"category\" : {\n \"name\" : \"name\",\n \"id\" : 6\n },\n \"tags\" : [ {\n \"name\" : \"name\",\n \"id\" : 1\n }, {\n \"name\" : \"name\",\n \"id\" : 1\n } ],\n \"status\" : \"available\"\n} ]") break } if (mediaType.isCompatibleWith(MediaType.valueOf("application/xml"))) { - ApiUtil.setExampleResponse(request, "application/xml", " 123456789 123456789 aeiou doggie aeiou 123456789 aeiou aeiou") + ApiUtil.setExampleResponse(request, "application/xml", "\n 123456789\n \n 123456789\n aeiou\n \n doggie\n \n aeiou\n \n \n \n 123456789\n aeiou\n \n \n aeiou\n") break } } @@ -78,11 +78,11 @@ interface PetApiDelegate { getRequest().ifPresent { request -> for (mediaType in MediaType.parseMediaTypes(request.getHeader("Accept"))) { if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { - ApiUtil.setExampleResponse(request, "application/json", "[ { \"photoUrls\" : [ \"photoUrls\", \"photoUrls\" ], \"name\" : \"doggie\", \"id\" : 0, \"category\" : { \"name\" : \"name\", \"id\" : 6 }, \"tags\" : [ { \"name\" : \"name\", \"id\" : 1 }, { \"name\" : \"name\", \"id\" : 1 } ], \"status\" : \"available\"}, { \"photoUrls\" : [ \"photoUrls\", \"photoUrls\" ], \"name\" : \"doggie\", \"id\" : 0, \"category\" : { \"name\" : \"name\", \"id\" : 6 }, \"tags\" : [ { \"name\" : \"name\", \"id\" : 1 }, { \"name\" : \"name\", \"id\" : 1 } ], \"status\" : \"available\"} ]") + ApiUtil.setExampleResponse(request, "application/json", "[ {\n \"photoUrls\" : [ \"photoUrls\", \"photoUrls\" ],\n \"name\" : \"doggie\",\n \"id\" : 0,\n \"category\" : {\n \"name\" : \"name\",\n \"id\" : 6\n },\n \"tags\" : [ {\n \"name\" : \"name\",\n \"id\" : 1\n }, {\n \"name\" : \"name\",\n \"id\" : 1\n } ],\n \"status\" : \"available\"\n}, {\n \"photoUrls\" : [ \"photoUrls\", \"photoUrls\" ],\n \"name\" : \"doggie\",\n \"id\" : 0,\n \"category\" : {\n \"name\" : \"name\",\n \"id\" : 6\n },\n \"tags\" : [ {\n \"name\" : \"name\",\n \"id\" : 1\n }, {\n \"name\" : \"name\",\n \"id\" : 1\n } ],\n \"status\" : \"available\"\n} ]") break } if (mediaType.isCompatibleWith(MediaType.valueOf("application/xml"))) { - ApiUtil.setExampleResponse(request, "application/xml", " 123456789 123456789 aeiou doggie aeiou 123456789 aeiou aeiou") + ApiUtil.setExampleResponse(request, "application/xml", "\n 123456789\n \n 123456789\n aeiou\n \n doggie\n \n aeiou\n \n \n \n 123456789\n aeiou\n \n \n aeiou\n") break } } @@ -99,11 +99,11 @@ interface PetApiDelegate { getRequest().ifPresent { request -> for (mediaType in MediaType.parseMediaTypes(request.getHeader("Accept"))) { if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { - ApiUtil.setExampleResponse(request, "application/json", "{ \"photoUrls\" : [ \"photoUrls\", \"photoUrls\" ], \"name\" : \"doggie\", \"id\" : 0, \"category\" : { \"name\" : \"name\", \"id\" : 6 }, \"tags\" : [ { \"name\" : \"name\", \"id\" : 1 }, { \"name\" : \"name\", \"id\" : 1 } ], \"status\" : \"available\"}") + ApiUtil.setExampleResponse(request, "application/json", "{\n \"photoUrls\" : [ \"photoUrls\", \"photoUrls\" ],\n \"name\" : \"doggie\",\n \"id\" : 0,\n \"category\" : {\n \"name\" : \"name\",\n \"id\" : 6\n },\n \"tags\" : [ {\n \"name\" : \"name\",\n \"id\" : 1\n }, {\n \"name\" : \"name\",\n \"id\" : 1\n } ],\n \"status\" : \"available\"\n}") break } if (mediaType.isCompatibleWith(MediaType.valueOf("application/xml"))) { - ApiUtil.setExampleResponse(request, "application/xml", " 123456789 123456789 aeiou doggie aeiou 123456789 aeiou aeiou") + ApiUtil.setExampleResponse(request, "application/xml", "\n 123456789\n \n 123456789\n aeiou\n \n doggie\n \n aeiou\n \n \n \n 123456789\n aeiou\n \n \n aeiou\n") break } } @@ -120,11 +120,11 @@ interface PetApiDelegate { getRequest().ifPresent { request -> for (mediaType in MediaType.parseMediaTypes(request.getHeader("Accept"))) { if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { - ApiUtil.setExampleResponse(request, "application/json", "{ \"photoUrls\" : [ \"photoUrls\", \"photoUrls\" ], \"name\" : \"doggie\", \"id\" : 0, \"category\" : { \"name\" : \"name\", \"id\" : 6 }, \"tags\" : [ { \"name\" : \"name\", \"id\" : 1 }, { \"name\" : \"name\", \"id\" : 1 } ], \"status\" : \"available\"}") + ApiUtil.setExampleResponse(request, "application/json", "{\n \"photoUrls\" : [ \"photoUrls\", \"photoUrls\" ],\n \"name\" : \"doggie\",\n \"id\" : 0,\n \"category\" : {\n \"name\" : \"name\",\n \"id\" : 6\n },\n \"tags\" : [ {\n \"name\" : \"name\",\n \"id\" : 1\n }, {\n \"name\" : \"name\",\n \"id\" : 1\n } ],\n \"status\" : \"available\"\n}") break } if (mediaType.isCompatibleWith(MediaType.valueOf("application/xml"))) { - ApiUtil.setExampleResponse(request, "application/xml", " 123456789 doggie aeiou aeiou") + ApiUtil.setExampleResponse(request, "application/xml", "\n 123456789\n doggie\n \n aeiou\n \n \n \n aeiou\n") break } } @@ -154,7 +154,7 @@ interface PetApiDelegate { getRequest().ifPresent { request -> for (mediaType in MediaType.parseMediaTypes(request.getHeader("Accept"))) { if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { - ApiUtil.setExampleResponse(request, "application/json", "{ \"code\" : 0, \"type\" : \"type\", \"message\" : \"message\"}") + ApiUtil.setExampleResponse(request, "application/json", "{\n \"code\" : 0,\n \"type\" : \"type\",\n \"message\" : \"message\"\n}") break } } diff --git a/samples/server/petstore/kotlin-springboot-delegate/src/main/kotlin/org/openapitools/api/StoreApiDelegate.kt b/samples/server/petstore/kotlin-springboot-delegate/src/main/kotlin/org/openapitools/api/StoreApiDelegate.kt index c8b6c62ca4d2..c854870be6ae 100644 --- a/samples/server/petstore/kotlin-springboot-delegate/src/main/kotlin/org/openapitools/api/StoreApiDelegate.kt +++ b/samples/server/petstore/kotlin-springboot-delegate/src/main/kotlin/org/openapitools/api/StoreApiDelegate.kt @@ -43,11 +43,11 @@ interface StoreApiDelegate { getRequest().ifPresent { request -> for (mediaType in MediaType.parseMediaTypes(request.getHeader("Accept"))) { if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { - ApiUtil.setExampleResponse(request, "application/json", "{ \"petId\" : 6, \"quantity\" : 1, \"id\" : 0, \"shipDate\" : \"2000-01-23T04:56:07.000+00:00\", \"complete\" : false, \"status\" : \"placed\"}") + ApiUtil.setExampleResponse(request, "application/json", "{\n \"petId\" : 6,\n \"quantity\" : 1,\n \"id\" : 0,\n \"shipDate\" : \"2000-01-23T04:56:07.000+00:00\",\n \"complete\" : false,\n \"status\" : \"placed\"\n}") break } if (mediaType.isCompatibleWith(MediaType.valueOf("application/xml"))) { - ApiUtil.setExampleResponse(request, "application/xml", " 123456789 123456789 123 2000-01-23T04:56:07.000Z aeiou true") + ApiUtil.setExampleResponse(request, "application/xml", "\n 123456789\n 123456789\n 123\n 2000-01-23T04:56:07.000Z\n aeiou\n true\n") break } } @@ -64,11 +64,11 @@ interface StoreApiDelegate { getRequest().ifPresent { request -> for (mediaType in MediaType.parseMediaTypes(request.getHeader("Accept"))) { if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { - ApiUtil.setExampleResponse(request, "application/json", "{ \"petId\" : 6, \"quantity\" : 1, \"id\" : 0, \"shipDate\" : \"2000-01-23T04:56:07.000+00:00\", \"complete\" : false, \"status\" : \"placed\"}") + ApiUtil.setExampleResponse(request, "application/json", "{\n \"petId\" : 6,\n \"quantity\" : 1,\n \"id\" : 0,\n \"shipDate\" : \"2000-01-23T04:56:07.000+00:00\",\n \"complete\" : false,\n \"status\" : \"placed\"\n}") break } if (mediaType.isCompatibleWith(MediaType.valueOf("application/xml"))) { - ApiUtil.setExampleResponse(request, "application/xml", " 123456789 123456789 123 2000-01-23T04:56:07.000Z aeiou true") + ApiUtil.setExampleResponse(request, "application/xml", "\n 123456789\n 123456789\n 123\n 2000-01-23T04:56:07.000Z\n aeiou\n true\n") break } } diff --git a/samples/server/petstore/kotlin-springboot-delegate/src/main/kotlin/org/openapitools/api/UserApiDelegate.kt b/samples/server/petstore/kotlin-springboot-delegate/src/main/kotlin/org/openapitools/api/UserApiDelegate.kt index 410f3c12ea2c..dd662ceac7fd 100644 --- a/samples/server/petstore/kotlin-springboot-delegate/src/main/kotlin/org/openapitools/api/UserApiDelegate.kt +++ b/samples/server/petstore/kotlin-springboot-delegate/src/main/kotlin/org/openapitools/api/UserApiDelegate.kt @@ -61,11 +61,11 @@ interface UserApiDelegate { getRequest().ifPresent { request -> for (mediaType in MediaType.parseMediaTypes(request.getHeader("Accept"))) { if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { - ApiUtil.setExampleResponse(request, "application/json", "{ \"firstName\" : \"firstName\", \"lastName\" : \"lastName\", \"password\" : \"password\", \"userStatus\" : 6, \"phone\" : \"phone\", \"id\" : 0, \"email\" : \"email\", \"username\" : \"username\"}") + ApiUtil.setExampleResponse(request, "application/json", "{\n \"firstName\" : \"firstName\",\n \"lastName\" : \"lastName\",\n \"password\" : \"password\",\n \"userStatus\" : 6,\n \"phone\" : \"phone\",\n \"id\" : 0,\n \"email\" : \"email\",\n \"username\" : \"username\"\n}") break } if (mediaType.isCompatibleWith(MediaType.valueOf("application/xml"))) { - ApiUtil.setExampleResponse(request, "application/xml", " 123456789 aeiou aeiou aeiou aeiou aeiou aeiou 123") + ApiUtil.setExampleResponse(request, "application/xml", "\n 123456789\n aeiou\n aeiou\n aeiou\n aeiou\n aeiou\n aeiou\n 123\n") break } } diff --git a/samples/server/petstore/kotlin-springboot-no-response-entity-delegate/src/main/kotlin/org/openapitools/api/PetApiDelegate.kt b/samples/server/petstore/kotlin-springboot-no-response-entity-delegate/src/main/kotlin/org/openapitools/api/PetApiDelegate.kt index c45d28c4ccb7..2ff9e842b9b1 100644 --- a/samples/server/petstore/kotlin-springboot-no-response-entity-delegate/src/main/kotlin/org/openapitools/api/PetApiDelegate.kt +++ b/samples/server/petstore/kotlin-springboot-no-response-entity-delegate/src/main/kotlin/org/openapitools/api/PetApiDelegate.kt @@ -43,11 +43,11 @@ interface PetApiDelegate { getRequest().ifPresent { request -> for (mediaType in MediaType.parseMediaTypes(request.getHeader("Accept"))) { if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { - ApiUtil.setExampleResponse(request, "application/json", "[ { \"photoUrls\" : [ \"photoUrls\", \"photoUrls\" ], \"name\" : \"doggie\", \"id\" : 0, \"category\" : { \"name\" : \"name\", \"id\" : 6 }, \"tags\" : [ { \"name\" : \"name\", \"id\" : 1 }, { \"name\" : \"name\", \"id\" : 1 } ], \"status\" : \"available\"}, { \"photoUrls\" : [ \"photoUrls\", \"photoUrls\" ], \"name\" : \"doggie\", \"id\" : 0, \"category\" : { \"name\" : \"name\", \"id\" : 6 }, \"tags\" : [ { \"name\" : \"name\", \"id\" : 1 }, { \"name\" : \"name\", \"id\" : 1 } ], \"status\" : \"available\"} ]") + ApiUtil.setExampleResponse(request, "application/json", "[ {\n \"photoUrls\" : [ \"photoUrls\", \"photoUrls\" ],\n \"name\" : \"doggie\",\n \"id\" : 0,\n \"category\" : {\n \"name\" : \"name\",\n \"id\" : 6\n },\n \"tags\" : [ {\n \"name\" : \"name\",\n \"id\" : 1\n }, {\n \"name\" : \"name\",\n \"id\" : 1\n } ],\n \"status\" : \"available\"\n}, {\n \"photoUrls\" : [ \"photoUrls\", \"photoUrls\" ],\n \"name\" : \"doggie\",\n \"id\" : 0,\n \"category\" : {\n \"name\" : \"name\",\n \"id\" : 6\n },\n \"tags\" : [ {\n \"name\" : \"name\",\n \"id\" : 1\n }, {\n \"name\" : \"name\",\n \"id\" : 1\n } ],\n \"status\" : \"available\"\n} ]") break } if (mediaType.isCompatibleWith(MediaType.valueOf("application/xml"))) { - ApiUtil.setExampleResponse(request, "application/xml", " 123456789 123456789 aeiou doggie aeiou 123456789 aeiou aeiou") + ApiUtil.setExampleResponse(request, "application/xml", "\n 123456789\n \n 123456789\n aeiou\n \n doggie\n \n aeiou\n \n \n \n 123456789\n aeiou\n \n \n aeiou\n") break } } @@ -64,11 +64,11 @@ interface PetApiDelegate { getRequest().ifPresent { request -> for (mediaType in MediaType.parseMediaTypes(request.getHeader("Accept"))) { if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { - ApiUtil.setExampleResponse(request, "application/json", "[ { \"photoUrls\" : [ \"photoUrls\", \"photoUrls\" ], \"name\" : \"doggie\", \"id\" : 0, \"category\" : { \"name\" : \"name\", \"id\" : 6 }, \"tags\" : [ { \"name\" : \"name\", \"id\" : 1 }, { \"name\" : \"name\", \"id\" : 1 } ], \"status\" : \"available\"}, { \"photoUrls\" : [ \"photoUrls\", \"photoUrls\" ], \"name\" : \"doggie\", \"id\" : 0, \"category\" : { \"name\" : \"name\", \"id\" : 6 }, \"tags\" : [ { \"name\" : \"name\", \"id\" : 1 }, { \"name\" : \"name\", \"id\" : 1 } ], \"status\" : \"available\"} ]") + ApiUtil.setExampleResponse(request, "application/json", "[ {\n \"photoUrls\" : [ \"photoUrls\", \"photoUrls\" ],\n \"name\" : \"doggie\",\n \"id\" : 0,\n \"category\" : {\n \"name\" : \"name\",\n \"id\" : 6\n },\n \"tags\" : [ {\n \"name\" : \"name\",\n \"id\" : 1\n }, {\n \"name\" : \"name\",\n \"id\" : 1\n } ],\n \"status\" : \"available\"\n}, {\n \"photoUrls\" : [ \"photoUrls\", \"photoUrls\" ],\n \"name\" : \"doggie\",\n \"id\" : 0,\n \"category\" : {\n \"name\" : \"name\",\n \"id\" : 6\n },\n \"tags\" : [ {\n \"name\" : \"name\",\n \"id\" : 1\n }, {\n \"name\" : \"name\",\n \"id\" : 1\n } ],\n \"status\" : \"available\"\n} ]") break } if (mediaType.isCompatibleWith(MediaType.valueOf("application/xml"))) { - ApiUtil.setExampleResponse(request, "application/xml", " 123456789 123456789 aeiou doggie aeiou 123456789 aeiou aeiou") + ApiUtil.setExampleResponse(request, "application/xml", "\n 123456789\n \n 123456789\n aeiou\n \n doggie\n \n aeiou\n \n \n \n 123456789\n aeiou\n \n \n aeiou\n") break } } @@ -85,11 +85,11 @@ interface PetApiDelegate { getRequest().ifPresent { request -> for (mediaType in MediaType.parseMediaTypes(request.getHeader("Accept"))) { if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { - ApiUtil.setExampleResponse(request, "application/json", "{ \"photoUrls\" : [ \"photoUrls\", \"photoUrls\" ], \"name\" : \"doggie\", \"id\" : 0, \"category\" : { \"name\" : \"name\", \"id\" : 6 }, \"tags\" : [ { \"name\" : \"name\", \"id\" : 1 }, { \"name\" : \"name\", \"id\" : 1 } ], \"status\" : \"available\"}") + ApiUtil.setExampleResponse(request, "application/json", "{\n \"photoUrls\" : [ \"photoUrls\", \"photoUrls\" ],\n \"name\" : \"doggie\",\n \"id\" : 0,\n \"category\" : {\n \"name\" : \"name\",\n \"id\" : 6\n },\n \"tags\" : [ {\n \"name\" : \"name\",\n \"id\" : 1\n }, {\n \"name\" : \"name\",\n \"id\" : 1\n } ],\n \"status\" : \"available\"\n}") break } if (mediaType.isCompatibleWith(MediaType.valueOf("application/xml"))) { - ApiUtil.setExampleResponse(request, "application/xml", " 123456789 123456789 aeiou doggie aeiou 123456789 aeiou aeiou") + ApiUtil.setExampleResponse(request, "application/xml", "\n 123456789\n \n 123456789\n aeiou\n \n doggie\n \n aeiou\n \n \n \n 123456789\n aeiou\n \n \n aeiou\n") break } } @@ -128,7 +128,7 @@ interface PetApiDelegate { getRequest().ifPresent { request -> for (mediaType in MediaType.parseMediaTypes(request.getHeader("Accept"))) { if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { - ApiUtil.setExampleResponse(request, "application/json", "{ \"code\" : 0, \"type\" : \"type\", \"message\" : \"message\"}") + ApiUtil.setExampleResponse(request, "application/json", "{\n \"code\" : 0,\n \"type\" : \"type\",\n \"message\" : \"message\"\n}") break } } diff --git a/samples/server/petstore/kotlin-springboot-no-response-entity-delegate/src/main/kotlin/org/openapitools/api/StoreApiDelegate.kt b/samples/server/petstore/kotlin-springboot-no-response-entity-delegate/src/main/kotlin/org/openapitools/api/StoreApiDelegate.kt index 6a99bc0d1089..0308b98793b2 100644 --- a/samples/server/petstore/kotlin-springboot-no-response-entity-delegate/src/main/kotlin/org/openapitools/api/StoreApiDelegate.kt +++ b/samples/server/petstore/kotlin-springboot-no-response-entity-delegate/src/main/kotlin/org/openapitools/api/StoreApiDelegate.kt @@ -41,11 +41,11 @@ interface StoreApiDelegate { getRequest().ifPresent { request -> for (mediaType in MediaType.parseMediaTypes(request.getHeader("Accept"))) { if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { - ApiUtil.setExampleResponse(request, "application/json", "{ \"petId\" : 6, \"quantity\" : 1, \"id\" : 0, \"shipDate\" : \"2000-01-23T04:56:07.000+00:00\", \"complete\" : false, \"status\" : \"placed\"}") + ApiUtil.setExampleResponse(request, "application/json", "{\n \"petId\" : 6,\n \"quantity\" : 1,\n \"id\" : 0,\n \"shipDate\" : \"2000-01-23T04:56:07.000+00:00\",\n \"complete\" : false,\n \"status\" : \"placed\"\n}") break } if (mediaType.isCompatibleWith(MediaType.valueOf("application/xml"))) { - ApiUtil.setExampleResponse(request, "application/xml", " 123456789 123456789 123 2000-01-23T04:56:07.000Z aeiou true") + ApiUtil.setExampleResponse(request, "application/xml", "\n 123456789\n 123456789\n 123\n 2000-01-23T04:56:07.000Z\n aeiou\n true\n") break } } @@ -62,11 +62,11 @@ interface StoreApiDelegate { getRequest().ifPresent { request -> for (mediaType in MediaType.parseMediaTypes(request.getHeader("Accept"))) { if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { - ApiUtil.setExampleResponse(request, "application/json", "{ \"petId\" : 6, \"quantity\" : 1, \"id\" : 0, \"shipDate\" : \"2000-01-23T04:56:07.000+00:00\", \"complete\" : false, \"status\" : \"placed\"}") + ApiUtil.setExampleResponse(request, "application/json", "{\n \"petId\" : 6,\n \"quantity\" : 1,\n \"id\" : 0,\n \"shipDate\" : \"2000-01-23T04:56:07.000+00:00\",\n \"complete\" : false,\n \"status\" : \"placed\"\n}") break } if (mediaType.isCompatibleWith(MediaType.valueOf("application/xml"))) { - ApiUtil.setExampleResponse(request, "application/xml", " 123456789 123456789 123 2000-01-23T04:56:07.000Z aeiou true") + ApiUtil.setExampleResponse(request, "application/xml", "\n 123456789\n 123456789\n 123\n 2000-01-23T04:56:07.000Z\n aeiou\n true\n") break } } diff --git a/samples/server/petstore/kotlin-springboot-no-response-entity-delegate/src/main/kotlin/org/openapitools/api/UserApiDelegate.kt b/samples/server/petstore/kotlin-springboot-no-response-entity-delegate/src/main/kotlin/org/openapitools/api/UserApiDelegate.kt index 11b66862f3b6..3eb216032617 100644 --- a/samples/server/petstore/kotlin-springboot-no-response-entity-delegate/src/main/kotlin/org/openapitools/api/UserApiDelegate.kt +++ b/samples/server/petstore/kotlin-springboot-no-response-entity-delegate/src/main/kotlin/org/openapitools/api/UserApiDelegate.kt @@ -59,11 +59,11 @@ interface UserApiDelegate { getRequest().ifPresent { request -> for (mediaType in MediaType.parseMediaTypes(request.getHeader("Accept"))) { if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { - ApiUtil.setExampleResponse(request, "application/json", "{ \"firstName\" : \"firstName\", \"lastName\" : \"lastName\", \"password\" : \"password\", \"userStatus\" : 6, \"phone\" : \"phone\", \"id\" : 0, \"email\" : \"email\", \"username\" : \"username\"}") + ApiUtil.setExampleResponse(request, "application/json", "{\n \"firstName\" : \"firstName\",\n \"lastName\" : \"lastName\",\n \"password\" : \"password\",\n \"userStatus\" : 6,\n \"phone\" : \"phone\",\n \"id\" : 0,\n \"email\" : \"email\",\n \"username\" : \"username\"\n}") break } if (mediaType.isCompatibleWith(MediaType.valueOf("application/xml"))) { - ApiUtil.setExampleResponse(request, "application/xml", " 123456789 aeiou aeiou aeiou aeiou aeiou aeiou 123") + ApiUtil.setExampleResponse(request, "application/xml", "\n 123456789\n aeiou\n aeiou\n aeiou\n aeiou\n aeiou\n aeiou\n 123\n") break } }