From 9276ef8f4760e9964d29bb64347bc59887725da5 Mon Sep 17 00:00:00 2001 From: khayashi4337 Date: Sun, 20 Sep 2026 17:46:49 +0900 Subject: [PATCH 01/31] fix(core): warn instead of silently dropping unrecognized path-item operations (#24212) Under --skip-validate-spec, when the parser encounters a path-item member it doesn't recognize (e.g. a future operation like OpenAPI 3.2's 'query' HTTP method), it silently drops it and generation reports success with no indication that an operation is missing. - Detect swagger-parser's "attribute paths.'X'.Y is unexpected" messages and escalate matching ones into an explicit WARN naming exactly which path-item members will be missing from the generated output. - When the parser cannot produce an OpenAPI object at all (e.g. an unsupported spec version), fail immediately with a message that includes the parser's own diagnostics, instead of letting null propagate through several layers before a generic error surfaces later in DefaultGenerator.generate(). Closes #24212 --- .../codegen/config/CodegenConfigurator.java | 43 +++++++ .../config/CodegenConfiguratorTest.java | 112 ++++++++++++++++++ .../issue_24212_path_item_parameter_typo.yaml | 17 +++ .../issue_24212_unknown_path_item_member.yaml | 16 +++ .../3_0/issue_24212_unsupported_version.yaml | 16 +++ 5 files changed, 204 insertions(+) create mode 100644 modules/openapi-generator/src/test/resources/3_0/issue_24212_path_item_parameter_typo.yaml create mode 100644 modules/openapi-generator/src/test/resources/3_0/issue_24212_unknown_path_item_member.yaml create mode 100644 modules/openapi-generator/src/test/resources/3_0/issue_24212_unsupported_version.yaml diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/config/CodegenConfigurator.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/config/CodegenConfigurator.java index 6a53f919fe97..34de7371dbc7 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/config/CodegenConfigurator.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/config/CodegenConfigurator.java @@ -41,6 +41,8 @@ import java.io.File; import java.io.IOException; import java.util.*; +import java.util.regex.Matcher; +import java.util.regex.Pattern; import static org.apache.commons.lang3.StringUtils.isEmpty; import static org.apache.commons.lang3.StringUtils.isNotEmpty; @@ -57,6 +59,14 @@ public class CodegenConfigurator { public static final Logger LOGGER = LoggerFactory.getLogger(CodegenConfigurator.class); + // Matches swagger-parser's OpenAPIDeserializer$ParseResult#extra(...) message format, + // e.g. "attribute paths.'/tasks'.query is unexpected". The attribute name is restricted to a + // single simple token so this does NOT match a typo'd key nested one level down (e.g. a + // path-level parameter or server object), which is reported under the same "paths.'X'." prefix + // but is not itself a dropped operation. + private static final Pattern UNEXPECTED_PATH_ITEM_ATTRIBUTE = + Pattern.compile("attribute paths\\.'(.+)'\\.([^.\\[\\]()'\\s]+) is unexpected"); + private GeneratorSettings.Builder generatorSettingsBuilder = GeneratorSettings.newBuilder(); private WorkflowSettings.Builder workflowSettingsBuilder = WorkflowSettings.newBuilder(); @@ -758,9 +768,42 @@ public Context toContext() { msg -> sb.append("\t-").append(msg).append(System.lineSeparator())); } LOGGER.warn(sb.toString()); + + // The parser silently drops any path-item member it doesn't recognize (e.g. a + // future-spec operation like OpenAPI 3.2's 'query'), but still reports it as an + // "unexpected attribute" message. With validation disabled that message is easy to + // miss among unrelated warnings, so surface it explicitly. Only do this when + // generation will actually proceed (specification != null) -- otherwise the + // null-check below already reports failure, and claiming specific members will be + // "missing" is misleading when nothing at all will be generated. + // See https://github.com/OpenAPITools/openapi-generator/issues/24212 + if (specification != null) { + List droppedPathItemMembers = new ArrayList<>(); + for (String msg : validationMessages) { + Matcher matcher = UNEXPECTED_PATH_ITEM_ATTRIBUTE.matcher(msg); + if (matcher.matches()) { + droppedPathItemMembers.add("'" + matcher.group(2) + "' at path '" + matcher.group(1) + "'"); + } + } + if (!droppedPathItemMembers.isEmpty()) { + LOGGER.warn("The OpenAPI parser did not recognize the following attribute(s) under these " + + "paths and dropped them; if one of them was meant to be an operation (e.g. using an " + + "HTTP method this parser version doesn't know, such as OpenAPI 3.2's 'query'), it " + + "will be MISSING from the generated output: " + String.join(", ", droppedPathItemMembers)); + } + } } } + if (specification == null) { + String reason = validationMessages.isEmpty() + ? "no additional detail was reported by the OpenAPI parser" + : "the parser reported: " + String.join("; ", validationMessages); + throw new RuntimeException("Unable to parse an OpenAPI document from '" + inputSpec + "' (" + reason + + "). This can happen when the spec declares an OpenAPI version newer than what this generator's " + + "parser supports, or when the file is malformed."); + } + return new Context<>(specification, generatorSettings, workflowSettings); } diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/config/CodegenConfiguratorTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/config/CodegenConfiguratorTest.java index 551c613b1ca0..e782c03df6a0 100644 --- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/config/CodegenConfiguratorTest.java +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/config/CodegenConfiguratorTest.java @@ -16,12 +16,16 @@ package org.openapitools.codegen.config; +import ch.qos.logback.classic.spi.ILoggingEvent; +import ch.qos.logback.core.read.ListAppender; import io.swagger.v3.oas.models.OpenAPI; import org.junit.jupiter.api.Assertions; import org.openapitools.codegen.ClientOptInput; import org.openapitools.codegen.CodegenConfig; import org.openapitools.codegen.CodegenConstants; +import org.openapitools.codegen.SpecValidationException; import org.openapitools.codegen.testutils.ConfigAssert; +import org.slf4j.LoggerFactory; import org.testng.annotations.Test; import java.io.File; @@ -29,7 +33,12 @@ import java.nio.file.Files; import java.nio.file.Paths; import java.util.HashMap; +import java.util.List; import java.util.Map; +import java.util.stream.Collectors; + +import static org.testng.Assert.assertFalse; +import static org.testng.Assert.assertTrue; public class CodegenConfiguratorTest { private void want(ConfigAssert configAssert, String key, Object expected) { @@ -133,4 +142,107 @@ public void resolvesResponses() { Assertions.assertNotNull(context.getSpecDocument().getPaths().get("/hello").getGet().getResponses().get("200").getContent()); } + + // https://github.com/OpenAPITools/openapi-generator/issues/24212 + @Test + public void shouldWarnAboutDroppedUnrecognizedPathItemOperation() { + ch.qos.logback.classic.Logger logger = + (ch.qos.logback.classic.Logger) LoggerFactory.getLogger(CodegenConfigurator.class); + ListAppender listAppender = new ListAppender<>(); + listAppender.start(); + logger.addAppender(listAppender); + + try { + @SuppressWarnings("unchecked") Context context = (Context) new CodegenConfigurator() + .setInputSpec("src/test/resources/3_0/issue_24212_unknown_path_item_member.yaml") + .setGeneratorName("java") + .setValidateSpec(false) + .toContext(); + + // generation still proceeds: the recognized 'get' operation is present + Assertions.assertNotNull(context.getSpecDocument().getPaths().get("/tasks").getGet()); + + List missingWarnLogs = listAppender.list.stream() + .filter(e -> e.getLevel() == ch.qos.logback.classic.Level.WARN) + .filter(e -> e.getFormattedMessage().contains("'query' at path '/tasks'")) + .filter(e -> e.getFormattedMessage().contains("MISSING")) + .collect(Collectors.toList()); + assertFalse(missingWarnLogs.isEmpty(), + "A WARN log naming the dropped 'query' operation at path '/tasks' as MISSING must be emitted"); + } finally { + logger.detachAppender(listAppender); + } + } + + // https://github.com/OpenAPITools/openapi-generator/issues/24212 + @Test + public void shouldNotFalsePositiveOnNestedPathItemMemberTypo() { + ch.qos.logback.classic.Logger logger = + (ch.qos.logback.classic.Logger) LoggerFactory.getLogger(CodegenConfigurator.class); + ListAppender listAppender = new ListAppender<>(); + listAppender.start(); + logger.addAppender(listAppender); + + try { + @SuppressWarnings("unchecked") Context context = (Context) new CodegenConfigurator() + .setInputSpec("src/test/resources/3_0/issue_24212_path_item_parameter_typo.yaml") + .setGeneratorName("java") + .setValidateSpec(false) + .toContext(); + + // generation still proceeds despite the typo'd nested attribute + Assertions.assertNotNull(context.getSpecDocument().getPaths().get("/tasks/{id}").getGet()); + + // a typo inside a path-level parameter/server object is not itself a dropped operation + List missingWarnLogs = listAppender.list.stream() + .filter(e -> e.getLevel() == ch.qos.logback.classic.Level.WARN) + .filter(e -> e.getFormattedMessage().contains("MISSING")) + .collect(Collectors.toList()); + assertTrue(missingWarnLogs.isEmpty(), + "A nested parameter/server typo must not be reported as a dropped path-item operation"); + } finally { + logger.detachAppender(listAppender); + } + } + + // https://github.com/OpenAPITools/openapi-generator/issues/24212 + @Test + public void shouldFailWithClearMessageAndNoMisleadingWarningWhenSpecificationIsNull() { + ch.qos.logback.classic.Logger logger = + (ch.qos.logback.classic.Logger) LoggerFactory.getLogger(CodegenConfigurator.class); + ListAppender listAppender = new ListAppender<>(); + listAppender.start(); + logger.addAppender(listAppender); + + try { + CodegenConfigurator configurator = new CodegenConfigurator() + .setInputSpec("src/test/resources/3_0/issue_24212_unsupported_version.yaml") + .setGeneratorName("java") + .setValidateSpec(false); + + RuntimeException ex = Assertions.assertThrows(RuntimeException.class, configurator::toContext); + assertFalse(ex instanceof SpecValidationException, "expected a plain RuntimeException, not SpecValidationException"); + assertTrue(ex.getMessage().startsWith("Unable to parse an OpenAPI document"), ex.getMessage()); + + // nothing will be generated at all, so no operation should be reported as merely "MISSING" + List missingWarnLogs = listAppender.list.stream() + .filter(e -> e.getFormattedMessage().contains("MISSING")) + .collect(Collectors.toList()); + assertTrue(missingWarnLogs.isEmpty(), + "Must not claim specific operations are 'MISSING' when generation cannot proceed at all"); + } finally { + logger.detachAppender(listAppender); + } + } + + // https://github.com/OpenAPITools/openapi-generator/issues/24212 + @Test + public void shouldStillThrowSpecValidationExceptionByDefaultForUnknownPathItemOperation() { + CodegenConfigurator configurator = new CodegenConfigurator() + .setInputSpec("src/test/resources/3_0/issue_24212_unknown_path_item_member.yaml") + .setGeneratorName("java"); + // default validateSpec=true is unchanged by this fix: it still fails fast with the + // existing, structured SpecValidationException rather than the new generic message. + Assertions.assertThrows(SpecValidationException.class, configurator::toContext); + } } diff --git a/modules/openapi-generator/src/test/resources/3_0/issue_24212_path_item_parameter_typo.yaml b/modules/openapi-generator/src/test/resources/3_0/issue_24212_path_item_parameter_typo.yaml new file mode 100644 index 000000000000..c7aaee914a0f --- /dev/null +++ b/modules/openapi-generator/src/test/resources/3_0/issue_24212_path_item_parameter_typo.yaml @@ -0,0 +1,17 @@ +openapi: 3.0.3 +info: + title: issue 24212 false-positive regression test + version: '1.0' +paths: + /tasks/{id}: + parameters: + - name: id + in: path + requried: true + schema: + type: string + get: + operationId: getTask + responses: + '200': + description: OK diff --git a/modules/openapi-generator/src/test/resources/3_0/issue_24212_unknown_path_item_member.yaml b/modules/openapi-generator/src/test/resources/3_0/issue_24212_unknown_path_item_member.yaml new file mode 100644 index 000000000000..751983692d15 --- /dev/null +++ b/modules/openapi-generator/src/test/resources/3_0/issue_24212_unknown_path_item_member.yaml @@ -0,0 +1,16 @@ +openapi: 3.0.3 +info: + title: issue 24212 test + version: '1.0' +paths: + /tasks: + get: + operationId: getTasks + responses: + '200': + description: OK + query: + operationId: queryTasks + responses: + '200': + description: OK diff --git a/modules/openapi-generator/src/test/resources/3_0/issue_24212_unsupported_version.yaml b/modules/openapi-generator/src/test/resources/3_0/issue_24212_unsupported_version.yaml new file mode 100644 index 000000000000..2a4f4c877aab --- /dev/null +++ b/modules/openapi-generator/src/test/resources/3_0/issue_24212_unsupported_version.yaml @@ -0,0 +1,16 @@ +openapi: 3.2.0 +info: + title: issue 24212 unparseable-version test + version: '1.0' +paths: + /tasks: + get: + operationId: getTasks + responses: + '200': + description: OK + query: + operationId: queryTasks + responses: + '200': + description: OK From c83850f809633a32d14643ed7056dfa176c1273c Mon Sep 17 00:00:00 2001 From: khayashi4337 Date: Tue, 22 Sep 2026 10:33:35 +0900 Subject: [PATCH 02/31] feat(core): generate OpenAPI 3.2 query/additionalOperations and in:querystring - ingest PathItem.query and PathItem.additionalOperations through the same core paths as the fixed methods (operation collection, preprocess, callback discovery, inline model resolution, filter marking, PathItem serialization); additionalOperations keys are sent verbatim as the HTTP method name - represent `in: querystring` parameters as a plain string via the new CodegenParameter.isQueryStringParam flag; generators without dedicated support are warned once - okhttp-gson: serialize querystring params as the whole already-encoded query string appended to the path, register query/additional operations in dynamicOperations lookup (only when the spec uses them, so generated clients still compile against the pinned swagger-parser), and accept querystring in fillParametersFromOperation - bump swagger-parser to 2.1.49-SNAPSHOT for OpenAPI 3.2 model classes --- .../codegen/CodegenParameter.java | 10 ++- .../openapitools/codegen/DefaultCodegen.java | 76 ++++++++++++++++--- .../codegen/DefaultGenerator.java | 21 ++++- .../codegen/InlineModelResolver.java | 46 +++++------ .../codegen/OpenAPINormalizer.java | 12 ++- .../codegen/languages/JavaClientCodegen.java | 20 +++++ .../serializer/PathItemSerializer.java | 6 ++ .../libraries/okhttp-gson/ApiClient.mustache | 14 +++- .../Java/libraries/okhttp-gson/api.mustache | 2 +- .../codegen/DefaultCodegenTest.java | 38 ++++++++++ .../codegen/DefaultGeneratorTest.java | 59 ++++++++++++++ .../codegen/InlineModelResolverTest.java | 61 +++++++++++++++ .../codegen/OpenAPINormalizerTest.java | 34 +++++++++ .../codegen/java/JavaClientCodegenTest.java | 63 +++++++++++++++ .../3_0/issue_24212_unsupported_version.yaml | 2 +- .../test/resources/3_2/query-operation.yaml | 25 ++++++ .../resources/3_2/querystring-object.yaml | 28 +++++++ pom.xml | 2 +- 18 files changed, 470 insertions(+), 49 deletions(-) create mode 100644 modules/openapi-generator/src/test/resources/3_2/query-operation.yaml create mode 100644 modules/openapi-generator/src/test/resources/3_2/querystring-object.yaml 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..a3aa4e8e1ea5 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 @@ -50,6 +50,11 @@ public class CodegenParameter implements IJsonSchemaValidationProperties { * If a query parameter should be serialized as json */ public boolean queryIsJsonMimeType; + /** + * OpenAPI 3.2 {@code in: querystring} parameter: the parameter value describes + * the entire query string (via {@code content}), not a single name=value pair. + */ + public boolean isQueryStringParam; /** * datatype is the generic inner parameter of a std::optional for C++, or Optional (Java) */ @@ -270,6 +275,7 @@ public CodegenParameter copy() { output.isArray = this.isArray; output.isMap = this.isMap; output.queryIsJsonMimeType = this.queryIsJsonMimeType; + output.isQueryStringParam = this.isQueryStringParam; output.isOptional = this.isOptional; output.isExplode = this.isExplode; output.style = this.style; @@ -294,7 +300,7 @@ public int hashCode() { isFormStyle, isSpaceDelimited, isPipeDelimited, jsonSchema, isString, isNumeric, isInteger, isLong, isNumber, isFloat, isDouble, isDecimal, isByteArray, isBinary, isBoolean, isDate, isDateTime, isUuid, isUri, isEmail, isPassword, - isFreeFormObject, isAnyType, isArray, isMap, queryIsJsonMimeType, isOptional, isFile, isEnum, isEnumRef, _enum, allowableValues, + isFreeFormObject, isAnyType, isArray, isMap, queryIsJsonMimeType, isQueryStringParam, isOptional, isFile, isEnum, isEnumRef, _enum, allowableValues, items, mostInnerItems, additionalProperties, vars, requiredVars, vendorExtensions, hasValidation, getMaxProperties(), getMinProperties(), isNullable, isDeprecated, required, getMaximum(), getExclusiveMaximum(), getMinimum(), getExclusiveMinimum(), getMaxLength(), getMinLength(), @@ -312,6 +318,7 @@ public boolean equals(Object o) { CodegenParameter that = (CodegenParameter) o; return isFormParam == that.isFormParam && isQueryParam == that.isQueryParam && + isQueryStringParam == that.isQueryStringParam && isPathParam == that.isPathParam && isHeaderParam == that.isHeaderParam && isCookieParam == that.isCookieParam && @@ -429,6 +436,7 @@ public String toString() { final StringBuilder sb = new StringBuilder("CodegenParameter{"); sb.append("isFormParam=").append(isFormParam); sb.append(", isQueryParam=").append(isQueryParam); + sb.append(", isQueryStringParam=").append(isQueryStringParam); sb.append(", isPathParam=").append(isPathParam); sb.append(", isHeaderParam=").append(isHeaderParam); sb.append(", isCookieParam=").append(isCookieParam); 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 dcdad60d1816..98daca45fc93 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 @@ -1397,8 +1397,14 @@ public void preprocessOpenAPI(OpenAPI openAPI) { // we need to add all request and response bodies to processed schemas if (pathItems != null) { for (Map.Entry e : pathItems.entrySet()) { - for (Map.Entry op : e.getValue().readOperationsMap().entrySet()) { - String opId = getOrGenerateOperationId(op.getValue(), e.getKey(), op.getKey().toString()); + Map pathOperations = new LinkedHashMap<>(); + e.getValue().readOperationsMap().forEach((method, operation) -> + pathOperations.put(method.toString(), operation)); + if (e.getValue().getAdditionalOperations() != null) { + pathOperations.putAll(e.getValue().getAdditionalOperations()); + } + for (Map.Entry op : pathOperations.entrySet()) { + String opId = getOrGenerateOperationId(op.getValue(), e.getKey(), op.getKey()); // process request body RequestBody b = ModelUtils.getReferencedRequestBody(openAPI, op.getValue().getRequestBody()); Schema requestSchema = null; @@ -5154,7 +5160,11 @@ public CodegenOperation fromOperation(String path, param = ModelUtils.getReferencedParameter(this.openAPI, param); CodegenParameter p = fromParameter(param, imports); - p.setContent(getContent(param.getContent(), imports, "RequestParameter" + toModelName(param.getName()))); + // for `in: querystring` the content schema only describes the wire format; + // the codegen parameter is a plain string and needs no content metadata/imports + if (!(param instanceof QueryStringParameter) && !"querystring".equalsIgnoreCase(param.getIn())) { + p.setContent(getContent(param.getContent(), imports, "RequestParameter" + toModelName(param.getName()))); + } // ensure unique params if (ensureUniqueParams) { @@ -5173,6 +5183,10 @@ public CodegenOperation fromOperation(String path, headerParams.add(p.copy()); } else if (param instanceof CookieParameter || "cookie".equalsIgnoreCase(param.getIn())) { cookieParams.add(p.copy()); + } else if (param instanceof QueryStringParameter || "querystring".equalsIgnoreCase(param.getIn())) { + // keep it in queryParams so it lands in the operation signature; + // templates use isQueryStringParam to emit the whole-query-string form + queryParams.add(p.copy()); } else { LOGGER.warn("Unknown parameter type {} for {}", p.baseType, p.baseName); } @@ -5501,14 +5515,21 @@ public CodegenCallback fromCallback(String name, Callback callback, List u.vendorExtensions.putAll(pi.getExtensions()); } - Stream.of( - Pair.of("get", pi.getGet()), - Pair.of("head", pi.getHead()), - Pair.of("put", pi.getPut()), - Pair.of("post", pi.getPost()), - Pair.of("delete", pi.getDelete()), - Pair.of("patch", pi.getPatch()), - Pair.of("options", pi.getOptions())) + Stream.Builder> callbackOps = Stream.builder(); + callbackOps.add(Pair.of("get", pi.getGet())); + callbackOps.add(Pair.of("head", pi.getHead())); + callbackOps.add(Pair.of("put", pi.getPut())); + callbackOps.add(Pair.of("post", pi.getPost())); + callbackOps.add(Pair.of("delete", pi.getDelete())); + callbackOps.add(Pair.of("patch", pi.getPatch())); + callbackOps.add(Pair.of("options", pi.getOptions())); + callbackOps.add(Pair.of("trace", pi.getTrace())); + callbackOps.add(Pair.of("query", pi.getQuery())); + if (pi.getAdditionalOperations() != null) { + pi.getAdditionalOperations().forEach((m, o) -> + callbackOps.add(Pair.of(m.toLowerCase(Locale.ROOT), o))); + } + callbackOps.build() .filter(p -> p.getValue() != null) .forEach(p -> { String method = p.getKey(); @@ -5646,7 +5667,22 @@ public CodegenParameter fromParameter(Parameter parameter, Set imports) // e.g. #/components/schemas/list_pageQuery_parameter => toModelName(list_pageQuery_parameter) String parameterModelName = null; - if (parameter.getSchema() != null) { + // OpenAPI 3.2 `in: querystring`: the parameter describes the entire query + // string via `content`. Codegen exposes it as a plain string - the caller + // supplies the already-encoded query string (typed serialization of the + // content schema is not generated). + boolean isQueryStringParam = parameter instanceof QueryStringParameter + || "querystring".equalsIgnoreCase(parameter.getIn()); + if (isQueryStringParam) { + parameterSchema = new StringSchema(); + parameterModelName = getParameterDataType(parameter, parameterSchema); + if (!supportsQueryStringParameters()) { + once(LOGGER).warn("Encountered an `in: querystring` parameter ({}): this generator has no " + + "dedicated querystring serialization support - generated code may drop the " + + "parameter or emit a regular name=value pair instead of the whole query string.", + parameter.getName()); + } + } else if (parameter.getSchema() != null) { parameterSchema = unaliasSchema(parameter.getSchema()); parameterModelName = getParameterDataType(parameter, parameterSchema); CodegenProperty prop; @@ -5688,6 +5724,9 @@ public CodegenParameter fromParameter(Parameter parameter, Set imports) codegenParameter.isHeaderParam = true; } else if (parameter instanceof CookieParameter || "cookie".equalsIgnoreCase(parameter.getIn())) { codegenParameter.isCookieParam = true; + } else if (parameter instanceof QueryStringParameter || "querystring".equalsIgnoreCase(parameter.getIn())) { + // OpenAPI 3.2: the parameter describes the entire query string via `content` + codegenParameter.isQueryStringParam = true; } else { LOGGER.warn("Unknown parameter type: {}", parameter.getName()); } @@ -5935,6 +5974,19 @@ public boolean isDataTypeBinary(String dataType) { } } + /** + * Whether this generator emits dedicated serialization for OpenAPI 3.2 + * {@code in: querystring} parameters (the parameter value is the whole, + * already-encoded query string rather than a single name=value pair). + * Generators without support may drop the parameter or emit a named query + * parameter - {@link #fromParameter} warns in that case. + * + * @return true if the generator supports {@code in: querystring} parameters + */ + protected boolean supportsQueryStringParameters() { + return false; + } + // TODO revise below as it should be replaced by ModelUtils.isFileSchema(parameterSchema) public boolean isDataTypeFile(String dataType) { if (dataType != null) { diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultGenerator.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultGenerator.java index 497d45078fec..d2f4a4c84fa1 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultGenerator.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultGenerator.java @@ -1497,6 +1497,11 @@ public Map> processPaths(Paths paths) { processOperation(resourcePath, "patch", path.getPatch(), ops, path); processOperation(resourcePath, "options", path.getOptions(), ops, path); processOperation(resourcePath, "trace", path.getTrace(), ops, path); + processOperation(resourcePath, "query", path.getQuery(), ops, path); + if (path.getAdditionalOperations() != null) { + path.getAdditionalOperations().forEach((method, operation) -> + processOperation(resourcePath, method, method, operation, ops, path)); + } } return ops; } @@ -1518,11 +1523,20 @@ public Map> processWebhooks(Map processOperation(resourceKey, "patch", path.getPatch(), ops, path); processOperation(resourceKey, "options", path.getOptions(), ops, path); processOperation(resourceKey, "trace", path.getTrace(), ops, path); + processOperation(resourceKey, "query", path.getQuery(), ops, path); + if (path.getAdditionalOperations() != null) { + path.getAdditionalOperations().forEach((method, operation) -> + processOperation(resourceKey, method, method, operation, ops, path)); + } } return ops; } private void processOperation(String resourcePath, String httpMethod, Operation operation, Map> operations, PathItem path) { + processOperation(resourcePath, httpMethod, null, operation, operations, path); + } + + private void processOperation(String resourcePath, String httpMethod, String wireHttpMethod, Operation operation, Map> operations, PathItem path) { if (operation == null) { return; } @@ -1533,7 +1547,7 @@ private void processOperation(String resourcePath, String httpMethod, Operation List contentTypeVariants = config.divideOperationsByContentType(openAPI, resourcePath, httpMethod, operation); if (contentTypeVariants.size() > 1) { for (Operation variant : contentTypeVariants) { - processOperation(resourcePath, httpMethod, variant, operations, path); + processOperation(resourcePath, httpMethod, wireHttpMethod, variant, operations, path); } return; } @@ -1604,6 +1618,11 @@ private void processOperation(String resourcePath, String httpMethod, Operation httpMethod, resourcePath, operation.getOperationId()); } else { CodegenOperation codegenOperation = config.fromOperation(resourcePath, httpMethod, operation, path.getServers()); + if (wireHttpMethod != null) { + // OpenAPI 3.2 additionalOperations: the map key is the HTTP method + // name and must be sent verbatim instead of upper-cased + codegenOperation.httpMethod = wireHttpMethod; + } codegenOperation.tags = new ArrayList<>(tags); config.addOperationToGroup(config.sanitizeTag(tag.getName()), resourcePath, operation, codegenOperation, operations); diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/InlineModelResolver.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/InlineModelResolver.java index 94ad2cc38842..6c8e10a648f0 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/InlineModelResolver.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/InlineModelResolver.java @@ -23,7 +23,6 @@ import com.fasterxml.jackson.databind.ObjectMapper; import io.swagger.v3.core.util.Json; import io.swagger.v3.oas.models.*; -import io.swagger.v3.oas.models.PathItem.HttpMethod; import io.swagger.v3.oas.models.callbacks.Callback; import io.swagger.v3.oas.models.headers.Header; import io.swagger.v3.oas.models.media.*; @@ -239,22 +238,22 @@ private void flattenPaths() { private void flattenPathItems(Map pathItemMap) { for (Map.Entry pathsEntry : pathItemMap.entrySet()) { PathItem path = pathsEntry.getValue(); - List> toFlatten = new ArrayList<>(path.readOperationsMap().entrySet()); + List> toFlatten = new ArrayList<>(); + addOperationEntries(toFlatten, path); // use path name (e.g. /foo/bar) and HTTP verb to come up with a name // in case operationId is not defined later in other methods String pathname = pathsEntry.getKey(); // Include callback operation as well - for (Map.Entry operationEntry : new LinkedHashMap<>(path.readOperationsMap()).entrySet()) { - Operation operation = operationEntry.getValue(); + // (readOperations() also covers query and arbitrary additionalOperations) + for (Operation operation : path.readOperations()) { Map callbacks = operation.getCallbacks(); if (callbacks != null) { for (Map.Entry callbackEntry : callbacks.entrySet()) { Callback callback = callbackEntry.getValue(); for (Map.Entry pathItemEntry : callback.entrySet()) { - PathItem pathItem = pathItemEntry.getValue(); - toFlatten.addAll(pathItem.readOperationsMap().entrySet()); + addOperationEntries(toFlatten, pathItemEntry.getValue()); } } } @@ -264,7 +263,7 @@ private void flattenPathItems(Map pathItemMap) { flattenParameters(pathname, path.getParameters(), null); // flatten parameters for each operation - for (Map.Entry operationEntry : toFlatten) { + for (Map.Entry operationEntry : toFlatten) { Operation operation = operationEntry.getValue(); String inlineSchemaName = this.getInlineSchemaName(operationEntry.getKey(), pathname); flattenRequestBody(inlineSchemaName, operation); @@ -274,28 +273,19 @@ private void flattenPathItems(Map pathItemMap) { } } - private String getInlineSchemaName(HttpMethod httpVerb, String pathname) { + private void addOperationEntries(List> entries, PathItem pathItem) { + pathItem.readOperationsMap().forEach((method, operation) -> + entries.add(new AbstractMap.SimpleEntry<>(method.toString().toLowerCase(Locale.ROOT), operation))); + if (pathItem.getAdditionalOperations() != null) { + pathItem.getAdditionalOperations().forEach((method, operation) -> + entries.add(new AbstractMap.SimpleEntry<>(method, operation))); + } + } + + private String getInlineSchemaName(String httpVerb, String pathname) { String name = pathname; - if (httpVerb.equals(HttpMethod.DELETE)) { - name += "_delete"; - } else if (httpVerb.equals(HttpMethod.GET)) { - name += "_get"; - } else if (httpVerb.equals(HttpMethod.HEAD)) { - name += "_head"; - } else if (httpVerb.equals(HttpMethod.OPTIONS)) { - name += "_options"; - } else if (httpVerb.equals(HttpMethod.PATCH)) { - name += "_patch"; - } else if (httpVerb.equals(HttpMethod.POST)) { - name += "_post"; - } else if (httpVerb.equals(HttpMethod.PUT)) { - name += "_put"; - } else if (httpVerb.equals(HttpMethod.TRACE)) { - name += "_trace"; - } else { - // no HTTP verb defined? - // throw new RuntimeException("No HTTP verb found/detected in the inline model - // resolver"); + if (StringUtils.isNotBlank(httpVerb)) { + name += "_" + httpVerb.toLowerCase(Locale.ROOT); } return name; } diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/OpenAPINormalizer.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/OpenAPINormalizer.java index a684bf326683..ba7a39cbcaa3 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/OpenAPINormalizer.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/OpenAPINormalizer.java @@ -480,7 +480,7 @@ protected void normalizePaths() { PathItem path = pathsEntry.getValue(); List operations = new ArrayList<>(path.readOperations()); - Map> methodMap = Map.of( + Map> methodMap = new HashMap<>(Map.of( "get", PathItem::getGet, "put", PathItem::getPut, "head", PathItem::getHead, @@ -488,8 +488,14 @@ protected void normalizePaths() { "delete", PathItem::getDelete, "patch", PathItem::getPatch, "options", PathItem::getOptions, - "trace", PathItem::getTrace - ); + "trace", PathItem::getTrace, + "query", PathItem::getQuery + )); + if (path.getAdditionalOperations() != null) { + path.getAdditionalOperations().forEach((method, operation) -> + methodMap.put(method.toLowerCase(Locale.ROOT), + pathItem -> pathItem.getAdditionalOperations().get(method))); + } if (filter != null && filter.hasFilter()) { // Iterates over each HTTP method in methodMap, retrieves the corresponding Operations from the PathItem, diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaClientCodegen.java index 7882151f5e70..431a3dc11529 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaClientCodegen.java @@ -18,6 +18,7 @@ package org.openapitools.codegen.languages; import com.samskivert.mustache.Mustache; +import io.swagger.v3.oas.models.OpenAPI; import io.swagger.v3.oas.models.Operation; import io.swagger.v3.oas.models.media.Schema; import io.swagger.v3.oas.models.servers.Server; @@ -1426,4 +1427,23 @@ protected void applyJspecify() { // override the default pattern for the "find and replace" jSpecifyNullableLambda.setNullableAnnotation(nullableAnnotation); } + + @Override + protected boolean supportsQueryStringParameters() { + // only the okhttp-gson api.mustache serializes an `in: querystring` + // parameter as the whole (already-encoded) query string + return isLibrary(OKHTTP_GSON) || StringUtils.isBlank(getLibrary()); + } + + @Override + public void preprocessOpenAPI(OpenAPI openAPI) { + super.preprocessOpenAPI(openAPI); + // the generated ApiClient (dynamicOperations mode) calls PathItem.getQuery()/ + // getAdditionalOperations(), which only exist in swagger-parser releases with + // OpenAPI 3.2 model support - only emit those calls when the spec uses them + boolean hasQueryOrAdditionalOperations = openAPI.getPaths() != null + && openAPI.getPaths().values().stream().anyMatch(pathItem -> pathItem.getQuery() != null + || (pathItem.getAdditionalOperations() != null && !pathItem.getAdditionalOperations().isEmpty())); + additionalProperties.put("hasQueryOrAdditionalOperations", hasQueryOrAdditionalOperations); + } } diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/serializer/PathItemSerializer.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/serializer/PathItemSerializer.java index 9adea7f45543..a2c96b937d41 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/serializer/PathItemSerializer.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/serializer/PathItemSerializer.java @@ -49,6 +49,12 @@ public void serialize(PathItem value, JsonGenerator gen, SerializerProvider seri if (value.getTrace() != null) { gen.writeObjectField("trace", value.getTrace()); } + if (value.getQuery() != null) { + gen.writeObjectField("query", value.getQuery()); + } + if (value.getAdditionalOperations() != null) { + gen.writeObjectField("additionalOperations", value.getAdditionalOperations()); + } if (value.getServers() != null) { gen.writeObjectField("servers", value.getServers()); } diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson/ApiClient.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson/ApiClient.mustache index f52c6e17238a..2bd59dbfe2aa 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson/ApiClient.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson/ApiClient.mustache @@ -1913,7 +1913,13 @@ public class ApiClient { addOperationLookupEntry(path, "HEAD", pathItem.getHead()); addOperationLookupEntry(path, "PATCH", pathItem.getPatch()); addOperationLookupEntry(path, "TRACE", pathItem.getTrace()); - } + {{#hasQueryOrAdditionalOperations}}{{! requires a swagger-parser version with OpenAPI 3.2 model support }}addOperationLookupEntry(path, "QUERY", pathItem.getQuery()); + if (pathItem.getAdditionalOperations() != null) { + for (Map.Entry additionalOperation : pathItem.getAdditionalOperations().entrySet()) { + addOperationLookupEntry(path, additionalOperation.getKey(), additionalOperation.getValue()); + } + } + {{/hasQueryOrAdditionalOperations}} } return this; } @@ -1959,6 +1965,12 @@ public class ApiClient { case "cookie": cookieParams.put(param.getName(), parameterToString(value)); break; + case "querystring": + // OpenAPI 3.2: the value is the whole (already encoded) query string + if (value != null) { + path = path + (path.contains("?") ? "&" : "?") + value.toString(); + } + break; default: throw new IllegalStateException("Unexpected param in: " + param.getIn()); } diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson/api.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson/api.mustache index 9519ce13c75e..53fbdcae94e2 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson/api.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson/api.mustache @@ -170,7 +170,7 @@ public class {{classname}} { {{^dynamicOperations}} {{#queryParams}} if ({{paramName}} != null) { - {{#isFreeFormObject}}localVarQueryParams.addAll(localVarApiClient.freeFormParameterToPairs({{paramName}}));{{/isFreeFormObject}}{{^isFreeFormObject}}{{#collectionFormat}}localVarCollectionQueryParams.addAll(localVarApiClient.parameterToPairs("{{{.}}}", {{/collectionFormat}}{{^collectionFormat}}localVarQueryParams.addAll(localVarApiClient.parameterToPair({{/collectionFormat}}"{{baseName}}", {{paramName}}));{{/isFreeFormObject}} + {{#isQueryStringParam}}{{! OpenAPI 3.2 in: querystring - the value is the whole (already encoded) query string }}localVarPath = localVarPath + (localVarPath.contains("?") ? "&" : "?") + {{paramName}};{{/isQueryStringParam}}{{^isQueryStringParam}}{{#isFreeFormObject}}localVarQueryParams.addAll(localVarApiClient.freeFormParameterToPairs({{paramName}}));{{/isFreeFormObject}}{{^isFreeFormObject}}{{#collectionFormat}}localVarCollectionQueryParams.addAll(localVarApiClient.parameterToPairs("{{{.}}}", {{/collectionFormat}}{{^collectionFormat}}localVarQueryParams.addAll(localVarApiClient.parameterToPair({{/collectionFormat}}"{{baseName}}", {{paramName}}));{{/isFreeFormObject}}{{/isQueryStringParam}} } {{/queryParams}} diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/DefaultCodegenTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/DefaultCodegenTest.java index e94a6d5e5e72..6ac50075c0b8 100644 --- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/DefaultCodegenTest.java +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/DefaultCodegenTest.java @@ -2556,6 +2556,44 @@ private ModelsMap codegenModelWithXEnumVarNameAsMap() { return TestUtils.createCodegenModelWrapper(cm); } + @Test + public void queryStringParameterSetsFlagAndLandsInQueryParams() { + final OpenAPI openAPI = TestUtils.parseFlattenSpec("src/test/resources/3_2/query-operation.yaml"); + final DefaultCodegen codegen = new DefaultCodegen(); + codegen.setOpenAPI(openAPI); + + Operation queryOp = openAPI.getPaths().get("/pets").getQuery(); + assertNotNull(queryOp, "3.2 query operation should be bound by the parser"); + CodegenOperation co = codegen.fromOperation("/pets", "query", queryOp, null); + + assertEquals(co.queryParams.size(), 1); + CodegenParameter p = co.queryParams.get(0); + assertTrue(p.isQueryStringParam, "in: querystring parameter must set isQueryStringParam"); + assertFalse(p.isQueryParam); + assertEquals(co.allParams.size(), 1); + } + + @Test + public void queryStringParameterWithObjectContentBecomesString() { + // `in: querystring` describes the whole query string via `content`. + // Even when the content schema is an object/model, the codegen parameter + // must be a plain String (caller supplies the encoded query string), so + // no typed model is pulled into the operation signature. + final OpenAPI openAPI = TestUtils.parseFlattenSpec("src/test/resources/3_2/querystring-object.yaml"); + final DefaultCodegen codegen = new DefaultCodegen(); + codegen.setOpenAPI(openAPI); + + Operation getOp = openAPI.getPaths().get("/pets").getGet(); + CodegenOperation co = codegen.fromOperation("/pets", "get", getOp, null); + + assertEquals(co.queryParams.size(), 1); + CodegenParameter p = co.queryParams.get(0); + assertTrue(p.isQueryStringParam); + assertEquals(p.dataType, "String"); + assertFalse(p.isModel); + assertFalse(p.isMap); + } + @Test public void objectQueryParamIdentifyAsObject() { final OpenAPI openAPI = TestUtils.parseFlattenSpec("src/test/resources/3_0/objectQueryParam.yaml"); diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/DefaultGeneratorTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/DefaultGeneratorTest.java index 5da01b91254f..6dee8ed65917 100644 --- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/DefaultGeneratorTest.java +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/DefaultGeneratorTest.java @@ -448,6 +448,65 @@ public void testProcessPaths() throws Exception { Assert.assertEquals(defaultList.get(3).allParams.size(), 1); } + @Test + public void testProcessPathsQueryAndAdditionalOperations() throws Exception { + OpenAPI openAPI = TestUtils.createOpenAPI(); + openAPI.setPaths(new Paths()); + Operation queryOp = new Operation().operationId("queryPets") + .responses(new ApiResponses().addApiResponse("200", new ApiResponse().description("OK"))); + Operation purgeOp = new Operation().operationId("purgePets") + .responses(new ApiResponses().addApiResponse("204", new ApiResponse().description("done"))); + Operation customOp = new Operation().operationId("customPets") + .responses(new ApiResponses().addApiResponse("204", new ApiResponse().description("done"))); + openAPI.getPaths().addPathItem("/pets", + new PathItem().query(queryOp) + .addAdditionalOperation("PURGE", purgeOp) + .addAdditionalOperation("customMethod", customOp)); + + ClientOptInput opts = new ClientOptInput(); + opts.openAPI(openAPI); + opts.config(new DefaultCodegen()); + + DefaultGenerator generator = new DefaultGenerator(); + generator.opts(opts); + Map> result = generator.processPaths(openAPI.getPaths()); + Assert.assertEquals(result.size(), 1); + List defaultList = result.get("Default"); + Assert.assertEquals(defaultList.size(), 3); + Assert.assertEquals(defaultList.get(0).operationId, "queryPets"); + Assert.assertEquals(defaultList.get(0).httpMethod, "QUERY"); + Assert.assertEquals(defaultList.get(1).operationId, "purgePets"); + Assert.assertEquals(defaultList.get(1).httpMethod, "PURGE"); + // additionalOperations keys are HTTP method names and must be sent verbatim + Assert.assertEquals(defaultList.get(2).operationId, "customPets"); + Assert.assertEquals(defaultList.get(2).httpMethod, "customMethod"); + } + + @Test + public void testProcessWebhooksQueryAndAdditionalOperations() throws Exception { + OpenAPI openAPI = TestUtils.createOpenAPI(); + Operation queryOp = new Operation().operationId("queryHook") + .responses(new ApiResponses().addApiResponse("200", new ApiResponse().description("OK"))); + Operation customOp = new Operation().operationId("customHook") + .responses(new ApiResponses().addApiResponse("204", new ApiResponse().description("done"))); + PathItem webhook = new PathItem().query(queryOp).addAdditionalOperation("RETRY", customOp); + + ClientOptInput opts = new ClientOptInput(); + opts.openAPI(openAPI); + opts.config(new DefaultCodegen()); + + DefaultGenerator generator = new DefaultGenerator(); + generator.opts(opts); + Map> result = + generator.processWebhooks(Collections.singletonMap("hook", webhook)); + List ops = result.get("Default"); + Assert.assertEquals(ops.size(), 2); + Assert.assertEquals(ops.get(0).operationId, "queryHook"); + Assert.assertEquals(ops.get(0).httpMethod, "QUERY"); + Assert.assertEquals(ops.get(1).operationId, "customHook"); + Assert.assertEquals(ops.get(1).httpMethod, "RETRY"); + } + @Test public void testRefModelValidationProperties() { OpenAPI openAPI = TestUtils.parseFlattenSpec("src/test/resources/2_0/refAliasedPrimitiveWithValidation.yml"); diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/InlineModelResolverTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/InlineModelResolverTest.java index b6b81d765a03..891c68fc7fdf 100644 --- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/InlineModelResolverTest.java +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/InlineModelResolverTest.java @@ -23,6 +23,7 @@ import io.swagger.v3.oas.models.Operation; import io.swagger.v3.oas.models.PathItem; import io.swagger.v3.oas.models.Paths; +import io.swagger.v3.oas.models.callbacks.Callback; import io.swagger.v3.oas.models.headers.Header; import io.swagger.v3.oas.models.media.*; import io.swagger.v3.oas.models.parameters.Parameter; @@ -1240,6 +1241,66 @@ public void callbacks() { assertTrue(properties.get("data") instanceof StringSchema); } + @Test + public void callbacksInsideAdditionalOperations() { + // OpenAPI 3.2: callbacks attached to an additionalOperations entry must be + // discovered for inline model flattening just like fixed-method operations + Operation callbackPost = new Operation() + .operationId("hookReceive") + .requestBody(new RequestBody().content(new Content() + .addMediaType("application/json", new MediaType() + .schema(new ObjectSchema() + .addProperties("id", new StringSchema()))))) + .responses(new ApiResponses().addApiResponse("200", + new ApiResponse().description("ok"))); + // an additionalOperations entry *inside* a callback PathItem must be flattened too + Operation callbackRetry = new Operation() + .operationId("hookRetry") + .requestBody(new RequestBody().content(new Content() + .addMediaType("application/json", new MediaType() + .schema(new ObjectSchema() + .addProperties("retryId", new StringSchema()))))) + .responses(new ApiResponses().addApiResponse("200", + new ApiResponse().description("ok"))); + Callback hook = new Callback().addPathItem("{$request.body#/url}", + new PathItem().post(callbackPost) + .addAdditionalOperation("RETRY", callbackRetry)); + Operation notifyOp = new Operation() + .operationId("notifyOp") + .responses(new ApiResponses().addApiResponse("200", + new ApiResponse().description("ok"))) + .addCallback("hook", hook); + OpenAPI openAPI = new OpenAPI() + .paths(new Paths().addPathItem("/pets", new PathItem() + .addAdditionalOperation("NOTIFY", notifyOp))); + + new InlineModelResolver().flatten(openAPI); + + RequestBody callbackRequestBody = openAPI.getPaths().get("/pets") + .getAdditionalOperations().get("NOTIFY") + .getCallbacks().get("hook") + .get("{$request.body#/url}") + .getPost().getRequestBody(); + Schema schema = callbackRequestBody.getContent().get("application/json").getSchema(); + assertNotNull(schema.get$ref()); + assertTrue("inline callback schema in an additionalOperations entry must be extracted", + schema.get$ref().startsWith("#/components/schemas/")); + Schema resolved = openAPI.getComponents().getSchemas() + .get(ModelUtils.getSimpleRef(schema.get$ref())); + assertNotNull(resolved); + assertTrue(resolved.getProperties().get("id") instanceof StringSchema); + + Schema retrySchema = openAPI.getPaths().get("/pets") + .getAdditionalOperations().get("NOTIFY") + .getCallbacks().get("hook") + .get("{$request.body#/url}") + .getAdditionalOperations().get("RETRY") + .getRequestBody().getContent().get("application/json").getSchema(); + assertNotNull(retrySchema.get$ref()); + assertTrue("inline schema of a callback's additionalOperations entry must be extracted", + retrySchema.get$ref().startsWith("#/components/schemas/")); + } + @Test public void testInlineSchemaNameMapping() { OpenAPI openAPI = TestUtils.parseSpec("src/test/resources/3_0/inline_model_resolver.yaml"); diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/OpenAPINormalizerTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/OpenAPINormalizerTest.java index c213586af2b9..d50969cb6c4f 100644 --- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/OpenAPINormalizerTest.java +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/OpenAPINormalizerTest.java @@ -874,6 +874,40 @@ public void testFilterWithMethod() { assertEquals(openAPI.getPaths().get("/person/display/{personId}").getPut().getExtensions().get(X_INTERNAL), true); } + @Test + public void testFilterWithMethodCoversQueryAndAdditionalOperations() { + // OpenAPI 3.2: `query` and arbitrary `additionalOperations` entries must be + // covered by `method:` filtering like the fixed methods + OpenAPI openAPI = TestUtils.createOpenAPI(); + PathItem pathItem = new PathItem() + .get(new Operation().operationId("getPets")) + .query(new Operation().operationId("queryPets")) + .addAdditionalOperation("PURGE", new Operation().operationId("purgePets")); + openAPI.path("/pets", pathItem); + + Map options = Map.of("FILTER", "method:get"); + new OpenAPINormalizer(openAPI, options).normalize(); + + assertEquals(pathItem.getGet().getExtensions().get(X_INTERNAL), false); + assertEquals(pathItem.getQuery().getExtensions().get(X_INTERNAL), true); + assertEquals(pathItem.getAdditionalOperations().get("PURGE").getExtensions().get(X_INTERNAL), true); + + // filtering by the additional method name must keep that operation + OpenAPI openAPI2 = TestUtils.createOpenAPI(); + PathItem pathItem2 = new PathItem() + .get(new Operation().operationId("getPets")) + .query(new Operation().operationId("queryPets")) + .addAdditionalOperation("PURGE", new Operation().operationId("purgePets")); + openAPI2.path("/pets", pathItem2); + + Map options2 = Map.of("FILTER", "method:query|purge"); + new OpenAPINormalizer(openAPI2, options2).normalize(); + + assertEquals(pathItem2.getGet().getExtensions().get(X_INTERNAL), true); + assertEquals(pathItem2.getQuery().getExtensions().get(X_INTERNAL), false); + assertEquals(pathItem2.getAdditionalOperations().get("PURGE").getExtensions().get(X_INTERNAL), false); + } + static OpenAPINormalizer.Filter parseOperationsFilter(String filters) { OpenAPINormalizer.Filter filter = new OpenAPINormalizer.Filter(filters); filter.parse(); diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/JavaClientCodegenTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/JavaClientCodegenTest.java index 4b5f72bf9fb1..e51fac451030 100644 --- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/JavaClientCodegenTest.java +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/JavaClientCodegenTest.java @@ -5259,6 +5259,69 @@ public void testInsecureTlsHookOmittedWhenDisabled(String library) { .doesNotContain("import java.security.cert.X509Certificate;"); } + @Test + public void testQueryOperationAndQueryStringParamGeneration() { + final Path output = newTempFolder(); + final CodegenConfigurator configurator = new CodegenConfigurator() + .setGeneratorName(JAVA_GENERATOR) // default library okhttp-gson + .setInputSpec("src/test/resources/3_2/query-operation.yaml") + .setOutputDir(output.toString().replace("\\", "/")); + + new DefaultGenerator().opts(configurator.toClientOptInput()).generate(); + + // the 3.2 'query' operation and the additionalOperations 'PURGE' entry + // must both be generated, and the in: querystring parameter is emitted + // as the whole (already encoded) query string appended to the path + assertThat(output.resolve("src/main/java/org/openapitools/client/api/DefaultApi.java")) + .content() + .contains("queryPetsCall(") + .contains("purgePetsCall(") + .contains("\"QUERY\"") + .contains("\"PURGE\"") + .contains("localVarPath = localVarPath + (localVarPath.contains(\"?\") ? \"&\" : \"?\") + qs;"); + } + + @Test + public void testDynamicOperationsWithQueryAndQueryString() { + final Path output = newTempFolder(); + final CodegenConfigurator configurator = new CodegenConfigurator() + .setGeneratorName(JAVA_GENERATOR) + .setInputSpec("src/test/resources/3_2/query-operation.yaml") + .addAdditionalProperty("dynamicOperations", true) + .setOutputDir(output.toString().replace("\\", "/")); + + new DefaultGenerator().opts(configurator.toClientOptInput()).generate(); + + // dynamic operation lookup must register the 3.2 'query' operation and + // additionalOperations entries, and fillParametersFromOperation must + // accept `in: querystring` + assertThat(output.resolve("src/main/java/org/openapitools/client/ApiClient.java")) + .content() + .contains("addOperationLookupEntry(path, \"QUERY\", pathItem.getQuery());") + .contains("pathItem.getAdditionalOperations()") + .contains("case \"querystring\":"); + } + + @Test + public void testDynamicOperationsWithout32Operations() { + final Path output = newTempFolder(); + final CodegenConfigurator configurator = new CodegenConfigurator() + .setGeneratorName(JAVA_GENERATOR) + .setInputSpec("src/test/resources/3_0/petstore.yaml") + .addAdditionalProperty("dynamicOperations", true) + .setOutputDir(output.toString().replace("\\", "/")); + + new DefaultGenerator().opts(configurator.toClientOptInput()).generate(); + + // specs without `query`/`additionalOperations` must not emit calls to + // PathItem.getQuery()/getAdditionalOperations() - the generated client's + // pinned swagger-parser release has no such methods and would not compile + assertThat(output.resolve("src/main/java/org/openapitools/client/ApiClient.java")) + .content() + .doesNotContain("pathItem.getQuery()") + .doesNotContain("getAdditionalOperations()"); + } + private static Path generateJerseyClient(String library, Boolean generateInsecureTlsHook) { Path output = newTempFolder(); CodegenConfigurator configurator = new CodegenConfigurator() diff --git a/modules/openapi-generator/src/test/resources/3_0/issue_24212_unsupported_version.yaml b/modules/openapi-generator/src/test/resources/3_0/issue_24212_unsupported_version.yaml index 2a4f4c877aab..f2e4e2a863ca 100644 --- a/modules/openapi-generator/src/test/resources/3_0/issue_24212_unsupported_version.yaml +++ b/modules/openapi-generator/src/test/resources/3_0/issue_24212_unsupported_version.yaml @@ -1,4 +1,4 @@ -openapi: 3.2.0 +openapi: 4.0.0 info: title: issue 24212 unparseable-version test version: '1.0' diff --git a/modules/openapi-generator/src/test/resources/3_2/query-operation.yaml b/modules/openapi-generator/src/test/resources/3_2/query-operation.yaml new file mode 100644 index 000000000000..9615ceed1547 --- /dev/null +++ b/modules/openapi-generator/src/test/resources/3_2/query-operation.yaml @@ -0,0 +1,25 @@ +openapi: 3.2.0 +info: + title: query operation test + version: '1.0' +paths: + /pets: + query: + operationId: queryPets + parameters: + - name: qs + in: querystring + required: true + content: + application/x-www-form-urlencoded: + schema: + type: string + responses: + '200': + description: ok + additionalOperations: + PURGE: + operationId: purgePets + responses: + '204': + description: done diff --git a/modules/openapi-generator/src/test/resources/3_2/querystring-object.yaml b/modules/openapi-generator/src/test/resources/3_2/querystring-object.yaml new file mode 100644 index 000000000000..508e8a76fa79 --- /dev/null +++ b/modules/openapi-generator/src/test/resources/3_2/querystring-object.yaml @@ -0,0 +1,28 @@ +openapi: 3.2.0 +info: + title: querystring object content test + version: '1.0' +paths: + /pets: + get: + operationId: findPets + parameters: + - name: filter + in: querystring + required: true + content: + application/x-www-form-urlencoded: + schema: + $ref: '#/components/schemas/PetFilter' + responses: + '200': + description: ok +components: + schemas: + PetFilter: + type: object + properties: + name: + type: string + age: + type: integer diff --git a/pom.xml b/pom.xml index 10897f98277a..267b8ce61173 100644 --- a/pom.xml +++ b/pom.xml @@ -1287,7 +1287,7 @@ 2.4 3.1.12.2 io.swagger.parser.v3 - 2.1.47 + 2.1.49-SNAPSHOT 7.10.2 1.34 3.4.3 From a52ebe25da043853948c1aafc3c2d90a84cfe04d Mon Sep 17 00:00:00 2001 From: khayashi4337 Date: Tue, 22 Sep 2026 12:44:56 +0900 Subject: [PATCH 03/31] fix(core): gate OpenAPI 3.2 operations behind generator capability Generators whose templates embed enumerated HTTP method constants (e.g. HttpMethod.QUERY) produced uncompilable code for OpenAPI 3.2 query/additionalOperations. Introduce supportsAdditionalOperations() (default false; only okhttp-gson opts in) so unsupported generators warn and skip instead. - CodegenConfig: supportsAdditionalOperations() capability hook - DefaultGenerator/DefaultCodegen/InlineModelResolver: skip 3.2 query/additionalOperations with a warning when unsupported - JavaClientCodegen: enable the capability for okhttp-gson only - fromCallback: keep additionalOperations method names verbatim ("customMethod" no longer becomes CUSTOMMETHOD) and warn on skip - MergedSpecBuilder: merge additionalOperations and cover them in operationId conflict detection instead of dropping them - ApiClient.mustache: put section tags on their own lines so generated indentation is stable in both branches - regenerate okhttp-gson-dynamicOperations sample --- .../openapitools/codegen/CodegenConfig.java | 14 +++++++ .../openapitools/codegen/DefaultCodegen.java | 33 +++++++++++---- .../codegen/DefaultGenerator.java | 30 ++++++++++---- .../codegen/InlineModelResolver.java | 16 ++++++-- .../codegen/config/MergedSpecBuilder.java | 28 ++++++++++++- .../codegen/languages/JavaClientCodegen.java | 8 ++++ .../libraries/okhttp-gson/ApiClient.mustache | 7 +++- .../codegen/DefaultCodegenTest.java | 27 ++++++++++++ .../codegen/DefaultGeneratorTest.java | 41 ++++++++++++++++++- .../org/openapitools/client/ApiClient.java | 6 +++ 10 files changed, 187 insertions(+), 23 deletions(-) diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenConfig.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenConfig.java index 99cb42eb3987..495b7062c83b 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenConfig.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenConfig.java @@ -387,4 +387,18 @@ default List divideOperationsByContentType(OpenAPI openAPI, String pa Set getOpenapiGeneratorIgnoreList(); + /** + * Whether this generator can emit operations defined through OpenAPI 3.2's + * {@code query} fixed field and {@code additionalOperations} map, i.e. HTTP + * methods outside the original eight fixed methods. Generators whose + * templates embed enumerated method constants (e.g. {@code HttpMethod.QUERY}) + * must keep the default {@code false}: the affected operations are then + * skipped with a warning instead of producing uncompilable code. + * + * @return true if the generator supports OpenAPI 3.2 query/additional operations + */ + default boolean supportsAdditionalOperations() { + return false; + } + } 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 98daca45fc93..3b96423876b9 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 @@ -1398,9 +1398,15 @@ public void preprocessOpenAPI(OpenAPI openAPI) { if (pathItems != null) { for (Map.Entry e : pathItems.entrySet()) { Map pathOperations = new LinkedHashMap<>(); - e.getValue().readOperationsMap().forEach((method, operation) -> - pathOperations.put(method.toString(), operation)); - if (e.getValue().getAdditionalOperations() != null) { + e.getValue().readOperationsMap().forEach((method, operation) -> { + // HttpMethod.QUERY is in the enum map too - skip it for + // generators that cannot emit the 3.2 operations + if (method == PathItem.HttpMethod.QUERY && !supportsAdditionalOperations()) { + return; + } + pathOperations.put(method.toString(), operation); + }); + if (supportsAdditionalOperations() && e.getValue().getAdditionalOperations() != null) { pathOperations.putAll(e.getValue().getAdditionalOperations()); } for (Map.Entry op : pathOperations.entrySet()) { @@ -5524,10 +5530,20 @@ public CodegenCallback fromCallback(String name, Callback callback, List callbackOps.add(Pair.of("patch", pi.getPatch())); callbackOps.add(Pair.of("options", pi.getOptions())); callbackOps.add(Pair.of("trace", pi.getTrace())); - callbackOps.add(Pair.of("query", pi.getQuery())); - if (pi.getAdditionalOperations() != null) { - pi.getAdditionalOperations().forEach((m, o) -> - callbackOps.add(Pair.of(m.toLowerCase(Locale.ROOT), o))); + // additionalOperations keys are HTTP method names sent verbatim + Set verbatimMethods = new HashSet<>(); + if (supportsAdditionalOperations()) { + callbackOps.add(Pair.of("query", pi.getQuery())); + if (pi.getAdditionalOperations() != null) { + pi.getAdditionalOperations().forEach((m, o) -> { + callbackOps.add(Pair.of(m, o)); + verbatimMethods.add(m); + }); + } + } else if (pi.getQuery() != null + || (pi.getAdditionalOperations() != null && !pi.getAdditionalOperations().isEmpty())) { + LOGGER.warn("Callback '{}' on expression '{}' declares OpenAPI 3.2 query/additionalOperations but generator '{}' does not support them; those operations will be missing from the generated output", + name, expression, getName()); } callbackOps.build() .filter(p -> p.getValue() != null) @@ -5553,6 +5569,9 @@ public CodegenCallback fromCallback(String name, Callback callback, List op.getExtensions().put("x-callback-request", true); CodegenOperation co = fromOperation(expression, method, op, servers); + if (verbatimMethods.contains(method)) { + co.httpMethod = method; + } if (genId) { co.operationIdOriginal = null; // legacy (see `fromOperation()`) diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultGenerator.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultGenerator.java index d2f4a4c84fa1..28c63b1181bf 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultGenerator.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultGenerator.java @@ -277,6 +277,7 @@ void configureGeneratorProperties() { // resolve inline models if (config.getUseInlineModelResolver()) { InlineModelResolver inlineModelResolver = new InlineModelResolver(); + inlineModelResolver.setCodegen(config); inlineModelResolver.setInlineSchemaNameMapping(config.inlineSchemaNameMapping()); inlineModelResolver.setInlineSchemaOptions(config.inlineSchemaOption()); @@ -1497,10 +1498,14 @@ public Map> processPaths(Paths paths) { processOperation(resourcePath, "patch", path.getPatch(), ops, path); processOperation(resourcePath, "options", path.getOptions(), ops, path); processOperation(resourcePath, "trace", path.getTrace(), ops, path); - processOperation(resourcePath, "query", path.getQuery(), ops, path); - if (path.getAdditionalOperations() != null) { - path.getAdditionalOperations().forEach((method, operation) -> - processOperation(resourcePath, method, method, operation, ops, path)); + if (config.supportsAdditionalOperations()) { + processOperation(resourcePath, "query", path.getQuery(), ops, path); + if (path.getAdditionalOperations() != null) { + path.getAdditionalOperations().forEach((method, operation) -> + processOperation(resourcePath, method, method, operation, ops, path)); + } + } else if (hasQueryOrAdditionalOperations(path)) { + LOGGER.warn("Path '{}' declares OpenAPI 3.2 query/additionalOperations but generator '{}' does not support them; those operations will be missing from the generated output", resourcePath, config.getName()); } } return ops; @@ -1523,15 +1528,24 @@ public Map> processWebhooks(Map processOperation(resourceKey, "patch", path.getPatch(), ops, path); processOperation(resourceKey, "options", path.getOptions(), ops, path); processOperation(resourceKey, "trace", path.getTrace(), ops, path); - processOperation(resourceKey, "query", path.getQuery(), ops, path); - if (path.getAdditionalOperations() != null) { - path.getAdditionalOperations().forEach((method, operation) -> - processOperation(resourceKey, method, method, operation, ops, path)); + if (config.supportsAdditionalOperations()) { + processOperation(resourceKey, "query", path.getQuery(), ops, path); + if (path.getAdditionalOperations() != null) { + path.getAdditionalOperations().forEach((method, operation) -> + processOperation(resourceKey, method, method, operation, ops, path)); + } + } else if (hasQueryOrAdditionalOperations(path)) { + LOGGER.warn("Webhook '{}' declares OpenAPI 3.2 query/additionalOperations but generator '{}' does not support them; those operations will be missing from the generated output", resourceKey, config.getName()); } } return ops; } + private boolean hasQueryOrAdditionalOperations(PathItem path) { + return path.getQuery() != null + || (path.getAdditionalOperations() != null && !path.getAdditionalOperations().isEmpty()); + } + private void processOperation(String resourcePath, String httpMethod, Operation operation, Map> operations, PathItem path) { processOperation(resourcePath, httpMethod, null, operation, operations, path); } diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/InlineModelResolver.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/InlineModelResolver.java index 6c8e10a648f0..cd985bba331b 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/InlineModelResolver.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/InlineModelResolver.java @@ -67,6 +67,7 @@ public class InlineModelResolver { private Map inlineSchemaNameMapping = new HashMap<>(); private Map inlineSchemaOptions = new HashMap<>(); private Set inlineSchemaNameMappingValues = new HashSet<>(); + private CodegenConfig codegen; public boolean resolveInlineEnums = false; public boolean skipSchemaReuse = false; // skip reusing inline schema if set to true public Boolean refactorAllOfInlineSchemas = null; // refactor allOf inline schemas into $ref @@ -150,6 +151,10 @@ public InlineModelResolver() { this.inlineSchemaOptions.put("MAP_ITEM_SUFFIX", "_value"); } + public void setCodegen(CodegenConfig codegen) { + this.codegen = codegen; + } + public void setInlineSchemaNameMapping(Map inlineSchemaNameMapping) { this.inlineSchemaNameMapping = inlineSchemaNameMapping; this.inlineSchemaNameMappingValues = new HashSet<>(inlineSchemaNameMapping.values()); @@ -274,9 +279,14 @@ private void flattenPathItems(Map pathItemMap) { } private void addOperationEntries(List> entries, PathItem pathItem) { - pathItem.readOperationsMap().forEach((method, operation) -> - entries.add(new AbstractMap.SimpleEntry<>(method.toString().toLowerCase(Locale.ROOT), operation))); - if (pathItem.getAdditionalOperations() != null) { + boolean supports32Ops = codegen == null || codegen.supportsAdditionalOperations(); + pathItem.readOperationsMap().forEach((method, operation) -> { + if (method == PathItem.HttpMethod.QUERY && !supports32Ops) { + return; + } + entries.add(new AbstractMap.SimpleEntry<>(method.toString().toLowerCase(Locale.ROOT), operation)); + }); + if (supports32Ops && pathItem.getAdditionalOperations() != null) { pathItem.getAdditionalOperations().forEach((method, operation) -> entries.add(new AbstractMap.SimpleEntry<>(method, operation))); } diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/config/MergedSpecBuilder.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/config/MergedSpecBuilder.java index 88ab9d987b08..269cf0d7109b 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/config/MergedSpecBuilder.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/config/MergedSpecBuilder.java @@ -628,7 +628,12 @@ private void resolveOperationIdConflicts(OpenAPI merged) { if (pathItem == null || pathItem.readOperationsMap() == null) { continue; } - for (Map.Entry opEntry : pathItem.readOperationsMap().entrySet()) { + Map allOperations = new LinkedHashMap<>(); + pathItem.readOperationsMap().forEach((method, operation) -> allOperations.put(method.name(), operation)); + if (pathItem.getAdditionalOperations() != null) { + allOperations.putAll(pathItem.getAdditionalOperations()); + } + for (Map.Entry opEntry : allOperations.entrySet()) { Operation operation = opEntry.getValue(); String operationId = operation.getOperationId(); if (operationId == null || operationId.isEmpty()) { @@ -722,6 +727,27 @@ private void mergePathItem(PathItem existing, PathItem incoming, String pathKey) existing.operation(method, operation); }); + // Merge OpenAPI 3.2 additionalOperations (arbitrary HTTP method names that + // cannot appear in the enum-keyed readOperationsMap) + if (incoming.getAdditionalOperations() != null) { + incoming.getAdditionalOperations().forEach((method, operation) -> { + if (existing.getAdditionalOperations() != null && existing.getAdditionalOperations().containsKey(method)) { + String message = String.format(Locale.ROOT, + "Path+method conflict during spec merge: %s %s is defined in multiple specs. " + + "Unlike schema reuse, duplicate HTTP methods on the same path are not valid — " + + "check that your spec files do not overlap. Keeping the first definition.", + method, pathKey); + if (conflictStrategy == MergeConflictStrategy.FAIL) { + throw new RuntimeException(message); + } + LOGGER.warn(message); + // WARN: keep the first (existing) operation, skip the incoming one. + return; + } + existing.addAdditionalOperation(method, operation); + }); + } + // Merge path-level parameters (first wins on conflict). Identity is the $ref value when the // parameter is a reference; otherwise name+in. Without this, multiple distinct $ref // parameters would all collapse to the key "null:null" and all but the first would be lost. diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaClientCodegen.java index 431a3dc11529..479c61383243 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaClientCodegen.java @@ -1435,6 +1435,14 @@ protected boolean supportsQueryStringParameters() { return isLibrary(OKHTTP_GSON) || StringUtils.isBlank(getLibrary()); } + @Override + public boolean supportsAdditionalOperations() { + // only the okhttp-gson templates emit the HTTP method as a plain string; + // other libraries embed enumerated constants (HttpMethod.QUERY etc.) + // that do not exist for the OpenAPI 3.2 methods + return isLibrary(OKHTTP_GSON) || StringUtils.isBlank(getLibrary()); + } + @Override public void preprocessOpenAPI(OpenAPI openAPI) { super.preprocessOpenAPI(openAPI); diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson/ApiClient.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson/ApiClient.mustache index 2bd59dbfe2aa..c4d73ec6ea39 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson/ApiClient.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson/ApiClient.mustache @@ -1913,13 +1913,16 @@ public class ApiClient { addOperationLookupEntry(path, "HEAD", pathItem.getHead()); addOperationLookupEntry(path, "PATCH", pathItem.getPatch()); addOperationLookupEntry(path, "TRACE", pathItem.getTrace()); - {{#hasQueryOrAdditionalOperations}}{{! requires a swagger-parser version with OpenAPI 3.2 model support }}addOperationLookupEntry(path, "QUERY", pathItem.getQuery()); + {{#hasQueryOrAdditionalOperations}} + {{! requires a swagger-parser version with OpenAPI 3.2 model support }} + addOperationLookupEntry(path, "QUERY", pathItem.getQuery()); if (pathItem.getAdditionalOperations() != null) { for (Map.Entry additionalOperation : pathItem.getAdditionalOperations().entrySet()) { addOperationLookupEntry(path, additionalOperation.getKey(), additionalOperation.getValue()); } } - {{/hasQueryOrAdditionalOperations}} } + {{/hasQueryOrAdditionalOperations}} + } return this; } diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/DefaultCodegenTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/DefaultCodegenTest.java index 6ac50075c0b8..ceda4c12b38f 100644 --- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/DefaultCodegenTest.java +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/DefaultCodegenTest.java @@ -29,6 +29,7 @@ import io.swagger.v3.oas.models.OpenAPI; import io.swagger.v3.oas.models.Operation; import io.swagger.v3.oas.models.PathItem; +import io.swagger.v3.oas.models.callbacks.Callback; import io.swagger.v3.oas.models.headers.Header; import io.swagger.v3.oas.models.media.*; import io.swagger.v3.oas.models.parameters.QueryParameter; @@ -2140,6 +2141,32 @@ public void testCallbacks() { }); } + @Test + public void testCallbackAdditionalOperationMethodCasingPreserved() { + // OpenAPI 3.2: additionalOperations keys are HTTP method names that must be + // sent verbatim - "customMethod" must not be normalized to CUSTOMMETHOD + DefaultCodegen codegen = new DefaultCodegen() { + @Override + public boolean supportsAdditionalOperations() { + return true; + } + }; + codegen.setOpenAPI(TestUtils.createOpenAPI()); + + PathItem callbackPath = new PathItem(); + callbackPath.addAdditionalOperation("customMethod", + new Operation().operationId("customCallback") + .responses(new ApiResponses() + .addApiResponse("200", new ApiResponse().description("ok")))); + Callback callback = new Callback(); + callback.addPathItem("{$request.body#/callbackUrl}", callbackPath); + + CodegenCallback cb = codegen.fromCallback("onEvent", callback, null); + Assert.assertEquals(cb.urls.size(), 1); + Assert.assertEquals(cb.urls.get(0).requests.size(), 1); + Assert.assertEquals(cb.urls.get(0).requests.get(0).httpMethod, "customMethod"); + } + @Test public void testLeadingSlashIsAddedIfMissing() { OpenAPI openAPI = TestUtils.createOpenAPI(); diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/DefaultGeneratorTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/DefaultGeneratorTest.java index 6dee8ed65917..9f38eb4b9e80 100644 --- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/DefaultGeneratorTest.java +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/DefaultGeneratorTest.java @@ -465,7 +465,12 @@ public void testProcessPathsQueryAndAdditionalOperations() throws Exception { ClientOptInput opts = new ClientOptInput(); opts.openAPI(openAPI); - opts.config(new DefaultCodegen()); + opts.config(new DefaultCodegen() { + @Override + public boolean supportsAdditionalOperations() { + return true; + } + }); DefaultGenerator generator = new DefaultGenerator(); generator.opts(opts); @@ -482,6 +487,33 @@ public void testProcessPathsQueryAndAdditionalOperations() throws Exception { Assert.assertEquals(defaultList.get(2).httpMethod, "customMethod"); } + @Test + public void testProcessPathsSkips32OperationsWhenUnsupported() throws Exception { + // generators that cannot emit arbitrary HTTP methods must skip + // query/additionalOperations instead of producing uncompilable code + OpenAPI openAPI = TestUtils.createOpenAPI(); + openAPI.setPaths(new Paths()); + Operation queryOp = new Operation().operationId("queryPets") + .responses(new ApiResponses().addApiResponse("200", new ApiResponse().description("OK"))); + Operation purgeOp = new Operation().operationId("purgePets") + .responses(new ApiResponses().addApiResponse("204", new ApiResponse().description("done"))); + Operation getOp = new Operation().operationId("getPets") + .responses(new ApiResponses().addApiResponse("200", new ApiResponse().description("OK"))); + openAPI.getPaths().addPathItem("/pets", + new PathItem().get(getOp).query(queryOp).addAdditionalOperation("PURGE", purgeOp)); + + ClientOptInput opts = new ClientOptInput(); + opts.openAPI(openAPI); + opts.config(new DefaultCodegen()); // default: supportsAdditionalOperations() == false + + DefaultGenerator generator = new DefaultGenerator(); + generator.opts(opts); + Map> result = generator.processPaths(openAPI.getPaths()); + List defaultList = result.get("Default"); + Assert.assertEquals(defaultList.size(), 1); + Assert.assertEquals(defaultList.get(0).operationId, "getPets"); + } + @Test public void testProcessWebhooksQueryAndAdditionalOperations() throws Exception { OpenAPI openAPI = TestUtils.createOpenAPI(); @@ -493,7 +525,12 @@ public void testProcessWebhooksQueryAndAdditionalOperations() throws Exception { ClientOptInput opts = new ClientOptInput(); opts.openAPI(openAPI); - opts.config(new DefaultCodegen()); + opts.config(new DefaultCodegen() { + @Override + public boolean supportsAdditionalOperations() { + return true; + } + }); DefaultGenerator generator = new DefaultGenerator(); generator.opts(opts); diff --git a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/ApiClient.java b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/ApiClient.java index 3cdf0e35a798..9babfb77274e 100644 --- a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/ApiClient.java +++ b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/ApiClient.java @@ -1778,6 +1778,12 @@ public String fillParametersFromOperation( case "cookie": cookieParams.put(param.getName(), parameterToString(value)); break; + case "querystring": + // OpenAPI 3.2: the value is the whole (already encoded) query string + if (value != null) { + path = path + (path.contains("?") ? "&" : "?") + value.toString(); + } + break; default: throw new IllegalStateException("Unexpected param in: " + param.getIn()); } From 87fa468c829d12c2beef259c1aa5b8161047e255 Mon Sep 17 00:00:00 2001 From: khayashi4337 Date: Tue, 22 Sep 2026 16:01:47 +0900 Subject: [PATCH 04/31] feat(go): generate OpenAPI 3.2 query/additionalOperations and in:querystring Opt the Go client generator into the 3.2 capability gates and emit operations that actually compile and behave correctly on the wire: - supportsAdditionalOperations()/supportsQueryStringParameters() return true for the go client generator only - Non-standard HTTP methods are snapshotted verbatim before AbstractGoCodegen camelizes httpMethod (which would corrupt "customMethod" into "Custommethod"), then restored and flagged with x-go-http-method-literal. IdentityHashMap is required because CodegenOperation.hashCode() includes the mutating httpMethod field. The same snapshot/restore is applied to webhooks via postProcessWebhooksWithModels, which renders through api.mustache too. - api.mustache emits standard methods as http.MethodXxx constants and non-standard methods as unescaped string literals so valid HTTP token punctuation (e.g. CHECK&FETCH) survives intact - in:querystring parameters append their raw, already-encoded value to the request path instead of name=value serialization - client.mustache captures url.RawQuery before url.Query() merges it into the normal parameter map, then re-appends it verbatim. Note: for requests whose path already embeds a query string, the embedded pairs now keep their verbatim form/order instead of being merged, decoded and re-sorted by Encode(); the only producer of such paths is the 3.2 querystring parameter (it cannot coexist with in:query per spec validation) - "strings" import is added when a querystring parameter exists and deduplicated against the path-parameter import Verified: go build on generated client, httptest request-capture tests (QUERY method, verbatim customMethod and CHECK&FETCH casing, verbatim raw query, ordinary GET regression, pathParam+querystring on one op), go-gin-server warns and omits unsupported 3.2 operations. Generated with [Devin](https://devin.ai) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com> --- .../codegen/languages/GoClientCodegen.java | 92 +++++++++++++++++ .../src/main/resources/go/api.mustache | 18 ++++ .../src/main/resources/go/client.mustache | 14 ++- .../codegen/go/GoClientCodegenTest.java | 98 +++++++++++++++++++ .../3_2/go-querystring-pathparam.yaml | 24 +++++ .../resources/3_2/go-webhook-operations.yaml | 26 +++++ .../test/resources/3_2/query-operation.yaml | 11 +++ .../echo_api/go-external-refs/client.go | 14 ++- samples/client/echo_api/go/client.go | 14 ++- .../client.go | 14 ++- .../client.go | 14 ++- .../others/go/oneof-anyof-required/client.go | 14 ++- .../go/oneof-discriminator-lookup/client.go | 14 ++- .../client/petstore/go/go-petstore/client.go | 14 ++- .../x-auth-id-alias/go-experimental/client.go | 14 ++- .../client.go | 14 ++- .../petstore/go-petstore-withXml/client.go | 14 ++- .../go/go-petstore-aws-signature/client.go | 14 ++- .../client/petstore/go/go-petstore/client.go | 14 ++- 19 files changed, 438 insertions(+), 13 deletions(-) create mode 100644 modules/openapi-generator/src/test/resources/3_2/go-querystring-pathparam.yaml create mode 100644 modules/openapi-generator/src/test/resources/3_2/go-webhook-operations.yaml diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/GoClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/GoClientCodegen.java index ebeb302d7dad..4f51d55a75b4 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/GoClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/GoClientCodegen.java @@ -33,6 +33,7 @@ import org.openapitools.codegen.model.ModelsMap; import org.openapitools.codegen.model.OperationMap; import org.openapitools.codegen.model.OperationsMap; +import org.openapitools.codegen.model.WebhooksMap; import org.openapitools.codegen.utils.ModelUtils; import org.openapitools.codegen.utils.ProcessUtils; import org.slf4j.Logger; @@ -74,6 +75,12 @@ public class GoClientCodegen extends AbstractGoCodegen { // A cache to efficiently lookup schema `toModelName()` based on the schema Key private Map schemaKeyToModelNameCache = new HashMap<>(); + // HTTP methods with net/http constants (http.MethodXxx, produced via + // camelize(httpMethod.toLowerCase())); OpenAPI 3.2 methods outside this + // set are emitted as string literals via x-go-http-method-literal + private static final Set STANDARD_HTTP_METHODS = new HashSet<>(Arrays.asList( + "GET", "PUT", "POST", "DELETE", "HEAD", "OPTIONS", "TRACE", "PATCH", "CONNECT")); + public GoClientCodegen() { super(); @@ -624,8 +631,24 @@ private void prefixEnumUnknownDefaultCase(CodegenModel model) { } } + @Override + public boolean supportsAdditionalOperations() { + // the Go client sends the HTTP method as a plain string to + // http.NewRequest, so QUERY and arbitrary additionalOperations work + return true; + } + + @Override + protected boolean supportsQueryStringParameters() { + // the raw, already-encoded query string is appended to the request + // path verbatim by the api template and preserved by prepareRequest + return true; + } + @Override public OperationsMap postProcessOperationsWithModels(OperationsMap objs, List allModels) { + Map verbatimMethods = snapshotVerbatimHttpMethods(objs.getOperations().getOperation()); + objs = super.postProcessOperationsWithModels(objs, allModels); OperationMap operations = objs.getOperations(); HashMap modelMaps = ModelMap.toCodegenModelMap(allModels); @@ -639,9 +662,15 @@ public OperationsMap postProcessOperationsWithModels(OperationsMap objs, List allModels) { + // webhooks render through api.mustache as well, so they need the same + // verbatim-method restore and strings import as regular operations + Map verbatimMethods = snapshotVerbatimHttpMethods(objs.getWebhooks().getOperation()); + + objs = super.postProcessWebhooksWithModels(objs, allModels); + + List operationList = objs.getWebhooks().getOperation(); + restoreVerbatimHttpMethods(operationList, verbatimMethods); + + boolean needsStringsImport = false; + for (CodegenOperation operation : operationList) { + for (CodegenParameter cp : operation.allParams) { + if (cp.isQueryStringParam) { + needsStringsImport = true; + break; + } + } + } + ensureStringsImport(needsStringsImport, objs.getImports()); + + return objs; + } + + // snapshot OpenAPI 3.2 non-standard HTTP methods verbatim before the + // superclass camelizes httpMethod, which would corrupt names like + // "customMethod" into "Custommethod". IdentityHashMap is required: + // CodegenOperation.hashCode() includes httpMethod, which the camelization + // mutates between put() and get() + private Map snapshotVerbatimHttpMethods(List operationList) { + Map verbatimMethods = new IdentityHashMap<>(); + for (CodegenOperation op : operationList) { + if (op.httpMethod != null && !STANDARD_HTTP_METHODS.contains(op.httpMethod)) { + verbatimMethods.put(op, op.httpMethod); + } + } + return verbatimMethods; + } + + private void restoreVerbatimHttpMethods(List operationList, + Map verbatimMethods) { + for (CodegenOperation operation : operationList) { + String verbatim = verbatimMethods.get(operation); + if (verbatim != null) { + operation.httpMethod = verbatim; + operation.vendorExtensions.put("x-go-http-method-literal", true); + } + } + } + + // querystring parameters use strings.Contains on localVarPath, which is + // otherwise only imported when path parameters exist (which may already + // have added "strings", so deduplicate) + private void ensureStringsImport(boolean needed, List> imports) { + if (needed && imports != null + && imports.stream().noneMatch(i -> "strings".equals(i.get("import")))) { + imports.add(createMapping("import", "strings")); + } + } + private String constructExampleCode(CodegenParameter codegenParameter, HashMap modelMaps, HashMap> processedModelMap) { if (codegenParameter.isArray) { // array String prefix = codegenParameter.dataType; diff --git a/modules/openapi-generator/src/main/resources/go/api.mustache b/modules/openapi-generator/src/main/resources/go/api.mustache index 2be5011b6546..915ed6a34175 100644 --- a/modules/openapi-generator/src/main/resources/go/api.mustache +++ b/modules/openapi-generator/src/main/resources/go/api.mustache @@ -110,7 +110,12 @@ func (a *{{{classname}}}Service) {{{nickname}}}(ctx context.Context{{#pathParams {{/isDeprecated}} func (a *{{{classname}}}Service) {{nickname}}Execute(r {{#structPrefix}}{{&classname}}{{/structPrefix}}{{^structPrefix}}Api{{/structPrefix}}{{operationId}}Request) ({{#returnType}}{{^isArray}}{{^returnTypeIsPrimitive}}{{^isResponseFile}}*{{/isResponseFile}}{{/returnTypeIsPrimitive}}{{/isArray}}{{{.}}}, {{/returnType}}*http.Response, error) { var ( + {{#vendorExtensions.x-go-http-method-literal}} + localVarHTTPMethod = "{{{httpMethod}}}"{{! OpenAPI 3.2: non-standard method sent verbatim; unescaped so valid token punctuation (& ' ` etc.) is preserved }} + {{/vendorExtensions.x-go-http-method-literal}} + {{^vendorExtensions.x-go-http-method-literal}} localVarHTTPMethod = http.Method{{httpMethod}} + {{/vendorExtensions.x-go-http-method-literal}} localVarPostBody interface{} formFiles []formFile {{#returnType}} @@ -182,6 +187,18 @@ func (a *{{{classname}}}Service) {{nickname}}Execute(r {{#structPrefix}}{{&class {{/allParams}} {{#queryParams}} + {{#isQueryStringParam}} + // OpenAPI 3.2 in: querystring - the value is the whole, already-encoded + // query string; append it verbatim instead of a name=value pair + if r.{{paramName}} != nil { + if strings.Contains(localVarPath, "?") { + localVarPath = localVarPath + "&" + *r.{{paramName}} + } else { + localVarPath = localVarPath + "?" + *r.{{paramName}} + } + } + {{/isQueryStringParam}} + {{^isQueryStringParam}} {{#required}} {{#isCollectionFormatMulti}} { @@ -229,6 +246,7 @@ func (a *{{{classname}}}Service) {{nickname}}Execute(r {{#structPrefix}}{{&class {{/isArray}} {{/defaultValue}}} {{/required}} + {{/isQueryStringParam}} {{/queryParams}} // to determine the Content-Type header {{=<% %>=}} diff --git a/modules/openapi-generator/src/main/resources/go/client.mustache b/modules/openapi-generator/src/main/resources/go/client.mustache index c0fea7cafc3d..39796aefc02d 100644 --- a/modules/openapi-generator/src/main/resources/go/client.mustache +++ b/modules/openapi-generator/src/main/resources/go/client.mustache @@ -388,6 +388,11 @@ func (c *APIClient) prepareRequest( } // Adding Query Param + // OpenAPI 3.2: an "in: querystring" parameter embeds the whole, already + // encoded query string into the path. Capture it before url.Query() would + // merge and re-encode it, and append it verbatim after encoding. + rawQueryString := url.RawQuery + url.RawQuery = "" query := url.Query() for k, v := range queryParams { for _, iv := range v { @@ -396,11 +401,18 @@ func (c *APIClient) prepareRequest( } // Encode the parameters. - url.RawQuery = queryParamSplit.ReplaceAllStringFunc(query.Encode(), func(s string) string { + encodedQuery := queryParamSplit.ReplaceAllStringFunc(query.Encode(), func(s string) string { pieces := strings.Split(s, "=") pieces[0] = queryDescape.Replace(pieces[0]) return strings.Join(pieces, "=") }) + if rawQueryString != "" { + if encodedQuery != "" { + encodedQuery += "&" + } + encodedQuery += rawQueryString + } + url.RawQuery = encodedQuery // Generate a new request if body != nil { diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/go/GoClientCodegenTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/go/GoClientCodegenTest.java index 6b04bf8e8703..9210d4bfb327 100644 --- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/go/GoClientCodegenTest.java +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/go/GoClientCodegenTest.java @@ -562,4 +562,102 @@ public void testOneOfUnmarshalJSONGeneratedByDefault() throws IOException { "validator.Validate", "gopkg.in/validator.v2"); } + + @Test(description = "OpenAPI 3.2 query/additionalOperations and in:querystring generate working Go code") + public void testOpenAPI32QueryAndAdditionalOperations() throws IOException { + File output = Files.createTempDirectory("test").toFile(); + output.deleteOnExit(); + + final CodegenConfigurator configurator = new CodegenConfigurator() + .setGeneratorName("go") + .setInputSpec("src/test/resources/3_2/query-operation.yaml") + .setOutputDir(output.getAbsolutePath().replace("\\", "/")); + + DefaultGenerator generator = new DefaultGenerator(); + List files = generator.opts(configurator.toClientOptInput()).generate(); + files.forEach(File::deleteOnExit); + + Path apiFile = Paths.get(output + "/api_default.go"); + // non-standard methods are emitted as string literals; net/http has no + // MethodQuery/MethodPurge/MethodCustomMethod constants + TestUtils.assertFileContains(apiFile, + "localVarHTTPMethod = \"QUERY\"", + "localVarHTTPMethod = \"PURGE\"", + // additionalOperations keys are sent verbatim - no camelize + "localVarHTTPMethod = \"customMethod\"", + // valid HTTP token punctuation must not be HTML-escaped + "localVarHTTPMethod = \"CHECK&FETCH\""); + TestUtils.assertFileNotContains(apiFile, "http.MethodQuery"); + TestUtils.assertFileNotContains(apiFile, "http.MethodPurge"); + TestUtils.assertFileNotContains(apiFile, "&"); + // in:querystring appends the raw, already-encoded value to the path + TestUtils.assertFileContains(apiFile, + "localVarPath = localVarPath + \"?\" + *r.qs"); + } + + @Test(description = "prepareRequest keeps a path-embedded raw query string verbatim") + public void testOpenAPI32QueryStringPreservedInClient() throws IOException { + File output = Files.createTempDirectory("test").toFile(); + output.deleteOnExit(); + + final CodegenConfigurator configurator = new CodegenConfigurator() + .setGeneratorName("go") + .setInputSpec("src/test/resources/3_2/query-operation.yaml") + .setOutputDir(output.getAbsolutePath().replace("\\", "/")); + + DefaultGenerator generator = new DefaultGenerator(); + List files = generator.opts(configurator.toClientOptInput()).generate(); + files.forEach(File::deleteOnExit); + + Path clientFile = Paths.get(output + "/client.go"); + TestUtils.assertFileContains(clientFile, "rawQueryString := url.RawQuery"); + } + + @Test(description = "in:querystring together with a path parameter imports strings only once") + public void testOpenAPI32QueryStringWithPathParamImports() throws IOException { + File output = Files.createTempDirectory("test").toFile(); + output.deleteOnExit(); + + final CodegenConfigurator configurator = new CodegenConfigurator() + .setGeneratorName("go") + .setInputSpec("src/test/resources/3_2/go-querystring-pathparam.yaml") + .setOutputDir(output.getAbsolutePath().replace("\\", "/")); + + DefaultGenerator generator = new DefaultGenerator(); + List files = generator.opts(configurator.toClientOptInput()).generate(); + files.forEach(File::deleteOnExit); + + Path apiFile = Paths.get(output + "/api_default.go"); + TestUtils.assertFileContains(apiFile, "strings.Contains(localVarPath, \"?\")"); + // pathParams already pull in "strings"; a duplicate import would not compile + String content = new String(Files.readAllBytes(apiFile)); + Assert.assertEquals(content.split("\"strings\"", -1).length - 1, 1, + "duplicate \"strings\" import in generated Go file"); + } + + @Test(description = "OpenAPI 3.2 query/additionalOperations in webhooks also emit verbatim method literals") + public void testOpenAPI32WebhookOperations() throws IOException { + File output = Files.createTempDirectory("test").toFile(); + output.deleteOnExit(); + + final CodegenConfigurator configurator = new CodegenConfigurator() + .setGeneratorName("go") + .setInputSpec("src/test/resources/3_2/go-webhook-operations.yaml") + .setOutputDir(output.getAbsolutePath().replace("\\", "/")); + + DefaultGenerator generator = new DefaultGenerator(); + List files = generator.opts(configurator.toClientOptInput()).generate(); + files.forEach(File::deleteOnExit); + + // webhooks render through the same api.mustache; their non-standard + // methods must be literals too, otherwise the output does not compile + Path apiFile = Paths.get(output + "/api_default.go"); + TestUtils.assertFileContains(apiFile, + "localVarHTTPMethod = \"QUERY\"", + "localVarHTTPMethod = \"customMethod\""); + TestUtils.assertFileNotContains(apiFile, "http.MethodQuery"); + TestUtils.assertFileNotContains(apiFile, "http.MethodCustommethod"); + // webhook querystring parameters need the strings import as well + TestUtils.assertFileContains(apiFile, "\"strings\""); + } } diff --git a/modules/openapi-generator/src/test/resources/3_2/go-querystring-pathparam.yaml b/modules/openapi-generator/src/test/resources/3_2/go-querystring-pathparam.yaml new file mode 100644 index 000000000000..25425ba73bb4 --- /dev/null +++ b/modules/openapi-generator/src/test/resources/3_2/go-querystring-pathparam.yaml @@ -0,0 +1,24 @@ +openapi: 3.2.0 +info: + title: querystring with path parameter + version: '1.0' +paths: + /pets/{petId}: + get: + operationId: getPetByQuery + parameters: + - name: petId + in: path + required: true + schema: + type: string + - name: qs + in: querystring + required: true + content: + application/x-www-form-urlencoded: + schema: + type: string + responses: + '200': + description: ok diff --git a/modules/openapi-generator/src/test/resources/3_2/go-webhook-operations.yaml b/modules/openapi-generator/src/test/resources/3_2/go-webhook-operations.yaml new file mode 100644 index 000000000000..2f7747abbcda --- /dev/null +++ b/modules/openapi-generator/src/test/resources/3_2/go-webhook-operations.yaml @@ -0,0 +1,26 @@ +openapi: 3.2.0 +info: + title: webhook operations test + version: '1.0' +paths: {} +webhooks: + petChanged: + query: + operationId: onPetQuery + parameters: + - name: qs + in: querystring + required: true + content: + application/x-www-form-urlencoded: + schema: + type: string + responses: + '200': + description: ok + additionalOperations: + "customMethod": + operationId: onPetCustom + responses: + '204': + description: done diff --git a/modules/openapi-generator/src/test/resources/3_2/query-operation.yaml b/modules/openapi-generator/src/test/resources/3_2/query-operation.yaml index 9615ceed1547..be5d63f84ab6 100644 --- a/modules/openapi-generator/src/test/resources/3_2/query-operation.yaml +++ b/modules/openapi-generator/src/test/resources/3_2/query-operation.yaml @@ -23,3 +23,14 @@ paths: responses: '204': description: done + customMethod: + operationId: customPets + responses: + '204': + description: done + # HTTP token punctuation must be preserved verbatim (RFC 9110 tchar) + "CHECK&FETCH": + operationId: checkFetchPets + responses: + '204': + description: done diff --git a/samples/client/echo_api/go-external-refs/client.go b/samples/client/echo_api/go-external-refs/client.go index 83d93205607b..0e3437f9b1d6 100644 --- a/samples/client/echo_api/go-external-refs/client.go +++ b/samples/client/echo_api/go-external-refs/client.go @@ -392,6 +392,11 @@ func (c *APIClient) prepareRequest( } // Adding Query Param + // OpenAPI 3.2: an "in: querystring" parameter embeds the whole, already + // encoded query string into the path. Capture it before url.Query() would + // merge and re-encode it, and append it verbatim after encoding. + rawQueryString := url.RawQuery + url.RawQuery = "" query := url.Query() for k, v := range queryParams { for _, iv := range v { @@ -400,11 +405,18 @@ func (c *APIClient) prepareRequest( } // Encode the parameters. - url.RawQuery = queryParamSplit.ReplaceAllStringFunc(query.Encode(), func(s string) string { + encodedQuery := queryParamSplit.ReplaceAllStringFunc(query.Encode(), func(s string) string { pieces := strings.Split(s, "=") pieces[0] = queryDescape.Replace(pieces[0]) return strings.Join(pieces, "=") }) + if rawQueryString != "" { + if encodedQuery != "" { + encodedQuery += "&" + } + encodedQuery += rawQueryString + } + url.RawQuery = encodedQuery // Generate a new request if body != nil { diff --git a/samples/client/echo_api/go/client.go b/samples/client/echo_api/go/client.go index 83d93205607b..0e3437f9b1d6 100644 --- a/samples/client/echo_api/go/client.go +++ b/samples/client/echo_api/go/client.go @@ -392,6 +392,11 @@ func (c *APIClient) prepareRequest( } // Adding Query Param + // OpenAPI 3.2: an "in: querystring" parameter embeds the whole, already + // encoded query string into the path. Capture it before url.Query() would + // merge and re-encode it, and append it verbatim after encoding. + rawQueryString := url.RawQuery + url.RawQuery = "" query := url.Query() for k, v := range queryParams { for _, iv := range v { @@ -400,11 +405,18 @@ func (c *APIClient) prepareRequest( } // Encode the parameters. - url.RawQuery = queryParamSplit.ReplaceAllStringFunc(query.Encode(), func(s string) string { + encodedQuery := queryParamSplit.ReplaceAllStringFunc(query.Encode(), func(s string) string { pieces := strings.Split(s, "=") pieces[0] = queryDescape.Replace(pieces[0]) return strings.Join(pieces, "=") }) + if rawQueryString != "" { + if encodedQuery != "" { + encodedQuery += "&" + } + encodedQuery += rawQueryString + } + url.RawQuery = encodedQuery // Generate a new request if body != nil { diff --git a/samples/client/others/go/allof_multiple_ref_and_discriminator/client.go b/samples/client/others/go/allof_multiple_ref_and_discriminator/client.go index 7a19a74088d8..ea7e1f3ac15a 100644 --- a/samples/client/others/go/allof_multiple_ref_and_discriminator/client.go +++ b/samples/client/others/go/allof_multiple_ref_and_discriminator/client.go @@ -373,6 +373,11 @@ func (c *APIClient) prepareRequest( } // Adding Query Param + // OpenAPI 3.2: an "in: querystring" parameter embeds the whole, already + // encoded query string into the path. Capture it before url.Query() would + // merge and re-encode it, and append it verbatim after encoding. + rawQueryString := url.RawQuery + url.RawQuery = "" query := url.Query() for k, v := range queryParams { for _, iv := range v { @@ -381,11 +386,18 @@ func (c *APIClient) prepareRequest( } // Encode the parameters. - url.RawQuery = queryParamSplit.ReplaceAllStringFunc(query.Encode(), func(s string) string { + encodedQuery := queryParamSplit.ReplaceAllStringFunc(query.Encode(), func(s string) string { pieces := strings.Split(s, "=") pieces[0] = queryDescape.Replace(pieces[0]) return strings.Join(pieces, "=") }) + if rawQueryString != "" { + if encodedQuery != "" { + encodedQuery += "&" + } + encodedQuery += rawQueryString + } + url.RawQuery = encodedQuery // Generate a new request if body != nil { diff --git a/samples/client/others/go/issue_20079_go_regex_wrongly_translated/client.go b/samples/client/others/go/issue_20079_go_regex_wrongly_translated/client.go index b681437f098b..2b0c6924f624 100644 --- a/samples/client/others/go/issue_20079_go_regex_wrongly_translated/client.go +++ b/samples/client/others/go/issue_20079_go_regex_wrongly_translated/client.go @@ -376,6 +376,11 @@ func (c *APIClient) prepareRequest( } // Adding Query Param + // OpenAPI 3.2: an "in: querystring" parameter embeds the whole, already + // encoded query string into the path. Capture it before url.Query() would + // merge and re-encode it, and append it verbatim after encoding. + rawQueryString := url.RawQuery + url.RawQuery = "" query := url.Query() for k, v := range queryParams { for _, iv := range v { @@ -384,11 +389,18 @@ func (c *APIClient) prepareRequest( } // Encode the parameters. - url.RawQuery = queryParamSplit.ReplaceAllStringFunc(query.Encode(), func(s string) string { + encodedQuery := queryParamSplit.ReplaceAllStringFunc(query.Encode(), func(s string) string { pieces := strings.Split(s, "=") pieces[0] = queryDescape.Replace(pieces[0]) return strings.Join(pieces, "=") }) + if rawQueryString != "" { + if encodedQuery != "" { + encodedQuery += "&" + } + encodedQuery += rawQueryString + } + url.RawQuery = encodedQuery // Generate a new request if body != nil { diff --git a/samples/client/others/go/oneof-anyof-required/client.go b/samples/client/others/go/oneof-anyof-required/client.go index 7a19a74088d8..ea7e1f3ac15a 100644 --- a/samples/client/others/go/oneof-anyof-required/client.go +++ b/samples/client/others/go/oneof-anyof-required/client.go @@ -373,6 +373,11 @@ func (c *APIClient) prepareRequest( } // Adding Query Param + // OpenAPI 3.2: an "in: querystring" parameter embeds the whole, already + // encoded query string into the path. Capture it before url.Query() would + // merge and re-encode it, and append it verbatim after encoding. + rawQueryString := url.RawQuery + url.RawQuery = "" query := url.Query() for k, v := range queryParams { for _, iv := range v { @@ -381,11 +386,18 @@ func (c *APIClient) prepareRequest( } // Encode the parameters. - url.RawQuery = queryParamSplit.ReplaceAllStringFunc(query.Encode(), func(s string) string { + encodedQuery := queryParamSplit.ReplaceAllStringFunc(query.Encode(), func(s string) string { pieces := strings.Split(s, "=") pieces[0] = queryDescape.Replace(pieces[0]) return strings.Join(pieces, "=") }) + if rawQueryString != "" { + if encodedQuery != "" { + encodedQuery += "&" + } + encodedQuery += rawQueryString + } + url.RawQuery = encodedQuery // Generate a new request if body != nil { diff --git a/samples/client/others/go/oneof-discriminator-lookup/client.go b/samples/client/others/go/oneof-discriminator-lookup/client.go index 7a19a74088d8..ea7e1f3ac15a 100644 --- a/samples/client/others/go/oneof-discriminator-lookup/client.go +++ b/samples/client/others/go/oneof-discriminator-lookup/client.go @@ -373,6 +373,11 @@ func (c *APIClient) prepareRequest( } // Adding Query Param + // OpenAPI 3.2: an "in: querystring" parameter embeds the whole, already + // encoded query string into the path. Capture it before url.Query() would + // merge and re-encode it, and append it verbatim after encoding. + rawQueryString := url.RawQuery + url.RawQuery = "" query := url.Query() for k, v := range queryParams { for _, iv := range v { @@ -381,11 +386,18 @@ func (c *APIClient) prepareRequest( } // Encode the parameters. - url.RawQuery = queryParamSplit.ReplaceAllStringFunc(query.Encode(), func(s string) string { + encodedQuery := queryParamSplit.ReplaceAllStringFunc(query.Encode(), func(s string) string { pieces := strings.Split(s, "=") pieces[0] = queryDescape.Replace(pieces[0]) return strings.Join(pieces, "=") }) + if rawQueryString != "" { + if encodedQuery != "" { + encodedQuery += "&" + } + encodedQuery += rawQueryString + } + url.RawQuery = encodedQuery // Generate a new request if body != nil { diff --git a/samples/client/petstore/go/go-petstore/client.go b/samples/client/petstore/go/go-petstore/client.go index 85036942f54b..3a067523750b 100644 --- a/samples/client/petstore/go/go-petstore/client.go +++ b/samples/client/petstore/go/go-petstore/client.go @@ -392,6 +392,11 @@ func (c *APIClient) prepareRequest( } // Adding Query Param + // OpenAPI 3.2: an "in: querystring" parameter embeds the whole, already + // encoded query string into the path. Capture it before url.Query() would + // merge and re-encode it, and append it verbatim after encoding. + rawQueryString := url.RawQuery + url.RawQuery = "" query := url.Query() for k, v := range queryParams { for _, iv := range v { @@ -400,11 +405,18 @@ func (c *APIClient) prepareRequest( } // Encode the parameters. - url.RawQuery = queryParamSplit.ReplaceAllStringFunc(query.Encode(), func(s string) string { + encodedQuery := queryParamSplit.ReplaceAllStringFunc(query.Encode(), func(s string) string { pieces := strings.Split(s, "=") pieces[0] = queryDescape.Replace(pieces[0]) return strings.Join(pieces, "=") }) + if rawQueryString != "" { + if encodedQuery != "" { + encodedQuery += "&" + } + encodedQuery += rawQueryString + } + url.RawQuery = encodedQuery // Generate a new request if body != nil { diff --git a/samples/openapi3/client/extensions/x-auth-id-alias/go-experimental/client.go b/samples/openapi3/client/extensions/x-auth-id-alias/go-experimental/client.go index 58b26ebc1573..e1c9e1a9c268 100644 --- a/samples/openapi3/client/extensions/x-auth-id-alias/go-experimental/client.go +++ b/samples/openapi3/client/extensions/x-auth-id-alias/go-experimental/client.go @@ -376,6 +376,11 @@ func (c *APIClient) prepareRequest( } // Adding Query Param + // OpenAPI 3.2: an "in: querystring" parameter embeds the whole, already + // encoded query string into the path. Capture it before url.Query() would + // merge and re-encode it, and append it verbatim after encoding. + rawQueryString := url.RawQuery + url.RawQuery = "" query := url.Query() for k, v := range queryParams { for _, iv := range v { @@ -384,11 +389,18 @@ func (c *APIClient) prepareRequest( } // Encode the parameters. - url.RawQuery = queryParamSplit.ReplaceAllStringFunc(query.Encode(), func(s string) string { + encodedQuery := queryParamSplit.ReplaceAllStringFunc(query.Encode(), func(s string) string { pieces := strings.Split(s, "=") pieces[0] = queryDescape.Replace(pieces[0]) return strings.Join(pieces, "=") }) + if rawQueryString != "" { + if encodedQuery != "" { + encodedQuery += "&" + } + encodedQuery += rawQueryString + } + url.RawQuery = encodedQuery // Generate a new request if body != nil { diff --git a/samples/openapi3/client/petstore/go-petstore-generateMarshalJSON-false/client.go b/samples/openapi3/client/petstore/go-petstore-generateMarshalJSON-false/client.go index 7f611c52fa4d..0b67c1c1308c 100644 --- a/samples/openapi3/client/petstore/go-petstore-generateMarshalJSON-false/client.go +++ b/samples/openapi3/client/petstore/go-petstore-generateMarshalJSON-false/client.go @@ -377,6 +377,11 @@ func (c *APIClient) prepareRequest( } // Adding Query Param + // OpenAPI 3.2: an "in: querystring" parameter embeds the whole, already + // encoded query string into the path. Capture it before url.Query() would + // merge and re-encode it, and append it verbatim after encoding. + rawQueryString := url.RawQuery + url.RawQuery = "" query := url.Query() for k, v := range queryParams { for _, iv := range v { @@ -385,11 +390,18 @@ func (c *APIClient) prepareRequest( } // Encode the parameters. - url.RawQuery = queryParamSplit.ReplaceAllStringFunc(query.Encode(), func(s string) string { + encodedQuery := queryParamSplit.ReplaceAllStringFunc(query.Encode(), func(s string) string { pieces := strings.Split(s, "=") pieces[0] = queryDescape.Replace(pieces[0]) return strings.Join(pieces, "=") }) + if rawQueryString != "" { + if encodedQuery != "" { + encodedQuery += "&" + } + encodedQuery += rawQueryString + } + url.RawQuery = encodedQuery // Generate a new request if body != nil { diff --git a/samples/openapi3/client/petstore/go-petstore-withXml/client.go b/samples/openapi3/client/petstore/go-petstore-withXml/client.go index 7f611c52fa4d..0b67c1c1308c 100644 --- a/samples/openapi3/client/petstore/go-petstore-withXml/client.go +++ b/samples/openapi3/client/petstore/go-petstore-withXml/client.go @@ -377,6 +377,11 @@ func (c *APIClient) prepareRequest( } // Adding Query Param + // OpenAPI 3.2: an "in: querystring" parameter embeds the whole, already + // encoded query string into the path. Capture it before url.Query() would + // merge and re-encode it, and append it verbatim after encoding. + rawQueryString := url.RawQuery + url.RawQuery = "" query := url.Query() for k, v := range queryParams { for _, iv := range v { @@ -385,11 +390,18 @@ func (c *APIClient) prepareRequest( } // Encode the parameters. - url.RawQuery = queryParamSplit.ReplaceAllStringFunc(query.Encode(), func(s string) string { + encodedQuery := queryParamSplit.ReplaceAllStringFunc(query.Encode(), func(s string) string { pieces := strings.Split(s, "=") pieces[0] = queryDescape.Replace(pieces[0]) return strings.Join(pieces, "=") }) + if rawQueryString != "" { + if encodedQuery != "" { + encodedQuery += "&" + } + encodedQuery += rawQueryString + } + url.RawQuery = encodedQuery // Generate a new request if body != nil { diff --git a/samples/openapi3/client/petstore/go/go-petstore-aws-signature/client.go b/samples/openapi3/client/petstore/go/go-petstore-aws-signature/client.go index 73c66a0e3188..ae38a2bbc6d1 100644 --- a/samples/openapi3/client/petstore/go/go-petstore-aws-signature/client.go +++ b/samples/openapi3/client/petstore/go/go-petstore-aws-signature/client.go @@ -381,6 +381,11 @@ func (c *APIClient) prepareRequest( } // Adding Query Param + // OpenAPI 3.2: an "in: querystring" parameter embeds the whole, already + // encoded query string into the path. Capture it before url.Query() would + // merge and re-encode it, and append it verbatim after encoding. + rawQueryString := url.RawQuery + url.RawQuery = "" query := url.Query() for k, v := range queryParams { for _, iv := range v { @@ -389,11 +394,18 @@ func (c *APIClient) prepareRequest( } // Encode the parameters. - url.RawQuery = queryParamSplit.ReplaceAllStringFunc(query.Encode(), func(s string) string { + encodedQuery := queryParamSplit.ReplaceAllStringFunc(query.Encode(), func(s string) string { pieces := strings.Split(s, "=") pieces[0] = queryDescape.Replace(pieces[0]) return strings.Join(pieces, "=") }) + if rawQueryString != "" { + if encodedQuery != "" { + encodedQuery += "&" + } + encodedQuery += rawQueryString + } + url.RawQuery = encodedQuery // Generate a new request if body != nil { diff --git a/samples/openapi3/client/petstore/go/go-petstore/client.go b/samples/openapi3/client/petstore/go/go-petstore/client.go index 8f341a904a36..8b70688f732a 100644 --- a/samples/openapi3/client/petstore/go/go-petstore/client.go +++ b/samples/openapi3/client/petstore/go/go-petstore/client.go @@ -395,6 +395,11 @@ func (c *APIClient) prepareRequest( } // Adding Query Param + // OpenAPI 3.2: an "in: querystring" parameter embeds the whole, already + // encoded query string into the path. Capture it before url.Query() would + // merge and re-encode it, and append it verbatim after encoding. + rawQueryString := url.RawQuery + url.RawQuery = "" query := url.Query() for k, v := range queryParams { for _, iv := range v { @@ -403,11 +408,18 @@ func (c *APIClient) prepareRequest( } // Encode the parameters. - url.RawQuery = queryParamSplit.ReplaceAllStringFunc(query.Encode(), func(s string) string { + encodedQuery := queryParamSplit.ReplaceAllStringFunc(query.Encode(), func(s string) string { pieces := strings.Split(s, "=") pieces[0] = queryDescape.Replace(pieces[0]) return strings.Join(pieces, "=") }) + if rawQueryString != "" { + if encodedQuery != "" { + encodedQuery += "&" + } + encodedQuery += rawQueryString + } + url.RawQuery = encodedQuery // Generate a new request if body != nil { From 78308cc435cd8b262a5576625d2330550ac128bc Mon Sep 17 00:00:00 2001 From: khayashi4337 Date: Tue, 22 Sep 2026 17:02:20 +0900 Subject: [PATCH 05/31] Add OpenAPI 3.2 support to Python client, harden Go method emission Python (urllib3 library only): - flag non-standard HTTP methods and querystring params after postProcessOperationsWithModels/WebhooksWithModels - emit non-standard methods via unescaped literals; append in: querystring values verbatim to the request path - bypass urllib3's request() for non-standard methods (it unconditionally uppercases); dispatch via request_encode_url/request_encode_body - fix double '?' when querystring path combines with serialized query params (e.g. apiKey-in-query auth) - validate additionalOperations keys as RFC 9110 tokens at codegen time; warn and skip invalid ones - asyncio(aiohttp)/httpx stay unsupported (they uppercase internally) and warn+skip 3.2 operations Go: same RFC 9110 token validation for verbatim method literals. Generated clients verified by request capture: QUERY/customMethod/ CHECK&FETCH sent verbatim, querystring preserved as written, standard GET unchanged. Generated with [Devin](https://devin.ai) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com> --- .../codegen/languages/GoClientCodegen.java | 14 +++- .../languages/PythonClientCodegen.java | 65 ++++++++++++++- .../src/main/resources/python/api.mustache | 24 ++++++ .../main/resources/python/api_client.mustache | 4 +- .../src/main/resources/python/rest.mustache | 48 ++++++++--- .../python/PythonClientCodegenTest.java | 80 +++++++++++++++++++ .../test/resources/3_2/query-operation.yaml | 5 ++ .../openapi_client/api_client.py | 4 +- .../openapi_client/rest.py | 48 ++++++++--- .../python/openapi_client/api_client.py | 4 +- .../echo_api/python/openapi_client/rest.py | 48 ++++++++--- .../legacy_model_dict_client/api_client.py | 4 +- .../legacy_model_dict_client/rest.py | 48 ++++++++--- .../python-aiohttp/petstore_api/api_client.py | 4 +- .../petstore_api/api_client.py | 4 +- .../python-httpx/petstore_api/api_client.py | 4 +- .../petstore_api/api_client.py | 4 +- .../python-lazyImports/petstore_api/rest.py | 48 ++++++++--- .../python/petstore_api/api_client.py | 4 +- .../petstore/python/petstore_api/rest.py | 48 ++++++++--- 20 files changed, 435 insertions(+), 77 deletions(-) diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/GoClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/GoClientCodegen.java index 4f51d55a75b4..b769d28869db 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/GoClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/GoClientCodegen.java @@ -723,11 +723,23 @@ private Map snapshotVerbatimHttpMethods(List operationList, Map verbatimMethods) { - for (CodegenOperation operation : operationList) { + for (Iterator it = operationList.iterator(); it.hasNext(); ) { + CodegenOperation operation = it.next(); String verbatim = verbatimMethods.get(operation); if (verbatim != null) { + if (!HTTP_TOKEN.matcher(verbatim).matches()) { + LOGGER.warn("HTTP method '{}' is not a valid RFC 9110 token; skipping operation {}", + verbatim, operation.operationId); + it.remove(); + continue; + } operation.httpMethod = verbatim; operation.vendorExtensions.put("x-go-http-method-literal", true); } diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PythonClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PythonClientCodegen.java index 27e6ab27ffab..52830b24ae60 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PythonClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PythonClientCodegen.java @@ -28,6 +28,7 @@ import org.openapitools.codegen.model.ModelMap; import org.openapitools.codegen.model.ModelsMap; import org.openapitools.codegen.model.OperationsMap; +import org.openapitools.codegen.model.WebhooksMap; import org.openapitools.codegen.utils.ModelUtils; import org.openapitools.codegen.utils.ProcessUtils; import org.slf4j.Logger; @@ -35,6 +36,7 @@ import java.io.File; import java.util.ArrayList; +import java.util.Arrays; import java.util.EnumSet; import java.util.HashMap; import java.util.HashSet; @@ -42,6 +44,7 @@ import java.util.Locale; import java.util.Map; import java.util.Set; +import java.util.regex.Pattern; import static org.openapitools.codegen.utils.ModelUtils.hasAnyOf; import static org.openapitools.codegen.utils.ModelUtils.hasOneOf; @@ -589,6 +592,30 @@ protected void addAdditionPropertiesToCodeGenModel(CodegenModel codegenModel, Sc } } + // HTTP methods emitted in the conventional 'GET' single-quoted style; + // OpenAPI 3.2 methods outside this set are emitted as unescaped + // double-quoted literals via x-python-http-method-literal so valid token + // punctuation (e.g. CHECK&FETCH) is not HTML-escaped by the template engine + private static final Set STANDARD_HTTP_METHODS = new HashSet<>(Arrays.asList( + "GET", "PUT", "POST", "DELETE", "HEAD", "OPTIONS", "TRACE", "PATCH", "CONNECT")); + + @Override + public boolean supportsAdditionalOperations() { + // the urllib3 rest client dispatches non-standard methods through + // urlopen(), preserving verbatim casing. aiohttp (asyncio library) + // and httpx unconditionally call method.upper() in their Request + // objects, which would corrupt e.g. 'customMethod' into + // 'CUSTOMMETHOD', so 3.2 operations are only enabled for urllib3 + return "urllib3".equals(getLibrary()); + } + + @Override + protected boolean supportsQueryStringParameters() { + // the raw, already-encoded query string is appended to the request + // path verbatim by the api template + return true; + } + @Override public OperationsMap postProcessOperationsWithModels( OperationsMap objs, List allModels) { @@ -596,7 +623,43 @@ public OperationsMap postProcessOperationsWithModels( renameIndependentClientOperationMembers( objs.getOperations().getOperation()); } - return super.postProcessOperationsWithModels(objs, allModels); + OperationsMap result = super.postProcessOperationsWithModels(objs, allModels); + flagOpenAPI32Operations(result.getOperations().getOperation()); + return result; + } + + @Override + public WebhooksMap postProcessWebhooksWithModels(WebhooksMap objs, List allModels) { + // webhooks render through api.mustache as well, so their non-standard + // methods and querystring parameters need the same flags + objs = super.postProcessWebhooksWithModels(objs, allModels); + flagOpenAPI32Operations(objs.getWebhooks().getOperation()); + return objs; + } + + // RFC 9110 tchar — additionalOperations keys must match this to be + // emitted as a Python string literal + private static final Pattern HTTP_TOKEN = Pattern.compile("[!#$%&'*+\\-.^_`|~0-9A-Za-z]+"); + + private void flagOpenAPI32Operations(List operations) { + for (java.util.Iterator it = operations.iterator(); it.hasNext(); ) { + CodegenOperation op = it.next(); + if (op.httpMethod != null && !STANDARD_HTTP_METHODS.contains(op.httpMethod)) { + if (!HTTP_TOKEN.matcher(op.httpMethod).matches()) { + LOGGER.warn("HTTP method '{}' is not a valid RFC 9110 token; skipping operation {}", + op.httpMethod, op.operationId); + it.remove(); + continue; + } + op.vendorExtensions.put("x-python-http-method-literal", true); + } + for (CodegenParameter cp : op.allParams) { + if (cp.isQueryStringParam) { + op.vendorExtensions.put("x-python-has-querystring-param", true); + break; + } + } + } } private void renameIndependentClientOperationMembers( diff --git a/modules/openapi-generator/src/main/resources/python/api.mustache b/modules/openapi-generator/src/main/resources/python/api.mustache index 514be3b69a85..44904a3d7e84 100644 --- a/modules/openapi-generator/src/main/resources/python/api.mustache +++ b/modules/openapi-generator/src/main/resources/python/api.mustache @@ -319,6 +319,7 @@ https://github.com/OpenAPITools/openapi-generator/blob/c84b949df1a9ec04ba75989cb {{/pathParams}} # process the query parameters {{#queryParams}} +{{^isQueryStringParam}} if {{paramName}} is not None: {{#isDateTime}} if isinstance({{paramName}}, datetime): @@ -349,6 +350,7 @@ https://github.com/OpenAPITools/openapi-generator/blob/c84b949df1a9ec04ba75989cb {{^isDateTime}}{{^isDate}} _query_params.append(('{{baseName}}', {{paramName}}{{#isEnumRef}}.value{{/isEnumRef}})) {{/isDate}}{{/isDateTime}} +{{/isQueryStringParam}} {{/queryParams}} # process the header parameters {{#headerParams}} @@ -426,9 +428,31 @@ https://github.com/OpenAPITools/openapi-generator/blob/c84b949df1a9ec04ba75989cb '{{name}}'{{^-last}}, {{/-last}}{{/authMethods}} ] +{{#vendorExtensions.x-python-has-querystring-param}} + _resource_path = '{{{path}}}' +{{#queryParams}} +{{#isQueryStringParam}} + # OpenAPI 3.2 in: querystring - the value is the whole, already-encoded + # query string; append it verbatim instead of a name=value pair. + # Note: urllib3 may normalize percent-escape hex casing on the wire. + if {{paramName}} is not None: + _resource_path += ('&' if '?' in _resource_path else '?') + {{paramName}} +{{/isQueryStringParam}} +{{/queryParams}} +{{/vendorExtensions.x-python-has-querystring-param}} return self.api_client.param_serialize( + {{#vendorExtensions.x-python-http-method-literal}} + method="{{{httpMethod}}}",{{! OpenAPI 3.2: non-standard method sent verbatim, unescaped }} + {{/vendorExtensions.x-python-http-method-literal}} + {{^vendorExtensions.x-python-http-method-literal}} method='{{httpMethod}}', + {{/vendorExtensions.x-python-http-method-literal}} + {{#vendorExtensions.x-python-has-querystring-param}} + resource_path=_resource_path, + {{/vendorExtensions.x-python-has-querystring-param}} + {{^vendorExtensions.x-python-has-querystring-param}} resource_path='{{{path}}}', + {{/vendorExtensions.x-python-has-querystring-param}} path_params=_path_params, query_params=_query_params, header_params=_header_params, diff --git a/modules/openapi-generator/src/main/resources/python/api_client.mustache b/modules/openapi-generator/src/main/resources/python/api_client.mustache index 874d9cd3efef..7d2f41f93028 100644 --- a/modules/openapi-generator/src/main/resources/python/api_client.mustache +++ b/modules/openapi-generator/src/main/resources/python/api_client.mustache @@ -385,7 +385,9 @@ https://github.com/OpenAPITools/openapi-generator/blob/c84b949df1a9ec04ba75989cb query_params, collection_formats ) - url += "?" + url_query + # OpenAPI 3.2 in: querystring may already have put a '?' in the + # path (e.g. combined with apiKey-in-query auth params) + url += ("&" if "?" in url else "?") + url_query return method, url, header_params, body, post_params diff --git a/modules/openapi-generator/src/main/resources/python/rest.mustache b/modules/openapi-generator/src/main/resources/python/rest.mustache index 5f56a2d60b32..0dde824d1d75 100644 --- a/modules/openapi-generator/src/main/resources/python/rest.mustache +++ b/modules/openapi-generator/src/main/resources/python/rest.mustache @@ -172,6 +172,23 @@ class RESTClientObject: self.pool_manager.clear() {{/useIndependentImplicitClients}} + # urllib3's RequestMethods.request() unconditionally calls method.upper(), + # which would corrupt OpenAPI 3.2 method names (e.g. 'customMethod'). + # Dispatch non-standard methods through the encode helpers directly, + # exactly as request() does after its upper() call. Relies on urllib3 + # 2.x internals (_encode_url_methods); the generated client pins + # urllib3 >= 2.7.0, < 3.0.0. + _STANDARD_METHODS = frozenset([ + 'GET', 'HEAD', 'DELETE', 'POST', 'PUT', 'PATCH', 'OPTIONS' + ]) + + def _pool_request(self, method, url, **kwargs): + if method.upper() in self._STANDARD_METHODS: + return self.pool_manager.request(method, url, **kwargs) + if method in self.pool_manager._encode_url_methods: + return self.pool_manager.request_encode_url(method, url, **kwargs) + return self.pool_manager.request_encode_body(method, url, **kwargs) + def request( self, method, @@ -195,8 +212,13 @@ class RESTClientObject: timeout. It can also be a pair (tuple) of (connection, read) timeouts. """ - method = method.upper() - assert method in [ + # OpenAPI 3.2 allows arbitrary HTTP method names (query operations, + # additionalOperations keys). Keep the historic upper()+whitelist for + # the standard set; anything else is validated as an HTTP token + # (RFC 9110 tchar) and sent verbatim so casing like 'customMethod' + # survives + _upper_method = method.upper() + if _upper_method in [ 'GET', 'HEAD', 'DELETE', @@ -204,7 +226,10 @@ class RESTClientObject: 'PUT', 'PATCH', 'OPTIONS' - ] + ]: + method = _upper_method + else: + assert re.fullmatch(r"[!#$%&'*+\-.^_`|~0-9A-Za-z]+", method) is not None if post_params and body: raise ApiValueError( @@ -228,8 +253,9 @@ class RESTClientObject: ) try: - # For `POST`, `PUT`, `PATCH`, `OPTIONS`, `DELETE` - if method in ['POST', 'PUT', 'PATCH', 'OPTIONS', 'DELETE']: + # For `POST`, `PUT`, `PATCH`, `OPTIONS`, `DELETE` - or any + # OpenAPI 3.2 method that actually carries a body/form data + if method in ['POST', 'PUT', 'PATCH', 'OPTIONS', 'DELETE'] or body is not None or post_params: content_type = headers.get('Content-Type') is_json = ( @@ -252,7 +278,7 @@ class RESTClientObject: request_body = None if body is not None: request_body = json.dumps(body{{#setEnsureAsciiToFalse}}, ensure_ascii=False{{/setEnsureAsciiToFalse}}) - r = self.pool_manager.request( + r = self._pool_request( method, url, body=request_body, @@ -261,7 +287,7 @@ class RESTClientObject: preload_content=False ) elif contenttype_matches(content_type, 'application', 'x-www-form-urlencoded'): - r = self.pool_manager.request( + r = self._pool_request( method, url, fields=post_params, @@ -277,7 +303,7 @@ class RESTClientObject: del headers['Content-Type'] # Ensures that dict objects are serialized post_params = [(a, json.dumps(b)) if isinstance(b, dict) else (a,b) for a, b in post_params] - r = self.pool_manager.request( + r = self._pool_request( method, url, fields=post_params, @@ -290,7 +316,7 @@ class RESTClientObject: # other content types than JSON when `body` argument is # provided in serialized form. elif isinstance(body, str) or isinstance(body, bytes): - r = self.pool_manager.request( + r = self._pool_request( method, url, body=body, @@ -300,7 +326,7 @@ class RESTClientObject: ) elif content_type.startswith('text/') and isinstance(body, bool): request_body = "true" if body else "false" - r = self.pool_manager.request( + r = self._pool_request( method, url, body=request_body, @@ -315,7 +341,7 @@ class RESTClientObject: raise ApiException(status=0, reason=msg) # For `GET`, `HEAD` else: - r = self.pool_manager.request( + r = self._pool_request( method, url, fields={}, diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/python/PythonClientCodegenTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/python/PythonClientCodegenTest.java index 9787717eb07f..027adb1fbe04 100644 --- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/python/PythonClientCodegenTest.java +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/python/PythonClientCodegenTest.java @@ -1533,4 +1533,84 @@ public void testIndependentImplicitClientsPreserveDefaultsWhenDisabled() throws "def close(self) -> None:"); TestUtils.assertFileNotContains(rest, "def close(self) -> None:"); } + + @Test(description = "OpenAPI 3.2 query/additionalOperations and in:querystring generate working Python code") + public void testOpenAPI32QueryAndAdditionalOperations() throws IOException { + File output = Files.createTempDirectory("test").toFile(); + output.deleteOnExit(); + + final CodegenConfigurator configurator = new CodegenConfigurator() + .setGeneratorName("python") + .setInputSpec("src/test/resources/3_2/query-operation.yaml") + .setOutputDir(output.getAbsolutePath().replace("\\", "/")); + + DefaultGenerator generator = new DefaultGenerator(); + List files = generator.opts(configurator.toClientOptInput()).generate(); + files.forEach(File::deleteOnExit); + + Path apiFile = Paths.get(output + "/openapi_client/api/default_api.py"); + // non-standard methods are emitted as unescaped double-quoted literals; + // '...' single-quoted escaping would corrupt CHECK&FETCH to & + assertFileContains(apiFile, + "method=\"QUERY\"", + "method=\"PURGE\"", + // additionalOperations keys are sent verbatim - no case folding + "method=\"customMethod\"", + // valid HTTP token punctuation must not be HTML-escaped + "method=\"CHECK&FETCH\""); + TestUtils.assertFileNotContains(apiFile, "&"); + // in:querystring appends the raw, already-encoded value to the path + assertFileContains(apiFile, + "_resource_path += ('&' if '?' in _resource_path else '?') + qs"); + + Path restFile = Paths.get(output + "/openapi_client/rest.py"); + // urllib3's request() uppercases method; non-standard methods must be + // dispatched through the encode helpers to keep verbatim casing + assertFileContains(restFile, "_pool_request", "request_encode_body"); + } + + @Test(description = "OpenAPI 3.2 query/additionalOperations in webhooks also emit verbatim method literals") + public void testOpenAPI32WebhookOperations() throws IOException { + File output = Files.createTempDirectory("test").toFile(); + output.deleteOnExit(); + + final CodegenConfigurator configurator = new CodegenConfigurator() + .setGeneratorName("python") + .setInputSpec("src/test/resources/3_2/go-webhook-operations.yaml") + .setOutputDir(output.getAbsolutePath().replace("\\", "/")); + + DefaultGenerator generator = new DefaultGenerator(); + List files = generator.opts(configurator.toClientOptInput()).generate(); + files.forEach(File::deleteOnExit); + + Path apiFile = Paths.get(output + "/openapi_client/api/default_api.py"); + assertFileContains(apiFile, + "method=\"QUERY\"", + "method=\"customMethod\""); + } + + @Test(description = "non-urllib3 python libraries cannot preserve method casing and must skip 3.2 operations") + public void testOpenAPI32UnsupportedLibrarySkips() throws IOException { + File output = Files.createTempDirectory("test").toFile(); + output.deleteOnExit(); + + final CodegenConfigurator configurator = new CodegenConfigurator() + .setGeneratorName("python") + .setLibrary("asyncio") + .setInputSpec("src/test/resources/3_2/query-operation.yaml") + .setOutputDir(output.getAbsolutePath().replace("\\", "/")); + + DefaultGenerator generator = new DefaultGenerator(); + List files = generator.opts(configurator.toClientOptInput()).generate(); + files.forEach(File::deleteOnExit); + + // aiohttp uppercases method names internally, so QUERY/customMethod + // cannot be sent verbatim - the ops must be omitted, not broken, + // while the ordinary GET operation still generates + Path apiFile = Paths.get(output + "/openapi_client/api/default_api.py"); + assertFileContains(apiFile, "def list_pets"); + TestUtils.assertFileNotContains(apiFile, "query_pets"); + TestUtils.assertFileNotContains(apiFile, "purge_pets"); + TestUtils.assertFileNotContains(apiFile, "custom_pets"); + } } diff --git a/modules/openapi-generator/src/test/resources/3_2/query-operation.yaml b/modules/openapi-generator/src/test/resources/3_2/query-operation.yaml index be5d63f84ab6..def88f6699cb 100644 --- a/modules/openapi-generator/src/test/resources/3_2/query-operation.yaml +++ b/modules/openapi-generator/src/test/resources/3_2/query-operation.yaml @@ -4,6 +4,11 @@ info: version: '1.0' paths: /pets: + get: + operationId: listPets + responses: + '200': + description: ok query: operationId: queryPets parameters: diff --git a/samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent/openapi_client/api_client.py b/samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent/openapi_client/api_client.py index 17c439964cee..8f16bbd3ee7b 100644 --- a/samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent/openapi_client/api_client.py +++ b/samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent/openapi_client/api_client.py @@ -244,7 +244,9 @@ def param_serialize( query_params, collection_formats ) - url += "?" + url_query + # OpenAPI 3.2 in: querystring may already have put a '?' in the + # path (e.g. combined with apiKey-in-query auth params) + url += ("&" if "?" in url else "?") + url_query return method, url, header_params, body, post_params diff --git a/samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent/openapi_client/rest.py b/samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent/openapi_client/rest.py index 9a0c6d4de785..d2a8a05eec8e 100644 --- a/samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent/openapi_client/rest.py +++ b/samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent/openapi_client/rest.py @@ -177,6 +177,23 @@ def __init__(self, configuration) -> None: else: self.pool_manager = urllib3.PoolManager(**pool_args) + # urllib3's RequestMethods.request() unconditionally calls method.upper(), + # which would corrupt OpenAPI 3.2 method names (e.g. 'customMethod'). + # Dispatch non-standard methods through the encode helpers directly, + # exactly as request() does after its upper() call. Relies on urllib3 + # 2.x internals (_encode_url_methods); the generated client pins + # urllib3 >= 2.7.0, < 3.0.0. + _STANDARD_METHODS = frozenset([ + 'GET', 'HEAD', 'DELETE', 'POST', 'PUT', 'PATCH', 'OPTIONS' + ]) + + def _pool_request(self, method, url, **kwargs): + if method.upper() in self._STANDARD_METHODS: + return self.pool_manager.request(method, url, **kwargs) + if method in self.pool_manager._encode_url_methods: + return self.pool_manager.request_encode_url(method, url, **kwargs) + return self.pool_manager.request_encode_body(method, url, **kwargs) + def request( self, method, @@ -200,8 +217,13 @@ def request( timeout. It can also be a pair (tuple) of (connection, read) timeouts. """ - method = method.upper() - assert method in [ + # OpenAPI 3.2 allows arbitrary HTTP method names (query operations, + # additionalOperations keys). Keep the historic upper()+whitelist for + # the standard set; anything else is validated as an HTTP token + # (RFC 9110 tchar) and sent verbatim so casing like 'customMethod' + # survives + _upper_method = method.upper() + if _upper_method in [ 'GET', 'HEAD', 'DELETE', @@ -209,7 +231,10 @@ def request( 'PUT', 'PATCH', 'OPTIONS' - ] + ]: + method = _upper_method + else: + assert re.fullmatch(r"[!#$%&'*+\-.^_`|~0-9A-Za-z]+", method) is not None if post_params and body: raise ApiValueError( @@ -233,8 +258,9 @@ def request( ) try: - # For `POST`, `PUT`, `PATCH`, `OPTIONS`, `DELETE` - if method in ['POST', 'PUT', 'PATCH', 'OPTIONS', 'DELETE']: + # For `POST`, `PUT`, `PATCH`, `OPTIONS`, `DELETE` - or any + # OpenAPI 3.2 method that actually carries a body/form data + if method in ['POST', 'PUT', 'PATCH', 'OPTIONS', 'DELETE'] or body is not None or post_params: content_type = headers.get('Content-Type') is_json = ( @@ -257,7 +283,7 @@ def request( request_body = None if body is not None: request_body = json.dumps(body, ensure_ascii=False) - r = self.pool_manager.request( + r = self._pool_request( method, url, body=request_body, @@ -266,7 +292,7 @@ def request( preload_content=False ) elif contenttype_matches(content_type, 'application', 'x-www-form-urlencoded'): - r = self.pool_manager.request( + r = self._pool_request( method, url, fields=post_params, @@ -282,7 +308,7 @@ def request( del headers['Content-Type'] # Ensures that dict objects are serialized post_params = [(a, json.dumps(b)) if isinstance(b, dict) else (a,b) for a, b in post_params] - r = self.pool_manager.request( + r = self._pool_request( method, url, fields=post_params, @@ -295,7 +321,7 @@ def request( # other content types than JSON when `body` argument is # provided in serialized form. elif isinstance(body, str) or isinstance(body, bytes): - r = self.pool_manager.request( + r = self._pool_request( method, url, body=body, @@ -305,7 +331,7 @@ def request( ) elif content_type.startswith('text/') and isinstance(body, bool): request_body = "true" if body else "false" - r = self.pool_manager.request( + r = self._pool_request( method, url, body=request_body, @@ -320,7 +346,7 @@ def request( raise ApiException(status=0, reason=msg) # For `GET`, `HEAD` else: - r = self.pool_manager.request( + r = self._pool_request( method, url, fields={}, diff --git a/samples/client/echo_api/python/openapi_client/api_client.py b/samples/client/echo_api/python/openapi_client/api_client.py index 17c439964cee..8f16bbd3ee7b 100644 --- a/samples/client/echo_api/python/openapi_client/api_client.py +++ b/samples/client/echo_api/python/openapi_client/api_client.py @@ -244,7 +244,9 @@ def param_serialize( query_params, collection_formats ) - url += "?" + url_query + # OpenAPI 3.2 in: querystring may already have put a '?' in the + # path (e.g. combined with apiKey-in-query auth params) + url += ("&" if "?" in url else "?") + url_query return method, url, header_params, body, post_params diff --git a/samples/client/echo_api/python/openapi_client/rest.py b/samples/client/echo_api/python/openapi_client/rest.py index 77b4fe56053a..b01746eae8ba 100644 --- a/samples/client/echo_api/python/openapi_client/rest.py +++ b/samples/client/echo_api/python/openapi_client/rest.py @@ -177,6 +177,23 @@ def __init__(self, configuration) -> None: else: self.pool_manager = urllib3.PoolManager(**pool_args) + # urllib3's RequestMethods.request() unconditionally calls method.upper(), + # which would corrupt OpenAPI 3.2 method names (e.g. 'customMethod'). + # Dispatch non-standard methods through the encode helpers directly, + # exactly as request() does after its upper() call. Relies on urllib3 + # 2.x internals (_encode_url_methods); the generated client pins + # urllib3 >= 2.7.0, < 3.0.0. + _STANDARD_METHODS = frozenset([ + 'GET', 'HEAD', 'DELETE', 'POST', 'PUT', 'PATCH', 'OPTIONS' + ]) + + def _pool_request(self, method, url, **kwargs): + if method.upper() in self._STANDARD_METHODS: + return self.pool_manager.request(method, url, **kwargs) + if method in self.pool_manager._encode_url_methods: + return self.pool_manager.request_encode_url(method, url, **kwargs) + return self.pool_manager.request_encode_body(method, url, **kwargs) + def request( self, method, @@ -200,8 +217,13 @@ def request( timeout. It can also be a pair (tuple) of (connection, read) timeouts. """ - method = method.upper() - assert method in [ + # OpenAPI 3.2 allows arbitrary HTTP method names (query operations, + # additionalOperations keys). Keep the historic upper()+whitelist for + # the standard set; anything else is validated as an HTTP token + # (RFC 9110 tchar) and sent verbatim so casing like 'customMethod' + # survives + _upper_method = method.upper() + if _upper_method in [ 'GET', 'HEAD', 'DELETE', @@ -209,7 +231,10 @@ def request( 'PUT', 'PATCH', 'OPTIONS' - ] + ]: + method = _upper_method + else: + assert re.fullmatch(r"[!#$%&'*+\-.^_`|~0-9A-Za-z]+", method) is not None if post_params and body: raise ApiValueError( @@ -233,8 +258,9 @@ def request( ) try: - # For `POST`, `PUT`, `PATCH`, `OPTIONS`, `DELETE` - if method in ['POST', 'PUT', 'PATCH', 'OPTIONS', 'DELETE']: + # For `POST`, `PUT`, `PATCH`, `OPTIONS`, `DELETE` - or any + # OpenAPI 3.2 method that actually carries a body/form data + if method in ['POST', 'PUT', 'PATCH', 'OPTIONS', 'DELETE'] or body is not None or post_params: content_type = headers.get('Content-Type') is_json = ( @@ -257,7 +283,7 @@ def request( request_body = None if body is not None: request_body = json.dumps(body) - r = self.pool_manager.request( + r = self._pool_request( method, url, body=request_body, @@ -266,7 +292,7 @@ def request( preload_content=False ) elif contenttype_matches(content_type, 'application', 'x-www-form-urlencoded'): - r = self.pool_manager.request( + r = self._pool_request( method, url, fields=post_params, @@ -282,7 +308,7 @@ def request( del headers['Content-Type'] # Ensures that dict objects are serialized post_params = [(a, json.dumps(b)) if isinstance(b, dict) else (a,b) for a, b in post_params] - r = self.pool_manager.request( + r = self._pool_request( method, url, fields=post_params, @@ -295,7 +321,7 @@ def request( # other content types than JSON when `body` argument is # provided in serialized form. elif isinstance(body, str) or isinstance(body, bytes): - r = self.pool_manager.request( + r = self._pool_request( method, url, body=body, @@ -305,7 +331,7 @@ def request( ) elif content_type.startswith('text/') and isinstance(body, bool): request_body = "true" if body else "false" - r = self.pool_manager.request( + r = self._pool_request( method, url, body=request_body, @@ -320,7 +346,7 @@ def request( raise ApiException(status=0, reason=msg) # For `GET`, `HEAD` else: - r = self.pool_manager.request( + r = self._pool_request( method, url, fields={}, diff --git a/samples/client/others/python-legacy-model-dictionaries/legacy_model_dict_client/api_client.py b/samples/client/others/python-legacy-model-dictionaries/legacy_model_dict_client/api_client.py index baab728d4dd5..942047bbc559 100644 --- a/samples/client/others/python-legacy-model-dictionaries/legacy_model_dict_client/api_client.py +++ b/samples/client/others/python-legacy-model-dictionaries/legacy_model_dict_client/api_client.py @@ -348,7 +348,9 @@ def param_serialize( query_params, collection_formats ) - url += "?" + url_query + # OpenAPI 3.2 in: querystring may already have put a '?' in the + # path (e.g. combined with apiKey-in-query auth params) + url += ("&" if "?" in url else "?") + url_query return method, url, header_params, body, post_params diff --git a/samples/client/others/python-legacy-model-dictionaries/legacy_model_dict_client/rest.py b/samples/client/others/python-legacy-model-dictionaries/legacy_model_dict_client/rest.py index c6da043e386b..4970490415b2 100644 --- a/samples/client/others/python-legacy-model-dictionaries/legacy_model_dict_client/rest.py +++ b/samples/client/others/python-legacy-model-dictionaries/legacy_model_dict_client/rest.py @@ -176,6 +176,23 @@ def __init__(self, configuration) -> None: else: self.pool_manager = urllib3.PoolManager(**pool_args) + # urllib3's RequestMethods.request() unconditionally calls method.upper(), + # which would corrupt OpenAPI 3.2 method names (e.g. 'customMethod'). + # Dispatch non-standard methods through the encode helpers directly, + # exactly as request() does after its upper() call. Relies on urllib3 + # 2.x internals (_encode_url_methods); the generated client pins + # urllib3 >= 2.7.0, < 3.0.0. + _STANDARD_METHODS = frozenset([ + 'GET', 'HEAD', 'DELETE', 'POST', 'PUT', 'PATCH', 'OPTIONS' + ]) + + def _pool_request(self, method, url, **kwargs): + if method.upper() in self._STANDARD_METHODS: + return self.pool_manager.request(method, url, **kwargs) + if method in self.pool_manager._encode_url_methods: + return self.pool_manager.request_encode_url(method, url, **kwargs) + return self.pool_manager.request_encode_body(method, url, **kwargs) + def request( self, method, @@ -199,8 +216,13 @@ def request( timeout. It can also be a pair (tuple) of (connection, read) timeouts. """ - method = method.upper() - assert method in [ + # OpenAPI 3.2 allows arbitrary HTTP method names (query operations, + # additionalOperations keys). Keep the historic upper()+whitelist for + # the standard set; anything else is validated as an HTTP token + # (RFC 9110 tchar) and sent verbatim so casing like 'customMethod' + # survives + _upper_method = method.upper() + if _upper_method in [ 'GET', 'HEAD', 'DELETE', @@ -208,7 +230,10 @@ def request( 'PUT', 'PATCH', 'OPTIONS' - ] + ]: + method = _upper_method + else: + assert re.fullmatch(r"[!#$%&'*+\-.^_`|~0-9A-Za-z]+", method) is not None if post_params and body: raise ApiValueError( @@ -232,8 +257,9 @@ def request( ) try: - # For `POST`, `PUT`, `PATCH`, `OPTIONS`, `DELETE` - if method in ['POST', 'PUT', 'PATCH', 'OPTIONS', 'DELETE']: + # For `POST`, `PUT`, `PATCH`, `OPTIONS`, `DELETE` - or any + # OpenAPI 3.2 method that actually carries a body/form data + if method in ['POST', 'PUT', 'PATCH', 'OPTIONS', 'DELETE'] or body is not None or post_params: content_type = headers.get('Content-Type') is_json = ( @@ -256,7 +282,7 @@ def request( request_body = None if body is not None: request_body = json.dumps(body) - r = self.pool_manager.request( + r = self._pool_request( method, url, body=request_body, @@ -265,7 +291,7 @@ def request( preload_content=False ) elif contenttype_matches(content_type, 'application', 'x-www-form-urlencoded'): - r = self.pool_manager.request( + r = self._pool_request( method, url, fields=post_params, @@ -281,7 +307,7 @@ def request( del headers['Content-Type'] # Ensures that dict objects are serialized post_params = [(a, json.dumps(b)) if isinstance(b, dict) else (a,b) for a, b in post_params] - r = self.pool_manager.request( + r = self._pool_request( method, url, fields=post_params, @@ -294,7 +320,7 @@ def request( # other content types than JSON when `body` argument is # provided in serialized form. elif isinstance(body, str) or isinstance(body, bytes): - r = self.pool_manager.request( + r = self._pool_request( method, url, body=body, @@ -304,7 +330,7 @@ def request( ) elif content_type.startswith('text/') and isinstance(body, bool): request_body = "true" if body else "false" - r = self.pool_manager.request( + r = self._pool_request( method, url, body=request_body, @@ -319,7 +345,7 @@ def request( raise ApiException(status=0, reason=msg) # For `GET`, `HEAD` else: - r = self.pool_manager.request( + r = self._pool_request( method, url, fields={}, diff --git a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/api_client.py b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/api_client.py index 49b32fc8edd6..bf8049ba6a77 100644 --- a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/api_client.py +++ b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/api_client.py @@ -243,7 +243,9 @@ def param_serialize( query_params, collection_formats ) - url += "?" + url_query + # OpenAPI 3.2 in: querystring may already have put a '?' in the + # path (e.g. combined with apiKey-in-query auth params) + url += ("&" if "?" in url else "?") + url_query return method, url, header_params, body, post_params diff --git a/samples/openapi3/client/petstore/python-httpx-sync/petstore_api/api_client.py b/samples/openapi3/client/petstore/python-httpx-sync/petstore_api/api_client.py index b7eb3a9170cb..ba467e1f9771 100644 --- a/samples/openapi3/client/petstore/python-httpx-sync/petstore_api/api_client.py +++ b/samples/openapi3/client/petstore/python-httpx-sync/petstore_api/api_client.py @@ -246,7 +246,9 @@ def param_serialize( query_params, collection_formats ) - url += "?" + url_query + # OpenAPI 3.2 in: querystring may already have put a '?' in the + # path (e.g. combined with apiKey-in-query auth params) + url += ("&" if "?" in url else "?") + url_query return method, url, header_params, body, post_params diff --git a/samples/openapi3/client/petstore/python-httpx/petstore_api/api_client.py b/samples/openapi3/client/petstore/python-httpx/petstore_api/api_client.py index b7eb3a9170cb..ba467e1f9771 100644 --- a/samples/openapi3/client/petstore/python-httpx/petstore_api/api_client.py +++ b/samples/openapi3/client/petstore/python-httpx/petstore_api/api_client.py @@ -246,7 +246,9 @@ def param_serialize( query_params, collection_formats ) - url += "?" + url_query + # OpenAPI 3.2 in: querystring may already have put a '?' in the + # path (e.g. combined with apiKey-in-query auth params) + url += ("&" if "?" in url else "?") + url_query return method, url, header_params, body, post_params diff --git a/samples/openapi3/client/petstore/python-lazyImports/petstore_api/api_client.py b/samples/openapi3/client/petstore/python-lazyImports/petstore_api/api_client.py index 8dcae18708cf..de8a64e77d82 100644 --- a/samples/openapi3/client/petstore/python-lazyImports/petstore_api/api_client.py +++ b/samples/openapi3/client/petstore/python-lazyImports/petstore_api/api_client.py @@ -243,7 +243,9 @@ def param_serialize( query_params, collection_formats ) - url += "?" + url_query + # OpenAPI 3.2 in: querystring may already have put a '?' in the + # path (e.g. combined with apiKey-in-query auth params) + url += ("&" if "?" in url else "?") + url_query return method, url, header_params, body, post_params diff --git a/samples/openapi3/client/petstore/python-lazyImports/petstore_api/rest.py b/samples/openapi3/client/petstore/python-lazyImports/petstore_api/rest.py index 8affe12ad0a2..a7c5138db987 100644 --- a/samples/openapi3/client/petstore/python-lazyImports/petstore_api/rest.py +++ b/samples/openapi3/client/petstore/python-lazyImports/petstore_api/rest.py @@ -179,6 +179,23 @@ def __init__(self, configuration) -> None: def close(self) -> None: self.pool_manager.clear() + # urllib3's RequestMethods.request() unconditionally calls method.upper(), + # which would corrupt OpenAPI 3.2 method names (e.g. 'customMethod'). + # Dispatch non-standard methods through the encode helpers directly, + # exactly as request() does after its upper() call. Relies on urllib3 + # 2.x internals (_encode_url_methods); the generated client pins + # urllib3 >= 2.7.0, < 3.0.0. + _STANDARD_METHODS = frozenset([ + 'GET', 'HEAD', 'DELETE', 'POST', 'PUT', 'PATCH', 'OPTIONS' + ]) + + def _pool_request(self, method, url, **kwargs): + if method.upper() in self._STANDARD_METHODS: + return self.pool_manager.request(method, url, **kwargs) + if method in self.pool_manager._encode_url_methods: + return self.pool_manager.request_encode_url(method, url, **kwargs) + return self.pool_manager.request_encode_body(method, url, **kwargs) + def request( self, method, @@ -202,8 +219,13 @@ def request( timeout. It can also be a pair (tuple) of (connection, read) timeouts. """ - method = method.upper() - assert method in [ + # OpenAPI 3.2 allows arbitrary HTTP method names (query operations, + # additionalOperations keys). Keep the historic upper()+whitelist for + # the standard set; anything else is validated as an HTTP token + # (RFC 9110 tchar) and sent verbatim so casing like 'customMethod' + # survives + _upper_method = method.upper() + if _upper_method in [ 'GET', 'HEAD', 'DELETE', @@ -211,7 +233,10 @@ def request( 'PUT', 'PATCH', 'OPTIONS' - ] + ]: + method = _upper_method + else: + assert re.fullmatch(r"[!#$%&'*+\-.^_`|~0-9A-Za-z]+", method) is not None if post_params and body: raise ApiValueError( @@ -235,8 +260,9 @@ def request( ) try: - # For `POST`, `PUT`, `PATCH`, `OPTIONS`, `DELETE` - if method in ['POST', 'PUT', 'PATCH', 'OPTIONS', 'DELETE']: + # For `POST`, `PUT`, `PATCH`, `OPTIONS`, `DELETE` - or any + # OpenAPI 3.2 method that actually carries a body/form data + if method in ['POST', 'PUT', 'PATCH', 'OPTIONS', 'DELETE'] or body is not None or post_params: content_type = headers.get('Content-Type') is_json = ( @@ -259,7 +285,7 @@ def request( request_body = None if body is not None: request_body = json.dumps(body) - r = self.pool_manager.request( + r = self._pool_request( method, url, body=request_body, @@ -268,7 +294,7 @@ def request( preload_content=False ) elif contenttype_matches(content_type, 'application', 'x-www-form-urlencoded'): - r = self.pool_manager.request( + r = self._pool_request( method, url, fields=post_params, @@ -284,7 +310,7 @@ def request( del headers['Content-Type'] # Ensures that dict objects are serialized post_params = [(a, json.dumps(b)) if isinstance(b, dict) else (a,b) for a, b in post_params] - r = self.pool_manager.request( + r = self._pool_request( method, url, fields=post_params, @@ -297,7 +323,7 @@ def request( # other content types than JSON when `body` argument is # provided in serialized form. elif isinstance(body, str) or isinstance(body, bytes): - r = self.pool_manager.request( + r = self._pool_request( method, url, body=body, @@ -307,7 +333,7 @@ def request( ) elif content_type.startswith('text/') and isinstance(body, bool): request_body = "true" if body else "false" - r = self.pool_manager.request( + r = self._pool_request( method, url, body=request_body, @@ -322,7 +348,7 @@ def request( raise ApiException(status=0, reason=msg) # For `GET`, `HEAD` else: - r = self.pool_manager.request( + r = self._pool_request( method, url, fields={}, diff --git a/samples/openapi3/client/petstore/python/petstore_api/api_client.py b/samples/openapi3/client/petstore/python/petstore_api/api_client.py index 899983e443d6..919e34910c81 100755 --- a/samples/openapi3/client/petstore/python/petstore_api/api_client.py +++ b/samples/openapi3/client/petstore/python/petstore_api/api_client.py @@ -243,7 +243,9 @@ def param_serialize( query_params, collection_formats ) - url += "?" + url_query + # OpenAPI 3.2 in: querystring may already have put a '?' in the + # path (e.g. combined with apiKey-in-query auth params) + url += ("&" if "?" in url else "?") + url_query return method, url, header_params, body, post_params diff --git a/samples/openapi3/client/petstore/python/petstore_api/rest.py b/samples/openapi3/client/petstore/python/petstore_api/rest.py index a265bee3515c..eb7c6d863e4d 100755 --- a/samples/openapi3/client/petstore/python/petstore_api/rest.py +++ b/samples/openapi3/client/petstore/python/petstore_api/rest.py @@ -176,6 +176,23 @@ def __init__(self, configuration) -> None: else: self.pool_manager = urllib3.PoolManager(**pool_args) + # urllib3's RequestMethods.request() unconditionally calls method.upper(), + # which would corrupt OpenAPI 3.2 method names (e.g. 'customMethod'). + # Dispatch non-standard methods through the encode helpers directly, + # exactly as request() does after its upper() call. Relies on urllib3 + # 2.x internals (_encode_url_methods); the generated client pins + # urllib3 >= 2.7.0, < 3.0.0. + _STANDARD_METHODS = frozenset([ + 'GET', 'HEAD', 'DELETE', 'POST', 'PUT', 'PATCH', 'OPTIONS' + ]) + + def _pool_request(self, method, url, **kwargs): + if method.upper() in self._STANDARD_METHODS: + return self.pool_manager.request(method, url, **kwargs) + if method in self.pool_manager._encode_url_methods: + return self.pool_manager.request_encode_url(method, url, **kwargs) + return self.pool_manager.request_encode_body(method, url, **kwargs) + def request( self, method, @@ -199,8 +216,13 @@ def request( timeout. It can also be a pair (tuple) of (connection, read) timeouts. """ - method = method.upper() - assert method in [ + # OpenAPI 3.2 allows arbitrary HTTP method names (query operations, + # additionalOperations keys). Keep the historic upper()+whitelist for + # the standard set; anything else is validated as an HTTP token + # (RFC 9110 tchar) and sent verbatim so casing like 'customMethod' + # survives + _upper_method = method.upper() + if _upper_method in [ 'GET', 'HEAD', 'DELETE', @@ -208,7 +230,10 @@ def request( 'PUT', 'PATCH', 'OPTIONS' - ] + ]: + method = _upper_method + else: + assert re.fullmatch(r"[!#$%&'*+\-.^_`|~0-9A-Za-z]+", method) is not None if post_params and body: raise ApiValueError( @@ -232,8 +257,9 @@ def request( ) try: - # For `POST`, `PUT`, `PATCH`, `OPTIONS`, `DELETE` - if method in ['POST', 'PUT', 'PATCH', 'OPTIONS', 'DELETE']: + # For `POST`, `PUT`, `PATCH`, `OPTIONS`, `DELETE` - or any + # OpenAPI 3.2 method that actually carries a body/form data + if method in ['POST', 'PUT', 'PATCH', 'OPTIONS', 'DELETE'] or body is not None or post_params: content_type = headers.get('Content-Type') is_json = ( @@ -256,7 +282,7 @@ def request( request_body = None if body is not None: request_body = json.dumps(body) - r = self.pool_manager.request( + r = self._pool_request( method, url, body=request_body, @@ -265,7 +291,7 @@ def request( preload_content=False ) elif contenttype_matches(content_type, 'application', 'x-www-form-urlencoded'): - r = self.pool_manager.request( + r = self._pool_request( method, url, fields=post_params, @@ -281,7 +307,7 @@ def request( del headers['Content-Type'] # Ensures that dict objects are serialized post_params = [(a, json.dumps(b)) if isinstance(b, dict) else (a,b) for a, b in post_params] - r = self.pool_manager.request( + r = self._pool_request( method, url, fields=post_params, @@ -294,7 +320,7 @@ def request( # other content types than JSON when `body` argument is # provided in serialized form. elif isinstance(body, str) or isinstance(body, bytes): - r = self.pool_manager.request( + r = self._pool_request( method, url, body=body, @@ -304,7 +330,7 @@ def request( ) elif content_type.startswith('text/') and isinstance(body, bool): request_body = "true" if body else "false" - r = self.pool_manager.request( + r = self._pool_request( method, url, body=request_body, @@ -319,7 +345,7 @@ def request( raise ApiException(status=0, reason=msg) # For `GET`, `HEAD` else: - r = self.pool_manager.request( + r = self._pool_request( method, url, fields={}, From e2b405d31235749a4260f03c39b5f573141bb12e Mon Sep 17 00:00:00 2001 From: khayashi4337 Date: Tue, 22 Sep 2026 18:08:42 +0900 Subject: [PATCH 06/31] feat(typescript-fetch): generate OpenAPI 3.2 query/additionalOperations and in:querystring - enable supportsAdditionalOperations/supportsQueryStringParameters: fetch() passes RequestInit.method verbatim, preserving arbitrary method names - emit non-standard methods as double-quoted unescaped literals (apostrophes and backticks are valid tchars); warn+skip keys that are not RFC 9110 tokens, warn when fetch forbids the method - widen HTTPMethod with (string & {}) so custom methods typecheck while keeping autocomplete for the standard set - append in:querystring values verbatim to urlPath ('&' when a '?' is already present); match that in createFetchParams so apiKey-in-query auth params chain with '&' instead of a second '?' - escape '|' in generated markdown docs via x-ts-http-method-doc - fix ExtendedCodegenParameter's manual field copy silently dropping ~30 CodegenParameter fields (isQueryStringParam among them); copy every field/accessor now - webhooks get the same flags via postProcessWebhooksWithModels Verified by tsc strict compile and a raw-TCP capture test: QUERY, customMethod and CHECK&FETCH reach the wire verbatim, the querystring value is preserved as written, standard GET unchanged. typescript-axios and other siblings warn and skip 3.2 operations as before. Generated with [Devin](https://devin.ai) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com> --- .../TypeScriptFetchClientCodegen.java | 111 ++++++++++++++++++ .../typescript-fetch/README.mustache | 2 +- .../typescript-fetch/api_doc.mustache | 2 +- .../resources/typescript-fetch/apis.mustache | 23 ++++ .../typescript-fetch/runtime.mustache | 6 +- .../codegen/go/GoClientCodegenTest.java | 2 +- .../TypeScriptFetchClientCodegenTest.java | 26 ++++ .../runtime.ts | 6 +- .../infinite-recursion-issue/runtime.ts | 6 +- .../multipart-file-array/runtime.ts | 6 +- .../self-import-issue/runtime.ts | 6 +- .../builds/allOf-nullable/runtime.ts | 6 +- .../builds/allOf-readonly/runtime.ts | 6 +- .../builds/date-library-date/src/runtime.ts | 6 +- .../builds/date-library-string/src/runtime.ts | 6 +- .../builds/default-v3.0/runtime.ts | 6 +- .../builds/default/runtime.ts | 6 +- .../typescript-fetch/builds/enum/runtime.ts | 6 +- .../builds/es6-target/src/runtime.ts | 6 +- .../builds/kebab-case/runtime.ts | 6 +- .../builds/multiple-parameters/runtime.ts | 6 +- .../typescript-fetch/builds/oneOf/runtime.ts | 6 +- .../src/runtime.ts | 6 +- .../builds/sagas-and-records/src/runtime.ts | 6 +- .../builds/snakecase-discriminator/runtime.ts | 6 +- .../split-by-content-type/src/runtime.ts | 6 +- .../builds/validation-attributes/runtime.ts | 6 +- .../builds/with-interfaces/runtime.ts | 6 +- .../builds/with-npm-version/src/runtime.ts | 6 +- .../builds/with-string-enums/runtime.ts | 6 +- .../without-runtime-checks/src/runtime.ts | 6 +- 31 files changed, 263 insertions(+), 53 deletions(-) diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/TypeScriptFetchClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/TypeScriptFetchClientCodegen.java index 843f9cb89962..742405678359 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/TypeScriptFetchClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/TypeScriptFetchClientCodegen.java @@ -34,6 +34,7 @@ import org.openapitools.codegen.model.ModelMap; import org.openapitools.codegen.model.ModelsMap; import org.openapitools.codegen.model.OperationsMap; +import org.openapitools.codegen.model.WebhooksMap; import org.openapitools.codegen.templating.mustache.IndentedLambda; import org.openapitools.codegen.utils.ModelUtils; import org.slf4j.Logger; @@ -42,6 +43,7 @@ import java.io.File; import java.util.*; import java.util.function.BiConsumer; +import java.util.regex.Pattern; import java.util.function.Function; import java.util.stream.Collectors; @@ -871,10 +873,85 @@ public OperationsMap postProcessOperationsWithModels(OperationsMap operations, L // updateOperationParameterForEnum, for one, is what prefixes an enum parameter's type name with the // operation's, and a variant it never visited would be left referencing a type nobody declares. this.mergeContentTypeVariants(operations); + this.flagOpenAPI32Operations(operations.getOperations().getOperation()); return operations; } + // HTTP methods emitted in the conventional 'GET' single-quoted style; + // OpenAPI 3.2 methods outside this set are emitted as unescaped + // double-quoted literals via x-ts-http-method-literal so valid token + // punctuation (e.g. CHECK&FETCH, or a token containing an apostrophe, + // which would break single-quoting) survives template rendering + private static final Set STANDARD_HTTP_METHODS = new HashSet<>(Arrays.asList( + "GET", "PUT", "POST", "DELETE", "HEAD", "OPTIONS", "TRACE", "PATCH", "CONNECT")); + + // RFC 9110 tchar — additionalOperations keys must match this to be + // emitted as a TypeScript string literal + private static final Pattern HTTP_TOKEN = Pattern.compile("[!#$%&'*+\\-.^_`|~0-9A-Za-z]+"); + + // methods the WHATWG fetch spec forbids — RequestInit throws TypeError + private static final Set FETCH_FORBIDDEN_METHODS = new HashSet<>(Arrays.asList( + "CONNECT", "TRACE", "TRACK")); + + @Override + public boolean supportsAdditionalOperations() { + // fetch() passes RequestInit.method through verbatim, preserving + // arbitrary OpenAPI 3.2 method names + return true; + } + + @Override + protected boolean supportsQueryStringParameters() { + // the raw, already-encoded query string is appended to the request + // path verbatim by the api template + return true; + } + + @Override + public WebhooksMap postProcessWebhooksWithModels(WebhooksMap objs, List allModels) { + // webhooks render through apis.mustache as well, so their + // non-standard methods and querystring parameters need the same flags + objs = super.postProcessWebhooksWithModels(objs, allModels); + flagOpenAPI32Operations(objs.getWebhooks().getOperation()); + return objs; + } + + private void flagOpenAPI32Operations(List operations) { + for (Iterator it = operations.iterator(); it.hasNext(); ) { + CodegenOperation op = it.next(); + if (op.httpMethod == null) { + continue; + } + // markdown docs render the method inside table cells where a '|' + // (a valid tchar) would split the cell + op.vendorExtensions.put("x-ts-http-method-doc", op.httpMethod.replace("|", "\\|")); + if (!STANDARD_HTTP_METHODS.contains(op.httpMethod)) { + if (!HTTP_TOKEN.matcher(op.httpMethod).matches()) { + LOGGER.warn("HTTP method '{}' is not a valid RFC 9110 token; skipping operation {}", + op.httpMethod, op.operationId); + it.remove(); + continue; + } + if (FETCH_FORBIDDEN_METHODS.contains(op.httpMethod.toUpperCase(Locale.ROOT))) { + LOGGER.warn("HTTP method '{}' is forbidden by the fetch specification; " + + "the generated client will throw TypeError when calling operation {}", + op.httpMethod, op.operationId); + } + // fetch() byte-uppercases only DELETE/GET/HEAD/OPTIONS/POST/PUT; + // every other method reaches the wire exactly as written + op.vendorExtensions.put("x-ts-http-method-literal", true); + } + for (CodegenParameter cp : op.allParams) { + if (cp.isQueryStringParam) { + op.vendorExtensions.put("x-ts-has-querystring-param", true); + break; + } + } + + } + } + @Override public Map postProcessSupportingFileData(Map objs) { Map parentObjs = super.postProcessSupportingFileData(objs); @@ -1564,6 +1641,7 @@ public ExtendedCodegenParameter(CodegenParameter cp) { this.isDeprecated = cp.isDeprecated; this.isFormParam = cp.isFormParam; this.isQueryParam = cp.isQueryParam; + this.isQueryStringParam = cp.isQueryStringParam; this.isPathParam = cp.isPathParam; this.isHeaderParam = cp.isHeaderParam; this.isCookieParam = cp.isCookieParam; @@ -1634,6 +1712,39 @@ public ExtendedCodegenParameter(CodegenParameter cp) { this.minItems = cp.minItems; this.uniqueItems = cp.uniqueItems; this.multipleOf = cp.multipleOf; + // fields added to CodegenParameter after this constructor was + // written; without them the extended copy silently drops them + // (isQueryStringParam above was one such casualty) + this.isDeepObject = cp.isDeepObject; + this.isMatrix = cp.isMatrix; + this.isAllowEmptyValue = cp.isAllowEmptyValue; + this.isFormStyle = cp.isFormStyle; + this.isSpaceDelimited = cp.isSpaceDelimited; + this.isPipeDelimited = cp.isPipeDelimited; + this.enumDefaultValue = cp.enumDefaultValue; + this.nameInCamelCase = cp.nameInCamelCase; + this.nameInPascalCase = cp.nameInPascalCase; + this.nameInSnakeCase = cp.nameInSnakeCase; + this.examples = cp.examples; + this.isPassword = cp.isPassword; + this.isShort = cp.isShort; + this.isUnboundedInteger = cp.isUnboundedInteger; + this.queryIsJsonMimeType = cp.queryIsJsonMimeType; + this.isOptional = cp.isOptional; + this.containerType = cp.containerType; + this.containerTypeMapped = cp.containerTypeMapped; + this.isNull = cp.isNull; + this.isVoid = cp.isVoid; + this.setSchema(cp.getSchema()); + this.setContent(cp.getContent()); + this.setRef(cp.getRef()); + this.setComposedSchemas(cp.getComposedSchemas()); + this.setRequiredVarsMap(cp.getRequiredVarsMap()); + this.setHasMultipleTypes(cp.getHasMultipleTypes()); + this.setUniqueItemsBoolean(cp.getUniqueItemsBoolean()); + this.setSchemaIsFromAdditionalProperties(cp.getSchemaIsFromAdditionalProperties()); + this.setHasDiscriminatorWithNonEmptyMapping(cp.getHasDiscriminatorWithNonEmptyMapping()); + this.setAdditionalPropertiesIsAnyType(cp.getAdditionalPropertiesIsAnyType()); this.setHasVars(cp.getHasVars()); this.setHasRequired(cp.getHasRequired()); this.setMaxProperties(cp.getMaxProperties()); diff --git a/modules/openapi-generator/src/main/resources/typescript-fetch/README.mustache b/modules/openapi-generator/src/main/resources/typescript-fetch/README.mustache index b73c64591fc0..0d9d1bf2e892 100644 --- a/modules/openapi-generator/src/main/resources/typescript-fetch/README.mustache +++ b/modules/openapi-generator/src/main/resources/typescript-fetch/README.mustache @@ -26,7 +26,7 @@ All URIs are relative to *{{basePath}}* | Class | Method | HTTP request | Description | ----- | ------ | ------------ | ------------- -{{#apiInfo}}{{#apis}}{{#operations}}{{#operation}}*{{classname}}* | [**{{operationId}}**]({{apiDocPath}}/{{classname}}.md#{{operationIdLowerCase}}) | **{{httpMethod}}** {{path}} | {{summary}} +{{#apiInfo}}{{#apis}}{{#operations}}{{#operation}}*{{classname}}* | [**{{operationId}}**]({{apiDocPath}}/{{classname}}.md#{{operationIdLowerCase}}) | **{{vendorExtensions.x-ts-http-method-doc}}** {{path}} | {{summary}} {{/operation}}{{/operations}}{{/apis}}{{/apiInfo}} ### Models diff --git a/modules/openapi-generator/src/main/resources/typescript-fetch/api_doc.mustache b/modules/openapi-generator/src/main/resources/typescript-fetch/api_doc.mustache index f5c49271a9fc..6be95ae3425a 100644 --- a/modules/openapi-generator/src/main/resources/typescript-fetch/api_doc.mustache +++ b/modules/openapi-generator/src/main/resources/typescript-fetch/api_doc.mustache @@ -6,7 +6,7 @@ All URIs are relative to *{{basePath}}* | Method | HTTP request | Description | |------------- | ------------- | -------------| -{{#operations}}{{#operation}}| [**{{operationId}}**]({{classname}}.md#{{operationIdLowerCase}}) | **{{httpMethod}}** {{commonPath}}{{path}} | {{summary}} | +{{#operations}}{{#operation}}| [**{{operationId}}**]({{classname}}.md#{{operationIdLowerCase}}) | **{{vendorExtensions.x-ts-http-method-doc}}** {{commonPath}}{{path}} | {{summary}} | {{/operation}}{{/operations}} {{#operations}} diff --git a/modules/openapi-generator/src/main/resources/typescript-fetch/apis.mustache b/modules/openapi-generator/src/main/resources/typescript-fetch/apis.mustache index 7fa306995134..263aa0ad96e0 100644 --- a/modules/openapi-generator/src/main/resources/typescript-fetch/apis.mustache +++ b/modules/openapi-generator/src/main/resources/typescript-fetch/apis.mustache @@ -188,6 +188,7 @@ export class {{classname}} extends runtime.BaseAPI { const queryParameters: any = {}; {{#queryParams}} + {{^isQueryStringParam}} {{#isArray}} if (requestParameters['{{paramName}}'] != null) { {{#isCollectionFormatMulti}} @@ -217,6 +218,7 @@ export class {{classname}} extends runtime.BaseAPI { } {{/isArray}} + {{/isQueryStringParam}} {{/queryParams}} const headerParameters: runtime.HTTPHeaders = {}; @@ -338,6 +340,17 @@ export class {{classname}} extends runtime.BaseAPI { {{/isDateType}} {{/isDateTimeType}} {{/pathParams}} + {{#vendorExtensions.x-ts-has-querystring-param}} + {{#queryParams}} + {{#isQueryStringParam}} + // OpenAPI 3.2 in: querystring - the value is the whole, already-encoded + // query string; append it verbatim instead of a name=value pair + if (requestParameters['{{paramName}}'] != null && requestParameters['{{paramName}}'] !== '') { + urlPath += (urlPath.includes('?') ? '&' : '?') + requestParameters['{{paramName}}']; + } + {{/isQueryStringParam}} + {{/queryParams}} + {{/vendorExtensions.x-ts-has-querystring-param}} {{#hasContentTypeRequestVariants}} {{! `contentType` selects the body's type, so narrow on it before serialising }} @@ -362,7 +375,12 @@ export class {{classname}} extends runtime.BaseAPI { return { path: urlPath, + {{#vendorExtensions.x-ts-http-method-literal}} + method: "{{{httpMethod}}}",{{! OpenAPI 3.2: non-standard method sent verbatim, unescaped }} + {{/vendorExtensions.x-ts-http-method-literal}} + {{^vendorExtensions.x-ts-http-method-literal}} method: '{{httpMethod}}', + {{/vendorExtensions.x-ts-http-method-literal}} headers: headerParameters, query: queryParameters, body: body, @@ -372,7 +390,12 @@ export class {{classname}} extends runtime.BaseAPI { {{^hasContentTypeRequestVariants}} return { path: urlPath, + {{#vendorExtensions.x-ts-http-method-literal}} + method: "{{{httpMethod}}}", + {{/vendorExtensions.x-ts-http-method-literal}} + {{^vendorExtensions.x-ts-http-method-literal}} method: '{{httpMethod}}', + {{/vendorExtensions.x-ts-http-method-literal}} headers: headerParameters, query: queryParameters, {{#hasBodyParam}} diff --git a/modules/openapi-generator/src/main/resources/typescript-fetch/runtime.mustache b/modules/openapi-generator/src/main/resources/typescript-fetch/runtime.mustache index ec58f037d84e..af1a61103092 100644 --- a/modules/openapi-generator/src/main/resources/typescript-fetch/runtime.mustache +++ b/modules/openapi-generator/src/main/resources/typescript-fetch/runtime.mustache @@ -135,7 +135,7 @@ export class BaseAPI { // only add the querystring to the URL if there are query parameters. // this is done to avoid urls ending with a "?" character which buggy webservers // do not handle correctly sometimes. - url += '?' + this.configuration.queryParamsStringify(context.query); + url += (url.includes('?') ? '&' : '?') + this.configuration.queryParamsStringify(context.query); } const headers = Object.assign({}, this.configuration.headers, context.headers); @@ -310,7 +310,9 @@ export type ExclusiveUnion = U extends unknown {{/splitOperationsByContentType}} export type Json = any; -export type HTTPMethod = 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE' | 'OPTIONS' | 'HEAD'; +// (string & {}) keeps editor autocomplete for the standard methods while +// admitting arbitrary OpenAPI 3.2 method names (query, additionalOperations) +export type HTTPMethod = 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE' | 'OPTIONS' | 'HEAD' | (string & {}); export type HTTPHeaders = { [key: string]: string }; export type HTTPQuery = { [key: string]: string | number | null | boolean | Array | Set | HTTPQuery }; export type HTTPBody = Json | FormData | URLSearchParams; diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/go/GoClientCodegenTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/go/GoClientCodegenTest.java index 9210d4bfb327..e213595de05d 100644 --- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/go/GoClientCodegenTest.java +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/go/GoClientCodegenTest.java @@ -630,7 +630,7 @@ public void testOpenAPI32QueryStringWithPathParamImports() throws IOException { Path apiFile = Paths.get(output + "/api_default.go"); TestUtils.assertFileContains(apiFile, "strings.Contains(localVarPath, \"?\")"); // pathParams already pull in "strings"; a duplicate import would not compile - String content = new String(Files.readAllBytes(apiFile)); + String content = new String(Files.readAllBytes(apiFile), java.nio.charset.StandardCharsets.UTF_8); Assert.assertEquals(content.split("\"strings\"", -1).length - 1, 1, "duplicate \"strings\" import in generated Go file"); } diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/typescript/fetch/TypeScriptFetchClientCodegenTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/typescript/fetch/TypeScriptFetchClientCodegenTest.java index 443e534b03a9..f5ec5f2adf06 100644 --- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/typescript/fetch/TypeScriptFetchClientCodegenTest.java +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/typescript/fetch/TypeScriptFetchClientCodegenTest.java @@ -1236,6 +1236,32 @@ public void testDateFormatIsSerializedAsACalendarDate() throws IOException { private static final String DATE_HANDLING_SPEC = "src/test/resources/3_0/typescript-fetch/date-handling.yaml"; + @Test + public void testOpenAPI32QueryAndAdditionalOperations() throws IOException { + File output = generate(Collections.emptyMap(), "src/test/resources/3_2/query-operation.yaml"); + Path api = Paths.get(output + "/apis/DefaultApi.ts"); + + // arbitrary additionalOperations keys are emitted verbatim as double-quoted + // literals so token punctuation and mixed case survive (CHECK&FETCH, customMethod) + TestUtils.assertFileContains(api, + "method: \"CHECK&FETCH\"", + "method: \"customMethod\"", + "method: \"PURGE\"", + "method: \"QUERY\""); + + // standard methods keep the conventional single-quoted form + TestUtils.assertFileContains(api, "method: 'GET'"); + + // in: querystring appends the already-encoded value to the path verbatim + // rather than serialising a name=value pair + TestUtils.assertFileContains(api, + "urlPath += (urlPath.includes('?') ? '&' : '?') + requestParameters['qs']"); + TestUtils.assertFileNotContains(api, "queryParameters['qs']"); + + // the HTTPMethod type admits arbitrary method strings + TestUtils.assertFileContains(Paths.get(output + "/runtime.ts"), "| (string & {})"); + } + private static File generate( Map properties, String inputSpec diff --git a/samples/client/others/typescript-fetch/additional-properties-in-multipart-issue/runtime.ts b/samples/client/others/typescript-fetch/additional-properties-in-multipart-issue/runtime.ts index 1d2ddace09ec..7a01d0839e93 100644 --- a/samples/client/others/typescript-fetch/additional-properties-in-multipart-issue/runtime.ts +++ b/samples/client/others/typescript-fetch/additional-properties-in-multipart-issue/runtime.ts @@ -145,7 +145,7 @@ export class BaseAPI { // only add the querystring to the URL if there are query parameters. // this is done to avoid urls ending with a "?" character which buggy webservers // do not handle correctly sometimes. - url += '?' + this.configuration.queryParamsStringify(context.query); + url += (url.includes('?') ? '&' : '?') + this.configuration.queryParamsStringify(context.query); } const headers = Object.assign({}, this.configuration.headers, context.headers); @@ -305,7 +305,9 @@ export const COLLECTION_FORMATS = { export type FetchAPI = WindowOrWorkerGlobalScope['fetch']; export type Json = any; -export type HTTPMethod = 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE' | 'OPTIONS' | 'HEAD'; +// (string & {}) keeps editor autocomplete for the standard methods while +// admitting arbitrary OpenAPI 3.2 method names (query, additionalOperations) +export type HTTPMethod = 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE' | 'OPTIONS' | 'HEAD' | (string & {}); export type HTTPHeaders = { [key: string]: string }; export type HTTPQuery = { [key: string]: string | number | null | boolean | Array | Set | HTTPQuery }; export type HTTPBody = Json | FormData | URLSearchParams; diff --git a/samples/client/others/typescript-fetch/infinite-recursion-issue/runtime.ts b/samples/client/others/typescript-fetch/infinite-recursion-issue/runtime.ts index 1d2ddace09ec..7a01d0839e93 100644 --- a/samples/client/others/typescript-fetch/infinite-recursion-issue/runtime.ts +++ b/samples/client/others/typescript-fetch/infinite-recursion-issue/runtime.ts @@ -145,7 +145,7 @@ export class BaseAPI { // only add the querystring to the URL if there are query parameters. // this is done to avoid urls ending with a "?" character which buggy webservers // do not handle correctly sometimes. - url += '?' + this.configuration.queryParamsStringify(context.query); + url += (url.includes('?') ? '&' : '?') + this.configuration.queryParamsStringify(context.query); } const headers = Object.assign({}, this.configuration.headers, context.headers); @@ -305,7 +305,9 @@ export const COLLECTION_FORMATS = { export type FetchAPI = WindowOrWorkerGlobalScope['fetch']; export type Json = any; -export type HTTPMethod = 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE' | 'OPTIONS' | 'HEAD'; +// (string & {}) keeps editor autocomplete for the standard methods while +// admitting arbitrary OpenAPI 3.2 method names (query, additionalOperations) +export type HTTPMethod = 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE' | 'OPTIONS' | 'HEAD' | (string & {}); export type HTTPHeaders = { [key: string]: string }; export type HTTPQuery = { [key: string]: string | number | null | boolean | Array | Set | HTTPQuery }; export type HTTPBody = Json | FormData | URLSearchParams; diff --git a/samples/client/others/typescript-fetch/multipart-file-array/runtime.ts b/samples/client/others/typescript-fetch/multipart-file-array/runtime.ts index e93ee831ab96..e01a0c304d59 100644 --- a/samples/client/others/typescript-fetch/multipart-file-array/runtime.ts +++ b/samples/client/others/typescript-fetch/multipart-file-array/runtime.ts @@ -145,7 +145,7 @@ export class BaseAPI { // only add the querystring to the URL if there are query parameters. // this is done to avoid urls ending with a "?" character which buggy webservers // do not handle correctly sometimes. - url += '?' + this.configuration.queryParamsStringify(context.query); + url += (url.includes('?') ? '&' : '?') + this.configuration.queryParamsStringify(context.query); } const headers = Object.assign({}, this.configuration.headers, context.headers); @@ -305,7 +305,9 @@ export const COLLECTION_FORMATS = { export type FetchAPI = WindowOrWorkerGlobalScope['fetch']; export type Json = any; -export type HTTPMethod = 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE' | 'OPTIONS' | 'HEAD'; +// (string & {}) keeps editor autocomplete for the standard methods while +// admitting arbitrary OpenAPI 3.2 method names (query, additionalOperations) +export type HTTPMethod = 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE' | 'OPTIONS' | 'HEAD' | (string & {}); export type HTTPHeaders = { [key: string]: string }; export type HTTPQuery = { [key: string]: string | number | null | boolean | Array | Set | HTTPQuery }; export type HTTPBody = Json | FormData | URLSearchParams; diff --git a/samples/client/others/typescript-fetch/self-import-issue/runtime.ts b/samples/client/others/typescript-fetch/self-import-issue/runtime.ts index 0562a357d812..26c249fabe8a 100644 --- a/samples/client/others/typescript-fetch/self-import-issue/runtime.ts +++ b/samples/client/others/typescript-fetch/self-import-issue/runtime.ts @@ -145,7 +145,7 @@ export class BaseAPI { // only add the querystring to the URL if there are query parameters. // this is done to avoid urls ending with a "?" character which buggy webservers // do not handle correctly sometimes. - url += '?' + this.configuration.queryParamsStringify(context.query); + url += (url.includes('?') ? '&' : '?') + this.configuration.queryParamsStringify(context.query); } const headers = Object.assign({}, this.configuration.headers, context.headers); @@ -305,7 +305,9 @@ export const COLLECTION_FORMATS = { export type FetchAPI = WindowOrWorkerGlobalScope['fetch']; export type Json = any; -export type HTTPMethod = 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE' | 'OPTIONS' | 'HEAD'; +// (string & {}) keeps editor autocomplete for the standard methods while +// admitting arbitrary OpenAPI 3.2 method names (query, additionalOperations) +export type HTTPMethod = 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE' | 'OPTIONS' | 'HEAD' | (string & {}); export type HTTPHeaders = { [key: string]: string }; export type HTTPQuery = { [key: string]: string | number | null | boolean | Array | Set | HTTPQuery }; export type HTTPBody = Json | FormData | URLSearchParams; diff --git a/samples/client/petstore/typescript-fetch/builds/allOf-nullable/runtime.ts b/samples/client/petstore/typescript-fetch/builds/allOf-nullable/runtime.ts index 21ac6b88d7ff..2f3a69bc4b18 100644 --- a/samples/client/petstore/typescript-fetch/builds/allOf-nullable/runtime.ts +++ b/samples/client/petstore/typescript-fetch/builds/allOf-nullable/runtime.ts @@ -145,7 +145,7 @@ export class BaseAPI { // only add the querystring to the URL if there are query parameters. // this is done to avoid urls ending with a "?" character which buggy webservers // do not handle correctly sometimes. - url += '?' + this.configuration.queryParamsStringify(context.query); + url += (url.includes('?') ? '&' : '?') + this.configuration.queryParamsStringify(context.query); } const headers = Object.assign({}, this.configuration.headers, context.headers); @@ -305,7 +305,9 @@ export const COLLECTION_FORMATS = { export type FetchAPI = WindowOrWorkerGlobalScope['fetch']; export type Json = any; -export type HTTPMethod = 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE' | 'OPTIONS' | 'HEAD'; +// (string & {}) keeps editor autocomplete for the standard methods while +// admitting arbitrary OpenAPI 3.2 method names (query, additionalOperations) +export type HTTPMethod = 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE' | 'OPTIONS' | 'HEAD' | (string & {}); export type HTTPHeaders = { [key: string]: string }; export type HTTPQuery = { [key: string]: string | number | null | boolean | Array | Set | HTTPQuery }; export type HTTPBody = Json | FormData | URLSearchParams; diff --git a/samples/client/petstore/typescript-fetch/builds/allOf-readonly/runtime.ts b/samples/client/petstore/typescript-fetch/builds/allOf-readonly/runtime.ts index 21ac6b88d7ff..2f3a69bc4b18 100644 --- a/samples/client/petstore/typescript-fetch/builds/allOf-readonly/runtime.ts +++ b/samples/client/petstore/typescript-fetch/builds/allOf-readonly/runtime.ts @@ -145,7 +145,7 @@ export class BaseAPI { // only add the querystring to the URL if there are query parameters. // this is done to avoid urls ending with a "?" character which buggy webservers // do not handle correctly sometimes. - url += '?' + this.configuration.queryParamsStringify(context.query); + url += (url.includes('?') ? '&' : '?') + this.configuration.queryParamsStringify(context.query); } const headers = Object.assign({}, this.configuration.headers, context.headers); @@ -305,7 +305,9 @@ export const COLLECTION_FORMATS = { export type FetchAPI = WindowOrWorkerGlobalScope['fetch']; export type Json = any; -export type HTTPMethod = 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE' | 'OPTIONS' | 'HEAD'; +// (string & {}) keeps editor autocomplete for the standard methods while +// admitting arbitrary OpenAPI 3.2 method names (query, additionalOperations) +export type HTTPMethod = 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE' | 'OPTIONS' | 'HEAD' | (string & {}); export type HTTPHeaders = { [key: string]: string }; export type HTTPQuery = { [key: string]: string | number | null | boolean | Array | Set | HTTPQuery }; export type HTTPBody = Json | FormData | URLSearchParams; diff --git a/samples/client/petstore/typescript-fetch/builds/date-library-date/src/runtime.ts b/samples/client/petstore/typescript-fetch/builds/date-library-date/src/runtime.ts index 59aa9338bf8d..09555a99be96 100644 --- a/samples/client/petstore/typescript-fetch/builds/date-library-date/src/runtime.ts +++ b/samples/client/petstore/typescript-fetch/builds/date-library-date/src/runtime.ts @@ -145,7 +145,7 @@ export class BaseAPI { // only add the querystring to the URL if there are query parameters. // this is done to avoid urls ending with a "?" character which buggy webservers // do not handle correctly sometimes. - url += '?' + this.configuration.queryParamsStringify(context.query); + url += (url.includes('?') ? '&' : '?') + this.configuration.queryParamsStringify(context.query); } const headers = Object.assign({}, this.configuration.headers, context.headers); @@ -305,7 +305,9 @@ export const COLLECTION_FORMATS = { export type FetchAPI = WindowOrWorkerGlobalScope['fetch']; export type Json = any; -export type HTTPMethod = 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE' | 'OPTIONS' | 'HEAD'; +// (string & {}) keeps editor autocomplete for the standard methods while +// admitting arbitrary OpenAPI 3.2 method names (query, additionalOperations) +export type HTTPMethod = 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE' | 'OPTIONS' | 'HEAD' | (string & {}); export type HTTPHeaders = { [key: string]: string }; export type HTTPQuery = { [key: string]: string | number | null | boolean | Array | Set | HTTPQuery }; export type HTTPBody = Json | FormData | URLSearchParams; diff --git a/samples/client/petstore/typescript-fetch/builds/date-library-string/src/runtime.ts b/samples/client/petstore/typescript-fetch/builds/date-library-string/src/runtime.ts index 2535518eb0ca..6a02a88521ca 100644 --- a/samples/client/petstore/typescript-fetch/builds/date-library-string/src/runtime.ts +++ b/samples/client/petstore/typescript-fetch/builds/date-library-string/src/runtime.ts @@ -145,7 +145,7 @@ export class BaseAPI { // only add the querystring to the URL if there are query parameters. // this is done to avoid urls ending with a "?" character which buggy webservers // do not handle correctly sometimes. - url += '?' + this.configuration.queryParamsStringify(context.query); + url += (url.includes('?') ? '&' : '?') + this.configuration.queryParamsStringify(context.query); } const headers = Object.assign({}, this.configuration.headers, context.headers); @@ -305,7 +305,9 @@ export const COLLECTION_FORMATS = { export type FetchAPI = WindowOrWorkerGlobalScope['fetch']; export type Json = any; -export type HTTPMethod = 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE' | 'OPTIONS' | 'HEAD'; +// (string & {}) keeps editor autocomplete for the standard methods while +// admitting arbitrary OpenAPI 3.2 method names (query, additionalOperations) +export type HTTPMethod = 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE' | 'OPTIONS' | 'HEAD' | (string & {}); export type HTTPHeaders = { [key: string]: string }; export type HTTPQuery = { [key: string]: string | number | null | boolean | Array | Set | HTTPQuery }; export type HTTPBody = Json | FormData | URLSearchParams; diff --git a/samples/client/petstore/typescript-fetch/builds/default-v3.0/runtime.ts b/samples/client/petstore/typescript-fetch/builds/default-v3.0/runtime.ts index 9300aaa0f8d6..0af1dce0b7a6 100644 --- a/samples/client/petstore/typescript-fetch/builds/default-v3.0/runtime.ts +++ b/samples/client/petstore/typescript-fetch/builds/default-v3.0/runtime.ts @@ -145,7 +145,7 @@ export class BaseAPI { // only add the querystring to the URL if there are query parameters. // this is done to avoid urls ending with a "?" character which buggy webservers // do not handle correctly sometimes. - url += '?' + this.configuration.queryParamsStringify(context.query); + url += (url.includes('?') ? '&' : '?') + this.configuration.queryParamsStringify(context.query); } const headers = Object.assign({}, this.configuration.headers, context.headers); @@ -305,7 +305,9 @@ export const COLLECTION_FORMATS = { export type FetchAPI = WindowOrWorkerGlobalScope['fetch']; export type Json = any; -export type HTTPMethod = 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE' | 'OPTIONS' | 'HEAD'; +// (string & {}) keeps editor autocomplete for the standard methods while +// admitting arbitrary OpenAPI 3.2 method names (query, additionalOperations) +export type HTTPMethod = 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE' | 'OPTIONS' | 'HEAD' | (string & {}); export type HTTPHeaders = { [key: string]: string }; export type HTTPQuery = { [key: string]: string | number | null | boolean | Array | Set | HTTPQuery }; export type HTTPBody = Json | FormData | URLSearchParams; diff --git a/samples/client/petstore/typescript-fetch/builds/default/runtime.ts b/samples/client/petstore/typescript-fetch/builds/default/runtime.ts index b71d0834f8cf..6f02bf7b11b0 100644 --- a/samples/client/petstore/typescript-fetch/builds/default/runtime.ts +++ b/samples/client/petstore/typescript-fetch/builds/default/runtime.ts @@ -145,7 +145,7 @@ export class BaseAPI { // only add the querystring to the URL if there are query parameters. // this is done to avoid urls ending with a "?" character which buggy webservers // do not handle correctly sometimes. - url += '?' + this.configuration.queryParamsStringify(context.query); + url += (url.includes('?') ? '&' : '?') + this.configuration.queryParamsStringify(context.query); } const headers = Object.assign({}, this.configuration.headers, context.headers); @@ -305,7 +305,9 @@ export const COLLECTION_FORMATS = { export type FetchAPI = WindowOrWorkerGlobalScope['fetch']; export type Json = any; -export type HTTPMethod = 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE' | 'OPTIONS' | 'HEAD'; +// (string & {}) keeps editor autocomplete for the standard methods while +// admitting arbitrary OpenAPI 3.2 method names (query, additionalOperations) +export type HTTPMethod = 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE' | 'OPTIONS' | 'HEAD' | (string & {}); export type HTTPHeaders = { [key: string]: string }; export type HTTPQuery = { [key: string]: string | number | null | boolean | Array | Set | HTTPQuery }; export type HTTPBody = Json | FormData | URLSearchParams; diff --git a/samples/client/petstore/typescript-fetch/builds/enum/runtime.ts b/samples/client/petstore/typescript-fetch/builds/enum/runtime.ts index 200d6e694abf..8fc9a5dd1828 100644 --- a/samples/client/petstore/typescript-fetch/builds/enum/runtime.ts +++ b/samples/client/petstore/typescript-fetch/builds/enum/runtime.ts @@ -145,7 +145,7 @@ export class BaseAPI { // only add the querystring to the URL if there are query parameters. // this is done to avoid urls ending with a "?" character which buggy webservers // do not handle correctly sometimes. - url += '?' + this.configuration.queryParamsStringify(context.query); + url += (url.includes('?') ? '&' : '?') + this.configuration.queryParamsStringify(context.query); } const headers = Object.assign({}, this.configuration.headers, context.headers); @@ -305,7 +305,9 @@ export const COLLECTION_FORMATS = { export type FetchAPI = WindowOrWorkerGlobalScope['fetch']; export type Json = any; -export type HTTPMethod = 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE' | 'OPTIONS' | 'HEAD'; +// (string & {}) keeps editor autocomplete for the standard methods while +// admitting arbitrary OpenAPI 3.2 method names (query, additionalOperations) +export type HTTPMethod = 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE' | 'OPTIONS' | 'HEAD' | (string & {}); export type HTTPHeaders = { [key: string]: string }; export type HTTPQuery = { [key: string]: string | number | null | boolean | Array | Set | HTTPQuery }; export type HTTPBody = Json | FormData | URLSearchParams; diff --git a/samples/client/petstore/typescript-fetch/builds/es6-target/src/runtime.ts b/samples/client/petstore/typescript-fetch/builds/es6-target/src/runtime.ts index b71d0834f8cf..6f02bf7b11b0 100644 --- a/samples/client/petstore/typescript-fetch/builds/es6-target/src/runtime.ts +++ b/samples/client/petstore/typescript-fetch/builds/es6-target/src/runtime.ts @@ -145,7 +145,7 @@ export class BaseAPI { // only add the querystring to the URL if there are query parameters. // this is done to avoid urls ending with a "?" character which buggy webservers // do not handle correctly sometimes. - url += '?' + this.configuration.queryParamsStringify(context.query); + url += (url.includes('?') ? '&' : '?') + this.configuration.queryParamsStringify(context.query); } const headers = Object.assign({}, this.configuration.headers, context.headers); @@ -305,7 +305,9 @@ export const COLLECTION_FORMATS = { export type FetchAPI = WindowOrWorkerGlobalScope['fetch']; export type Json = any; -export type HTTPMethod = 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE' | 'OPTIONS' | 'HEAD'; +// (string & {}) keeps editor autocomplete for the standard methods while +// admitting arbitrary OpenAPI 3.2 method names (query, additionalOperations) +export type HTTPMethod = 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE' | 'OPTIONS' | 'HEAD' | (string & {}); export type HTTPHeaders = { [key: string]: string }; export type HTTPQuery = { [key: string]: string | number | null | boolean | Array | Set | HTTPQuery }; export type HTTPBody = Json | FormData | URLSearchParams; diff --git a/samples/client/petstore/typescript-fetch/builds/kebab-case/runtime.ts b/samples/client/petstore/typescript-fetch/builds/kebab-case/runtime.ts index 9300aaa0f8d6..0af1dce0b7a6 100644 --- a/samples/client/petstore/typescript-fetch/builds/kebab-case/runtime.ts +++ b/samples/client/petstore/typescript-fetch/builds/kebab-case/runtime.ts @@ -145,7 +145,7 @@ export class BaseAPI { // only add the querystring to the URL if there are query parameters. // this is done to avoid urls ending with a "?" character which buggy webservers // do not handle correctly sometimes. - url += '?' + this.configuration.queryParamsStringify(context.query); + url += (url.includes('?') ? '&' : '?') + this.configuration.queryParamsStringify(context.query); } const headers = Object.assign({}, this.configuration.headers, context.headers); @@ -305,7 +305,9 @@ export const COLLECTION_FORMATS = { export type FetchAPI = WindowOrWorkerGlobalScope['fetch']; export type Json = any; -export type HTTPMethod = 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE' | 'OPTIONS' | 'HEAD'; +// (string & {}) keeps editor autocomplete for the standard methods while +// admitting arbitrary OpenAPI 3.2 method names (query, additionalOperations) +export type HTTPMethod = 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE' | 'OPTIONS' | 'HEAD' | (string & {}); export type HTTPHeaders = { [key: string]: string }; export type HTTPQuery = { [key: string]: string | number | null | boolean | Array | Set | HTTPQuery }; export type HTTPBody = Json | FormData | URLSearchParams; diff --git a/samples/client/petstore/typescript-fetch/builds/multiple-parameters/runtime.ts b/samples/client/petstore/typescript-fetch/builds/multiple-parameters/runtime.ts index b71d0834f8cf..6f02bf7b11b0 100644 --- a/samples/client/petstore/typescript-fetch/builds/multiple-parameters/runtime.ts +++ b/samples/client/petstore/typescript-fetch/builds/multiple-parameters/runtime.ts @@ -145,7 +145,7 @@ export class BaseAPI { // only add the querystring to the URL if there are query parameters. // this is done to avoid urls ending with a "?" character which buggy webservers // do not handle correctly sometimes. - url += '?' + this.configuration.queryParamsStringify(context.query); + url += (url.includes('?') ? '&' : '?') + this.configuration.queryParamsStringify(context.query); } const headers = Object.assign({}, this.configuration.headers, context.headers); @@ -305,7 +305,9 @@ export const COLLECTION_FORMATS = { export type FetchAPI = WindowOrWorkerGlobalScope['fetch']; export type Json = any; -export type HTTPMethod = 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE' | 'OPTIONS' | 'HEAD'; +// (string & {}) keeps editor autocomplete for the standard methods while +// admitting arbitrary OpenAPI 3.2 method names (query, additionalOperations) +export type HTTPMethod = 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE' | 'OPTIONS' | 'HEAD' | (string & {}); export type HTTPHeaders = { [key: string]: string }; export type HTTPQuery = { [key: string]: string | number | null | boolean | Array | Set | HTTPQuery }; export type HTTPBody = Json | FormData | URLSearchParams; diff --git a/samples/client/petstore/typescript-fetch/builds/oneOf/runtime.ts b/samples/client/petstore/typescript-fetch/builds/oneOf/runtime.ts index 9ad5703db110..5689eb4c6ea1 100644 --- a/samples/client/petstore/typescript-fetch/builds/oneOf/runtime.ts +++ b/samples/client/petstore/typescript-fetch/builds/oneOf/runtime.ts @@ -145,7 +145,7 @@ export class BaseAPI { // only add the querystring to the URL if there are query parameters. // this is done to avoid urls ending with a "?" character which buggy webservers // do not handle correctly sometimes. - url += '?' + this.configuration.queryParamsStringify(context.query); + url += (url.includes('?') ? '&' : '?') + this.configuration.queryParamsStringify(context.query); } const headers = Object.assign({}, this.configuration.headers, context.headers); @@ -305,7 +305,9 @@ export const COLLECTION_FORMATS = { export type FetchAPI = WindowOrWorkerGlobalScope['fetch']; export type Json = any; -export type HTTPMethod = 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE' | 'OPTIONS' | 'HEAD'; +// (string & {}) keeps editor autocomplete for the standard methods while +// admitting arbitrary OpenAPI 3.2 method names (query, additionalOperations) +export type HTTPMethod = 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE' | 'OPTIONS' | 'HEAD' | (string & {}); export type HTTPHeaders = { [key: string]: string }; export type HTTPQuery = { [key: string]: string | number | null | boolean | Array | Set | HTTPQuery }; export type HTTPBody = Json | FormData | URLSearchParams; diff --git a/samples/client/petstore/typescript-fetch/builds/prefix-parameter-interfaces/src/runtime.ts b/samples/client/petstore/typescript-fetch/builds/prefix-parameter-interfaces/src/runtime.ts index b71d0834f8cf..6f02bf7b11b0 100644 --- a/samples/client/petstore/typescript-fetch/builds/prefix-parameter-interfaces/src/runtime.ts +++ b/samples/client/petstore/typescript-fetch/builds/prefix-parameter-interfaces/src/runtime.ts @@ -145,7 +145,7 @@ export class BaseAPI { // only add the querystring to the URL if there are query parameters. // this is done to avoid urls ending with a "?" character which buggy webservers // do not handle correctly sometimes. - url += '?' + this.configuration.queryParamsStringify(context.query); + url += (url.includes('?') ? '&' : '?') + this.configuration.queryParamsStringify(context.query); } const headers = Object.assign({}, this.configuration.headers, context.headers); @@ -305,7 +305,9 @@ export const COLLECTION_FORMATS = { export type FetchAPI = WindowOrWorkerGlobalScope['fetch']; export type Json = any; -export type HTTPMethod = 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE' | 'OPTIONS' | 'HEAD'; +// (string & {}) keeps editor autocomplete for the standard methods while +// admitting arbitrary OpenAPI 3.2 method names (query, additionalOperations) +export type HTTPMethod = 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE' | 'OPTIONS' | 'HEAD' | (string & {}); export type HTTPHeaders = { [key: string]: string }; export type HTTPQuery = { [key: string]: string | number | null | boolean | Array | Set | HTTPQuery }; export type HTTPBody = Json | FormData | URLSearchParams; diff --git a/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/runtime.ts b/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/runtime.ts index b71d0834f8cf..6f02bf7b11b0 100644 --- a/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/runtime.ts +++ b/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/runtime.ts @@ -145,7 +145,7 @@ export class BaseAPI { // only add the querystring to the URL if there are query parameters. // this is done to avoid urls ending with a "?" character which buggy webservers // do not handle correctly sometimes. - url += '?' + this.configuration.queryParamsStringify(context.query); + url += (url.includes('?') ? '&' : '?') + this.configuration.queryParamsStringify(context.query); } const headers = Object.assign({}, this.configuration.headers, context.headers); @@ -305,7 +305,9 @@ export const COLLECTION_FORMATS = { export type FetchAPI = WindowOrWorkerGlobalScope['fetch']; export type Json = any; -export type HTTPMethod = 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE' | 'OPTIONS' | 'HEAD'; +// (string & {}) keeps editor autocomplete for the standard methods while +// admitting arbitrary OpenAPI 3.2 method names (query, additionalOperations) +export type HTTPMethod = 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE' | 'OPTIONS' | 'HEAD' | (string & {}); export type HTTPHeaders = { [key: string]: string }; export type HTTPQuery = { [key: string]: string | number | null | boolean | Array | Set | HTTPQuery }; export type HTTPBody = Json | FormData | URLSearchParams; diff --git a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/runtime.ts b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/runtime.ts index 9300aaa0f8d6..0af1dce0b7a6 100644 --- a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/runtime.ts +++ b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/runtime.ts @@ -145,7 +145,7 @@ export class BaseAPI { // only add the querystring to the URL if there are query parameters. // this is done to avoid urls ending with a "?" character which buggy webservers // do not handle correctly sometimes. - url += '?' + this.configuration.queryParamsStringify(context.query); + url += (url.includes('?') ? '&' : '?') + this.configuration.queryParamsStringify(context.query); } const headers = Object.assign({}, this.configuration.headers, context.headers); @@ -305,7 +305,9 @@ export const COLLECTION_FORMATS = { export type FetchAPI = WindowOrWorkerGlobalScope['fetch']; export type Json = any; -export type HTTPMethod = 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE' | 'OPTIONS' | 'HEAD'; +// (string & {}) keeps editor autocomplete for the standard methods while +// admitting arbitrary OpenAPI 3.2 method names (query, additionalOperations) +export type HTTPMethod = 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE' | 'OPTIONS' | 'HEAD' | (string & {}); export type HTTPHeaders = { [key: string]: string }; export type HTTPQuery = { [key: string]: string | number | null | boolean | Array | Set | HTTPQuery }; export type HTTPBody = Json | FormData | URLSearchParams; diff --git a/samples/client/petstore/typescript-fetch/builds/split-by-content-type/src/runtime.ts b/samples/client/petstore/typescript-fetch/builds/split-by-content-type/src/runtime.ts index ac813429c9ec..27aced2d4a72 100644 --- a/samples/client/petstore/typescript-fetch/builds/split-by-content-type/src/runtime.ts +++ b/samples/client/petstore/typescript-fetch/builds/split-by-content-type/src/runtime.ts @@ -145,7 +145,7 @@ export class BaseAPI { // only add the querystring to the URL if there are query parameters. // this is done to avoid urls ending with a "?" character which buggy webservers // do not handle correctly sometimes. - url += '?' + this.configuration.queryParamsStringify(context.query); + url += (url.includes('?') ? '&' : '?') + this.configuration.queryParamsStringify(context.query); } const headers = Object.assign({}, this.configuration.headers, context.headers); @@ -318,7 +318,9 @@ export type ExclusiveUnion = U extends unknown : never; export type Json = any; -export type HTTPMethod = 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE' | 'OPTIONS' | 'HEAD'; +// (string & {}) keeps editor autocomplete for the standard methods while +// admitting arbitrary OpenAPI 3.2 method names (query, additionalOperations) +export type HTTPMethod = 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE' | 'OPTIONS' | 'HEAD' | (string & {}); export type HTTPHeaders = { [key: string]: string }; export type HTTPQuery = { [key: string]: string | number | null | boolean | Array | Set | HTTPQuery }; export type HTTPBody = Json | FormData | URLSearchParams; diff --git a/samples/client/petstore/typescript-fetch/builds/validation-attributes/runtime.ts b/samples/client/petstore/typescript-fetch/builds/validation-attributes/runtime.ts index b71d0834f8cf..6f02bf7b11b0 100644 --- a/samples/client/petstore/typescript-fetch/builds/validation-attributes/runtime.ts +++ b/samples/client/petstore/typescript-fetch/builds/validation-attributes/runtime.ts @@ -145,7 +145,7 @@ export class BaseAPI { // only add the querystring to the URL if there are query parameters. // this is done to avoid urls ending with a "?" character which buggy webservers // do not handle correctly sometimes. - url += '?' + this.configuration.queryParamsStringify(context.query); + url += (url.includes('?') ? '&' : '?') + this.configuration.queryParamsStringify(context.query); } const headers = Object.assign({}, this.configuration.headers, context.headers); @@ -305,7 +305,9 @@ export const COLLECTION_FORMATS = { export type FetchAPI = WindowOrWorkerGlobalScope['fetch']; export type Json = any; -export type HTTPMethod = 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE' | 'OPTIONS' | 'HEAD'; +// (string & {}) keeps editor autocomplete for the standard methods while +// admitting arbitrary OpenAPI 3.2 method names (query, additionalOperations) +export type HTTPMethod = 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE' | 'OPTIONS' | 'HEAD' | (string & {}); export type HTTPHeaders = { [key: string]: string }; export type HTTPQuery = { [key: string]: string | number | null | boolean | Array | Set | HTTPQuery }; export type HTTPBody = Json | FormData | URLSearchParams; diff --git a/samples/client/petstore/typescript-fetch/builds/with-interfaces/runtime.ts b/samples/client/petstore/typescript-fetch/builds/with-interfaces/runtime.ts index b71d0834f8cf..6f02bf7b11b0 100644 --- a/samples/client/petstore/typescript-fetch/builds/with-interfaces/runtime.ts +++ b/samples/client/petstore/typescript-fetch/builds/with-interfaces/runtime.ts @@ -145,7 +145,7 @@ export class BaseAPI { // only add the querystring to the URL if there are query parameters. // this is done to avoid urls ending with a "?" character which buggy webservers // do not handle correctly sometimes. - url += '?' + this.configuration.queryParamsStringify(context.query); + url += (url.includes('?') ? '&' : '?') + this.configuration.queryParamsStringify(context.query); } const headers = Object.assign({}, this.configuration.headers, context.headers); @@ -305,7 +305,9 @@ export const COLLECTION_FORMATS = { export type FetchAPI = WindowOrWorkerGlobalScope['fetch']; export type Json = any; -export type HTTPMethod = 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE' | 'OPTIONS' | 'HEAD'; +// (string & {}) keeps editor autocomplete for the standard methods while +// admitting arbitrary OpenAPI 3.2 method names (query, additionalOperations) +export type HTTPMethod = 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE' | 'OPTIONS' | 'HEAD' | (string & {}); export type HTTPHeaders = { [key: string]: string }; export type HTTPQuery = { [key: string]: string | number | null | boolean | Array | Set | HTTPQuery }; export type HTTPBody = Json | FormData | URLSearchParams; diff --git a/samples/client/petstore/typescript-fetch/builds/with-npm-version/src/runtime.ts b/samples/client/petstore/typescript-fetch/builds/with-npm-version/src/runtime.ts index b71d0834f8cf..6f02bf7b11b0 100644 --- a/samples/client/petstore/typescript-fetch/builds/with-npm-version/src/runtime.ts +++ b/samples/client/petstore/typescript-fetch/builds/with-npm-version/src/runtime.ts @@ -145,7 +145,7 @@ export class BaseAPI { // only add the querystring to the URL if there are query parameters. // this is done to avoid urls ending with a "?" character which buggy webservers // do not handle correctly sometimes. - url += '?' + this.configuration.queryParamsStringify(context.query); + url += (url.includes('?') ? '&' : '?') + this.configuration.queryParamsStringify(context.query); } const headers = Object.assign({}, this.configuration.headers, context.headers); @@ -305,7 +305,9 @@ export const COLLECTION_FORMATS = { export type FetchAPI = WindowOrWorkerGlobalScope['fetch']; export type Json = any; -export type HTTPMethod = 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE' | 'OPTIONS' | 'HEAD'; +// (string & {}) keeps editor autocomplete for the standard methods while +// admitting arbitrary OpenAPI 3.2 method names (query, additionalOperations) +export type HTTPMethod = 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE' | 'OPTIONS' | 'HEAD' | (string & {}); export type HTTPHeaders = { [key: string]: string }; export type HTTPQuery = { [key: string]: string | number | null | boolean | Array | Set | HTTPQuery }; export type HTTPBody = Json | FormData | URLSearchParams; diff --git a/samples/client/petstore/typescript-fetch/builds/with-string-enums/runtime.ts b/samples/client/petstore/typescript-fetch/builds/with-string-enums/runtime.ts index 200d6e694abf..8fc9a5dd1828 100644 --- a/samples/client/petstore/typescript-fetch/builds/with-string-enums/runtime.ts +++ b/samples/client/petstore/typescript-fetch/builds/with-string-enums/runtime.ts @@ -145,7 +145,7 @@ export class BaseAPI { // only add the querystring to the URL if there are query parameters. // this is done to avoid urls ending with a "?" character which buggy webservers // do not handle correctly sometimes. - url += '?' + this.configuration.queryParamsStringify(context.query); + url += (url.includes('?') ? '&' : '?') + this.configuration.queryParamsStringify(context.query); } const headers = Object.assign({}, this.configuration.headers, context.headers); @@ -305,7 +305,9 @@ export const COLLECTION_FORMATS = { export type FetchAPI = WindowOrWorkerGlobalScope['fetch']; export type Json = any; -export type HTTPMethod = 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE' | 'OPTIONS' | 'HEAD'; +// (string & {}) keeps editor autocomplete for the standard methods while +// admitting arbitrary OpenAPI 3.2 method names (query, additionalOperations) +export type HTTPMethod = 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE' | 'OPTIONS' | 'HEAD' | (string & {}); export type HTTPHeaders = { [key: string]: string }; export type HTTPQuery = { [key: string]: string | number | null | boolean | Array | Set | HTTPQuery }; export type HTTPBody = Json | FormData | URLSearchParams; diff --git a/samples/client/petstore/typescript-fetch/builds/without-runtime-checks/src/runtime.ts b/samples/client/petstore/typescript-fetch/builds/without-runtime-checks/src/runtime.ts index 56e2e516c01a..7307e87dda5a 100644 --- a/samples/client/petstore/typescript-fetch/builds/without-runtime-checks/src/runtime.ts +++ b/samples/client/petstore/typescript-fetch/builds/without-runtime-checks/src/runtime.ts @@ -145,7 +145,7 @@ export class BaseAPI { // only add the querystring to the URL if there are query parameters. // this is done to avoid urls ending with a "?" character which buggy webservers // do not handle correctly sometimes. - url += '?' + this.configuration.queryParamsStringify(context.query); + url += (url.includes('?') ? '&' : '?') + this.configuration.queryParamsStringify(context.query); } const headers = Object.assign({}, this.configuration.headers, context.headers); @@ -305,7 +305,9 @@ export const COLLECTION_FORMATS = { export type FetchAPI = WindowOrWorkerGlobalScope['fetch']; export type Json = any; -export type HTTPMethod = 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE' | 'OPTIONS' | 'HEAD'; +// (string & {}) keeps editor autocomplete for the standard methods while +// admitting arbitrary OpenAPI 3.2 method names (query, additionalOperations) +export type HTTPMethod = 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE' | 'OPTIONS' | 'HEAD' | (string & {}); export type HTTPHeaders = { [key: string]: string }; export type HTTPQuery = { [key: string]: string | number | null | boolean | Array | Set | HTTPQuery }; export type HTTPBody = Json | FormData | URLSearchParams; From c901798d66a118f8c8bb1d0a100546d74be9a616 Mon Sep 17 00:00:00 2001 From: khayashi4337 Date: Tue, 22 Sep 2026 20:56:04 +0900 Subject: [PATCH 07/31] feat(rust): generate OpenAPI 3.2 query/additionalOperations and in:querystring Enable OpenAPI 3.2 constructs for the rust client generator, reqwest library only (hyper/hyper0x/reqwest-trait keep warning and skipping unsupported operations): - supportsAdditionalOperations()/supportsQueryStringParameters() return true for the reqwest library - Non-standard HTTP methods (query op, additionalOperations) are snapshotted before the per-library method-case conversion and emitted verbatim via reqwest::Method::from_bytes(b"..."), preserving case (e.g. customMethod) and RFC 9110 tchar punctuation (e.g. CHECK&FETCH) - Invalid RFC 9110 method tokens are warned about and skipped instead of producing uncompilable Rust - `in: querystring` parameters append the caller-supplied query component verbatim to the URI (with ? or & as needed), bypassing reqwest's name=value .query() serialization; excluded from the queryParams template loop - Webhook operations get the same verbatim-method and querystring handling via postProcessWebhooksWithModels - Doc templates escape | in method names so markdown tables stay intact - New TestNG coverage includes a committed wire-level test: the generated blocking client is built with cargo and its request lines are captured on a raw TCP listener, verifying QUERY, customMethod, CHECK&FETCH, PURGE and a verbatim, non-double-encoded querystring (skipped when cargo or crates.io is unavailable) Co-Authored-By: Claude Opus 4.8 (1M context) --- .../codegen/languages/RustClientCodegen.java | 103 +++++++++ .../src/main/resources/rust/README.mustache | 2 +- .../src/main/resources/rust/api_doc.mustache | 2 +- .../main/resources/rust/reqwest/api.mustache | 22 +- .../codegen/rust/RustClientCodegenTest.java | 211 ++++++++++++++++++ .../resources/3_2/rust-invalid-method.yaml | 18 ++ .../3_2/rust-reqwest-capture/capture.rs | 80 +++++++ 7 files changed, 434 insertions(+), 4 deletions(-) create mode 100644 modules/openapi-generator/src/test/resources/3_2/rust-invalid-method.yaml create mode 100644 modules/openapi-generator/src/test/resources/3_2/rust-reqwest-capture/capture.rs diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/RustClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/RustClientCodegen.java index e9d42056baec..daf13d1d61f6 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/RustClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/RustClientCodegen.java @@ -33,6 +33,7 @@ import org.openapitools.codegen.model.ModelsMap; import org.openapitools.codegen.model.OperationMap; import org.openapitools.codegen.model.OperationsMap; +import org.openapitools.codegen.model.WebhooksMap; import org.openapitools.codegen.templating.mustache.ReplaceAllLambda; import org.openapitools.codegen.utils.ModelUtils; import org.openapitools.codegen.utils.StringUtils; @@ -780,11 +781,98 @@ public void postProcessParameter(CodegenParameter parameter) { } } + @Override + public boolean supportsAdditionalOperations() { + // reqwest's Method::from_bytes keeps arbitrary method names verbatim; the + // hyper templates need Rust identifiers, so hyper/reqwest-trait stay unsupported + return REQWEST_LIBRARY.equals(getLibrary()); + } + + @Override + protected boolean supportsQueryStringParameters() { + return REQWEST_LIBRARY.equals(getLibrary()); + } + + private static final Set STANDARD_HTTP_METHODS = new HashSet<>(Arrays.asList( + "GET", "PUT", "POST", "DELETE", "OPTIONS", "HEAD", "PATCH", "TRACE", "CONNECT")); + + // RFC 9110 tchar: the method token reqwest::Method::from_bytes accepts verbatim + private static final java.util.regex.Pattern HTTP_METHOD_TOKEN_PATTERN = + java.util.regex.Pattern.compile("[!#$%&'*+\\-.^_`|~0-9A-Za-z]+"); + + /** + * Snapshot non-standard (OpenAPI 3.2 additionalOperations) HTTP method names before the + * per-library case conversion below so they can be restored verbatim for + * {@code reqwest::Method::from_bytes}. + */ + private Map snapshotVerbatimHttpMethods(List operations) { + Map verbatim = new IdentityHashMap<>(); + for (CodegenOperation operation : operations) { + // exact match only: a lower/mixed-case key like `get` in additionalOperations is a + // distinct (non-standard) method on the wire and must be emitted verbatim, while + // non-ASCII names must reach the RFC 9110 token check rather than be upper-cased + if (operation.httpMethod != null + && !STANDARD_HTTP_METHODS.contains(operation.httpMethod)) { + verbatim.put(operation, operation.httpMethod); + } + } + return verbatim; + } + + /** + * Restore verbatim HTTP methods captured by {@link #snapshotVerbatimHttpMethods} and mark + * them via {@code x-rust-http-method-literal} so templates emit them as method literals. + * Operation names that are not valid RFC 9110 tokens are warned about and skipped. + */ + private void restoreVerbatimHttpMethods(List operations, + Map verbatim) { + Iterator it = operations.iterator(); + while (it.hasNext()) { + CodegenOperation operation = it.next(); + String method = verbatim.get(operation); + if (method == null) { + continue; + } + if (!HTTP_METHOD_TOKEN_PATTERN.matcher(method).matches()) { + LOGGER.warn("Skipping operation {}: HTTP method name '{}' is not a valid " + + "RFC 9110 token and cannot be emitted as a Rust method literal.", + operation.operationId, method); + it.remove(); + continue; + } + operation.httpMethod = method; + operation.vendorExtensions.put("x-rust-http-method-literal", true); + // `|` is a valid RFC 9110 tchar but breaks markdown tables in doc templates + operation.vendorExtensions.put("x-rust-http-method-doc", method.replace("|", "\\|")); + } + } + + @Override + public WebhooksMap postProcessWebhooksWithModels(WebhooksMap objs, List allModels) { + WebhooksMap map = super.postProcessWebhooksWithModels(objs, allModels); + if (REQWEST_LIBRARY.equals(getLibrary())) { + List operations = map.getWebhooks().getOperation(); + restoreVerbatimHttpMethods(operations, snapshotVerbatimHttpMethods(operations)); + for (CodegenOperation operation : operations) { + for (CodegenParameter p : operation.allParams) { + if (p.isQueryStringParam) { + operation.vendorExtensions.put("x-rust-has-querystring-param", true); + break; + } + } + } + } + return map; + } + @Override public OperationsMap postProcessOperationsWithModels(OperationsMap objs, List allModels) { OperationMap objectMap = objs.getOperations(); boolean useAsyncFileStream = false; List operations = objectMap.getOperation(); + Map verbatimHttpMethods = REQWEST_LIBRARY.equals(getLibrary()) + ? snapshotVerbatimHttpMethods(operations) + : Collections.emptyMap(); for (CodegenOperation operation : operations) { // For types with `isAnyType` we assume it's a `serde_json::Value` type. // However for path, query, and headers it's unlikely to be JSON so we default to `String`. @@ -919,6 +1007,21 @@ public OperationsMap postProcessOperationsWithModels(OperationsMap objs, List(&self, id: &'id str, run_id: Option<&'run_id str>)"); TestUtils.assertFileNotContains(outputPath, "Option<&str>"); } + + @Test + public void testReqwestOpenApi32OperationsAndQueryStringParam() throws IOException { + Path target = Files.createTempDirectory("test"); + target.toFile().deleteOnExit(); + final CodegenConfigurator configurator = new CodegenConfigurator() + .setGeneratorName("rust") + .setLibrary("reqwest") + .setInputSpec("src/test/resources/3_2/query-operation.yaml") + .setSkipOverwrite(false) + .setOutputDir(target.toAbsolutePath().toString().replace("\\", "/")); + new DefaultGenerator().opts(configurator.toClientOptInput()).generate(); + Path outputPath = Path.of(target.toString(), "src/apis/default_api.rs"); + TestUtils.assertFileExists(outputPath); + String generated = new String(Files.readAllBytes(outputPath), StandardCharsets.UTF_8); + // standard methods still use the typed constants + Assert.assertTrue(generated.contains("reqwest::Method::GET"), + "list_pets should use reqwest::Method::GET"); + // query and additionalOperations methods are emitted verbatim via Method::from_bytes + for (String method : new String[]{"QUERY", "PURGE", "customMethod", "CHECK&FETCH"}) { + Assert.assertTrue(generated.contains("reqwest::Method::from_bytes(b\"" + method + "\")"), + "expected verbatim method literal for " + method); + } + // `in: querystring` is appended to the URI verbatim, not sent through .query() + Assert.assertTrue(generated.contains("uri_str.push_str(&p_qs);"), + "querystring param should be appended verbatim"); + Assert.assertTrue(generated.contains("qs: &str"), + "query_pets signature must expose the querystring parameter"); + Assert.assertFalse(generated.contains("\"qs\""), + "querystring param must not be serialized as a name=value query pair"); + } + + @Test + public void testReqwestOpenApi32QueryStringParamGrouped() throws IOException { + Path target = Files.createTempDirectory("test"); + target.toFile().deleteOnExit(); + final CodegenConfigurator configurator = new CodegenConfigurator() + .setGeneratorName("rust") + .setLibrary("reqwest") + .addAdditionalProperty("useSingleRequestParameter", true) + .setInputSpec("src/test/resources/3_2/query-operation.yaml") + .setSkipOverwrite(false) + .setOutputDir(target.toAbsolutePath().toString().replace("\\", "/")); + new DefaultGenerator().opts(configurator.toClientOptInput()).generate(); + Path outputPath = Path.of(target.toString(), "src/apis/default_api.rs"); + TestUtils.assertFileExists(outputPath); + // grouped params struct stores String fields; the borrow is required to compile + TestUtils.assertFileContains(outputPath, "uri_str.push_str(¶ms.qs);"); + } + + @Test + public void testReqwestSkipsInvalidMethodNames() throws IOException { + Path target = Files.createTempDirectory("test"); + target.toFile().deleteOnExit(); + final CodegenConfigurator configurator = new CodegenConfigurator() + .setGeneratorName("rust") + .setLibrary("reqwest") + .setInputSpec("src/test/resources/3_2/rust-invalid-method.yaml") + .setSkipOverwrite(false) + .setOutputDir(target.toAbsolutePath().toString().replace("\\", "/")); + new DefaultGenerator().opts(configurator.toClientOptInput()).generate(); + Path outputPath = Path.of(target.toString(), "src/apis/default_api.rs"); + TestUtils.assertFileExists(outputPath); + String generated = new String(Files.readAllBytes(outputPath), StandardCharsets.UTF_8); + Assert.assertTrue(generated.contains("fn list_pets"), "GET operation should be kept"); + Assert.assertFalse(generated.contains("bad_method"), + "operation with an invalid RFC 9110 method name must be skipped"); + } + + @Test + public void testReqwestWebhookOpenApi32Operations() throws IOException { + Path target = Files.createTempDirectory("test"); + target.toFile().deleteOnExit(); + final CodegenConfigurator configurator = new CodegenConfigurator() + .setGeneratorName("rust") + .setLibrary("reqwest") + .setInputSpec("src/test/resources/3_2/go-webhook-operations.yaml") + .setSkipOverwrite(false) + .setOutputDir(target.toAbsolutePath().toString().replace("\\", "/")); + new DefaultGenerator().opts(configurator.toClientOptInput()).generate(); + Path apiDir = Path.of(target.toString(), "src/apis"); + File webhookFile = null; + for (File f : Objects.requireNonNull(apiDir.toFile().listFiles())) { + String content = new String(Files.readAllBytes(f.toPath()), StandardCharsets.UTF_8); + if (content.contains("on_pet_custom")) { + webhookFile = f; + break; + } + } + Assert.assertNotNull(webhookFile, "expected a generated file containing webhook ops"); + String generated = new String(Files.readAllBytes(webhookFile.toPath()), StandardCharsets.UTF_8); + Assert.assertTrue(generated.contains("reqwest::Method::from_bytes(b\"QUERY\")"), + "webhook query op should emit a verbatim method"); + Assert.assertTrue(generated.contains("reqwest::Method::from_bytes(b\"customMethod\")"), + "webhook additionalOperations should emit verbatim methods"); + Assert.assertTrue(generated.contains("uri_str.push_str(&p_qs);"), + "webhook querystring param should be appended verbatim"); + } + + @Test + public void testHyperSkipsOpenApi32Operations() throws IOException { + Path target = Files.createTempDirectory("test"); + target.toFile().deleteOnExit(); + final CodegenConfigurator configurator = new CodegenConfigurator() + .setGeneratorName("rust") + .setLibrary("hyper") + .setInputSpec("src/test/resources/3_2/query-operation.yaml") + .setSkipOverwrite(false) + .setOutputDir(target.toAbsolutePath().toString().replace("\\", "/")); + new DefaultGenerator().opts(configurator.toClientOptInput()).generate(); + Path outputPath = Path.of(target.toString(), "src/apis/default_api.rs"); + TestUtils.assertFileExists(outputPath); + String generated = new String(Files.readAllBytes(outputPath), StandardCharsets.UTF_8); + // hyper templates cannot express arbitrary method names -> warned and skipped + Assert.assertTrue(generated.contains("list_pets"), "GET operation should be kept"); + for (String op : new String[]{"query_pets", "purge_pets", "custom_pets", "check_fetch_pets"}) { + Assert.assertFalse(generated.contains("fn " + op), + "hyper library must skip unsupported 3.2 operation " + op); + } + } + + /** + * End-to-end check: builds the generated reqwest (blocking) client with cargo and + * verifies on a raw TCP listener that QUERY/additionalOperations methods and + * `in: querystring` reach the wire verbatim. Skipped when cargo is unavailable. + */ + @Test + public void testReqwestGeneratedClientSendsVerbatimMethods() throws IOException, InterruptedException { + if (!isCommandAvailable("cargo")) { + throw new org.testng.SkipException("cargo is not on PATH; skipping generated-client verification"); + } + if (!isCratesIoReachable() && !System.getenv().containsKey("CARGO_NET_OFFLINE")) { + // a warm CARGO_HOME registry cache may still make the offline build work, + // but without one the build would stall on dependency resolution + throw new org.testng.SkipException("crates.io is unreachable; skipping generated-client verification"); + } + Path target = Files.createTempDirectory("rust32-verify"); + target.toFile().deleteOnExit(); + final CodegenConfigurator configurator = new CodegenConfigurator() + .setGeneratorName("rust") + .setLibrary("reqwest") + .addAdditionalProperty("reqwestDefaultFeatures", "rustls") + .addAdditionalProperty("supportAsync", false) + .setInputSpec("src/test/resources/3_2/query-operation.yaml") + .setSkipOverwrite(false) + .setOutputDir(target.toAbsolutePath().toString().replace("\\", "/")); + new DefaultGenerator().opts(configurator.toClientOptInput()).generate(); + + Path binDir = target.resolve("src/bin"); + Files.createDirectories(binDir); + Files.copy(Path.of("src/test/resources/3_2/rust-reqwest-capture/capture.rs"), + binDir.resolve("capture.rs")); + + runCargo(target, "build"); + String out = runCargo(target, "run", "--bin", "capture"); + Assert.assertTrue(out.contains("CAPTURE-PASS"), + "generated client did not send verbatim 3.2 methods/querystring:\n" + out); + } + + private boolean isCommandAvailable(String command) { + try { + Process p = new ProcessBuilder(command, "--version") + .redirectErrorStream(true).start(); + p.getInputStream().transferTo(java.io.OutputStream.nullOutputStream()); + if (!p.waitFor(10, TimeUnit.SECONDS)) { + p.destroyForcibly(); + return false; + } + return p.exitValue() == 0; + } catch (IOException | InterruptedException e) { + return false; + } + } + + private boolean isCratesIoReachable() { + try (java.net.Socket socket = new java.net.Socket()) { + socket.connect(new java.net.InetSocketAddress("index.crates.io", 443), 5000); + return true; + } catch (IOException e) { + return false; + } + } + + private String runCargo(Path projectDir, String... args) throws IOException, InterruptedException { + List cmd = new ArrayList<>(); + cmd.add("cargo"); + cmd.addAll(Arrays.asList(args)); + ProcessBuilder pb = new ProcessBuilder(cmd) + .directory(projectDir.toFile()) + .redirectErrorStream(true); + // keep the cargo target dir inside the temp project + pb.environment().put("CARGO_TARGET_DIR", + projectDir.resolve("target").toAbsolutePath().toString()); + // the capture listener is local; never let proxy env vars intercept it + pb.environment().put("NO_PROXY", "127.0.0.1,localhost"); + pb.environment().put("no_proxy", "127.0.0.1,localhost"); + Process p = pb.start(); + boolean finished = p.waitFor(15, TimeUnit.MINUTES); + if (!finished) { + p.destroyForcibly(); + } + String output = new String(p.getInputStream().readAllBytes(), StandardCharsets.UTF_8); + Assert.assertTrue(finished, "cargo " + String.join(" ", args) + " timed out:\n" + output); + Assert.assertEquals(p.exitValue(), 0, "cargo " + String.join(" ", args) + " failed:\n" + output); + return output; + } } diff --git a/modules/openapi-generator/src/test/resources/3_2/rust-invalid-method.yaml b/modules/openapi-generator/src/test/resources/3_2/rust-invalid-method.yaml new file mode 100644 index 000000000000..8efef49a5f03 --- /dev/null +++ b/modules/openapi-generator/src/test/resources/3_2/rust-invalid-method.yaml @@ -0,0 +1,18 @@ +openapi: 3.2.0 +info: + title: invalid method name test + version: '1.0' +paths: + /pets: + get: + operationId: listPets + responses: + '200': + description: ok + additionalOperations: + # contains a space - not a valid RFC 9110 token; must be skipped with a warning + "MY METHOD": + operationId: badMethod + responses: + '204': + description: done diff --git a/modules/openapi-generator/src/test/resources/3_2/rust-reqwest-capture/capture.rs b/modules/openapi-generator/src/test/resources/3_2/rust-reqwest-capture/capture.rs new file mode 100644 index 000000000000..468449800fdc --- /dev/null +++ b/modules/openapi-generator/src/test/resources/3_2/rust-reqwest-capture/capture.rs @@ -0,0 +1,80 @@ +// Wire-level verification harness for OpenAPI 3.2 support in the generated +// `rust` (reqwest, blocking) client. Copied into the generated crate as +// src/bin/capture.rs by RustClientCodegenTest and executed with `cargo run`. +// +// A raw TCP listener records the HTTP request line for every generated call: +// standard methods must keep `reqwest::Method::GET` etc., while +// `query`/additionalOperations methods and `in: querystring` parameters must +// reach the wire verbatim (no upper-casing, no re-encoding). +use openapi::apis::{configuration, default_api}; +use std::io::{BufRead, BufReader, Write}; +use std::net::TcpListener; +use std::sync::mpsc; +use std::time::Duration; + +fn main() { + let listener = TcpListener::bind("127.0.0.1:0").expect("bind capture server"); + let port = listener.local_addr().unwrap().port(); + let (tx, rx) = mpsc::channel::(); + std::thread::spawn(move || { + for stream in listener.incoming() { + let stream = match stream { + Ok(s) => s, + Err(_) => break, + }; + let mut reader = BufReader::new(stream.try_clone().unwrap()); + let mut request_line = String::new(); + if reader.read_line(&mut request_line).is_err() { + continue; + } + // consume request headers (no body in this fixture) + loop { + let mut h = String::new(); + match reader.read_line(&mut h) { + Ok(0) | Err(_) => break, + _ => { + if h.trim().is_empty() { + break; + } + } + } + } + let mut s = stream; + let _ = s.write_all( + b"HTTP/1.1 200 OK\r\nContent-Length: 0\r\nConnection: close\r\n\r\n", + ); + if tx.send(request_line.trim().to_string()).is_err() { + break; + } + } + }); + + let mut conf = configuration::Configuration::default(); + conf.base_path = format!("http://127.0.0.1:{}", port); + conf.user_agent = None; + // hermetic: reqwest honors HTTP(S)_PROXY env vars, which would bypass the local listener + conf.client = reqwest::blocking::Client::builder().no_proxy().build().unwrap(); + + // `in: querystring` callers pass the query component without the leading `?` + default_api::query_pets(&conf, "a=1&b=%20x").expect("query_pets"); + default_api::custom_pets(&conf).expect("custom_pets"); + default_api::check_fetch_pets(&conf).expect("check_fetch_pets"); + default_api::purge_pets(&conf).expect("purge_pets"); + default_api::list_pets(&conf).expect("list_pets"); + + let mut got = Vec::new(); + for _ in 0..5 { + got.push(rx.recv_timeout(Duration::from_secs(15)).expect("request captured")); + } + + // `in: querystring` is appended verbatim with `?` added: `%20` not double-encoded + assert_eq!(got[0], "QUERY /pets?a=1&b=%20x HTTP/1.1"); + // additionalOperations methods arrive verbatim, case preserved + assert_eq!(got[1], "customMethod /pets HTTP/1.1"); + assert_eq!(got[2], "CHECK&FETCH /pets HTTP/1.1"); + assert_eq!(got[3], "PURGE /pets HTTP/1.1"); + // standard methods are unaffected + assert_eq!(got[4], "GET /pets HTTP/1.1"); + + println!("CAPTURE-PASS"); +} From d0e19353fd1ed049b131ea2c1b9873ca97be6d62 Mon Sep 17 00:00:00 2001 From: khayashi4337 Date: Wed, 23 Sep 2026 00:48:25 +0900 Subject: [PATCH 08/31] feat(ruby): generate OpenAPI 3.2 query/additionalOperations and in:querystring (httpx) Scope: httpx library only - raw TCP probes showed typhoeus up-cases custom verbs and crashes on non-alphanumeric tokens, and faraday rejects them, so both keep warning/skipping 3.2 operations. - arbitrary RFC 9110 method tokens are emitted as quoted Ruby symbols and reach the wire verbatim; HTTPX::Request internally stores @verb = verb.to_s.upcase, so non-standard verbs build the request via session.build_request and then restore @verb (HTTPX-internal dependency documented in the generated code) - invalid RFC 9110 tokens are warned about and skipped at codegen time - '#' is escaped inside the :"..." literal to avoid Ruby interpolation, '|' is escaped in generated markdown docs - in:querystring parameters are appended verbatim with automatic ?/& delimiter and excluded from the regular query_params hash - adds an executable raw TCP capture test (6 request lines verified) and unit tests for invalid-token skip, typhoeus skipping, and webhooks; samples regenerated (symbol quoting change is functionally equivalent) Generated with [Devin](https://devin.ai) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com> --- .../codegen/languages/RubyClientCodegen.java | 59 ++++++ .../resources/ruby-client/README.mustache | 2 +- .../main/resources/ruby-client/api.mustache | 17 +- .../api_client_httpx_partial.mustache | 17 +- .../resources/ruby-client/api_doc.mustache | 2 +- .../codegen/ruby/RubyClientCodegenTest.java | 175 ++++++++++++++++++ .../test/resources/3_2/query-operation.yaml | 6 + .../3_2/ruby-httpx-capture/capture.rb | 58 ++++++ .../lib/openapi_client/api/auth_api.rb | 4 +- .../lib/openapi_client/api/body_api.rb | 20 +- .../lib/openapi_client/api/form_api.rb | 6 +- .../lib/openapi_client/api/header_api.rb | 2 +- .../lib/openapi_client/api/path_api.rb | 2 +- .../lib/openapi_client/api/query_api.rb | 22 +-- .../lib/openapi_client/api/auth_api.rb | 4 +- .../lib/openapi_client/api/body_api.rb | 20 +- .../lib/openapi_client/api/form_api.rb | 6 +- .../lib/openapi_client/api/header_api.rb | 2 +- .../lib/openapi_client/api/path_api.rb | 2 +- .../lib/openapi_client/api/query_api.rb | 22 +-- .../lib/openapi_client/api_client.rb | 17 +- .../lib/openapi_client/api/auth_api.rb | 4 +- .../lib/openapi_client/api/body_api.rb | 20 +- .../lib/openapi_client/api/form_api.rb | 6 +- .../lib/openapi_client/api/header_api.rb | 2 +- .../lib/openapi_client/api/path_api.rb | 2 +- .../lib/openapi_client/api/query_api.rb | 22 +-- .../lib/petstore/api/another_fake_api.rb | 2 +- .../lib/petstore/api/default_api.rb | 2 +- .../lib/petstore/api/fake_api.rb | 44 ++--- .../api/fake_classname_tags123_api.rb | 2 +- .../ruby-autoload/lib/petstore/api/pet_api.rb | 18 +- .../lib/petstore/api/store_api.rb | 8 +- .../lib/petstore/api/user_api.rb | 16 +- .../lib/petstore/api/another_fake_api.rb | 2 +- .../lib/petstore/api/default_api.rb | 2 +- .../ruby-faraday/lib/petstore/api/fake_api.rb | 44 ++--- .../api/fake_classname_tags123_api.rb | 2 +- .../ruby-faraday/lib/petstore/api/pet_api.rb | 18 +- .../lib/petstore/api/store_api.rb | 8 +- .../ruby-faraday/lib/petstore/api/user_api.rb | 16 +- .../lib/petstore/api/another_fake_api.rb | 2 +- .../lib/petstore/api/default_api.rb | 2 +- .../ruby-httpx/lib/petstore/api/fake_api.rb | 44 ++--- .../api/fake_classname_tags123_api.rb | 2 +- .../ruby-httpx/lib/petstore/api/pet_api.rb | 18 +- .../ruby-httpx/lib/petstore/api/store_api.rb | 8 +- .../ruby-httpx/lib/petstore/api/user_api.rb | 16 +- .../ruby-httpx/lib/petstore/api_client.rb | 17 +- .../ruby/lib/petstore/api/another_fake_api.rb | 2 +- .../ruby/lib/petstore/api/default_api.rb | 2 +- .../ruby/lib/petstore/api/fake_api.rb | 44 ++--- .../api/fake_classname_tags123_api.rb | 2 +- .../petstore/ruby/lib/petstore/api/pet_api.rb | 18 +- .../ruby/lib/petstore/api/store_api.rb | 8 +- .../ruby/lib/petstore/api/user_api.rb | 16 +- .../lib/x_auth_id_alias/api/usage_api.rb | 8 +- .../ruby/lib/dynamic_servers/api/usage_api.rb | 4 +- .../ruby-client/lib/petstore/api/usage_api.rb | 4 +- 59 files changed, 640 insertions(+), 282 deletions(-) create mode 100644 modules/openapi-generator/src/test/resources/3_2/ruby-httpx-capture/capture.rb diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/RubyClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/RubyClientCodegen.java index 6a3481fad6f4..26c4d475a30c 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/RubyClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/RubyClientCodegen.java @@ -28,6 +28,7 @@ import org.openapitools.codegen.model.ModelsMap; import org.openapitools.codegen.model.OperationMap; import org.openapitools.codegen.model.OperationsMap; +import org.openapitools.codegen.model.WebhooksMap; import org.openapitools.codegen.model.EnumVarMap; import org.openapitools.codegen.utils.ModelUtils; import org.slf4j.Logger; @@ -602,6 +603,63 @@ protected void addAdditionPropertiesToCodeGenModel(CodegenModel codegenModel, Sc } } + @Override + public boolean supportsAdditionalOperations() { + // only httpx can emit arbitrary methods verbatim: typhoeus crashes on + // non-alphanumeric tokens and up-cases the rest, faraday rejects them outright + return HTTPX.equals(getLibrary()); + } + + @Override + protected boolean supportsQueryStringParameters() { + return HTTPX.equals(getLibrary()); + } + + private static final Set STANDARD_HTTP_METHODS = new HashSet<>(Arrays.asList( + "GET", "PUT", "POST", "DELETE", "OPTIONS", "HEAD", "PATCH", "TRACE", "CONNECT")); + + // RFC 9110 tchar: method tokens the generated client can send verbatim + private static final java.util.regex.Pattern HTTP_METHOD_TOKEN_PATTERN = + java.util.regex.Pattern.compile("[!#$%&'*+\\-.^_`|~0-9A-Za-z]+"); + + /** + * Flags non-standard (OpenAPI 3.2 query/additionalOperations) HTTP methods, stores a + * doc-safe variant ({@code x-ruby-http-method-doc}) because {@code |} is a valid RFC 9110 + * tchar but breaks markdown tables, and a symbol-safe variant + * ({@code x-ruby-http-method-symbol}) escaping {@code #} so {@code :"...#$x"} does not + * interpolate Ruby variables. Operation names that are not valid RFC 9110 tokens are + * warned about and skipped. + */ + private void flagVerbatimHttpMethods(List operationList) { + Iterator it = operationList.iterator(); + while (it.hasNext()) { + CodegenOperation op = it.next(); + if (op.httpMethod == null) { + continue; + } + if (STANDARD_HTTP_METHODS.contains(op.httpMethod)) { + op.vendorExtensions.put("x-ruby-http-method-symbol", op.httpMethod); + continue; + } + if (!HTTP_METHOD_TOKEN_PATTERN.matcher(op.httpMethod).matches()) { + LOGGER.warn("Skipping operation {}: HTTP method name '{}' is not a valid " + + "RFC 9110 token and cannot be emitted as a Ruby method symbol.", + op.operationId, op.httpMethod); + it.remove(); + continue; + } + op.vendorExtensions.put("x-ruby-http-method-doc", op.httpMethod.replace("|", "\\|")); + op.vendorExtensions.put("x-ruby-http-method-symbol", op.httpMethod.replace("#", "\\#")); + } + } + + @Override + public WebhooksMap postProcessWebhooksWithModels(WebhooksMap objs, List allModels) { + WebhooksMap map = super.postProcessWebhooksWithModels(objs, allModels); + flagVerbatimHttpMethods(map.getWebhooks().getOperation()); + return map; + } + @Override public OperationsMap postProcessOperationsWithModels(OperationsMap objs, List allModels) { objs = super.postProcessOperationsWithModels(objs, allModels); @@ -610,6 +668,7 @@ public OperationsMap postProcessOperationsWithModels(OperationsMap objs, List processedModelMaps = new HashMap<>(); List operationList = operations.getOperation(); + flagVerbatimHttpMethods(operationList); for (CodegenOperation op : operationList) { for (CodegenParameter p : op.allParams) { p.vendorExtensions.put("x-ruby-example", constructExampleCode(p, modelMaps, processedModelMaps)); diff --git a/modules/openapi-generator/src/main/resources/ruby-client/README.mustache b/modules/openapi-generator/src/main/resources/ruby-client/README.mustache index 5f5893469607..cf35a4289844 100644 --- a/modules/openapi-generator/src/main/resources/ruby-client/README.mustache +++ b/modules/openapi-generator/src/main/resources/ruby-client/README.mustache @@ -123,7 +123,7 @@ All URIs are relative to *{{basePath}}* Class | Method | HTTP request | Description ------------ | ------------- | ------------- | ------------- -{{#apiInfo}}{{#apis}}{{#operations}}{{#operation}}*{{moduleName}}::{{classname}}* | [**{{operationId}}**]({{apiDocPath}}{{classname}}.md#{{operationId}}) | **{{httpMethod}}** {{path}} | {{{summary}}} +{{#apiInfo}}{{#apis}}{{#operations}}{{#operation}}*{{moduleName}}::{{classname}}* | [**{{operationId}}**]({{apiDocPath}}{{classname}}.md#{{operationId}}) | **{{#vendorExtensions.x-ruby-http-method-doc}}{{{vendorExtensions.x-ruby-http-method-doc}}}{{/vendorExtensions.x-ruby-http-method-doc}}{{^vendorExtensions.x-ruby-http-method-doc}}{{httpMethod}}{{/vendorExtensions.x-ruby-http-method-doc}}** {{path}} | {{{summary}}} {{/operation}}{{/operations}}{{/apis}}{{/apiInfo}} ## Documentation for Models diff --git a/modules/openapi-generator/src/main/resources/ruby-client/api.mustache b/modules/openapi-generator/src/main/resources/ruby-client/api.mustache index 97f38c704126..1e1b964a6ee6 100644 --- a/modules/openapi-generator/src/main/resources/ruby-client/api.mustache +++ b/modules/openapi-generator/src/main/resources/ruby-client/api.mustache @@ -171,10 +171,22 @@ module {{moduleName}} {{/allParams}} # resource path local_var_path = '{{{path}}}'{{#pathParams}}.sub({{=<< >>=}}'{<>}'<<={{ }}=>>, CGI.escape({{paramName}}.to_s){{^strictSpecBehavior}}.gsub('%2F', '/'){{/strictSpecBehavior}}){{/pathParams}} + {{#allParams}} + {{#isQueryStringParam}} + {{#required}} + # OpenAPI 3.2 `in: querystring`: the value IS the query component, appended verbatim + local_var_path = local_var_path + (local_var_path.include?('?') ? '&' : '?') + {{{paramName}}}.to_s + {{/required}} + {{^required}} + local_var_path = local_var_path + (local_var_path.include?('?') ? '&' : '?') + opts[:'{{{paramName}}}'].to_s if !opts[:'{{{paramName}}}'].nil? + {{/required}} + {{/isQueryStringParam}} + {{/allParams}} # query parameters query_params = opts[:query_params] || {} {{#queryParams}} + {{^isQueryStringParam}} {{#required}} {{#queryIsJsonMimeType}} query_params[:'{{{baseName}}}'] = {{{paramName}}}.to_json @@ -183,8 +195,10 @@ module {{moduleName}} query_params[:'{{{baseName}}}'] = {{#collectionFormat}}@api_client.build_collection_param({{{paramName}}}, :{{{collectionFormat}}}){{/collectionFormat}}{{^collectionFormat}}{{{paramName}}}{{/collectionFormat}} {{/queryIsJsonMimeType}} {{/required}} + {{/isQueryStringParam}} {{/queryParams}} {{#queryParams}} + {{^isQueryStringParam}} {{^required}} {{#queryIsJsonMimeType}} query_params[:'{{{baseName}}}'] = opts[:'{{{paramName}}}'].to_json if !opts[:'{{{paramName}}}'].nil? @@ -193,6 +207,7 @@ module {{moduleName}} query_params[:'{{{baseName}}}'] = {{#collectionFormat}}@api_client.build_collection_param(opts[:'{{{paramName}}}'], :{{{collectionFormat}}}){{/collectionFormat}}{{^collectionFormat}}opts[:'{{{paramName}}}']{{/collectionFormat}} if !opts[:'{{{paramName}}}'].nil? {{/queryIsJsonMimeType}} {{/required}} + {{/isQueryStringParam}} {{/queryParams}} # header parameters @@ -251,7 +266,7 @@ module {{moduleName}} :return_type => return_type ) - data, status_code, headers = @api_client.call_api(:{{httpMethod}}, local_var_path, new_options) + data, status_code, headers = @api_client.call_api(:"{{{vendorExtensions.x-ruby-http-method-symbol}}}", local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: {{classname}}#{{operationId}}\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end diff --git a/modules/openapi-generator/src/main/resources/ruby-client/api_client_httpx_partial.mustache b/modules/openapi-generator/src/main/resources/ruby-client/api_client_httpx_partial.mustache index 7dd5221daccb..1f62ee6baabb 100644 --- a/modules/openapi-generator/src/main/resources/ruby-client/api_client_httpx_partial.mustache +++ b/modules/openapi-generator/src/main/resources/ruby-client/api_client_httpx_partial.mustache @@ -1,3 +1,7 @@ + # HTTP verbs that HTTPX emits through its normal (upper-cased) dispatch path. + # OpenAPI 3.2 query/additionalOperations verbs are handled verbatim below. + STANDARD_HTTP_METHODS = %w[GET POST PUT PATCH DELETE OPTIONS HEAD TRACE CONNECT].freeze + # Call an API with given options. # # @return [Array<(Object, Integer, Hash)>] an array of 3 elements: @@ -62,7 +66,18 @@ } req_opts.merge!(body_params) if body_params req_opts[:params] = query_params if query_params && !query_params.empty? - session.request(http_method, url, **req_opts) + if STANDARD_HTTP_METHODS.include?(http_method.to_s) + session.request(http_method, url, **req_opts) + else + # OpenAPI 3.2 (query/additionalOperations): emit the verb verbatim. + # NOTE: HTTPX::Request internally stores @verb = verb.to_s.upcase and @verb is + # only used when emitting the request line, so we restore it after building. + # This depends on HTTPX internals - if a future httpx release changes how the + # verb is stored/emitted, this needs revisiting. + request = session.build_request(http_method, url, req_opts) + request.instance_variable_set(:@verb, http_method.to_s) + session.request(request) + end end # Builds the HTTP request body diff --git a/modules/openapi-generator/src/main/resources/ruby-client/api_doc.mustache b/modules/openapi-generator/src/main/resources/ruby-client/api_doc.mustache index ab2e666e1eb9..ba466f8a4ae5 100644 --- a/modules/openapi-generator/src/main/resources/ruby-client/api_doc.mustache +++ b/modules/openapi-generator/src/main/resources/ruby-client/api_doc.mustache @@ -8,7 +8,7 @@ All URIs are relative to *{{basePath}}* | ------ | ------------ | ----------- | {{#operations}} {{#operation}} -| [**{{operationId}}**]({{classname}}.md#{{operationId}}) | **{{httpMethod}}** {{path}} | {{summary}} | +| [**{{operationId}}**]({{classname}}.md#{{operationId}}) | **{{#vendorExtensions.x-ruby-http-method-doc}}{{{vendorExtensions.x-ruby-http-method-doc}}}{{/vendorExtensions.x-ruby-http-method-doc}}{{^vendorExtensions.x-ruby-http-method-doc}}{{httpMethod}}{{/vendorExtensions.x-ruby-http-method-doc}}** {{path}} | {{summary}} | {{/operation}} {{/operations}} diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/ruby/RubyClientCodegenTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/ruby/RubyClientCodegenTest.java index ed256377bc80..e30c48bd9ea4 100644 --- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/ruby/RubyClientCodegenTest.java +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/ruby/RubyClientCodegenTest.java @@ -22,6 +22,7 @@ import io.swagger.v3.oas.models.media.Schema; import org.apache.commons.io.FileUtils; import org.openapitools.codegen.*; +import org.openapitools.codegen.config.CodegenConfigurator; import org.openapitools.codegen.languages.RubyClientCodegen; import org.openapitools.codegen.model.ModelMap; import org.openapitools.codegen.model.OperationMap; @@ -30,8 +31,10 @@ import org.testng.annotations.Test; import java.io.File; +import java.io.IOException; import java.nio.charset.StandardCharsets; import java.nio.file.Files; +import java.nio.file.Path; import java.util.*; import java.util.stream.Collectors; @@ -762,4 +765,176 @@ public void testQueryParamJsonSerializationSetsQueryIsJsonMimeType() { assertTrue(op.queryParams.stream().allMatch(p -> p.queryIsJsonMimeType), "All content:application/json query params should have queryIsJsonMimeType=true"); } + + @Test + public void testHttpxOpenApi32OperationsAndQueryStringParam() throws IOException { + Path target = Files.createTempDirectory("test"); + try { + final CodegenConfigurator configurator = new CodegenConfigurator() + .setGeneratorName("ruby") + .setLibrary("httpx") + .setInputSpec("src/test/resources/3_2/query-operation.yaml") + .setSkipOverwrite(false) + .setOutputDir(target.toAbsolutePath().toString().replace("\\", "/")); + new DefaultGenerator().opts(configurator.toClientOptInput()).generate(); + Path apiPath = target.resolve("lib/openapi_client/api/default_api.rb"); + TestUtils.assertFileExists(apiPath); + String generated = new String(Files.readAllBytes(apiPath), StandardCharsets.UTF_8); + // methods are emitted as quoted symbols so arbitrary tokens stay valid Ruby + for (String method : new String[]{"QUERY", "PURGE", "customMethod", "CHECK&FETCH"}) { + Assert.assertTrue(generated.contains("call_api(:\"" + method + "\""), + "expected verbatim symbol literal for " + method); + } + Assert.assertTrue(generated.contains("call_api(:\"GET\""), "standard method kept"); + // `#` must be escaped inside the :"..." literal or Ruby interpolates #$/#@/#{ + Assert.assertTrue(generated.contains("call_api(:\"X\\#Y\""), + "# in method token must be escaped in the symbol literal"); + // `in: querystring` appends verbatim with ?/& handling, not via query_params + Assert.assertTrue(generated.contains("+ qs.to_s"), + "querystring param should be appended verbatim"); + Assert.assertFalse(generated.contains("query_params[:'qs']"), + "querystring param must not be serialized as a name=value pair"); + Path clientPath = target.resolve("lib/openapi_client/api_client.rb"); + String client = new String(Files.readAllBytes(clientPath), StandardCharsets.UTF_8); + Assert.assertTrue(client.contains("instance_variable_set(:@verb, http_method.to_s)"), + "httpx verbatim verb path should be present"); + } finally { + FileUtils.deleteDirectory(target.toFile()); + } + } + + @Test + public void testTyphoeusSkipsOpenApi32Operations() throws IOException { + Path target = Files.createTempDirectory("test"); + try { + final CodegenConfigurator configurator = new CodegenConfigurator() + .setGeneratorName("ruby") + .setLibrary("typhoeus") + .setInputSpec("src/test/resources/3_2/query-operation.yaml") + .setSkipOverwrite(false) + .setOutputDir(target.toAbsolutePath().toString().replace("\\", "/")); + new DefaultGenerator().opts(configurator.toClientOptInput()).generate(); + Path apiPath = target.resolve("lib/openapi_client/api/default_api.rb"); + TestUtils.assertFileExists(apiPath); + String generated = new String(Files.readAllBytes(apiPath), StandardCharsets.UTF_8); + Assert.assertTrue(generated.contains("def list_pets"), "GET operation should be kept"); + for (String op : new String[]{"query_pets", "purge_pets", "custom_pets", "check_fetch_pets", "hash_pets"}) { + Assert.assertFalse(generated.contains("def " + op), + "typhoeus must skip unsupported 3.2 operation " + op); + } + } finally { + FileUtils.deleteDirectory(target.toFile()); + } + } + + @Test + public void testHttpxSkipsInvalidHttpMethodToken() throws IOException { + Path target = Files.createTempDirectory("test"); + try { + final CodegenConfigurator configurator = new CodegenConfigurator() + .setGeneratorName("ruby") + .setLibrary("httpx") + .setInputSpec("src/test/resources/3_2/rust-invalid-method.yaml") + .setSkipOverwrite(false) + .setOutputDir(target.toAbsolutePath().toString().replace("\\", "/")); + new DefaultGenerator().opts(configurator.toClientOptInput()).generate(); + Path apiPath = target.resolve("lib/openapi_client/api/default_api.rb"); + TestUtils.assertFileExists(apiPath); + String generated = new String(Files.readAllBytes(apiPath), StandardCharsets.UTF_8); + Assert.assertTrue(generated.contains("def list_pets"), "GET operation should be kept"); + Assert.assertFalse(generated.contains("bad_method"), + "invalid RFC 9110 method token must be skipped"); + } finally { + FileUtils.deleteDirectory(target.toFile()); + } + } + + @Test + public void testHttpxWebhookOperationsEmitVerbatimSymbols() throws IOException { + Path target = Files.createTempDirectory("test"); + try { + final CodegenConfigurator configurator = new CodegenConfigurator() + .setGeneratorName("ruby") + .setLibrary("httpx") + .setInputSpec("src/test/resources/3_2/go-webhook-operations.yaml") + .setSkipOverwrite(false) + .setOutputDir(target.toAbsolutePath().toString().replace("\\", "/")); + new DefaultGenerator().opts(configurator.toClientOptInput()).generate(); + // webhooks render through the same api.mustache; their non-standard + // methods must be symbol literals too, otherwise the verb is lost + Path apiPath = target.resolve("lib/openapi_client/api/default_api.rb"); + TestUtils.assertFileExists(apiPath); + String generated = new String(Files.readAllBytes(apiPath), StandardCharsets.UTF_8); + Assert.assertTrue(generated.contains("call_api(:\"QUERY\""), + "webhook query operation should emit a verbatim QUERY symbol"); + Assert.assertTrue(generated.contains("call_api(:\"customMethod\""), + "webhook additionalOperations should emit a verbatim symbol"); + Assert.assertFalse(generated.contains("call_api(:\"\""), + "no operation may emit an empty method symbol"); + } finally { + FileUtils.deleteDirectory(target.toFile()); + } + } + + /** + * End-to-end check: runs the generated httpx client with a raw TCP capture + * listener, verifying QUERY/additionalOperations methods and + * `in: querystring` reach the wire verbatim. Skipped when ruby or the httpx + * gem is unavailable. + */ + @Test + public void testHttpxGeneratedClientSendsVerbatimMethods() throws IOException, InterruptedException { + if (!isCommandAvailable("ruby", "--version")) { + throw new org.testng.SkipException("ruby is not on PATH; skipping generated-client verification"); + } + if (!isCommandAvailable("ruby", "-e", "require 'httpx'")) { + throw new org.testng.SkipException("httpx gem not installed; skipping generated-client verification"); + } + Path target = Files.createTempDirectory("ruby32-verify"); + try { + final CodegenConfigurator configurator = new CodegenConfigurator() + .setGeneratorName("ruby") + .setLibrary("httpx") + .setInputSpec("src/test/resources/3_2/query-operation.yaml") + .setSkipOverwrite(false) + .setOutputDir(target.toAbsolutePath().toString().replace("\\", "/")); + new DefaultGenerator().opts(configurator.toClientOptInput()).generate(); + + Path capture = target.resolve("capture.rb"); + Files.copy(Path.of("src/test/resources/3_2/ruby-httpx-capture/capture.rb"), capture); + + Process p = new ProcessBuilder("ruby", "capture.rb", + target.resolve("lib").toAbsolutePath().toString()) + .directory(target.toFile()) + .redirectErrorStream(true) + .start(); + boolean finished = p.waitFor(60, java.util.concurrent.TimeUnit.SECONDS); + if (!finished) { + p.destroyForcibly(); + } + String output = new String(p.getInputStream().readAllBytes(), StandardCharsets.UTF_8); + Assert.assertTrue(finished, "ruby capture timed out:\n" + output); + Assert.assertTrue(output.contains("CAPTURE-PASS"), + "generated client did not send verbatim 3.2 methods/querystring:\n" + output); + } finally { + FileUtils.deleteDirectory(target.toFile()); + } + } + + private boolean isCommandAvailable(String... command) { + try { + Process p = new ProcessBuilder(command) + .redirectErrorStream(true).start(); + // wait before draining: a child that never exits would otherwise block + // the stream read forever + if (!p.waitFor(10, java.util.concurrent.TimeUnit.SECONDS)) { + p.destroyForcibly(); + return false; + } + p.getInputStream().transferTo(java.io.OutputStream.nullOutputStream()); + return p.exitValue() == 0; + } catch (IOException | InterruptedException e) { + return false; + } + } } diff --git a/modules/openapi-generator/src/test/resources/3_2/query-operation.yaml b/modules/openapi-generator/src/test/resources/3_2/query-operation.yaml index def88f6699cb..d4644e5007ad 100644 --- a/modules/openapi-generator/src/test/resources/3_2/query-operation.yaml +++ b/modules/openapi-generator/src/test/resources/3_2/query-operation.yaml @@ -39,3 +39,9 @@ paths: responses: '204': description: done + # `#` is valid tchar but would trigger interpolation inside a Ruby :"..." literal + "X#Y": + operationId: hashPets + responses: + '204': + description: done diff --git a/modules/openapi-generator/src/test/resources/3_2/ruby-httpx-capture/capture.rb b/modules/openapi-generator/src/test/resources/3_2/ruby-httpx-capture/capture.rb new file mode 100644 index 000000000000..313b837f824f --- /dev/null +++ b/modules/openapi-generator/src/test/resources/3_2/ruby-httpx-capture/capture.rb @@ -0,0 +1,58 @@ +# frozen_string_literal: true + +# Wire-level verification harness for OpenAPI 3.2 support in the generated +# `ruby` (httpx) client. RubyClientCodegenTest copies this file into the +# generated client directory and runs it with `ruby capture.rb `. +# +# A raw TCP listener records the HTTP request line for every generated call: +# standard methods keep the normal HTTPX dispatch, while query/ +# additionalOperations methods and `in: querystring` parameters must reach the +# wire verbatim (no up-casing, no re-encoding). +$LOAD_PATH.unshift ARGV[0] || raise('usage: capture.rb ') + +require 'socket' +require 'openapi_client' + +server = TCPServer.new('127.0.0.1', 0) +port = server.addr[1] +lines = Queue.new +Thread.new do + loop do + s = server.accept + line = s.gets + lines << line + # consume request headers (no body in this fixture) + while (h = s.gets) && h != "\r\n"; end + s.write "HTTP/1.1 200 OK\r\nContent-Length: 2\r\nConnection: close\r\n\r\n{}" + s.close + end +end + +config = OpenapiClient::Configuration.new +config.host = "127.0.0.1:#{port}" +config.scheme = 'http' +config.debugging = false +api = OpenapiClient::DefaultApi.new(OpenapiClient::ApiClient.new(config)) + +# `in: querystring` callers pass the query component without the leading `?` +api.query_pets('a=1&b=%20x') +api.custom_pets +api.check_fetch_pets +api.purge_pets +api.hash_pets +api.list_pets + +expected = [ + 'QUERY /pets?a=1&b=%20x HTTP/1.1', + 'customMethod /pets HTTP/1.1', + 'CHECK&FETCH /pets HTTP/1.1', + 'PURGE /pets HTTP/1.1', + 'X#Y /pets HTTP/1.1', + 'GET /pets HTTP/1.1' +] +got = 6.times.map { lines.pop.strip } +got.each_with_index do |line, i| + warn("FAIL: got #{line.inspect}, want #{expected[i].inspect}") unless line == expected[i] +end +abort('CAPTURE-FAIL') unless got == expected +puts 'CAPTURE-PASS' diff --git a/samples/client/echo_api/ruby-faraday/lib/openapi_client/api/auth_api.rb b/samples/client/echo_api/ruby-faraday/lib/openapi_client/api/auth_api.rb index f4e8e985dfa4..d294bdc010b9 100644 --- a/samples/client/echo_api/ruby-faraday/lib/openapi_client/api/auth_api.rb +++ b/samples/client/echo_api/ruby-faraday/lib/openapi_client/api/auth_api.rb @@ -69,7 +69,7 @@ def test_auth_http_basic_with_http_info(opts = {}) :return_type => return_type ) - data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) + data, status_code, headers = @api_client.call_api(:"POST", local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: AuthApi#test_auth_http_basic\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end @@ -126,7 +126,7 @@ def test_auth_http_bearer_with_http_info(opts = {}) :return_type => return_type ) - data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) + data, status_code, headers = @api_client.call_api(:"POST", local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: AuthApi#test_auth_http_bearer\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end diff --git a/samples/client/echo_api/ruby-faraday/lib/openapi_client/api/body_api.rb b/samples/client/echo_api/ruby-faraday/lib/openapi_client/api/body_api.rb index 312d706b6553..975319c6a54c 100644 --- a/samples/client/echo_api/ruby-faraday/lib/openapi_client/api/body_api.rb +++ b/samples/client/echo_api/ruby-faraday/lib/openapi_client/api/body_api.rb @@ -69,7 +69,7 @@ def test_binary_gif_with_http_info(opts = {}) :return_type => return_type ) - data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) + data, status_code, headers = @api_client.call_api(:"POST", local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: BodyApi#test_binary_gif\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end @@ -133,7 +133,7 @@ def test_body_application_octetstream_binary_with_http_info(opts = {}) :return_type => return_type ) - data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) + data, status_code, headers = @api_client.call_api(:"POST", local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: BodyApi#test_body_application_octetstream_binary\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end @@ -202,7 +202,7 @@ def test_body_multipart_formdata_array_of_binary_with_http_info(files, opts = {} :return_type => return_type ) - data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) + data, status_code, headers = @api_client.call_api(:"POST", local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: BodyApi#test_body_multipart_formdata_array_of_binary\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end @@ -267,7 +267,7 @@ def test_body_multipart_formdata_single_binary_with_http_info(opts = {}) :return_type => return_type ) - data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) + data, status_code, headers = @api_client.call_api(:"POST", local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: BodyApi#test_body_multipart_formdata_single_binary\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end @@ -331,7 +331,7 @@ def test_echo_body_all_of_pet_with_http_info(opts = {}) :return_type => return_type ) - data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) + data, status_code, headers = @api_client.call_api(:"POST", local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: BodyApi#test_echo_body_all_of_pet\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end @@ -395,7 +395,7 @@ def test_echo_body_free_form_object_response_string_with_http_info(opts = {}) :return_type => return_type ) - data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) + data, status_code, headers = @api_client.call_api(:"POST", local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: BodyApi#test_echo_body_free_form_object_response_string\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end @@ -459,7 +459,7 @@ def test_echo_body_pet_with_http_info(opts = {}) :return_type => return_type ) - data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) + data, status_code, headers = @api_client.call_api(:"POST", local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: BodyApi#test_echo_body_pet\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end @@ -523,7 +523,7 @@ def test_echo_body_pet_response_string_with_http_info(opts = {}) :return_type => return_type ) - data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) + data, status_code, headers = @api_client.call_api(:"POST", local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: BodyApi#test_echo_body_pet_response_string\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end @@ -587,7 +587,7 @@ def test_echo_body_string_enum_with_http_info(opts = {}) :return_type => return_type ) - data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) + data, status_code, headers = @api_client.call_api(:"POST", local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: BodyApi#test_echo_body_string_enum\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end @@ -651,7 +651,7 @@ def test_echo_body_tag_response_string_with_http_info(opts = {}) :return_type => return_type ) - data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) + data, status_code, headers = @api_client.call_api(:"POST", local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: BodyApi#test_echo_body_tag_response_string\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end diff --git a/samples/client/echo_api/ruby-faraday/lib/openapi_client/api/form_api.rb b/samples/client/echo_api/ruby-faraday/lib/openapi_client/api/form_api.rb index 2911204232f1..514923d94385 100644 --- a/samples/client/echo_api/ruby-faraday/lib/openapi_client/api/form_api.rb +++ b/samples/client/echo_api/ruby-faraday/lib/openapi_client/api/form_api.rb @@ -83,7 +83,7 @@ def test_form_integer_boolean_string_with_http_info(opts = {}) :return_type => return_type ) - data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) + data, status_code, headers = @api_client.call_api(:"POST", local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: FormApi#test_form_integer_boolean_string\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end @@ -152,7 +152,7 @@ def test_form_object_multipart_with_http_info(marker, opts = {}) :return_type => return_type ) - data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) + data, status_code, headers = @api_client.call_api(:"POST", local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: FormApi#test_form_object_multipart\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end @@ -232,7 +232,7 @@ def test_form_oneof_with_http_info(opts = {}) :return_type => return_type ) - data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) + data, status_code, headers = @api_client.call_api(:"POST", local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: FormApi#test_form_oneof\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end diff --git a/samples/client/echo_api/ruby-faraday/lib/openapi_client/api/header_api.rb b/samples/client/echo_api/ruby-faraday/lib/openapi_client/api/header_api.rb index 603221d511f0..2d495a003231 100644 --- a/samples/client/echo_api/ruby-faraday/lib/openapi_client/api/header_api.rb +++ b/samples/client/echo_api/ruby-faraday/lib/openapi_client/api/header_api.rb @@ -88,7 +88,7 @@ def test_header_integer_boolean_string_enums_with_http_info(opts = {}) :return_type => return_type ) - data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) + data, status_code, headers = @api_client.call_api(:"GET", local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: HeaderApi#test_header_integer_boolean_string_enums\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end diff --git a/samples/client/echo_api/ruby-faraday/lib/openapi_client/api/path_api.rb b/samples/client/echo_api/ruby-faraday/lib/openapi_client/api/path_api.rb index d1d23df36ee2..da38bcfb087f 100644 --- a/samples/client/echo_api/ruby-faraday/lib/openapi_client/api/path_api.rb +++ b/samples/client/echo_api/ruby-faraday/lib/openapi_client/api/path_api.rb @@ -98,7 +98,7 @@ def tests_path_string_path_string_integer_path_integer_enum_nonref_string_path_e :return_type => return_type ) - data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) + data, status_code, headers = @api_client.call_api(:"GET", local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: PathApi#tests_path_string_path_string_integer_path_integer_enum_nonref_string_path_enum_ref_string_path\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end diff --git a/samples/client/echo_api/ruby-faraday/lib/openapi_client/api/query_api.rb b/samples/client/echo_api/ruby-faraday/lib/openapi_client/api/query_api.rb index 8fa0cc139cfb..2383448c0e5f 100644 --- a/samples/client/echo_api/ruby-faraday/lib/openapi_client/api/query_api.rb +++ b/samples/client/echo_api/ruby-faraday/lib/openapi_client/api/query_api.rb @@ -79,7 +79,7 @@ def test_enum_ref_string_with_http_info(opts = {}) :return_type => return_type ) - data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) + data, status_code, headers = @api_client.call_api(:"GET", local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: QueryApi#test_enum_ref_string\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end @@ -145,7 +145,7 @@ def test_query_datetime_date_string_with_http_info(opts = {}) :return_type => return_type ) - data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) + data, status_code, headers = @api_client.call_api(:"GET", local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: QueryApi#test_query_datetime_date_string\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end @@ -211,7 +211,7 @@ def test_query_integer_boolean_string_with_http_info(opts = {}) :return_type => return_type ) - data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) + data, status_code, headers = @api_client.call_api(:"GET", local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: QueryApi#test_query_integer_boolean_string\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end @@ -271,7 +271,7 @@ def test_query_style_deep_object_explode_true_object_with_http_info(opts = {}) :return_type => return_type ) - data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) + data, status_code, headers = @api_client.call_api(:"GET", local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: QueryApi#test_query_style_deep_object_explode_true_object\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end @@ -331,7 +331,7 @@ def test_query_style_deep_object_explode_true_object_all_of_with_http_info(opts :return_type => return_type ) - data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) + data, status_code, headers = @api_client.call_api(:"GET", local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: QueryApi#test_query_style_deep_object_explode_true_object_all_of\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end @@ -391,7 +391,7 @@ def test_query_style_form_explode_false_array_integer_with_http_info(opts = {}) :return_type => return_type ) - data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) + data, status_code, headers = @api_client.call_api(:"GET", local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: QueryApi#test_query_style_form_explode_false_array_integer\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end @@ -451,7 +451,7 @@ def test_query_style_form_explode_false_array_string_with_http_info(opts = {}) :return_type => return_type ) - data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) + data, status_code, headers = @api_client.call_api(:"GET", local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: QueryApi#test_query_style_form_explode_false_array_string\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end @@ -511,7 +511,7 @@ def test_query_style_form_explode_true_array_string_with_http_info(opts = {}) :return_type => return_type ) - data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) + data, status_code, headers = @api_client.call_api(:"GET", local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: QueryApi#test_query_style_form_explode_true_array_string\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end @@ -571,7 +571,7 @@ def test_query_style_form_explode_true_object_with_http_info(opts = {}) :return_type => return_type ) - data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) + data, status_code, headers = @api_client.call_api(:"GET", local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: QueryApi#test_query_style_form_explode_true_object\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end @@ -631,7 +631,7 @@ def test_query_style_form_explode_true_object_all_of_with_http_info(opts = {}) :return_type => return_type ) - data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) + data, status_code, headers = @api_client.call_api(:"GET", local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: QueryApi#test_query_style_form_explode_true_object_all_of\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end @@ -694,7 +694,7 @@ def test_query_style_json_serialization_object_with_http_info(opts = {}) :return_type => return_type ) - data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) + data, status_code, headers = @api_client.call_api(:"GET", local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: QueryApi#test_query_style_json_serialization_object\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end diff --git a/samples/client/echo_api/ruby-httpx/lib/openapi_client/api/auth_api.rb b/samples/client/echo_api/ruby-httpx/lib/openapi_client/api/auth_api.rb index f4e8e985dfa4..d294bdc010b9 100644 --- a/samples/client/echo_api/ruby-httpx/lib/openapi_client/api/auth_api.rb +++ b/samples/client/echo_api/ruby-httpx/lib/openapi_client/api/auth_api.rb @@ -69,7 +69,7 @@ def test_auth_http_basic_with_http_info(opts = {}) :return_type => return_type ) - data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) + data, status_code, headers = @api_client.call_api(:"POST", local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: AuthApi#test_auth_http_basic\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end @@ -126,7 +126,7 @@ def test_auth_http_bearer_with_http_info(opts = {}) :return_type => return_type ) - data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) + data, status_code, headers = @api_client.call_api(:"POST", local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: AuthApi#test_auth_http_bearer\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end diff --git a/samples/client/echo_api/ruby-httpx/lib/openapi_client/api/body_api.rb b/samples/client/echo_api/ruby-httpx/lib/openapi_client/api/body_api.rb index 312d706b6553..975319c6a54c 100644 --- a/samples/client/echo_api/ruby-httpx/lib/openapi_client/api/body_api.rb +++ b/samples/client/echo_api/ruby-httpx/lib/openapi_client/api/body_api.rb @@ -69,7 +69,7 @@ def test_binary_gif_with_http_info(opts = {}) :return_type => return_type ) - data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) + data, status_code, headers = @api_client.call_api(:"POST", local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: BodyApi#test_binary_gif\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end @@ -133,7 +133,7 @@ def test_body_application_octetstream_binary_with_http_info(opts = {}) :return_type => return_type ) - data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) + data, status_code, headers = @api_client.call_api(:"POST", local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: BodyApi#test_body_application_octetstream_binary\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end @@ -202,7 +202,7 @@ def test_body_multipart_formdata_array_of_binary_with_http_info(files, opts = {} :return_type => return_type ) - data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) + data, status_code, headers = @api_client.call_api(:"POST", local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: BodyApi#test_body_multipart_formdata_array_of_binary\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end @@ -267,7 +267,7 @@ def test_body_multipart_formdata_single_binary_with_http_info(opts = {}) :return_type => return_type ) - data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) + data, status_code, headers = @api_client.call_api(:"POST", local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: BodyApi#test_body_multipart_formdata_single_binary\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end @@ -331,7 +331,7 @@ def test_echo_body_all_of_pet_with_http_info(opts = {}) :return_type => return_type ) - data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) + data, status_code, headers = @api_client.call_api(:"POST", local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: BodyApi#test_echo_body_all_of_pet\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end @@ -395,7 +395,7 @@ def test_echo_body_free_form_object_response_string_with_http_info(opts = {}) :return_type => return_type ) - data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) + data, status_code, headers = @api_client.call_api(:"POST", local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: BodyApi#test_echo_body_free_form_object_response_string\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end @@ -459,7 +459,7 @@ def test_echo_body_pet_with_http_info(opts = {}) :return_type => return_type ) - data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) + data, status_code, headers = @api_client.call_api(:"POST", local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: BodyApi#test_echo_body_pet\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end @@ -523,7 +523,7 @@ def test_echo_body_pet_response_string_with_http_info(opts = {}) :return_type => return_type ) - data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) + data, status_code, headers = @api_client.call_api(:"POST", local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: BodyApi#test_echo_body_pet_response_string\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end @@ -587,7 +587,7 @@ def test_echo_body_string_enum_with_http_info(opts = {}) :return_type => return_type ) - data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) + data, status_code, headers = @api_client.call_api(:"POST", local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: BodyApi#test_echo_body_string_enum\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end @@ -651,7 +651,7 @@ def test_echo_body_tag_response_string_with_http_info(opts = {}) :return_type => return_type ) - data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) + data, status_code, headers = @api_client.call_api(:"POST", local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: BodyApi#test_echo_body_tag_response_string\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end diff --git a/samples/client/echo_api/ruby-httpx/lib/openapi_client/api/form_api.rb b/samples/client/echo_api/ruby-httpx/lib/openapi_client/api/form_api.rb index 2911204232f1..514923d94385 100644 --- a/samples/client/echo_api/ruby-httpx/lib/openapi_client/api/form_api.rb +++ b/samples/client/echo_api/ruby-httpx/lib/openapi_client/api/form_api.rb @@ -83,7 +83,7 @@ def test_form_integer_boolean_string_with_http_info(opts = {}) :return_type => return_type ) - data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) + data, status_code, headers = @api_client.call_api(:"POST", local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: FormApi#test_form_integer_boolean_string\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end @@ -152,7 +152,7 @@ def test_form_object_multipart_with_http_info(marker, opts = {}) :return_type => return_type ) - data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) + data, status_code, headers = @api_client.call_api(:"POST", local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: FormApi#test_form_object_multipart\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end @@ -232,7 +232,7 @@ def test_form_oneof_with_http_info(opts = {}) :return_type => return_type ) - data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) + data, status_code, headers = @api_client.call_api(:"POST", local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: FormApi#test_form_oneof\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end diff --git a/samples/client/echo_api/ruby-httpx/lib/openapi_client/api/header_api.rb b/samples/client/echo_api/ruby-httpx/lib/openapi_client/api/header_api.rb index 603221d511f0..2d495a003231 100644 --- a/samples/client/echo_api/ruby-httpx/lib/openapi_client/api/header_api.rb +++ b/samples/client/echo_api/ruby-httpx/lib/openapi_client/api/header_api.rb @@ -88,7 +88,7 @@ def test_header_integer_boolean_string_enums_with_http_info(opts = {}) :return_type => return_type ) - data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) + data, status_code, headers = @api_client.call_api(:"GET", local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: HeaderApi#test_header_integer_boolean_string_enums\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end diff --git a/samples/client/echo_api/ruby-httpx/lib/openapi_client/api/path_api.rb b/samples/client/echo_api/ruby-httpx/lib/openapi_client/api/path_api.rb index d1d23df36ee2..da38bcfb087f 100644 --- a/samples/client/echo_api/ruby-httpx/lib/openapi_client/api/path_api.rb +++ b/samples/client/echo_api/ruby-httpx/lib/openapi_client/api/path_api.rb @@ -98,7 +98,7 @@ def tests_path_string_path_string_integer_path_integer_enum_nonref_string_path_e :return_type => return_type ) - data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) + data, status_code, headers = @api_client.call_api(:"GET", local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: PathApi#tests_path_string_path_string_integer_path_integer_enum_nonref_string_path_enum_ref_string_path\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end diff --git a/samples/client/echo_api/ruby-httpx/lib/openapi_client/api/query_api.rb b/samples/client/echo_api/ruby-httpx/lib/openapi_client/api/query_api.rb index 8fa0cc139cfb..2383448c0e5f 100644 --- a/samples/client/echo_api/ruby-httpx/lib/openapi_client/api/query_api.rb +++ b/samples/client/echo_api/ruby-httpx/lib/openapi_client/api/query_api.rb @@ -79,7 +79,7 @@ def test_enum_ref_string_with_http_info(opts = {}) :return_type => return_type ) - data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) + data, status_code, headers = @api_client.call_api(:"GET", local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: QueryApi#test_enum_ref_string\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end @@ -145,7 +145,7 @@ def test_query_datetime_date_string_with_http_info(opts = {}) :return_type => return_type ) - data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) + data, status_code, headers = @api_client.call_api(:"GET", local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: QueryApi#test_query_datetime_date_string\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end @@ -211,7 +211,7 @@ def test_query_integer_boolean_string_with_http_info(opts = {}) :return_type => return_type ) - data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) + data, status_code, headers = @api_client.call_api(:"GET", local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: QueryApi#test_query_integer_boolean_string\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end @@ -271,7 +271,7 @@ def test_query_style_deep_object_explode_true_object_with_http_info(opts = {}) :return_type => return_type ) - data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) + data, status_code, headers = @api_client.call_api(:"GET", local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: QueryApi#test_query_style_deep_object_explode_true_object\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end @@ -331,7 +331,7 @@ def test_query_style_deep_object_explode_true_object_all_of_with_http_info(opts :return_type => return_type ) - data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) + data, status_code, headers = @api_client.call_api(:"GET", local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: QueryApi#test_query_style_deep_object_explode_true_object_all_of\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end @@ -391,7 +391,7 @@ def test_query_style_form_explode_false_array_integer_with_http_info(opts = {}) :return_type => return_type ) - data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) + data, status_code, headers = @api_client.call_api(:"GET", local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: QueryApi#test_query_style_form_explode_false_array_integer\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end @@ -451,7 +451,7 @@ def test_query_style_form_explode_false_array_string_with_http_info(opts = {}) :return_type => return_type ) - data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) + data, status_code, headers = @api_client.call_api(:"GET", local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: QueryApi#test_query_style_form_explode_false_array_string\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end @@ -511,7 +511,7 @@ def test_query_style_form_explode_true_array_string_with_http_info(opts = {}) :return_type => return_type ) - data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) + data, status_code, headers = @api_client.call_api(:"GET", local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: QueryApi#test_query_style_form_explode_true_array_string\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end @@ -571,7 +571,7 @@ def test_query_style_form_explode_true_object_with_http_info(opts = {}) :return_type => return_type ) - data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) + data, status_code, headers = @api_client.call_api(:"GET", local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: QueryApi#test_query_style_form_explode_true_object\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end @@ -631,7 +631,7 @@ def test_query_style_form_explode_true_object_all_of_with_http_info(opts = {}) :return_type => return_type ) - data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) + data, status_code, headers = @api_client.call_api(:"GET", local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: QueryApi#test_query_style_form_explode_true_object_all_of\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end @@ -694,7 +694,7 @@ def test_query_style_json_serialization_object_with_http_info(opts = {}) :return_type => return_type ) - data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) + data, status_code, headers = @api_client.call_api(:"GET", local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: QueryApi#test_query_style_json_serialization_object\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end diff --git a/samples/client/echo_api/ruby-httpx/lib/openapi_client/api_client.rb b/samples/client/echo_api/ruby-httpx/lib/openapi_client/api_client.rb index 145b30df0f8e..bdb14dc06a52 100644 --- a/samples/client/echo_api/ruby-httpx/lib/openapi_client/api_client.rb +++ b/samples/client/echo_api/ruby-httpx/lib/openapi_client/api_client.rb @@ -44,6 +44,10 @@ def self.default @@default ||= ApiClient.new end + # HTTP verbs that HTTPX emits through its normal (upper-cased) dispatch path. + # OpenAPI 3.2 query/additionalOperations verbs are handled verbatim below. + STANDARD_HTTP_METHODS = %w[GET POST PUT PATCH DELETE OPTIONS HEAD TRACE CONNECT].freeze + # Call an API with given options. # # @return [Array<(Object, Integer, Hash)>] an array of 3 elements: @@ -108,7 +112,18 @@ def build_request(http_method, path, opts = {}) } req_opts.merge!(body_params) if body_params req_opts[:params] = query_params if query_params && !query_params.empty? - session.request(http_method, url, **req_opts) + if STANDARD_HTTP_METHODS.include?(http_method.to_s) + session.request(http_method, url, **req_opts) + else + # OpenAPI 3.2 (query/additionalOperations): emit the verb verbatim. + # NOTE: HTTPX::Request internally stores @verb = verb.to_s.upcase and @verb is + # only used when emitting the request line, so we restore it after building. + # This depends on HTTPX internals - if a future httpx release changes how the + # verb is stored/emitted, this needs revisiting. + request = session.build_request(http_method, url, req_opts) + request.instance_variable_set(:@verb, http_method.to_s) + session.request(request) + end end # Builds the HTTP request body diff --git a/samples/client/echo_api/ruby-typhoeus/lib/openapi_client/api/auth_api.rb b/samples/client/echo_api/ruby-typhoeus/lib/openapi_client/api/auth_api.rb index f4e8e985dfa4..d294bdc010b9 100644 --- a/samples/client/echo_api/ruby-typhoeus/lib/openapi_client/api/auth_api.rb +++ b/samples/client/echo_api/ruby-typhoeus/lib/openapi_client/api/auth_api.rb @@ -69,7 +69,7 @@ def test_auth_http_basic_with_http_info(opts = {}) :return_type => return_type ) - data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) + data, status_code, headers = @api_client.call_api(:"POST", local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: AuthApi#test_auth_http_basic\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end @@ -126,7 +126,7 @@ def test_auth_http_bearer_with_http_info(opts = {}) :return_type => return_type ) - data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) + data, status_code, headers = @api_client.call_api(:"POST", local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: AuthApi#test_auth_http_bearer\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end diff --git a/samples/client/echo_api/ruby-typhoeus/lib/openapi_client/api/body_api.rb b/samples/client/echo_api/ruby-typhoeus/lib/openapi_client/api/body_api.rb index 312d706b6553..975319c6a54c 100644 --- a/samples/client/echo_api/ruby-typhoeus/lib/openapi_client/api/body_api.rb +++ b/samples/client/echo_api/ruby-typhoeus/lib/openapi_client/api/body_api.rb @@ -69,7 +69,7 @@ def test_binary_gif_with_http_info(opts = {}) :return_type => return_type ) - data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) + data, status_code, headers = @api_client.call_api(:"POST", local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: BodyApi#test_binary_gif\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end @@ -133,7 +133,7 @@ def test_body_application_octetstream_binary_with_http_info(opts = {}) :return_type => return_type ) - data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) + data, status_code, headers = @api_client.call_api(:"POST", local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: BodyApi#test_body_application_octetstream_binary\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end @@ -202,7 +202,7 @@ def test_body_multipart_formdata_array_of_binary_with_http_info(files, opts = {} :return_type => return_type ) - data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) + data, status_code, headers = @api_client.call_api(:"POST", local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: BodyApi#test_body_multipart_formdata_array_of_binary\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end @@ -267,7 +267,7 @@ def test_body_multipart_formdata_single_binary_with_http_info(opts = {}) :return_type => return_type ) - data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) + data, status_code, headers = @api_client.call_api(:"POST", local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: BodyApi#test_body_multipart_formdata_single_binary\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end @@ -331,7 +331,7 @@ def test_echo_body_all_of_pet_with_http_info(opts = {}) :return_type => return_type ) - data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) + data, status_code, headers = @api_client.call_api(:"POST", local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: BodyApi#test_echo_body_all_of_pet\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end @@ -395,7 +395,7 @@ def test_echo_body_free_form_object_response_string_with_http_info(opts = {}) :return_type => return_type ) - data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) + data, status_code, headers = @api_client.call_api(:"POST", local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: BodyApi#test_echo_body_free_form_object_response_string\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end @@ -459,7 +459,7 @@ def test_echo_body_pet_with_http_info(opts = {}) :return_type => return_type ) - data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) + data, status_code, headers = @api_client.call_api(:"POST", local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: BodyApi#test_echo_body_pet\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end @@ -523,7 +523,7 @@ def test_echo_body_pet_response_string_with_http_info(opts = {}) :return_type => return_type ) - data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) + data, status_code, headers = @api_client.call_api(:"POST", local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: BodyApi#test_echo_body_pet_response_string\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end @@ -587,7 +587,7 @@ def test_echo_body_string_enum_with_http_info(opts = {}) :return_type => return_type ) - data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) + data, status_code, headers = @api_client.call_api(:"POST", local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: BodyApi#test_echo_body_string_enum\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end @@ -651,7 +651,7 @@ def test_echo_body_tag_response_string_with_http_info(opts = {}) :return_type => return_type ) - data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) + data, status_code, headers = @api_client.call_api(:"POST", local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: BodyApi#test_echo_body_tag_response_string\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end diff --git a/samples/client/echo_api/ruby-typhoeus/lib/openapi_client/api/form_api.rb b/samples/client/echo_api/ruby-typhoeus/lib/openapi_client/api/form_api.rb index 2911204232f1..514923d94385 100644 --- a/samples/client/echo_api/ruby-typhoeus/lib/openapi_client/api/form_api.rb +++ b/samples/client/echo_api/ruby-typhoeus/lib/openapi_client/api/form_api.rb @@ -83,7 +83,7 @@ def test_form_integer_boolean_string_with_http_info(opts = {}) :return_type => return_type ) - data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) + data, status_code, headers = @api_client.call_api(:"POST", local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: FormApi#test_form_integer_boolean_string\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end @@ -152,7 +152,7 @@ def test_form_object_multipart_with_http_info(marker, opts = {}) :return_type => return_type ) - data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) + data, status_code, headers = @api_client.call_api(:"POST", local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: FormApi#test_form_object_multipart\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end @@ -232,7 +232,7 @@ def test_form_oneof_with_http_info(opts = {}) :return_type => return_type ) - data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) + data, status_code, headers = @api_client.call_api(:"POST", local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: FormApi#test_form_oneof\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end diff --git a/samples/client/echo_api/ruby-typhoeus/lib/openapi_client/api/header_api.rb b/samples/client/echo_api/ruby-typhoeus/lib/openapi_client/api/header_api.rb index 603221d511f0..2d495a003231 100644 --- a/samples/client/echo_api/ruby-typhoeus/lib/openapi_client/api/header_api.rb +++ b/samples/client/echo_api/ruby-typhoeus/lib/openapi_client/api/header_api.rb @@ -88,7 +88,7 @@ def test_header_integer_boolean_string_enums_with_http_info(opts = {}) :return_type => return_type ) - data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) + data, status_code, headers = @api_client.call_api(:"GET", local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: HeaderApi#test_header_integer_boolean_string_enums\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end diff --git a/samples/client/echo_api/ruby-typhoeus/lib/openapi_client/api/path_api.rb b/samples/client/echo_api/ruby-typhoeus/lib/openapi_client/api/path_api.rb index d1d23df36ee2..da38bcfb087f 100644 --- a/samples/client/echo_api/ruby-typhoeus/lib/openapi_client/api/path_api.rb +++ b/samples/client/echo_api/ruby-typhoeus/lib/openapi_client/api/path_api.rb @@ -98,7 +98,7 @@ def tests_path_string_path_string_integer_path_integer_enum_nonref_string_path_e :return_type => return_type ) - data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) + data, status_code, headers = @api_client.call_api(:"GET", local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: PathApi#tests_path_string_path_string_integer_path_integer_enum_nonref_string_path_enum_ref_string_path\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end diff --git a/samples/client/echo_api/ruby-typhoeus/lib/openapi_client/api/query_api.rb b/samples/client/echo_api/ruby-typhoeus/lib/openapi_client/api/query_api.rb index 8fa0cc139cfb..2383448c0e5f 100644 --- a/samples/client/echo_api/ruby-typhoeus/lib/openapi_client/api/query_api.rb +++ b/samples/client/echo_api/ruby-typhoeus/lib/openapi_client/api/query_api.rb @@ -79,7 +79,7 @@ def test_enum_ref_string_with_http_info(opts = {}) :return_type => return_type ) - data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) + data, status_code, headers = @api_client.call_api(:"GET", local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: QueryApi#test_enum_ref_string\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end @@ -145,7 +145,7 @@ def test_query_datetime_date_string_with_http_info(opts = {}) :return_type => return_type ) - data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) + data, status_code, headers = @api_client.call_api(:"GET", local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: QueryApi#test_query_datetime_date_string\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end @@ -211,7 +211,7 @@ def test_query_integer_boolean_string_with_http_info(opts = {}) :return_type => return_type ) - data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) + data, status_code, headers = @api_client.call_api(:"GET", local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: QueryApi#test_query_integer_boolean_string\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end @@ -271,7 +271,7 @@ def test_query_style_deep_object_explode_true_object_with_http_info(opts = {}) :return_type => return_type ) - data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) + data, status_code, headers = @api_client.call_api(:"GET", local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: QueryApi#test_query_style_deep_object_explode_true_object\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end @@ -331,7 +331,7 @@ def test_query_style_deep_object_explode_true_object_all_of_with_http_info(opts :return_type => return_type ) - data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) + data, status_code, headers = @api_client.call_api(:"GET", local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: QueryApi#test_query_style_deep_object_explode_true_object_all_of\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end @@ -391,7 +391,7 @@ def test_query_style_form_explode_false_array_integer_with_http_info(opts = {}) :return_type => return_type ) - data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) + data, status_code, headers = @api_client.call_api(:"GET", local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: QueryApi#test_query_style_form_explode_false_array_integer\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end @@ -451,7 +451,7 @@ def test_query_style_form_explode_false_array_string_with_http_info(opts = {}) :return_type => return_type ) - data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) + data, status_code, headers = @api_client.call_api(:"GET", local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: QueryApi#test_query_style_form_explode_false_array_string\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end @@ -511,7 +511,7 @@ def test_query_style_form_explode_true_array_string_with_http_info(opts = {}) :return_type => return_type ) - data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) + data, status_code, headers = @api_client.call_api(:"GET", local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: QueryApi#test_query_style_form_explode_true_array_string\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end @@ -571,7 +571,7 @@ def test_query_style_form_explode_true_object_with_http_info(opts = {}) :return_type => return_type ) - data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) + data, status_code, headers = @api_client.call_api(:"GET", local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: QueryApi#test_query_style_form_explode_true_object\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end @@ -631,7 +631,7 @@ def test_query_style_form_explode_true_object_all_of_with_http_info(opts = {}) :return_type => return_type ) - data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) + data, status_code, headers = @api_client.call_api(:"GET", local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: QueryApi#test_query_style_form_explode_true_object_all_of\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end @@ -694,7 +694,7 @@ def test_query_style_json_serialization_object_with_http_info(opts = {}) :return_type => return_type ) - data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) + data, status_code, headers = @api_client.call_api(:"GET", local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: QueryApi#test_query_style_json_serialization_object\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end diff --git a/samples/client/petstore/ruby-autoload/lib/petstore/api/another_fake_api.rb b/samples/client/petstore/ruby-autoload/lib/petstore/api/another_fake_api.rb index 88be97e7995d..cbc2843866bf 100644 --- a/samples/client/petstore/ruby-autoload/lib/petstore/api/another_fake_api.rb +++ b/samples/client/petstore/ruby-autoload/lib/petstore/api/another_fake_api.rb @@ -80,7 +80,7 @@ def call_123_test_special_tags_with_http_info(client, opts = {}) :return_type => return_type ) - data, status_code, headers = @api_client.call_api(:PATCH, local_var_path, new_options) + data, status_code, headers = @api_client.call_api(:"PATCH", local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: AnotherFakeApi#call_123_test_special_tags\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end diff --git a/samples/client/petstore/ruby-autoload/lib/petstore/api/default_api.rb b/samples/client/petstore/ruby-autoload/lib/petstore/api/default_api.rb index 149ce403c232..eb2a9d6edb17 100644 --- a/samples/client/petstore/ruby-autoload/lib/petstore/api/default_api.rb +++ b/samples/client/petstore/ruby-autoload/lib/petstore/api/default_api.rb @@ -65,7 +65,7 @@ def foo_get_with_http_info(opts = {}) :return_type => return_type ) - data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) + data, status_code, headers = @api_client.call_api(:"GET", local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: DefaultApi#foo_get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end diff --git a/samples/client/petstore/ruby-autoload/lib/petstore/api/fake_api.rb b/samples/client/petstore/ruby-autoload/lib/petstore/api/fake_api.rb index a46c90375e88..14c4851096b3 100644 --- a/samples/client/petstore/ruby-autoload/lib/petstore/api/fake_api.rb +++ b/samples/client/petstore/ruby-autoload/lib/petstore/api/fake_api.rb @@ -67,7 +67,7 @@ def fake_big_decimal_map_with_http_info(opts = {}) :return_type => return_type ) - data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) + data, status_code, headers = @api_client.call_api(:"GET", local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: FakeApi#fake_big_decimal_map\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end @@ -122,7 +122,7 @@ def fake_health_get_with_http_info(opts = {}) :return_type => return_type ) - data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) + data, status_code, headers = @api_client.call_api(:"GET", local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: FakeApi#fake_health_get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end @@ -192,7 +192,7 @@ def fake_http_signature_test_with_http_info(pet, opts = {}) :return_type => return_type ) - data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) + data, status_code, headers = @api_client.call_api(:"GET", local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: FakeApi#fake_http_signature_test\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end @@ -254,7 +254,7 @@ def fake_outer_boolean_serialize_with_http_info(opts = {}) :return_type => return_type ) - data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) + data, status_code, headers = @api_client.call_api(:"POST", local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: FakeApi#fake_outer_boolean_serialize\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end @@ -316,7 +316,7 @@ def fake_outer_composite_serialize_with_http_info(opts = {}) :return_type => return_type ) - data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) + data, status_code, headers = @api_client.call_api(:"POST", local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: FakeApi#fake_outer_composite_serialize\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end @@ -378,7 +378,7 @@ def fake_outer_number_serialize_with_http_info(opts = {}) :return_type => return_type ) - data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) + data, status_code, headers = @api_client.call_api(:"POST", local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: FakeApi#fake_outer_number_serialize\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end @@ -440,7 +440,7 @@ def fake_outer_string_serialize_with_http_info(opts = {}) :return_type => return_type ) - data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) + data, status_code, headers = @api_client.call_api(:"POST", local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: FakeApi#fake_outer_string_serialize\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end @@ -506,7 +506,7 @@ def fake_property_enum_integer_serialize_with_http_info(outer_object_with_enum_p :return_type => return_type ) - data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) + data, status_code, headers = @api_client.call_api(:"POST", local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: FakeApi#fake_property_enum_integer_serialize\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end @@ -572,7 +572,7 @@ def test_additional_properties_reference_with_http_info(request_body, opts = {}) :return_type => return_type ) - data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) + data, status_code, headers = @api_client.call_api(:"POST", local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: FakeApi#test_additional_properties_reference\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end @@ -632,7 +632,7 @@ def test_body_with_binary_with_http_info(body, opts = {}) :return_type => return_type ) - data, status_code, headers = @api_client.call_api(:PUT, local_var_path, new_options) + data, status_code, headers = @api_client.call_api(:"PUT", local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: FakeApi#test_body_with_binary\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end @@ -696,7 +696,7 @@ def test_body_with_file_schema_with_http_info(file_schema_test_class, opts = {}) :return_type => return_type ) - data, status_code, headers = @api_client.call_api(:PUT, local_var_path, new_options) + data, status_code, headers = @api_client.call_api(:"PUT", local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: FakeApi#test_body_with_file_schema\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end @@ -765,7 +765,7 @@ def test_body_with_query_params_with_http_info(query, user, opts = {}) :return_type => return_type ) - data, status_code, headers = @api_client.call_api(:PUT, local_var_path, new_options) + data, status_code, headers = @api_client.call_api(:"PUT", local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: FakeApi#test_body_with_query_params\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end @@ -833,7 +833,7 @@ def test_client_model_with_http_info(client, opts = {}) :return_type => return_type ) - data, status_code, headers = @api_client.call_api(:PATCH, local_var_path, new_options) + data, status_code, headers = @api_client.call_api(:"PATCH", local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: FakeApi#test_client_model\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end @@ -1005,7 +1005,7 @@ def test_endpoint_parameters_with_http_info(number, double, pattern_without_deli :return_type => return_type ) - data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) + data, status_code, headers = @api_client.call_api(:"POST", local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: FakeApi#test_endpoint_parameters\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end @@ -1124,7 +1124,7 @@ def test_enum_parameters_with_http_info(opts = {}) :return_type => return_type ) - data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) + data, status_code, headers = @api_client.call_api(:"GET", local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: FakeApi#test_enum_parameters\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end @@ -1213,7 +1213,7 @@ def test_group_parameters_with_http_info(opts = {}) :return_type => return_type ) - data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options) + data, status_code, headers = @api_client.call_api(:"DELETE", local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: FakeApi#test_group_parameters\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end @@ -1279,7 +1279,7 @@ def test_inline_additional_properties_with_http_info(request_body, opts = {}) :return_type => return_type ) - data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) + data, status_code, headers = @api_client.call_api(:"POST", local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: FakeApi#test_inline_additional_properties\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end @@ -1345,7 +1345,7 @@ def test_inline_freeform_additional_properties_with_http_info(test_inline_freefo :return_type => return_type ) - data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) + data, status_code, headers = @api_client.call_api(:"POST", local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: FakeApi#test_inline_freeform_additional_properties\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end @@ -1419,7 +1419,7 @@ def test_json_form_data_with_http_info(param, param2, opts = {}) :return_type => return_type ) - data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) + data, status_code, headers = @api_client.call_api(:"GET", local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: FakeApi#test_json_form_data\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end @@ -1485,7 +1485,7 @@ def test_nullable_with_http_info(child_with_nullable, opts = {}) :return_type => return_type ) - data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) + data, status_code, headers = @api_client.call_api(:"POST", local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: FakeApi#test_nullable\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end @@ -1583,7 +1583,7 @@ def test_query_parameter_collection_format_with_http_info(pipe, ioutil, http, ur :return_type => return_type ) - data, status_code, headers = @api_client.call_api(:PUT, local_var_path, new_options) + data, status_code, headers = @api_client.call_api(:"PUT", local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: FakeApi#test_query_parameter_collection_format\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end @@ -1649,7 +1649,7 @@ def test_string_map_reference_with_http_info(request_body, opts = {}) :return_type => return_type ) - data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) + data, status_code, headers = @api_client.call_api(:"POST", local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: FakeApi#test_string_map_reference\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end diff --git a/samples/client/petstore/ruby-autoload/lib/petstore/api/fake_classname_tags123_api.rb b/samples/client/petstore/ruby-autoload/lib/petstore/api/fake_classname_tags123_api.rb index 50f0c12d88b2..93509f82bd33 100644 --- a/samples/client/petstore/ruby-autoload/lib/petstore/api/fake_classname_tags123_api.rb +++ b/samples/client/petstore/ruby-autoload/lib/petstore/api/fake_classname_tags123_api.rb @@ -80,7 +80,7 @@ def test_classname_with_http_info(client, opts = {}) :return_type => return_type ) - data, status_code, headers = @api_client.call_api(:PATCH, local_var_path, new_options) + data, status_code, headers = @api_client.call_api(:"PATCH", local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: FakeClassnameTags123Api#test_classname\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end diff --git a/samples/client/petstore/ruby-autoload/lib/petstore/api/pet_api.rb b/samples/client/petstore/ruby-autoload/lib/petstore/api/pet_api.rb index 2448e4f6e815..4665efaa210d 100644 --- a/samples/client/petstore/ruby-autoload/lib/petstore/api/pet_api.rb +++ b/samples/client/petstore/ruby-autoload/lib/petstore/api/pet_api.rb @@ -78,7 +78,7 @@ def add_pet_with_http_info(pet, opts = {}) :return_type => return_type ) - data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) + data, status_code, headers = @api_client.call_api(:"POST", local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: PetApi#add_pet\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end @@ -142,7 +142,7 @@ def delete_pet_with_http_info(pet_id, opts = {}) :return_type => return_type ) - data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options) + data, status_code, headers = @api_client.call_api(:"DELETE", local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: PetApi#delete_pet\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end @@ -206,7 +206,7 @@ def find_pets_by_status_with_http_info(status, opts = {}) :return_type => return_type ) - data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) + data, status_code, headers = @api_client.call_api(:"GET", local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: PetApi#find_pets_by_status\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end @@ -270,7 +270,7 @@ def find_pets_by_tags_with_http_info(tags, opts = {}) :return_type => return_type ) - data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) + data, status_code, headers = @api_client.call_api(:"GET", local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: PetApi#find_pets_by_tags\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end @@ -333,7 +333,7 @@ def get_pet_by_id_with_http_info(pet_id, opts = {}) :return_type => return_type ) - data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) + data, status_code, headers = @api_client.call_api(:"GET", local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: PetApi#get_pet_by_id\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end @@ -399,7 +399,7 @@ def update_pet_with_http_info(pet, opts = {}) :return_type => return_type ) - data, status_code, headers = @api_client.call_api(:PUT, local_var_path, new_options) + data, status_code, headers = @api_client.call_api(:"PUT", local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: PetApi#update_pet\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end @@ -471,7 +471,7 @@ def update_pet_with_form_with_http_info(pet_id, opts = {}) :return_type => return_type ) - data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) + data, status_code, headers = @api_client.call_api(:"POST", local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: PetApi#update_pet_with_form\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end @@ -545,7 +545,7 @@ def upload_file_with_http_info(pet_id, opts = {}) :return_type => return_type ) - data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) + data, status_code, headers = @api_client.call_api(:"POST", local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: PetApi#upload_file\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end @@ -623,7 +623,7 @@ def upload_file_with_required_file_with_http_info(pet_id, required_file, opts = :return_type => return_type ) - data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) + data, status_code, headers = @api_client.call_api(:"POST", local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: PetApi#upload_file_with_required_file\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end diff --git a/samples/client/petstore/ruby-autoload/lib/petstore/api/store_api.rb b/samples/client/petstore/ruby-autoload/lib/petstore/api/store_api.rb index d573ff72bcf3..6f6ef887bf08 100644 --- a/samples/client/petstore/ruby-autoload/lib/petstore/api/store_api.rb +++ b/samples/client/petstore/ruby-autoload/lib/petstore/api/store_api.rb @@ -73,7 +73,7 @@ def delete_order_with_http_info(order_id, opts = {}) :return_type => return_type ) - data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options) + data, status_code, headers = @api_client.call_api(:"DELETE", local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: StoreApi#delete_order\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end @@ -130,7 +130,7 @@ def get_inventory_with_http_info(opts = {}) :return_type => return_type ) - data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) + data, status_code, headers = @api_client.call_api(:"GET", local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: StoreApi#get_inventory\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end @@ -201,7 +201,7 @@ def get_order_by_id_with_http_info(order_id, opts = {}) :return_type => return_type ) - data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) + data, status_code, headers = @api_client.call_api(:"GET", local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: StoreApi#get_order_by_id\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end @@ -269,7 +269,7 @@ def place_order_with_http_info(order, opts = {}) :return_type => return_type ) - data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) + data, status_code, headers = @api_client.call_api(:"POST", local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: StoreApi#place_order\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end diff --git a/samples/client/petstore/ruby-autoload/lib/petstore/api/user_api.rb b/samples/client/petstore/ruby-autoload/lib/petstore/api/user_api.rb index 2374bcaf996a..9ba5e13f8c44 100644 --- a/samples/client/petstore/ruby-autoload/lib/petstore/api/user_api.rb +++ b/samples/client/petstore/ruby-autoload/lib/petstore/api/user_api.rb @@ -78,7 +78,7 @@ def create_user_with_http_info(user, opts = {}) :return_type => return_type ) - data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) + data, status_code, headers = @api_client.call_api(:"POST", local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: UserApi#create_user\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end @@ -144,7 +144,7 @@ def create_users_with_array_input_with_http_info(user, opts = {}) :return_type => return_type ) - data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) + data, status_code, headers = @api_client.call_api(:"POST", local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: UserApi#create_users_with_array_input\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end @@ -210,7 +210,7 @@ def create_users_with_list_input_with_http_info(user, opts = {}) :return_type => return_type ) - data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) + data, status_code, headers = @api_client.call_api(:"POST", local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: UserApi#create_users_with_list_input\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end @@ -271,7 +271,7 @@ def delete_user_with_http_info(username, opts = {}) :return_type => return_type ) - data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options) + data, status_code, headers = @api_client.call_api(:"DELETE", local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: UserApi#delete_user\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end @@ -334,7 +334,7 @@ def get_user_by_name_with_http_info(username, opts = {}) :return_type => return_type ) - data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) + data, status_code, headers = @api_client.call_api(:"GET", local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: UserApi#get_user_by_name\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end @@ -405,7 +405,7 @@ def login_user_with_http_info(username, password, opts = {}) :return_type => return_type ) - data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) + data, status_code, headers = @api_client.call_api(:"GET", local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: UserApi#login_user\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end @@ -460,7 +460,7 @@ def logout_user_with_http_info(opts = {}) :return_type => return_type ) - data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) + data, status_code, headers = @api_client.call_api(:"GET", local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: UserApi#logout_user\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end @@ -532,7 +532,7 @@ def update_user_with_http_info(username, user, opts = {}) :return_type => return_type ) - data, status_code, headers = @api_client.call_api(:PUT, local_var_path, new_options) + data, status_code, headers = @api_client.call_api(:"PUT", local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: UserApi#update_user\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end diff --git a/samples/client/petstore/ruby-faraday/lib/petstore/api/another_fake_api.rb b/samples/client/petstore/ruby-faraday/lib/petstore/api/another_fake_api.rb index 88be97e7995d..cbc2843866bf 100644 --- a/samples/client/petstore/ruby-faraday/lib/petstore/api/another_fake_api.rb +++ b/samples/client/petstore/ruby-faraday/lib/petstore/api/another_fake_api.rb @@ -80,7 +80,7 @@ def call_123_test_special_tags_with_http_info(client, opts = {}) :return_type => return_type ) - data, status_code, headers = @api_client.call_api(:PATCH, local_var_path, new_options) + data, status_code, headers = @api_client.call_api(:"PATCH", local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: AnotherFakeApi#call_123_test_special_tags\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end diff --git a/samples/client/petstore/ruby-faraday/lib/petstore/api/default_api.rb b/samples/client/petstore/ruby-faraday/lib/petstore/api/default_api.rb index 149ce403c232..eb2a9d6edb17 100644 --- a/samples/client/petstore/ruby-faraday/lib/petstore/api/default_api.rb +++ b/samples/client/petstore/ruby-faraday/lib/petstore/api/default_api.rb @@ -65,7 +65,7 @@ def foo_get_with_http_info(opts = {}) :return_type => return_type ) - data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) + data, status_code, headers = @api_client.call_api(:"GET", local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: DefaultApi#foo_get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end diff --git a/samples/client/petstore/ruby-faraday/lib/petstore/api/fake_api.rb b/samples/client/petstore/ruby-faraday/lib/petstore/api/fake_api.rb index 7efdb0244dea..944d9a2c9518 100644 --- a/samples/client/petstore/ruby-faraday/lib/petstore/api/fake_api.rb +++ b/samples/client/petstore/ruby-faraday/lib/petstore/api/fake_api.rb @@ -67,7 +67,7 @@ def fake_big_decimal_map_with_http_info(opts = {}) :return_type => return_type ) - data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) + data, status_code, headers = @api_client.call_api(:"GET", local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: FakeApi#fake_big_decimal_map\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end @@ -122,7 +122,7 @@ def fake_health_get_with_http_info(opts = {}) :return_type => return_type ) - data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) + data, status_code, headers = @api_client.call_api(:"GET", local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: FakeApi#fake_health_get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end @@ -192,7 +192,7 @@ def fake_http_signature_test_with_http_info(pet, opts = {}) :return_type => return_type ) - data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) + data, status_code, headers = @api_client.call_api(:"GET", local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: FakeApi#fake_http_signature_test\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end @@ -254,7 +254,7 @@ def fake_outer_boolean_serialize_with_http_info(opts = {}) :return_type => return_type ) - data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) + data, status_code, headers = @api_client.call_api(:"POST", local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: FakeApi#fake_outer_boolean_serialize\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end @@ -316,7 +316,7 @@ def fake_outer_composite_serialize_with_http_info(opts = {}) :return_type => return_type ) - data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) + data, status_code, headers = @api_client.call_api(:"POST", local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: FakeApi#fake_outer_composite_serialize\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end @@ -378,7 +378,7 @@ def fake_outer_number_serialize_with_http_info(opts = {}) :return_type => return_type ) - data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) + data, status_code, headers = @api_client.call_api(:"POST", local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: FakeApi#fake_outer_number_serialize\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end @@ -440,7 +440,7 @@ def fake_outer_string_serialize_with_http_info(opts = {}) :return_type => return_type ) - data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) + data, status_code, headers = @api_client.call_api(:"POST", local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: FakeApi#fake_outer_string_serialize\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end @@ -506,7 +506,7 @@ def fake_property_enum_integer_serialize_with_http_info(outer_object_with_enum_p :return_type => return_type ) - data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) + data, status_code, headers = @api_client.call_api(:"POST", local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: FakeApi#fake_property_enum_integer_serialize\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end @@ -587,7 +587,7 @@ def get_parameter_name_mapping_with_http_info(_type, type, type_, http_debug_opt :return_type => return_type ) - data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) + data, status_code, headers = @api_client.call_api(:"GET", local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: FakeApi#get_parameter_name_mapping\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end @@ -653,7 +653,7 @@ def test_additional_properties_reference_with_http_info(request_body, opts = {}) :return_type => return_type ) - data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) + data, status_code, headers = @api_client.call_api(:"POST", local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: FakeApi#test_additional_properties_reference\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end @@ -713,7 +713,7 @@ def test_body_with_binary_with_http_info(body, opts = {}) :return_type => return_type ) - data, status_code, headers = @api_client.call_api(:PUT, local_var_path, new_options) + data, status_code, headers = @api_client.call_api(:"PUT", local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: FakeApi#test_body_with_binary\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end @@ -777,7 +777,7 @@ def test_body_with_file_schema_with_http_info(file_schema_test_class, opts = {}) :return_type => return_type ) - data, status_code, headers = @api_client.call_api(:PUT, local_var_path, new_options) + data, status_code, headers = @api_client.call_api(:"PUT", local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: FakeApi#test_body_with_file_schema\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end @@ -846,7 +846,7 @@ def test_body_with_query_params_with_http_info(query, user, opts = {}) :return_type => return_type ) - data, status_code, headers = @api_client.call_api(:PUT, local_var_path, new_options) + data, status_code, headers = @api_client.call_api(:"PUT", local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: FakeApi#test_body_with_query_params\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end @@ -914,7 +914,7 @@ def test_client_model_with_http_info(client, opts = {}) :return_type => return_type ) - data, status_code, headers = @api_client.call_api(:PATCH, local_var_path, new_options) + data, status_code, headers = @api_client.call_api(:"PATCH", local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: FakeApi#test_client_model\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end @@ -1086,7 +1086,7 @@ def test_endpoint_parameters_with_http_info(number, double, pattern_without_deli :return_type => return_type ) - data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) + data, status_code, headers = @api_client.call_api(:"POST", local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: FakeApi#test_endpoint_parameters\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end @@ -1205,7 +1205,7 @@ def test_enum_parameters_with_http_info(opts = {}) :return_type => return_type ) - data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) + data, status_code, headers = @api_client.call_api(:"GET", local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: FakeApi#test_enum_parameters\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end @@ -1294,7 +1294,7 @@ def test_group_parameters_with_http_info(opts = {}) :return_type => return_type ) - data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options) + data, status_code, headers = @api_client.call_api(:"DELETE", local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: FakeApi#test_group_parameters\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end @@ -1360,7 +1360,7 @@ def test_inline_additional_properties_with_http_info(request_body, opts = {}) :return_type => return_type ) - data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) + data, status_code, headers = @api_client.call_api(:"POST", local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: FakeApi#test_inline_additional_properties\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end @@ -1426,7 +1426,7 @@ def test_inline_freeform_additional_properties_with_http_info(test_inline_freefo :return_type => return_type ) - data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) + data, status_code, headers = @api_client.call_api(:"POST", local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: FakeApi#test_inline_freeform_additional_properties\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end @@ -1500,7 +1500,7 @@ def test_json_form_data_with_http_info(param, param2, opts = {}) :return_type => return_type ) - data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) + data, status_code, headers = @api_client.call_api(:"GET", local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: FakeApi#test_json_form_data\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end @@ -1598,7 +1598,7 @@ def test_query_parameter_collection_format_with_http_info(pipe, ioutil, http, ur :return_type => return_type ) - data, status_code, headers = @api_client.call_api(:PUT, local_var_path, new_options) + data, status_code, headers = @api_client.call_api(:"PUT", local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: FakeApi#test_query_parameter_collection_format\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end @@ -1664,7 +1664,7 @@ def test_string_map_reference_with_http_info(request_body, opts = {}) :return_type => return_type ) - data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) + data, status_code, headers = @api_client.call_api(:"POST", local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: FakeApi#test_string_map_reference\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end diff --git a/samples/client/petstore/ruby-faraday/lib/petstore/api/fake_classname_tags123_api.rb b/samples/client/petstore/ruby-faraday/lib/petstore/api/fake_classname_tags123_api.rb index 50f0c12d88b2..93509f82bd33 100644 --- a/samples/client/petstore/ruby-faraday/lib/petstore/api/fake_classname_tags123_api.rb +++ b/samples/client/petstore/ruby-faraday/lib/petstore/api/fake_classname_tags123_api.rb @@ -80,7 +80,7 @@ def test_classname_with_http_info(client, opts = {}) :return_type => return_type ) - data, status_code, headers = @api_client.call_api(:PATCH, local_var_path, new_options) + data, status_code, headers = @api_client.call_api(:"PATCH", local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: FakeClassnameTags123Api#test_classname\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end diff --git a/samples/client/petstore/ruby-faraday/lib/petstore/api/pet_api.rb b/samples/client/petstore/ruby-faraday/lib/petstore/api/pet_api.rb index deb832acabe9..dc7ca9395298 100644 --- a/samples/client/petstore/ruby-faraday/lib/petstore/api/pet_api.rb +++ b/samples/client/petstore/ruby-faraday/lib/petstore/api/pet_api.rb @@ -78,7 +78,7 @@ def add_pet_with_http_info(pet, opts = {}) :return_type => return_type ) - data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) + data, status_code, headers = @api_client.call_api(:"POST", local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: PetApi#add_pet\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end @@ -142,7 +142,7 @@ def delete_pet_with_http_info(pet_id, opts = {}) :return_type => return_type ) - data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options) + data, status_code, headers = @api_client.call_api(:"DELETE", local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: PetApi#delete_pet\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end @@ -206,7 +206,7 @@ def find_pets_by_status_with_http_info(status, opts = {}) :return_type => return_type ) - data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) + data, status_code, headers = @api_client.call_api(:"GET", local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: PetApi#find_pets_by_status\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end @@ -270,7 +270,7 @@ def find_pets_by_tags_with_http_info(tags, opts = {}) :return_type => return_type ) - data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) + data, status_code, headers = @api_client.call_api(:"GET", local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: PetApi#find_pets_by_tags\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end @@ -333,7 +333,7 @@ def get_pet_by_id_with_http_info(pet_id, opts = {}) :return_type => return_type ) - data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) + data, status_code, headers = @api_client.call_api(:"GET", local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: PetApi#get_pet_by_id\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end @@ -399,7 +399,7 @@ def update_pet_with_http_info(pet, opts = {}) :return_type => return_type ) - data, status_code, headers = @api_client.call_api(:PUT, local_var_path, new_options) + data, status_code, headers = @api_client.call_api(:"PUT", local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: PetApi#update_pet\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end @@ -471,7 +471,7 @@ def update_pet_with_form_with_http_info(pet_id, opts = {}) :return_type => return_type ) - data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) + data, status_code, headers = @api_client.call_api(:"POST", local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: PetApi#update_pet_with_form\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end @@ -545,7 +545,7 @@ def upload_file_with_http_info(pet_id, opts = {}) :return_type => return_type ) - data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) + data, status_code, headers = @api_client.call_api(:"POST", local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: PetApi#upload_file\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end @@ -623,7 +623,7 @@ def upload_file_with_required_file_with_http_info(pet_id, required_file, opts = :return_type => return_type ) - data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) + data, status_code, headers = @api_client.call_api(:"POST", local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: PetApi#upload_file_with_required_file\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end diff --git a/samples/client/petstore/ruby-faraday/lib/petstore/api/store_api.rb b/samples/client/petstore/ruby-faraday/lib/petstore/api/store_api.rb index 388011660059..4c155d2d0afb 100644 --- a/samples/client/petstore/ruby-faraday/lib/petstore/api/store_api.rb +++ b/samples/client/petstore/ruby-faraday/lib/petstore/api/store_api.rb @@ -73,7 +73,7 @@ def delete_order_with_http_info(order_id, opts = {}) :return_type => return_type ) - data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options) + data, status_code, headers = @api_client.call_api(:"DELETE", local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: StoreApi#delete_order\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end @@ -130,7 +130,7 @@ def get_inventory_with_http_info(opts = {}) :return_type => return_type ) - data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) + data, status_code, headers = @api_client.call_api(:"GET", local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: StoreApi#get_inventory\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end @@ -201,7 +201,7 @@ def get_order_by_id_with_http_info(order_id, opts = {}) :return_type => return_type ) - data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) + data, status_code, headers = @api_client.call_api(:"GET", local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: StoreApi#get_order_by_id\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end @@ -269,7 +269,7 @@ def place_order_with_http_info(order, opts = {}) :return_type => return_type ) - data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) + data, status_code, headers = @api_client.call_api(:"POST", local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: StoreApi#place_order\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end diff --git a/samples/client/petstore/ruby-faraday/lib/petstore/api/user_api.rb b/samples/client/petstore/ruby-faraday/lib/petstore/api/user_api.rb index 80c409d6379e..16aaf10bd645 100644 --- a/samples/client/petstore/ruby-faraday/lib/petstore/api/user_api.rb +++ b/samples/client/petstore/ruby-faraday/lib/petstore/api/user_api.rb @@ -78,7 +78,7 @@ def create_user_with_http_info(user, opts = {}) :return_type => return_type ) - data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) + data, status_code, headers = @api_client.call_api(:"POST", local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: UserApi#create_user\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end @@ -144,7 +144,7 @@ def create_users_with_array_input_with_http_info(user, opts = {}) :return_type => return_type ) - data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) + data, status_code, headers = @api_client.call_api(:"POST", local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: UserApi#create_users_with_array_input\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end @@ -210,7 +210,7 @@ def create_users_with_list_input_with_http_info(user, opts = {}) :return_type => return_type ) - data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) + data, status_code, headers = @api_client.call_api(:"POST", local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: UserApi#create_users_with_list_input\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end @@ -271,7 +271,7 @@ def delete_user_with_http_info(username, opts = {}) :return_type => return_type ) - data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options) + data, status_code, headers = @api_client.call_api(:"DELETE", local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: UserApi#delete_user\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end @@ -334,7 +334,7 @@ def get_user_by_name_with_http_info(username, opts = {}) :return_type => return_type ) - data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) + data, status_code, headers = @api_client.call_api(:"GET", local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: UserApi#get_user_by_name\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end @@ -405,7 +405,7 @@ def login_user_with_http_info(username, password, opts = {}) :return_type => return_type ) - data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) + data, status_code, headers = @api_client.call_api(:"GET", local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: UserApi#login_user\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end @@ -460,7 +460,7 @@ def logout_user_with_http_info(opts = {}) :return_type => return_type ) - data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) + data, status_code, headers = @api_client.call_api(:"GET", local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: UserApi#logout_user\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end @@ -532,7 +532,7 @@ def update_user_with_http_info(username, user, opts = {}) :return_type => return_type ) - data, status_code, headers = @api_client.call_api(:PUT, local_var_path, new_options) + data, status_code, headers = @api_client.call_api(:"PUT", local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: UserApi#update_user\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end diff --git a/samples/client/petstore/ruby-httpx/lib/petstore/api/another_fake_api.rb b/samples/client/petstore/ruby-httpx/lib/petstore/api/another_fake_api.rb index 88be97e7995d..cbc2843866bf 100644 --- a/samples/client/petstore/ruby-httpx/lib/petstore/api/another_fake_api.rb +++ b/samples/client/petstore/ruby-httpx/lib/petstore/api/another_fake_api.rb @@ -80,7 +80,7 @@ def call_123_test_special_tags_with_http_info(client, opts = {}) :return_type => return_type ) - data, status_code, headers = @api_client.call_api(:PATCH, local_var_path, new_options) + data, status_code, headers = @api_client.call_api(:"PATCH", local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: AnotherFakeApi#call_123_test_special_tags\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end diff --git a/samples/client/petstore/ruby-httpx/lib/petstore/api/default_api.rb b/samples/client/petstore/ruby-httpx/lib/petstore/api/default_api.rb index 149ce403c232..eb2a9d6edb17 100644 --- a/samples/client/petstore/ruby-httpx/lib/petstore/api/default_api.rb +++ b/samples/client/petstore/ruby-httpx/lib/petstore/api/default_api.rb @@ -65,7 +65,7 @@ def foo_get_with_http_info(opts = {}) :return_type => return_type ) - data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) + data, status_code, headers = @api_client.call_api(:"GET", local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: DefaultApi#foo_get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end diff --git a/samples/client/petstore/ruby-httpx/lib/petstore/api/fake_api.rb b/samples/client/petstore/ruby-httpx/lib/petstore/api/fake_api.rb index 7efdb0244dea..944d9a2c9518 100644 --- a/samples/client/petstore/ruby-httpx/lib/petstore/api/fake_api.rb +++ b/samples/client/petstore/ruby-httpx/lib/petstore/api/fake_api.rb @@ -67,7 +67,7 @@ def fake_big_decimal_map_with_http_info(opts = {}) :return_type => return_type ) - data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) + data, status_code, headers = @api_client.call_api(:"GET", local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: FakeApi#fake_big_decimal_map\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end @@ -122,7 +122,7 @@ def fake_health_get_with_http_info(opts = {}) :return_type => return_type ) - data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) + data, status_code, headers = @api_client.call_api(:"GET", local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: FakeApi#fake_health_get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end @@ -192,7 +192,7 @@ def fake_http_signature_test_with_http_info(pet, opts = {}) :return_type => return_type ) - data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) + data, status_code, headers = @api_client.call_api(:"GET", local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: FakeApi#fake_http_signature_test\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end @@ -254,7 +254,7 @@ def fake_outer_boolean_serialize_with_http_info(opts = {}) :return_type => return_type ) - data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) + data, status_code, headers = @api_client.call_api(:"POST", local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: FakeApi#fake_outer_boolean_serialize\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end @@ -316,7 +316,7 @@ def fake_outer_composite_serialize_with_http_info(opts = {}) :return_type => return_type ) - data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) + data, status_code, headers = @api_client.call_api(:"POST", local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: FakeApi#fake_outer_composite_serialize\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end @@ -378,7 +378,7 @@ def fake_outer_number_serialize_with_http_info(opts = {}) :return_type => return_type ) - data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) + data, status_code, headers = @api_client.call_api(:"POST", local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: FakeApi#fake_outer_number_serialize\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end @@ -440,7 +440,7 @@ def fake_outer_string_serialize_with_http_info(opts = {}) :return_type => return_type ) - data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) + data, status_code, headers = @api_client.call_api(:"POST", local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: FakeApi#fake_outer_string_serialize\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end @@ -506,7 +506,7 @@ def fake_property_enum_integer_serialize_with_http_info(outer_object_with_enum_p :return_type => return_type ) - data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) + data, status_code, headers = @api_client.call_api(:"POST", local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: FakeApi#fake_property_enum_integer_serialize\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end @@ -587,7 +587,7 @@ def get_parameter_name_mapping_with_http_info(_type, type, type_, http_debug_opt :return_type => return_type ) - data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) + data, status_code, headers = @api_client.call_api(:"GET", local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: FakeApi#get_parameter_name_mapping\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end @@ -653,7 +653,7 @@ def test_additional_properties_reference_with_http_info(request_body, opts = {}) :return_type => return_type ) - data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) + data, status_code, headers = @api_client.call_api(:"POST", local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: FakeApi#test_additional_properties_reference\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end @@ -713,7 +713,7 @@ def test_body_with_binary_with_http_info(body, opts = {}) :return_type => return_type ) - data, status_code, headers = @api_client.call_api(:PUT, local_var_path, new_options) + data, status_code, headers = @api_client.call_api(:"PUT", local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: FakeApi#test_body_with_binary\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end @@ -777,7 +777,7 @@ def test_body_with_file_schema_with_http_info(file_schema_test_class, opts = {}) :return_type => return_type ) - data, status_code, headers = @api_client.call_api(:PUT, local_var_path, new_options) + data, status_code, headers = @api_client.call_api(:"PUT", local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: FakeApi#test_body_with_file_schema\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end @@ -846,7 +846,7 @@ def test_body_with_query_params_with_http_info(query, user, opts = {}) :return_type => return_type ) - data, status_code, headers = @api_client.call_api(:PUT, local_var_path, new_options) + data, status_code, headers = @api_client.call_api(:"PUT", local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: FakeApi#test_body_with_query_params\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end @@ -914,7 +914,7 @@ def test_client_model_with_http_info(client, opts = {}) :return_type => return_type ) - data, status_code, headers = @api_client.call_api(:PATCH, local_var_path, new_options) + data, status_code, headers = @api_client.call_api(:"PATCH", local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: FakeApi#test_client_model\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end @@ -1086,7 +1086,7 @@ def test_endpoint_parameters_with_http_info(number, double, pattern_without_deli :return_type => return_type ) - data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) + data, status_code, headers = @api_client.call_api(:"POST", local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: FakeApi#test_endpoint_parameters\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end @@ -1205,7 +1205,7 @@ def test_enum_parameters_with_http_info(opts = {}) :return_type => return_type ) - data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) + data, status_code, headers = @api_client.call_api(:"GET", local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: FakeApi#test_enum_parameters\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end @@ -1294,7 +1294,7 @@ def test_group_parameters_with_http_info(opts = {}) :return_type => return_type ) - data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options) + data, status_code, headers = @api_client.call_api(:"DELETE", local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: FakeApi#test_group_parameters\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end @@ -1360,7 +1360,7 @@ def test_inline_additional_properties_with_http_info(request_body, opts = {}) :return_type => return_type ) - data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) + data, status_code, headers = @api_client.call_api(:"POST", local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: FakeApi#test_inline_additional_properties\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end @@ -1426,7 +1426,7 @@ def test_inline_freeform_additional_properties_with_http_info(test_inline_freefo :return_type => return_type ) - data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) + data, status_code, headers = @api_client.call_api(:"POST", local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: FakeApi#test_inline_freeform_additional_properties\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end @@ -1500,7 +1500,7 @@ def test_json_form_data_with_http_info(param, param2, opts = {}) :return_type => return_type ) - data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) + data, status_code, headers = @api_client.call_api(:"GET", local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: FakeApi#test_json_form_data\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end @@ -1598,7 +1598,7 @@ def test_query_parameter_collection_format_with_http_info(pipe, ioutil, http, ur :return_type => return_type ) - data, status_code, headers = @api_client.call_api(:PUT, local_var_path, new_options) + data, status_code, headers = @api_client.call_api(:"PUT", local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: FakeApi#test_query_parameter_collection_format\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end @@ -1664,7 +1664,7 @@ def test_string_map_reference_with_http_info(request_body, opts = {}) :return_type => return_type ) - data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) + data, status_code, headers = @api_client.call_api(:"POST", local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: FakeApi#test_string_map_reference\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end diff --git a/samples/client/petstore/ruby-httpx/lib/petstore/api/fake_classname_tags123_api.rb b/samples/client/petstore/ruby-httpx/lib/petstore/api/fake_classname_tags123_api.rb index 50f0c12d88b2..93509f82bd33 100644 --- a/samples/client/petstore/ruby-httpx/lib/petstore/api/fake_classname_tags123_api.rb +++ b/samples/client/petstore/ruby-httpx/lib/petstore/api/fake_classname_tags123_api.rb @@ -80,7 +80,7 @@ def test_classname_with_http_info(client, opts = {}) :return_type => return_type ) - data, status_code, headers = @api_client.call_api(:PATCH, local_var_path, new_options) + data, status_code, headers = @api_client.call_api(:"PATCH", local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: FakeClassnameTags123Api#test_classname\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end diff --git a/samples/client/petstore/ruby-httpx/lib/petstore/api/pet_api.rb b/samples/client/petstore/ruby-httpx/lib/petstore/api/pet_api.rb index deb832acabe9..dc7ca9395298 100644 --- a/samples/client/petstore/ruby-httpx/lib/petstore/api/pet_api.rb +++ b/samples/client/petstore/ruby-httpx/lib/petstore/api/pet_api.rb @@ -78,7 +78,7 @@ def add_pet_with_http_info(pet, opts = {}) :return_type => return_type ) - data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) + data, status_code, headers = @api_client.call_api(:"POST", local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: PetApi#add_pet\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end @@ -142,7 +142,7 @@ def delete_pet_with_http_info(pet_id, opts = {}) :return_type => return_type ) - data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options) + data, status_code, headers = @api_client.call_api(:"DELETE", local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: PetApi#delete_pet\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end @@ -206,7 +206,7 @@ def find_pets_by_status_with_http_info(status, opts = {}) :return_type => return_type ) - data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) + data, status_code, headers = @api_client.call_api(:"GET", local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: PetApi#find_pets_by_status\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end @@ -270,7 +270,7 @@ def find_pets_by_tags_with_http_info(tags, opts = {}) :return_type => return_type ) - data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) + data, status_code, headers = @api_client.call_api(:"GET", local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: PetApi#find_pets_by_tags\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end @@ -333,7 +333,7 @@ def get_pet_by_id_with_http_info(pet_id, opts = {}) :return_type => return_type ) - data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) + data, status_code, headers = @api_client.call_api(:"GET", local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: PetApi#get_pet_by_id\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end @@ -399,7 +399,7 @@ def update_pet_with_http_info(pet, opts = {}) :return_type => return_type ) - data, status_code, headers = @api_client.call_api(:PUT, local_var_path, new_options) + data, status_code, headers = @api_client.call_api(:"PUT", local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: PetApi#update_pet\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end @@ -471,7 +471,7 @@ def update_pet_with_form_with_http_info(pet_id, opts = {}) :return_type => return_type ) - data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) + data, status_code, headers = @api_client.call_api(:"POST", local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: PetApi#update_pet_with_form\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end @@ -545,7 +545,7 @@ def upload_file_with_http_info(pet_id, opts = {}) :return_type => return_type ) - data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) + data, status_code, headers = @api_client.call_api(:"POST", local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: PetApi#upload_file\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end @@ -623,7 +623,7 @@ def upload_file_with_required_file_with_http_info(pet_id, required_file, opts = :return_type => return_type ) - data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) + data, status_code, headers = @api_client.call_api(:"POST", local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: PetApi#upload_file_with_required_file\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end diff --git a/samples/client/petstore/ruby-httpx/lib/petstore/api/store_api.rb b/samples/client/petstore/ruby-httpx/lib/petstore/api/store_api.rb index 388011660059..4c155d2d0afb 100644 --- a/samples/client/petstore/ruby-httpx/lib/petstore/api/store_api.rb +++ b/samples/client/petstore/ruby-httpx/lib/petstore/api/store_api.rb @@ -73,7 +73,7 @@ def delete_order_with_http_info(order_id, opts = {}) :return_type => return_type ) - data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options) + data, status_code, headers = @api_client.call_api(:"DELETE", local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: StoreApi#delete_order\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end @@ -130,7 +130,7 @@ def get_inventory_with_http_info(opts = {}) :return_type => return_type ) - data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) + data, status_code, headers = @api_client.call_api(:"GET", local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: StoreApi#get_inventory\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end @@ -201,7 +201,7 @@ def get_order_by_id_with_http_info(order_id, opts = {}) :return_type => return_type ) - data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) + data, status_code, headers = @api_client.call_api(:"GET", local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: StoreApi#get_order_by_id\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end @@ -269,7 +269,7 @@ def place_order_with_http_info(order, opts = {}) :return_type => return_type ) - data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) + data, status_code, headers = @api_client.call_api(:"POST", local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: StoreApi#place_order\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end diff --git a/samples/client/petstore/ruby-httpx/lib/petstore/api/user_api.rb b/samples/client/petstore/ruby-httpx/lib/petstore/api/user_api.rb index 80c409d6379e..16aaf10bd645 100644 --- a/samples/client/petstore/ruby-httpx/lib/petstore/api/user_api.rb +++ b/samples/client/petstore/ruby-httpx/lib/petstore/api/user_api.rb @@ -78,7 +78,7 @@ def create_user_with_http_info(user, opts = {}) :return_type => return_type ) - data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) + data, status_code, headers = @api_client.call_api(:"POST", local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: UserApi#create_user\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end @@ -144,7 +144,7 @@ def create_users_with_array_input_with_http_info(user, opts = {}) :return_type => return_type ) - data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) + data, status_code, headers = @api_client.call_api(:"POST", local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: UserApi#create_users_with_array_input\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end @@ -210,7 +210,7 @@ def create_users_with_list_input_with_http_info(user, opts = {}) :return_type => return_type ) - data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) + data, status_code, headers = @api_client.call_api(:"POST", local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: UserApi#create_users_with_list_input\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end @@ -271,7 +271,7 @@ def delete_user_with_http_info(username, opts = {}) :return_type => return_type ) - data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options) + data, status_code, headers = @api_client.call_api(:"DELETE", local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: UserApi#delete_user\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end @@ -334,7 +334,7 @@ def get_user_by_name_with_http_info(username, opts = {}) :return_type => return_type ) - data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) + data, status_code, headers = @api_client.call_api(:"GET", local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: UserApi#get_user_by_name\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end @@ -405,7 +405,7 @@ def login_user_with_http_info(username, password, opts = {}) :return_type => return_type ) - data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) + data, status_code, headers = @api_client.call_api(:"GET", local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: UserApi#login_user\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end @@ -460,7 +460,7 @@ def logout_user_with_http_info(opts = {}) :return_type => return_type ) - data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) + data, status_code, headers = @api_client.call_api(:"GET", local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: UserApi#logout_user\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end @@ -532,7 +532,7 @@ def update_user_with_http_info(username, user, opts = {}) :return_type => return_type ) - data, status_code, headers = @api_client.call_api(:PUT, local_var_path, new_options) + data, status_code, headers = @api_client.call_api(:"PUT", local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: UserApi#update_user\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end diff --git a/samples/client/petstore/ruby-httpx/lib/petstore/api_client.rb b/samples/client/petstore/ruby-httpx/lib/petstore/api_client.rb index 48cdc30b4ccd..e8637abbe5d4 100644 --- a/samples/client/petstore/ruby-httpx/lib/petstore/api_client.rb +++ b/samples/client/petstore/ruby-httpx/lib/petstore/api_client.rb @@ -44,6 +44,10 @@ def self.default @@default ||= ApiClient.new end + # HTTP verbs that HTTPX emits through its normal (upper-cased) dispatch path. + # OpenAPI 3.2 query/additionalOperations verbs are handled verbatim below. + STANDARD_HTTP_METHODS = %w[GET POST PUT PATCH DELETE OPTIONS HEAD TRACE CONNECT].freeze + # Call an API with given options. # # @return [Array<(Object, Integer, Hash)>] an array of 3 elements: @@ -108,7 +112,18 @@ def build_request(http_method, path, opts = {}) } req_opts.merge!(body_params) if body_params req_opts[:params] = query_params if query_params && !query_params.empty? - session.request(http_method, url, **req_opts) + if STANDARD_HTTP_METHODS.include?(http_method.to_s) + session.request(http_method, url, **req_opts) + else + # OpenAPI 3.2 (query/additionalOperations): emit the verb verbatim. + # NOTE: HTTPX::Request internally stores @verb = verb.to_s.upcase and @verb is + # only used when emitting the request line, so we restore it after building. + # This depends on HTTPX internals - if a future httpx release changes how the + # verb is stored/emitted, this needs revisiting. + request = session.build_request(http_method, url, req_opts) + request.instance_variable_set(:@verb, http_method.to_s) + session.request(request) + end end # Builds the HTTP request body diff --git a/samples/client/petstore/ruby/lib/petstore/api/another_fake_api.rb b/samples/client/petstore/ruby/lib/petstore/api/another_fake_api.rb index 88be97e7995d..cbc2843866bf 100644 --- a/samples/client/petstore/ruby/lib/petstore/api/another_fake_api.rb +++ b/samples/client/petstore/ruby/lib/petstore/api/another_fake_api.rb @@ -80,7 +80,7 @@ def call_123_test_special_tags_with_http_info(client, opts = {}) :return_type => return_type ) - data, status_code, headers = @api_client.call_api(:PATCH, local_var_path, new_options) + data, status_code, headers = @api_client.call_api(:"PATCH", local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: AnotherFakeApi#call_123_test_special_tags\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end diff --git a/samples/client/petstore/ruby/lib/petstore/api/default_api.rb b/samples/client/petstore/ruby/lib/petstore/api/default_api.rb index 149ce403c232..eb2a9d6edb17 100644 --- a/samples/client/petstore/ruby/lib/petstore/api/default_api.rb +++ b/samples/client/petstore/ruby/lib/petstore/api/default_api.rb @@ -65,7 +65,7 @@ def foo_get_with_http_info(opts = {}) :return_type => return_type ) - data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) + data, status_code, headers = @api_client.call_api(:"GET", local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: DefaultApi#foo_get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end diff --git a/samples/client/petstore/ruby/lib/petstore/api/fake_api.rb b/samples/client/petstore/ruby/lib/petstore/api/fake_api.rb index 09633923caf0..d5ecb872594b 100644 --- a/samples/client/petstore/ruby/lib/petstore/api/fake_api.rb +++ b/samples/client/petstore/ruby/lib/petstore/api/fake_api.rb @@ -67,7 +67,7 @@ def fake_big_decimal_map_with_http_info(opts = {}) :return_type => return_type ) - data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) + data, status_code, headers = @api_client.call_api(:"GET", local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: FakeApi#fake_big_decimal_map\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end @@ -122,7 +122,7 @@ def fake_health_get_with_http_info(opts = {}) :return_type => return_type ) - data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) + data, status_code, headers = @api_client.call_api(:"GET", local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: FakeApi#fake_health_get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end @@ -192,7 +192,7 @@ def fake_http_signature_test_with_http_info(pet, opts = {}) :return_type => return_type ) - data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) + data, status_code, headers = @api_client.call_api(:"GET", local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: FakeApi#fake_http_signature_test\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end @@ -254,7 +254,7 @@ def fake_outer_boolean_serialize_with_http_info(opts = {}) :return_type => return_type ) - data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) + data, status_code, headers = @api_client.call_api(:"POST", local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: FakeApi#fake_outer_boolean_serialize\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end @@ -316,7 +316,7 @@ def fake_outer_composite_serialize_with_http_info(opts = {}) :return_type => return_type ) - data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) + data, status_code, headers = @api_client.call_api(:"POST", local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: FakeApi#fake_outer_composite_serialize\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end @@ -378,7 +378,7 @@ def fake_outer_number_serialize_with_http_info(opts = {}) :return_type => return_type ) - data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) + data, status_code, headers = @api_client.call_api(:"POST", local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: FakeApi#fake_outer_number_serialize\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end @@ -440,7 +440,7 @@ def fake_outer_string_serialize_with_http_info(opts = {}) :return_type => return_type ) - data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) + data, status_code, headers = @api_client.call_api(:"POST", local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: FakeApi#fake_outer_string_serialize\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end @@ -506,7 +506,7 @@ def fake_property_enum_integer_serialize_with_http_info(outer_object_with_enum_p :return_type => return_type ) - data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) + data, status_code, headers = @api_client.call_api(:"POST", local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: FakeApi#fake_property_enum_integer_serialize\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end @@ -587,7 +587,7 @@ def get_parameter_name_mapping_with_http_info(underscore_type, type, type_with_u :return_type => return_type ) - data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) + data, status_code, headers = @api_client.call_api(:"GET", local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: FakeApi#get_parameter_name_mapping\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end @@ -653,7 +653,7 @@ def test_additional_properties_reference_with_http_info(request_body, opts = {}) :return_type => return_type ) - data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) + data, status_code, headers = @api_client.call_api(:"POST", local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: FakeApi#test_additional_properties_reference\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end @@ -713,7 +713,7 @@ def test_body_with_binary_with_http_info(body, opts = {}) :return_type => return_type ) - data, status_code, headers = @api_client.call_api(:PUT, local_var_path, new_options) + data, status_code, headers = @api_client.call_api(:"PUT", local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: FakeApi#test_body_with_binary\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end @@ -777,7 +777,7 @@ def test_body_with_file_schema_with_http_info(file_schema_test_class, opts = {}) :return_type => return_type ) - data, status_code, headers = @api_client.call_api(:PUT, local_var_path, new_options) + data, status_code, headers = @api_client.call_api(:"PUT", local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: FakeApi#test_body_with_file_schema\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end @@ -846,7 +846,7 @@ def test_body_with_query_params_with_http_info(query, user, opts = {}) :return_type => return_type ) - data, status_code, headers = @api_client.call_api(:PUT, local_var_path, new_options) + data, status_code, headers = @api_client.call_api(:"PUT", local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: FakeApi#test_body_with_query_params\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end @@ -914,7 +914,7 @@ def test_client_model_with_http_info(client, opts = {}) :return_type => return_type ) - data, status_code, headers = @api_client.call_api(:PATCH, local_var_path, new_options) + data, status_code, headers = @api_client.call_api(:"PATCH", local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: FakeApi#test_client_model\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end @@ -1086,7 +1086,7 @@ def test_endpoint_parameters_with_http_info(number, double, pattern_without_deli :return_type => return_type ) - data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) + data, status_code, headers = @api_client.call_api(:"POST", local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: FakeApi#test_endpoint_parameters\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end @@ -1205,7 +1205,7 @@ def test_enum_parameters_with_http_info(opts = {}) :return_type => return_type ) - data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) + data, status_code, headers = @api_client.call_api(:"GET", local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: FakeApi#test_enum_parameters\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end @@ -1294,7 +1294,7 @@ def test_group_parameters_with_http_info(opts = {}) :return_type => return_type ) - data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options) + data, status_code, headers = @api_client.call_api(:"DELETE", local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: FakeApi#test_group_parameters\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end @@ -1360,7 +1360,7 @@ def test_inline_additional_properties_with_http_info(request_body, opts = {}) :return_type => return_type ) - data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) + data, status_code, headers = @api_client.call_api(:"POST", local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: FakeApi#test_inline_additional_properties\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end @@ -1426,7 +1426,7 @@ def test_inline_freeform_additional_properties_with_http_info(test_inline_freefo :return_type => return_type ) - data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) + data, status_code, headers = @api_client.call_api(:"POST", local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: FakeApi#test_inline_freeform_additional_properties\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end @@ -1500,7 +1500,7 @@ def test_json_form_data_with_http_info(param, param2, opts = {}) :return_type => return_type ) - data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) + data, status_code, headers = @api_client.call_api(:"GET", local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: FakeApi#test_json_form_data\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end @@ -1598,7 +1598,7 @@ def test_query_parameter_collection_format_with_http_info(pipe, ioutil, http, ur :return_type => return_type ) - data, status_code, headers = @api_client.call_api(:PUT, local_var_path, new_options) + data, status_code, headers = @api_client.call_api(:"PUT", local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: FakeApi#test_query_parameter_collection_format\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end @@ -1664,7 +1664,7 @@ def test_string_map_reference_with_http_info(request_body, opts = {}) :return_type => return_type ) - data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) + data, status_code, headers = @api_client.call_api(:"POST", local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: FakeApi#test_string_map_reference\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end diff --git a/samples/client/petstore/ruby/lib/petstore/api/fake_classname_tags123_api.rb b/samples/client/petstore/ruby/lib/petstore/api/fake_classname_tags123_api.rb index 50f0c12d88b2..93509f82bd33 100644 --- a/samples/client/petstore/ruby/lib/petstore/api/fake_classname_tags123_api.rb +++ b/samples/client/petstore/ruby/lib/petstore/api/fake_classname_tags123_api.rb @@ -80,7 +80,7 @@ def test_classname_with_http_info(client, opts = {}) :return_type => return_type ) - data, status_code, headers = @api_client.call_api(:PATCH, local_var_path, new_options) + data, status_code, headers = @api_client.call_api(:"PATCH", local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: FakeClassnameTags123Api#test_classname\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end diff --git a/samples/client/petstore/ruby/lib/petstore/api/pet_api.rb b/samples/client/petstore/ruby/lib/petstore/api/pet_api.rb index 2448e4f6e815..4665efaa210d 100644 --- a/samples/client/petstore/ruby/lib/petstore/api/pet_api.rb +++ b/samples/client/petstore/ruby/lib/petstore/api/pet_api.rb @@ -78,7 +78,7 @@ def add_pet_with_http_info(pet, opts = {}) :return_type => return_type ) - data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) + data, status_code, headers = @api_client.call_api(:"POST", local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: PetApi#add_pet\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end @@ -142,7 +142,7 @@ def delete_pet_with_http_info(pet_id, opts = {}) :return_type => return_type ) - data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options) + data, status_code, headers = @api_client.call_api(:"DELETE", local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: PetApi#delete_pet\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end @@ -206,7 +206,7 @@ def find_pets_by_status_with_http_info(status, opts = {}) :return_type => return_type ) - data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) + data, status_code, headers = @api_client.call_api(:"GET", local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: PetApi#find_pets_by_status\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end @@ -270,7 +270,7 @@ def find_pets_by_tags_with_http_info(tags, opts = {}) :return_type => return_type ) - data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) + data, status_code, headers = @api_client.call_api(:"GET", local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: PetApi#find_pets_by_tags\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end @@ -333,7 +333,7 @@ def get_pet_by_id_with_http_info(pet_id, opts = {}) :return_type => return_type ) - data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) + data, status_code, headers = @api_client.call_api(:"GET", local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: PetApi#get_pet_by_id\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end @@ -399,7 +399,7 @@ def update_pet_with_http_info(pet, opts = {}) :return_type => return_type ) - data, status_code, headers = @api_client.call_api(:PUT, local_var_path, new_options) + data, status_code, headers = @api_client.call_api(:"PUT", local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: PetApi#update_pet\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end @@ -471,7 +471,7 @@ def update_pet_with_form_with_http_info(pet_id, opts = {}) :return_type => return_type ) - data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) + data, status_code, headers = @api_client.call_api(:"POST", local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: PetApi#update_pet_with_form\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end @@ -545,7 +545,7 @@ def upload_file_with_http_info(pet_id, opts = {}) :return_type => return_type ) - data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) + data, status_code, headers = @api_client.call_api(:"POST", local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: PetApi#upload_file\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end @@ -623,7 +623,7 @@ def upload_file_with_required_file_with_http_info(pet_id, required_file, opts = :return_type => return_type ) - data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) + data, status_code, headers = @api_client.call_api(:"POST", local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: PetApi#upload_file_with_required_file\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end diff --git a/samples/client/petstore/ruby/lib/petstore/api/store_api.rb b/samples/client/petstore/ruby/lib/petstore/api/store_api.rb index d573ff72bcf3..6f6ef887bf08 100644 --- a/samples/client/petstore/ruby/lib/petstore/api/store_api.rb +++ b/samples/client/petstore/ruby/lib/petstore/api/store_api.rb @@ -73,7 +73,7 @@ def delete_order_with_http_info(order_id, opts = {}) :return_type => return_type ) - data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options) + data, status_code, headers = @api_client.call_api(:"DELETE", local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: StoreApi#delete_order\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end @@ -130,7 +130,7 @@ def get_inventory_with_http_info(opts = {}) :return_type => return_type ) - data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) + data, status_code, headers = @api_client.call_api(:"GET", local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: StoreApi#get_inventory\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end @@ -201,7 +201,7 @@ def get_order_by_id_with_http_info(order_id, opts = {}) :return_type => return_type ) - data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) + data, status_code, headers = @api_client.call_api(:"GET", local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: StoreApi#get_order_by_id\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end @@ -269,7 +269,7 @@ def place_order_with_http_info(order, opts = {}) :return_type => return_type ) - data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) + data, status_code, headers = @api_client.call_api(:"POST", local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: StoreApi#place_order\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end diff --git a/samples/client/petstore/ruby/lib/petstore/api/user_api.rb b/samples/client/petstore/ruby/lib/petstore/api/user_api.rb index 2374bcaf996a..9ba5e13f8c44 100644 --- a/samples/client/petstore/ruby/lib/petstore/api/user_api.rb +++ b/samples/client/petstore/ruby/lib/petstore/api/user_api.rb @@ -78,7 +78,7 @@ def create_user_with_http_info(user, opts = {}) :return_type => return_type ) - data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) + data, status_code, headers = @api_client.call_api(:"POST", local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: UserApi#create_user\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end @@ -144,7 +144,7 @@ def create_users_with_array_input_with_http_info(user, opts = {}) :return_type => return_type ) - data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) + data, status_code, headers = @api_client.call_api(:"POST", local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: UserApi#create_users_with_array_input\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end @@ -210,7 +210,7 @@ def create_users_with_list_input_with_http_info(user, opts = {}) :return_type => return_type ) - data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) + data, status_code, headers = @api_client.call_api(:"POST", local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: UserApi#create_users_with_list_input\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end @@ -271,7 +271,7 @@ def delete_user_with_http_info(username, opts = {}) :return_type => return_type ) - data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options) + data, status_code, headers = @api_client.call_api(:"DELETE", local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: UserApi#delete_user\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end @@ -334,7 +334,7 @@ def get_user_by_name_with_http_info(username, opts = {}) :return_type => return_type ) - data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) + data, status_code, headers = @api_client.call_api(:"GET", local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: UserApi#get_user_by_name\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end @@ -405,7 +405,7 @@ def login_user_with_http_info(username, password, opts = {}) :return_type => return_type ) - data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) + data, status_code, headers = @api_client.call_api(:"GET", local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: UserApi#login_user\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end @@ -460,7 +460,7 @@ def logout_user_with_http_info(opts = {}) :return_type => return_type ) - data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) + data, status_code, headers = @api_client.call_api(:"GET", local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: UserApi#logout_user\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end @@ -532,7 +532,7 @@ def update_user_with_http_info(username, user, opts = {}) :return_type => return_type ) - data, status_code, headers = @api_client.call_api(:PUT, local_var_path, new_options) + data, status_code, headers = @api_client.call_api(:"PUT", local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: UserApi#update_user\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end diff --git a/samples/openapi3/client/extensions/x-auth-id-alias/ruby-client/lib/x_auth_id_alias/api/usage_api.rb b/samples/openapi3/client/extensions/x-auth-id-alias/ruby-client/lib/x_auth_id_alias/api/usage_api.rb index aa49d3c3b61b..033f50d7857d 100644 --- a/samples/openapi3/client/extensions/x-auth-id-alias/ruby-client/lib/x_auth_id_alias/api/usage_api.rb +++ b/samples/openapi3/client/extensions/x-auth-id-alias/ruby-client/lib/x_auth_id_alias/api/usage_api.rb @@ -69,7 +69,7 @@ def any_key_with_http_info(opts = {}) :return_type => return_type ) - data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) + data, status_code, headers = @api_client.call_api(:"GET", local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: UsageApi#any_key\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end @@ -126,7 +126,7 @@ def both_keys_with_http_info(opts = {}) :return_type => return_type ) - data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) + data, status_code, headers = @api_client.call_api(:"GET", local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: UsageApi#both_keys\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end @@ -183,7 +183,7 @@ def key_in_header_with_http_info(opts = {}) :return_type => return_type ) - data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) + data, status_code, headers = @api_client.call_api(:"GET", local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: UsageApi#key_in_header\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end @@ -240,7 +240,7 @@ def key_in_query_with_http_info(opts = {}) :return_type => return_type ) - data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) + data, status_code, headers = @api_client.call_api(:"GET", local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: UsageApi#key_in_query\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end diff --git a/samples/openapi3/client/features/dynamic-servers/ruby/lib/dynamic_servers/api/usage_api.rb b/samples/openapi3/client/features/dynamic-servers/ruby/lib/dynamic_servers/api/usage_api.rb index 61affdb24e22..22cf0b9e95de 100644 --- a/samples/openapi3/client/features/dynamic-servers/ruby/lib/dynamic_servers/api/usage_api.rb +++ b/samples/openapi3/client/features/dynamic-servers/ruby/lib/dynamic_servers/api/usage_api.rb @@ -69,7 +69,7 @@ def custom_server_with_http_info(opts = {}) :return_type => return_type ) - data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) + data, status_code, headers = @api_client.call_api(:"GET", local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: UsageApi#custom_server\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end @@ -126,7 +126,7 @@ def default_server_with_http_info(opts = {}) :return_type => return_type ) - data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) + data, status_code, headers = @api_client.call_api(:"GET", local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: UsageApi#default_server\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end diff --git a/samples/openapi3/client/features/generate-alias-as-model/ruby-client/lib/petstore/api/usage_api.rb b/samples/openapi3/client/features/generate-alias-as-model/ruby-client/lib/petstore/api/usage_api.rb index f2a4653f5d2d..bce6ceb79ef2 100644 --- a/samples/openapi3/client/features/generate-alias-as-model/ruby-client/lib/petstore/api/usage_api.rb +++ b/samples/openapi3/client/features/generate-alias-as-model/ruby-client/lib/petstore/api/usage_api.rb @@ -76,7 +76,7 @@ def array_with_http_info(opts = {}) :return_type => return_type ) - data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) + data, status_code, headers = @api_client.call_api(:"GET", local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: UsageApi#array\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end @@ -140,7 +140,7 @@ def map_with_http_info(opts = {}) :return_type => return_type ) - data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) + data, status_code, headers = @api_client.call_api(:"GET", local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: UsageApi#map\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end From 043b37aa564c998a9d0dce5ce74ce811b5893c60 Mon Sep 17 00:00:00 2001 From: khayashi4337 Date: Wed, 23 Sep 2026 00:48:26 +0900 Subject: [PATCH 09/31] test: delete generated temp dirs deterministically, fix probe hang File.deleteOnExit() cannot remove non-empty directories, so generated output trees (and cargo target dirs) accumulated in /tmp. GoClientCodegenTest now collects temp dirs and deletes them recursively in @AfterClass. isCommandAvailable() drained the child's stdout before waitFor(), which blocked forever when the spawned command waited on stdin (e.g. bare `ruby` with no arguments) - the timeout was never reached. Wait first, drain after. Generated with [Devin](https://devin.ai) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com> --- .../codegen/go/GoClientCodegenTest.java | 88 +++++++++---------- .../codegen/rust/RustClientCodegenTest.java | 49 ++++++----- 2 files changed, 68 insertions(+), 69 deletions(-) diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/go/GoClientCodegenTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/go/GoClientCodegenTest.java index e213595de05d..0ceedc76d2a9 100644 --- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/go/GoClientCodegenTest.java +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/go/GoClientCodegenTest.java @@ -19,10 +19,12 @@ import io.swagger.v3.oas.models.OpenAPI; import io.swagger.v3.oas.models.Operation; +import org.apache.commons.io.FileUtils; import org.openapitools.codegen.*; import org.openapitools.codegen.config.CodegenConfigurator; import org.openapitools.codegen.languages.GoClientCodegen; import org.testng.Assert; +import org.testng.annotations.AfterClass; import org.testng.annotations.Test; import java.io.File; @@ -30,6 +32,7 @@ import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; +import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -37,6 +40,19 @@ public class GoClientCodegenTest { + // File.deleteOnExit() cannot remove non-empty directories, so generated + // output trees are collected here and deleted recursively after the class + private static final List TEMP_DIRS = new ArrayList<>(); + + @AfterClass(alwaysRun = true) + public static void deleteTempDirs() throws IOException { + for (File dir : TEMP_DIRS) { + FileUtils.deleteDirectory(dir); + } + TEMP_DIRS.clear(); + } + + @Test public void testInitialConfigValues() throws Exception { final GoClientCodegen codegen = new GoClientCodegen(); @@ -121,7 +137,7 @@ public void testFilenames() throws Exception { @Test public void testPrimitiveTypeInOneOf() throws IOException { File output = Files.createTempDirectory("test").toFile(); - output.deleteOnExit(); + TEMP_DIRS.add(output); final CodegenConfigurator configurator = new CodegenConfigurator() .setGeneratorName("go") @@ -131,7 +147,6 @@ public void testPrimitiveTypeInOneOf() throws IOException { DefaultGenerator generator = new DefaultGenerator(); List files = generator.opts(configurator.toClientOptInput()).generate(); System.out.println(files); - files.forEach(File::deleteOnExit); Path modelFile = Paths.get(output + "/model_example.go"); TestUtils.assertFileContains(modelFile, "Child *Child"); @@ -144,7 +159,7 @@ public void testPrimitiveTypeInOneOf() throws IOException { @Test public void testNullableComposition() throws IOException { File output = Files.createTempDirectory("test").toFile(); - output.deleteOnExit(); + TEMP_DIRS.add(output); final CodegenConfigurator configurator = new CodegenConfigurator() .setGeneratorName("go") @@ -153,7 +168,6 @@ public void testNullableComposition() throws IOException { DefaultGenerator generator = new DefaultGenerator(); List files = generator.opts(configurator.toClientOptInput()).generate(); - files.forEach(File::deleteOnExit); TestUtils.assertFileContains(Paths.get(output + "/model_example.go"), "Child NullableChild"); } @@ -161,7 +175,7 @@ public void testNullableComposition() throws IOException { @Test public void testMultipleRequiredPropertiesHasSameOneOfObject() throws IOException { File output = Files.createTempDirectory("test").toFile(); - output.deleteOnExit(); + TEMP_DIRS.add(output); final CodegenConfigurator configurator = new CodegenConfigurator() .setGeneratorName("go") @@ -171,7 +185,6 @@ public void testMultipleRequiredPropertiesHasSameOneOfObject() throws IOExceptio DefaultGenerator generator = new DefaultGenerator(); List files = generator.opts(configurator.toClientOptInput()).generate(); System.out.println(files); - files.forEach(File::deleteOnExit); Path docFile = Paths.get(output + "/docs/PetAPI.md"); TestUtils.assertFileContains(docFile, "openapiclient.pet{Cat: openapiclient.NewCat(\"Attr_example\")}, openapiclient.pet{Cat: openapiclient.NewCat(\"Attr_example\")}, openapiclient.pet{Cat: openapiclient.NewCat(\"Attr_example\")}"); @@ -183,7 +196,7 @@ public void testStructPrefix() throws IOException { properties.put(GoClientCodegen.STRUCT_PREFIX, true); File output = Files.createTempDirectory("test").toFile(); - output.deleteOnExit(); + TEMP_DIRS.add(output); final CodegenConfigurator configurator = new CodegenConfigurator() .setGeneratorName("go") @@ -193,7 +206,6 @@ public void testStructPrefix() throws IOException { DefaultGenerator generator = new DefaultGenerator(); List files = generator.opts(configurator.toClientOptInput()).generate(); - files.forEach(File::deleteOnExit); TestUtils.assertFileContains(Paths.get(output + "/api_pet.go"), "type PetAPIAddPetRequest struct"); } @@ -205,7 +217,7 @@ public void testEnumUnknownDefaultCaseUsesModelSpecificNamesWhenEnumClassPrefixD properties.put(CodegenConstants.ENUM_CLASS_PREFIX, false); File output = Files.createTempDirectory("test").toFile(); - output.deleteOnExit(); + TEMP_DIRS.add(output); final CodegenConfigurator configurator = new CodegenConfigurator() .setGeneratorName("go") @@ -215,7 +227,6 @@ public void testEnumUnknownDefaultCaseUsesModelSpecificNamesWhenEnumClassPrefixD DefaultGenerator generator = new DefaultGenerator(); List files = generator.opts(configurator.toClientOptInput()).generate(); - files.forEach(File::deleteOnExit); Path statusA = Paths.get(output + "/model_status_a.go"); Path statusB = Paths.get(output + "/model_status_b.go"); @@ -241,7 +252,7 @@ public void testAdditionalPropertiesModelFileFolder() throws Exception { @Test public void verifyTestFile() throws IOException { File output = Files.createTempDirectory("test").toFile(); - output.deleteOnExit(); + TEMP_DIRS.add(output); final CodegenConfigurator configurator = new CodegenConfigurator() .setGeneratorName("go") @@ -250,7 +261,6 @@ public void verifyTestFile() throws IOException { DefaultGenerator generator = new DefaultGenerator(); List files = generator.opts(configurator.toClientOptInput()).generate(); - files.forEach(File::deleteOnExit); TestUtils.assertFileExists(Paths.get(output + "/test/api_pet_test.go")); TestUtils.assertFileContains(Paths.get(output + "/test/api_pet_test.go"), @@ -260,7 +270,7 @@ public void verifyTestFile() throws IOException { @Test public void verifyTestImport() throws IOException { File output = Files.createTempDirectory("test").toFile(); - output.deleteOnExit(); + TEMP_DIRS.add(output); final CodegenConfigurator configurator = new CodegenConfigurator() .setGeneratorName("go") @@ -271,7 +281,6 @@ public void verifyTestImport() throws IOException { DefaultGenerator generator = new DefaultGenerator(); List files = generator.opts(configurator.toClientOptInput()).generate(); - files.forEach(File::deleteOnExit); TestUtils.assertFileExists(Paths.get(output + "/test/api_pet_test.go")); TestUtils.assertFileContains(Paths.get(output + "/test/api_pet_test.go"), @@ -281,7 +290,7 @@ public void verifyTestImport() throws IOException { @Test public void verifyFormatErrorMessageInUse() throws IOException { File output = Files.createTempDirectory("test").toFile(); - output.deleteOnExit(); + TEMP_DIRS.add(output); final CodegenConfigurator configurator = new CodegenConfigurator() .setGeneratorName("go") @@ -290,7 +299,6 @@ public void verifyFormatErrorMessageInUse() throws IOException { DefaultGenerator generator = new DefaultGenerator(); List files = generator.opts(configurator.toClientOptInput()).generate(); - files.forEach(File::deleteOnExit); TestUtils.assertFileExists(Paths.get(output + "/api_pet.go")); TestUtils.assertFileContains(Paths.get(output + "/api_pet.go"), @@ -300,7 +308,7 @@ public void verifyFormatErrorMessageInUse() throws IOException { @Test public void verifyApiTestWithNullResponse() throws IOException { File output = Files.createTempDirectory("test").toFile(); - output.deleteOnExit(); + TEMP_DIRS.add(output); final CodegenConfigurator configurator = new CodegenConfigurator() .setGeneratorName("go") @@ -311,7 +319,6 @@ public void verifyApiTestWithNullResponse() throws IOException { DefaultGenerator generator = new DefaultGenerator(); List files = generator.opts(configurator.toClientOptInput()).generate(); - files.forEach(File::deleteOnExit); TestUtils.assertFileExists(Paths.get(output + "/test/api_pet_test.go")); TestUtils.assertFileNotContains(Paths.get(output + "/test/api_pet_test.go"), @@ -325,7 +332,7 @@ public void verifyApiTestWithNullResponse() throws IOException { @Test public void verifyApiWithAllOfMultipleRefAndDiscriminator() throws IOException { File output = Files.createTempDirectory("test").toFile(); - output.deleteOnExit(); + TEMP_DIRS.add(output); final CodegenConfigurator configurator = new CodegenConfigurator() .setGeneratorName("go") @@ -336,7 +343,6 @@ public void verifyApiWithAllOfMultipleRefAndDiscriminator() throws IOException { DefaultGenerator generator = new DefaultGenerator(); List files = generator.opts(configurator.toClientOptInput()).generate(); - files.forEach(File::deleteOnExit); TestUtils.assertFileExists(Paths.get(output + "/model_final_item.go")); TestUtils.assertFileContains(Paths.get(output + "/model_final_item.go"), @@ -346,7 +352,7 @@ public void verifyApiWithAllOfMultipleRefAndDiscriminator() throws IOException { @Test public void testVendorExtensionGenerateUnmarshalJson() throws IOException { File output = Files.createTempDirectory("test").toFile(); - output.deleteOnExit(); + TEMP_DIRS.add(output); final CodegenConfigurator configurator = new CodegenConfigurator() .setGeneratorName("go") @@ -357,7 +363,6 @@ public void testVendorExtensionGenerateUnmarshalJson() throws IOException { DefaultGenerator generator = new DefaultGenerator(); List files = generator.opts(configurator.toClientOptInput()).generate(); - files.forEach(File::deleteOnExit); TestUtils.assertFileExists(Paths.get(output + "/model_base_item.go")); TestUtils.assertFileContains(Paths.get(output + "/model_base_item.go"), @@ -367,7 +372,7 @@ public void testVendorExtensionGenerateUnmarshalJson() throws IOException { @Test public void testVendorExtensionSkipGenerateUnmarshalJson() throws IOException { File output = Files.createTempDirectory("test").toFile(); - output.deleteOnExit(); + TEMP_DIRS.add(output); final CodegenConfigurator configurator = new CodegenConfigurator() .setGeneratorName("go") @@ -378,7 +383,6 @@ public void testVendorExtensionSkipGenerateUnmarshalJson() throws IOException { DefaultGenerator generator = new DefaultGenerator(); List files = generator.opts(configurator.toClientOptInput()).generate(); - files.forEach(File::deleteOnExit); TestUtils.assertFileExists(Paths.get(output + "/model_base_item.go")); TestUtils.assertFileNotContains(Paths.get(output + "/model_base_item.go"), @@ -391,7 +395,7 @@ public void testNoImportsWithoutUnmarshal() throws IOException { properties.put(CodegenConstants.GENERATE_UNMARSHAL_JSON, false); File output = Files.createTempDirectory("test").toFile(); - output.deleteOnExit(); + TEMP_DIRS.add(output); final CodegenConfigurator configurator = new CodegenConfigurator() .setGeneratorName("go") @@ -401,7 +405,6 @@ public void testNoImportsWithoutUnmarshal() throws IOException { DefaultGenerator generator = new DefaultGenerator(); List files = generator.opts(configurator.toClientOptInput()).generate(); - files.forEach(File::deleteOnExit); TestUtils.assertFileNotContains(Paths.get(output + "/model_pet.go"), "bytes"); } @@ -409,7 +412,7 @@ public void testNoImportsWithoutUnmarshal() throws IOException { @Test public void testAdditionalPropertiesWithGoMod() throws Exception { File output = Files.createTempDirectory("test").toFile(); - output.deleteOnExit(); + TEMP_DIRS.add(output); final CodegenConfigurator configurator = new CodegenConfigurator() .setGeneratorName("go") @@ -419,7 +422,6 @@ public void testAdditionalPropertiesWithGoMod() throws Exception { DefaultGenerator generator = new DefaultGenerator(); List files = generator.opts(configurator.toClientOptInput()).generate(); System.out.println(files); - files.forEach(File::deleteOnExit); Path goModFile = Paths.get(output + "/go.mod"); TestUtils.assertFileExists(goModFile); @@ -430,7 +432,7 @@ public void testAdditionalPropertiesWithGoMod() throws Exception { @Test public void testAdditionalPropertiesWithoutGoMod() throws Exception { File output = Files.createTempDirectory("test").toFile(); - output.deleteOnExit(); + TEMP_DIRS.add(output); final CodegenConfigurator configurator = new CodegenConfigurator() .setGeneratorName("go") @@ -441,7 +443,6 @@ public void testAdditionalPropertiesWithoutGoMod() throws Exception { DefaultGenerator generator = new DefaultGenerator(); List files = generator.opts(configurator.toClientOptInput()).generate(); System.out.println(files); - files.forEach(File::deleteOnExit); Path goModFile = Paths.get(output + "/go.mod"); TestUtils.assertFileNotExists(goModFile); @@ -456,7 +457,7 @@ public void testXmlOptionsBeingUsed() throws IOException { properties.put(GoClientCodegen.WITH_XML, true); File output = Files.createTempDirectory("test").toFile(); - output.deleteOnExit(); + TEMP_DIRS.add(output); final CodegenConfigurator configurator = new CodegenConfigurator() .setGeneratorName("go") @@ -466,7 +467,6 @@ public void testXmlOptionsBeingUsed() throws IOException { DefaultGenerator generator = new DefaultGenerator(); List files = generator.opts(configurator.toClientOptInput()).generate(); - files.forEach(File::deleteOnExit); TestUtils.assertFileContains(Paths.get(output + "/model_pet.go"), "tags>tag"); } @@ -474,7 +474,7 @@ public void testXmlOptionsBeingUsed() throws IOException { @Test public void testArrayDefaultValue() throws IOException { File output = Files.createTempDirectory("test").toFile(); - output.deleteOnExit(); + TEMP_DIRS.add(output); final CodegenConfigurator configurator = new CodegenConfigurator() .setGeneratorName("go") @@ -483,7 +483,6 @@ public void testArrayDefaultValue() throws IOException { DefaultGenerator generator = new DefaultGenerator(); List files = generator.opts(configurator.toClientOptInput()).generate(); - files.forEach(File::deleteOnExit); Path apiPath = Paths.get(output + "/api_default.go"); String defaultStringArrayString = "var defaultValue []string = []string{\"test1\", \"test2\"}"; String defaultEnumArrayString = "var defaultValue []ExampleEnum = []ExampleEnum{\"example1\"}"; @@ -496,7 +495,7 @@ public void testArrayDefaultValue() throws IOException { @Test public void testEscapingInExamples() throws IOException { File output = Files.createTempDirectory("test").toFile(); - output.deleteOnExit(); + TEMP_DIRS.add(output); final CodegenConfigurator configurator = new CodegenConfigurator() .setGeneratorName("go") @@ -505,7 +504,6 @@ public void testEscapingInExamples() throws IOException { DefaultGenerator generator = new DefaultGenerator(); List files = generator.opts(configurator.toClientOptInput()).generate(); - files.forEach(File::deleteOnExit); Path docPath = Paths.get(output + "/docs/TestAPI.md"); // Verify that quotes are properly escaped in parameter examples @@ -522,7 +520,7 @@ public void testOneOfUnmarshalJSONHonorsGenerateUnmarshalJSONFlag() throws IOExc properties.put(CodegenConstants.GENERATE_UNMARSHAL_JSON, false); File output = Files.createTempDirectory("test").toFile(); - output.deleteOnExit(); + TEMP_DIRS.add(output); final CodegenConfigurator configurator = new CodegenConfigurator() .setGeneratorName("go") @@ -532,7 +530,6 @@ public void testOneOfUnmarshalJSONHonorsGenerateUnmarshalJSONFlag() throws IOExc DefaultGenerator generator = new DefaultGenerator(); List files = generator.opts(configurator.toClientOptInput()).generate(); - files.forEach(File::deleteOnExit); // With the flag disabled the validator import is not added, so the oneOf model must not // emit UnmarshalJSON (which would reference the missing validator package and fail to compile). @@ -545,7 +542,7 @@ public void testOneOfUnmarshalJSONHonorsGenerateUnmarshalJSONFlag() throws IOExc @Test(description = "with the default generateUnmarshalJSON=true the oneOf UnmarshalJSON and the validator import are still generated") public void testOneOfUnmarshalJSONGeneratedByDefault() throws IOException { File output = Files.createTempDirectory("test").toFile(); - output.deleteOnExit(); + TEMP_DIRS.add(output); final CodegenConfigurator configurator = new CodegenConfigurator() .setGeneratorName("go") @@ -554,7 +551,6 @@ public void testOneOfUnmarshalJSONGeneratedByDefault() throws IOException { DefaultGenerator generator = new DefaultGenerator(); List files = generator.opts(configurator.toClientOptInput()).generate(); - files.forEach(File::deleteOnExit); Path oneOfModel = Paths.get(output + "/model_object.go"); TestUtils.assertFileContains(oneOfModel, @@ -566,7 +562,7 @@ public void testOneOfUnmarshalJSONGeneratedByDefault() throws IOException { @Test(description = "OpenAPI 3.2 query/additionalOperations and in:querystring generate working Go code") public void testOpenAPI32QueryAndAdditionalOperations() throws IOException { File output = Files.createTempDirectory("test").toFile(); - output.deleteOnExit(); + TEMP_DIRS.add(output); final CodegenConfigurator configurator = new CodegenConfigurator() .setGeneratorName("go") @@ -575,7 +571,6 @@ public void testOpenAPI32QueryAndAdditionalOperations() throws IOException { DefaultGenerator generator = new DefaultGenerator(); List files = generator.opts(configurator.toClientOptInput()).generate(); - files.forEach(File::deleteOnExit); Path apiFile = Paths.get(output + "/api_default.go"); // non-standard methods are emitted as string literals; net/http has no @@ -598,7 +593,7 @@ public void testOpenAPI32QueryAndAdditionalOperations() throws IOException { @Test(description = "prepareRequest keeps a path-embedded raw query string verbatim") public void testOpenAPI32QueryStringPreservedInClient() throws IOException { File output = Files.createTempDirectory("test").toFile(); - output.deleteOnExit(); + TEMP_DIRS.add(output); final CodegenConfigurator configurator = new CodegenConfigurator() .setGeneratorName("go") @@ -607,7 +602,6 @@ public void testOpenAPI32QueryStringPreservedInClient() throws IOException { DefaultGenerator generator = new DefaultGenerator(); List files = generator.opts(configurator.toClientOptInput()).generate(); - files.forEach(File::deleteOnExit); Path clientFile = Paths.get(output + "/client.go"); TestUtils.assertFileContains(clientFile, "rawQueryString := url.RawQuery"); @@ -616,7 +610,7 @@ public void testOpenAPI32QueryStringPreservedInClient() throws IOException { @Test(description = "in:querystring together with a path parameter imports strings only once") public void testOpenAPI32QueryStringWithPathParamImports() throws IOException { File output = Files.createTempDirectory("test").toFile(); - output.deleteOnExit(); + TEMP_DIRS.add(output); final CodegenConfigurator configurator = new CodegenConfigurator() .setGeneratorName("go") @@ -625,7 +619,6 @@ public void testOpenAPI32QueryStringWithPathParamImports() throws IOException { DefaultGenerator generator = new DefaultGenerator(); List files = generator.opts(configurator.toClientOptInput()).generate(); - files.forEach(File::deleteOnExit); Path apiFile = Paths.get(output + "/api_default.go"); TestUtils.assertFileContains(apiFile, "strings.Contains(localVarPath, \"?\")"); @@ -638,7 +631,7 @@ public void testOpenAPI32QueryStringWithPathParamImports() throws IOException { @Test(description = "OpenAPI 3.2 query/additionalOperations in webhooks also emit verbatim method literals") public void testOpenAPI32WebhookOperations() throws IOException { File output = Files.createTempDirectory("test").toFile(); - output.deleteOnExit(); + TEMP_DIRS.add(output); final CodegenConfigurator configurator = new CodegenConfigurator() .setGeneratorName("go") @@ -647,7 +640,6 @@ public void testOpenAPI32WebhookOperations() throws IOException { DefaultGenerator generator = new DefaultGenerator(); List files = generator.opts(configurator.toClientOptInput()).generate(); - files.forEach(File::deleteOnExit); // webhooks render through the same api.mustache; their non-standard // methods must be literals too, otherwise the output does not compile diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/rust/RustClientCodegenTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/rust/RustClientCodegenTest.java index 646ef1a3ec3c..e02c3df29a7d 100644 --- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/rust/RustClientCodegenTest.java +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/rust/RustClientCodegenTest.java @@ -18,6 +18,7 @@ package org.openapitools.codegen.rust; import io.swagger.v3.oas.models.media.IntegerSchema; +import org.apache.commons.io.FileUtils; import org.openapitools.codegen.CodegenConstants; import org.openapitools.codegen.DefaultGenerator; import org.openapitools.codegen.TestUtils; @@ -499,37 +500,43 @@ public void testReqwestGeneratedClientSendsVerbatimMethods() throws IOException, throw new org.testng.SkipException("crates.io is unreachable; skipping generated-client verification"); } Path target = Files.createTempDirectory("rust32-verify"); - target.toFile().deleteOnExit(); - final CodegenConfigurator configurator = new CodegenConfigurator() - .setGeneratorName("rust") - .setLibrary("reqwest") - .addAdditionalProperty("reqwestDefaultFeatures", "rustls") - .addAdditionalProperty("supportAsync", false) - .setInputSpec("src/test/resources/3_2/query-operation.yaml") - .setSkipOverwrite(false) - .setOutputDir(target.toAbsolutePath().toString().replace("\\", "/")); - new DefaultGenerator().opts(configurator.toClientOptInput()).generate(); - - Path binDir = target.resolve("src/bin"); - Files.createDirectories(binDir); - Files.copy(Path.of("src/test/resources/3_2/rust-reqwest-capture/capture.rs"), - binDir.resolve("capture.rs")); - - runCargo(target, "build"); - String out = runCargo(target, "run", "--bin", "capture"); - Assert.assertTrue(out.contains("CAPTURE-PASS"), - "generated client did not send verbatim 3.2 methods/querystring:\n" + out); + try { + final CodegenConfigurator configurator = new CodegenConfigurator() + .setGeneratorName("rust") + .setLibrary("reqwest") + .addAdditionalProperty("reqwestDefaultFeatures", "rustls") + .addAdditionalProperty("supportAsync", false) + .setInputSpec("src/test/resources/3_2/query-operation.yaml") + .setSkipOverwrite(false) + .setOutputDir(target.toAbsolutePath().toString().replace("\\", "/")); + new DefaultGenerator().opts(configurator.toClientOptInput()).generate(); + + Path binDir = target.resolve("src/bin"); + Files.createDirectories(binDir); + Files.copy(Path.of("src/test/resources/3_2/rust-reqwest-capture/capture.rs"), + binDir.resolve("capture.rs")); + + runCargo(target, "build"); + String out = runCargo(target, "run", "--bin", "capture"); + Assert.assertTrue(out.contains("CAPTURE-PASS"), + "generated client did not send verbatim 3.2 methods/querystring:\n" + out); + } finally { + // cargo's target dir is hundreds of MB; deleteOnExit cannot remove non-empty dirs + FileUtils.deleteDirectory(target.toFile()); + } } private boolean isCommandAvailable(String command) { try { Process p = new ProcessBuilder(command, "--version") .redirectErrorStream(true).start(); - p.getInputStream().transferTo(java.io.OutputStream.nullOutputStream()); + // wait before draining: a child that never exits would otherwise block + // the stream read forever if (!p.waitFor(10, TimeUnit.SECONDS)) { p.destroyForcibly(); return false; } + p.getInputStream().transferTo(java.io.OutputStream.nullOutputStream()); return p.exitValue() == 0; } catch (IOException | InterruptedException e) { return false; From ef3f821581ba5f3a672eeb724ca7e6979b318b37 Mon Sep 17 00:00:00 2001 From: khayashi4337 Date: Wed, 23 Sep 2026 01:01:57 +0900 Subject: [PATCH 10/31] feat(php): generate OpenAPI 3.2 query/additionalOperations and in:querystring (guzzle) Scope: guzzle library only - psr-18 delegates method handling to the injected PSR-17/PSR-18 implementation (Guzzle's factory up-cases, Symfony rejects non-uppercase tokens), and php-nextgen/php-dt are out of scope, so those keep warning/skipping 3.2 operations. - non-standard RFC 9110 methods build the request through an anonymous Request subclass that keeps the verbatim token: guzzlehttp/psr7 upper-cases in the constructor/withMethod, but Guzzle handlers only ever read RequestInterface::getMethod() - invalid RFC 9110 tokens are warned about and skipped at codegen time - "'" is escaped for PHP single-quoted literals, "|" for markdown docs - in:querystring parameters append verbatim with automatic ?/& delimiter and are excluded from the regular query params - adds an executable raw TCP capture test (composer install + php run, 6 request lines verified) and unit tests for psr-18 skipping, invalid tokens, and webhooks; all 15 php sample configs regenerate byte-identical Generated with [Devin](https://devin.ai) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com> --- .../codegen/languages/PhpClientCodegen.java | 75 +++++++ .../src/main/resources/php/README.mustache | 2 +- .../src/main/resources/php/api.mustache | 53 ++++- .../src/main/resources/php/api_doc.mustache | 2 +- .../codegen/php/PhpClientCodegenTest.java | 197 ++++++++++++++++++ .../3_2/php-guzzle-capture/capture.php | 104 +++++++++ 6 files changed, 430 insertions(+), 3 deletions(-) create mode 100644 modules/openapi-generator/src/test/resources/3_2/php-guzzle-capture/capture.php diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PhpClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PhpClientCodegen.java index cc666a5723b0..780517d6f312 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PhpClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PhpClientCodegen.java @@ -20,17 +20,25 @@ import org.apache.commons.lang3.StringUtils; import org.openapitools.codegen.CliOption; import org.openapitools.codegen.CodegenConstants; +import org.openapitools.codegen.CodegenOperation; import org.openapitools.codegen.CodegenType; import org.openapitools.codegen.SupportingFile; import org.openapitools.codegen.meta.features.*; +import org.openapitools.codegen.model.ModelMap; +import org.openapitools.codegen.model.OperationsMap; +import org.openapitools.codegen.model.WebhooksMap; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.io.File; import java.util.ArrayList; +import java.util.Arrays; import java.util.Collections; import java.util.EnumSet; +import java.util.HashSet; +import java.util.Iterator; import java.util.List; +import java.util.Set; /** *

Mustache templates are located in @@ -143,4 +151,71 @@ public void processOpts() { } } + + @Override + public boolean supportsAdditionalOperations() { + // only the guzzle template can emit arbitrary methods verbatim: psr-18 + // delegates method handling to the injected PSR-17/PSR-18 implementation + // (Guzzle factory up-cases, Symfony rejects non-uppercase tokens) + return GUZZLE.equals(getLibrary()); + } + + @Override + protected boolean supportsQueryStringParameters() { + return GUZZLE.equals(getLibrary()); + } + + private static final Set STANDARD_HTTP_METHODS = new HashSet<>(Arrays.asList( + "GET", "PUT", "POST", "DELETE", "OPTIONS", "HEAD", "PATCH", "TRACE", "CONNECT")); + + // RFC 9110 tchar: method tokens the generated client can send verbatim + private static final java.util.regex.Pattern HTTP_METHOD_TOKEN_PATTERN = + java.util.regex.Pattern.compile("[!#$%&'*+\\-.^_`|~0-9A-Za-z]+"); + + /** + * Marks OpenAPI 3.2 (query/additionalOperations) HTTP methods for verbatim emission and + * operations carrying {@code in: querystring} parameters. Operation names that are not + * valid RFC 9110 tokens are warned about and skipped. + * + *

Extensions set: {@code x-php-verbatim-method} (non-standard method present), + * {@code x-php-http-method-literal} (token escaped for a PHP single-quoted string - + * {@code '} is valid tchar but would terminate the literal), and + * {@code x-php-http-method-doc} ({@code |} escaped for markdown tables). + */ + private void flagVerbatimHttpMethods(List operationList) { + Iterator it = operationList.iterator(); + while (it.hasNext()) { + CodegenOperation op = it.next(); + if (op.allParams != null && op.allParams.stream().anyMatch(p -> p.isQueryStringParam)) { + op.vendorExtensions.put("x-php-has-querystring-param", true); + } + if (op.httpMethod == null || STANDARD_HTTP_METHODS.contains(op.httpMethod)) { + continue; + } + if (!HTTP_METHOD_TOKEN_PATTERN.matcher(op.httpMethod).matches()) { + LOGGER.warn("Skipping operation {}: HTTP method name '{}' is not a valid " + + "RFC 9110 token and cannot be emitted as a PHP string literal.", + op.operationId, op.httpMethod); + it.remove(); + continue; + } + op.vendorExtensions.put("x-php-verbatim-method", true); + op.vendorExtensions.put("x-php-http-method-literal", op.httpMethod.replace("'", "\\'")); + op.vendorExtensions.put("x-php-http-method-doc", op.httpMethod.replace("|", "\\|")); + } + } + + @Override + public OperationsMap postProcessOperationsWithModels(OperationsMap objs, List allModels) { + OperationsMap map = super.postProcessOperationsWithModels(objs, allModels); + flagVerbatimHttpMethods(map.getOperations().getOperation()); + return map; + } + + @Override + public WebhooksMap postProcessWebhooksWithModels(WebhooksMap objs, List allModels) { + WebhooksMap map = super.postProcessWebhooksWithModels(objs, allModels); + flagVerbatimHttpMethods(map.getWebhooks().getOperation()); + return map; + } } diff --git a/modules/openapi-generator/src/main/resources/php/README.mustache b/modules/openapi-generator/src/main/resources/php/README.mustache index e4a17f15d17b..b5dd0ad9fb38 100644 --- a/modules/openapi-generator/src/main/resources/php/README.mustache +++ b/modules/openapi-generator/src/main/resources/php/README.mustache @@ -78,7 +78,7 @@ All URIs are relative to *{{basePath}}* Class | Method | HTTP request | Description ------------ | ------------- | ------------- | ------------- -{{#apiInfo}}{{#apis}}{{#operations}}{{#operation}}*{{classname}}* | [**{{operationId}}**]({{apiDocPath}}/{{classname}}.md#{{operationIdLowerCase}}) | **{{httpMethod}}** {{path}} | {{summary}} +{{#apiInfo}}{{#apis}}{{#operations}}{{#operation}}*{{classname}}* | [**{{operationId}}**]({{apiDocPath}}/{{classname}}.md#{{operationIdLowerCase}}) | **{{#vendorExtensions.x-php-http-method-doc}}{{{vendorExtensions.x-php-http-method-doc}}}{{/vendorExtensions.x-php-http-method-doc}}{{^vendorExtensions.x-php-http-method-doc}}{{httpMethod}}{{/vendorExtensions.x-php-http-method-doc}}** {{path}} | {{summary}} {{/operation}}{{/operations}}{{/apis}}{{/apiInfo}} ## Models diff --git a/modules/openapi-generator/src/main/resources/php/api.mustache b/modules/openapi-generator/src/main/resources/php/api.mustache index eb8540f3b618..c0e393caef7e 100644 --- a/modules/openapi-generator/src/main/resources/php/api.mustache +++ b/modules/openapi-generator/src/main/resources/php/api.mustache @@ -608,6 +608,7 @@ use {{invokerPackage}}\ObjectSerializer; $multipart = false; {{#queryParams}} + {{^isQueryStringParam}} // query params $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( ${{paramName}}, @@ -617,6 +618,7 @@ use {{invokerPackage}}\ObjectSerializer; {{#isExplode}}true{{/isExplode}}{{^isExplode}}false{{/isExplode}}, // explode {{required}} // required ) ?? []); + {{/isQueryStringParam}} {{/queryParams}} {{#headerParams}} @@ -777,12 +779,61 @@ use {{invokerPackage}}\ObjectSerializer; $operationHost = $this->config->getHost(); {{/servers.0}} $query = ObjectSerializer::buildQuery($queryParams); + {{#vendorExtensions.x-php-has-querystring-param}} + $uri = $operationHost . $resourcePath . ($query ? "?{$query}" : ''); + {{#allParams}} + {{#isQueryStringParam}} + // OpenAPI 3.2 `in: querystring`: the value IS the query component, appended verbatim + {{#required}} + $uri .= (str_contains($uri, '?') ? '&' : '?') . ${{paramName}}; + {{/required}} + {{^required}} + if (${{paramName}} !== null) { + $uri .= (str_contains($uri, '?') ? '&' : '?') . ${{paramName}}; + } + {{/required}} + {{/isQueryStringParam}} + {{/allParams}} + {{/vendorExtensions.x-php-has-querystring-param}} + {{#vendorExtensions.x-php-verbatim-method}} + // OpenAPI 3.2 custom verb: guzzlehttp/psr7 upper-cases the method in + // Request::__construct/withMethod, but Guzzle's handlers only ever read + // RequestInterface::getMethod(), so keep the verbatim token in a subclass. + return new class( + '{{{vendorExtensions.x-php-http-method-literal}}}', + {{#vendorExtensions.x-php-has-querystring-param}}$uri{{/vendorExtensions.x-php-has-querystring-param}}{{^vendorExtensions.x-php-has-querystring-param}}$operationHost . $resourcePath . ($query ? "?{$query}" : ''){{/vendorExtensions.x-php-has-querystring-param}}, + $headers, + $httpBody + ) extends Request { + private string $verbatimMethod; + + public function __construct(string $method, $uri, array $headers = [], $body = null, string $version = '1.1') + { + parent::__construct($method, $uri, $headers, $body, $version); + $this->verbatimMethod = $method; + } + + public function getMethod(): string + { + return $this->verbatimMethod; + } + + public function withMethod($method): RequestInterface + { + $new = parent::withMethod($method); + $new->verbatimMethod = $method; + return $new; + } + }; + {{/vendorExtensions.x-php-verbatim-method}} + {{^vendorExtensions.x-php-verbatim-method}} return new Request( '{{httpMethod}}', - $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + {{#vendorExtensions.x-php-has-querystring-param}}$uri{{/vendorExtensions.x-php-has-querystring-param}}{{^vendorExtensions.x-php-has-querystring-param}}$operationHost . $resourcePath . ($query ? "?{$query}" : ''){{/vendorExtensions.x-php-has-querystring-param}}, $headers, $httpBody ); + {{/vendorExtensions.x-php-verbatim-method}} } {{#servers.0}} diff --git a/modules/openapi-generator/src/main/resources/php/api_doc.mustache b/modules/openapi-generator/src/main/resources/php/api_doc.mustache index ea5dad63de83..b72b486f3b5c 100644 --- a/modules/openapi-generator/src/main/resources/php/api_doc.mustache +++ b/modules/openapi-generator/src/main/resources/php/api_doc.mustache @@ -6,7 +6,7 @@ All URIs are relative to {{basePath}}, except if the operation defines another b | Method | HTTP request | Description | | ------------- | ------------- | ------------- | -{{#operations}}{{#operation}}| [**{{operationId}}()**]({{classname}}.md#{{operationId}}) | **{{httpMethod}}** {{path}} | {{summary}} | +{{#operations}}{{#operation}}| [**{{operationId}}()**]({{classname}}.md#{{operationId}}) | **{{#vendorExtensions.x-php-http-method-doc}}{{{vendorExtensions.x-php-http-method-doc}}}{{/vendorExtensions.x-php-http-method-doc}}{{^vendorExtensions.x-php-http-method-doc}}{{httpMethod}}{{/vendorExtensions.x-php-http-method-doc}}** {{path}} | {{summary}} | {{/operation}}{{/operations}}{{#operations}}{{#operation}} ## `{{{operationId}}}()` diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/php/PhpClientCodegenTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/php/PhpClientCodegenTest.java index 7ffd48a1fd09..b2e9b2595d5d 100644 --- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/php/PhpClientCodegenTest.java +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/php/PhpClientCodegenTest.java @@ -23,14 +23,19 @@ import io.swagger.v3.oas.models.media.ObjectSchema; import io.swagger.v3.oas.models.media.StringSchema; import io.swagger.v3.parser.core.models.ParseOptions; +import org.apache.commons.io.FileUtils; import org.openapitools.codegen.*; +import org.openapitools.codegen.config.CodegenConfigurator; import org.openapitools.codegen.languages.PhpClientCodegen; import org.testng.Assert; import org.testng.annotations.BeforeMethod; import org.testng.annotations.Test; import java.io.File; +import java.io.IOException; +import java.nio.charset.StandardCharsets; import java.nio.file.Files; +import java.nio.file.Path; import java.util.List; import java.util.Map; import java.util.function.Function; @@ -192,4 +197,196 @@ public void testDateTimeLengthValidationIsNotGenerated() throws Exception { Assert.assertTrue(modelPhp.contains("mb_strlen($this->container['title']) > 10"), modelPhp); Assert.assertTrue(modelPhp.contains("mb_strlen($title) > 10"), modelPhp); } + + @Test + public void testGuzzleOpenApi32OperationsAndQueryStringParam() throws IOException { + Path target = Files.createTempDirectory("test"); + try { + final CodegenConfigurator configurator = new CodegenConfigurator() + .setGeneratorName("php") + .setLibrary("guzzle") + .setInputSpec("src/test/resources/3_2/query-operation.yaml") + .setSkipOverwrite(false) + .setOutputDir(target.toAbsolutePath().toString().replace("\\", "/")); + new DefaultGenerator().opts(configurator.toClientOptInput()).generate(); + Path apiPath = target.resolve("lib/Api/DefaultApi.php"); + TestUtils.assertFileExists(apiPath); + String generated = new String(Files.readAllBytes(apiPath), StandardCharsets.UTF_8); + // non-standard methods go through a verbatim subclass so psr7's + // strtoupper cannot mangle them + for (String method : new String[]{"QUERY", "PURGE", "customMethod", "CHECK&FETCH", "X#Y"}) { + Assert.assertTrue(generated.contains("'" + method + "'"), + "expected verbatim method literal for " + method); + } + Assert.assertTrue(generated.contains("new class("), "verbatim Request subclass expected"); + Assert.assertTrue(generated.contains("'GET'"), "standard method kept on plain Request"); + // `in: querystring` appends verbatim with ?/& handling, not via query params + Assert.assertTrue(generated.contains("(str_contains($uri, '?') ? '&' : '?') . $qs"), + "querystring param should be appended verbatim"); + Assert.assertFalse(generated.contains("toQueryValue(\n $qs"), + "querystring param must not be serialized as a name=value pair"); + } finally { + FileUtils.deleteDirectory(target.toFile()); + } + } + + @Test + public void testPsr18SkipsOpenApi32Operations() throws IOException { + Path target = Files.createTempDirectory("test"); + try { + final CodegenConfigurator configurator = new CodegenConfigurator() + .setGeneratorName("php") + .setLibrary("psr-18") + .setInputSpec("src/test/resources/3_2/query-operation.yaml") + .setSkipOverwrite(false) + .setOutputDir(target.toAbsolutePath().toString().replace("\\", "/")); + new DefaultGenerator().opts(configurator.toClientOptInput()).generate(); + Path apiPath = target.resolve("lib/Api/DefaultApi.php"); + TestUtils.assertFileExists(apiPath); + String generated = new String(Files.readAllBytes(apiPath), StandardCharsets.UTF_8); + Assert.assertTrue(generated.contains("function listPets"), "GET operation should be kept"); + for (String op : new String[]{"queryPets", "purgePets", "customPets", "checkFetchPets", "hashPets"}) { + Assert.assertFalse(generated.contains("function " + op), + "psr-18 must skip unsupported 3.2 operation " + op); + } + } finally { + FileUtils.deleteDirectory(target.toFile()); + } + } + + @Test + public void testGuzzleSkipsInvalidHttpMethodToken() throws IOException { + Path target = Files.createTempDirectory("test"); + try { + final CodegenConfigurator configurator = new CodegenConfigurator() + .setGeneratorName("php") + .setLibrary("guzzle") + .setInputSpec("src/test/resources/3_2/rust-invalid-method.yaml") + .setSkipOverwrite(false) + .setOutputDir(target.toAbsolutePath().toString().replace("\\", "/")); + new DefaultGenerator().opts(configurator.toClientOptInput()).generate(); + Path apiPath = target.resolve("lib/Api/DefaultApi.php"); + TestUtils.assertFileExists(apiPath); + String generated = new String(Files.readAllBytes(apiPath), StandardCharsets.UTF_8); + Assert.assertTrue(generated.contains("function listPets"), "GET operation should be kept"); + Assert.assertFalse(generated.contains("badMethod"), + "invalid RFC 9110 method token must be skipped"); + } finally { + FileUtils.deleteDirectory(target.toFile()); + } + } + + @Test + public void testGuzzleWebhookOperationsEmitVerbatimMethods() throws IOException { + Path target = Files.createTempDirectory("test"); + try { + final CodegenConfigurator configurator = new CodegenConfigurator() + .setGeneratorName("php") + .setLibrary("guzzle") + .setInputSpec("src/test/resources/3_2/go-webhook-operations.yaml") + .setSkipOverwrite(false) + .setOutputDir(target.toAbsolutePath().toString().replace("\\", "/")); + new DefaultGenerator().opts(configurator.toClientOptInput()).generate(); + Path apiPath = target.resolve("lib/Api/DefaultApi.php"); + TestUtils.assertFileExists(apiPath); + String generated = new String(Files.readAllBytes(apiPath), StandardCharsets.UTF_8); + Assert.assertTrue(generated.contains("'QUERY'"), + "webhook query operation should emit a verbatim QUERY method"); + Assert.assertTrue(generated.contains("'customMethod'"), + "webhook additionalOperations should emit a verbatim method"); + } finally { + FileUtils.deleteDirectory(target.toFile()); + } + } + + /** + * End-to-end check: runs the generated guzzle client against a raw TCP + * capture listener, verifying query/additionalOperations methods and + * `in: querystring` reach the wire verbatim. Skipped when php or composer + * is unavailable, or when packagist cannot be reached. + */ + @Test + public void testGuzzleGeneratedClientSendsVerbatimMethods() throws IOException, InterruptedException { + if (!isCommandAvailable("php", "--version")) { + throw new org.testng.SkipException("php is not on PATH; skipping generated-client verification"); + } + Path target = Files.createTempDirectory("php32-verify"); + try { + final CodegenConfigurator configurator = new CodegenConfigurator() + .setGeneratorName("php") + .setLibrary("guzzle") + .setInputSpec("src/test/resources/3_2/query-operation.yaml") + .setSkipOverwrite(false) + .setOutputDir(target.toAbsolutePath().toString().replace("\\", "/")); + new DefaultGenerator().opts(configurator.toClientOptInput()).generate(); + + ProcessBuilder composer = composerInstallCommand(target.toFile()); + if (composer == null || runAndCheck(composer, 300) != 0) { + throw new org.testng.SkipException( + "composer install failed (composer missing or packagist unreachable)"); + } + + Path capture = target.resolve("capture.php"); + Files.copy(Path.of("src/test/resources/3_2/php-guzzle-capture/capture.php"), capture); + + Process p = new ProcessBuilder("php", "capture.php", + target.toAbsolutePath().toString()) + .directory(target.toFile()) + .redirectErrorStream(true) + .start(); + boolean finished = p.waitFor(90, java.util.concurrent.TimeUnit.SECONDS); + if (!finished) { + p.destroyForcibly(); + } + String output = new String(p.getInputStream().readAllBytes(), StandardCharsets.UTF_8); + Assert.assertTrue(finished, "php capture timed out:\n" + output); + Assert.assertTrue(output.contains("CAPTURE-PASS"), + "generated client did not send verbatim 3.2 methods/querystring:\n" + output); + } finally { + // composer's vendor dir is tens of MB; deleteOnExit cannot remove non-empty dirs + FileUtils.deleteDirectory(target.toFile()); + } + } + + private ProcessBuilder composerInstallCommand(File dir) { + if (isCommandAvailable("composer", "--version")) { + return new ProcessBuilder("composer", "install", "--quiet", "--no-interaction", + "--no-dev", "--prefer-dist") + .directory(dir).redirectErrorStream(true); + } + String phar = System.getenv("COMPOSER_PHAR"); + if (phar != null && Files.isRegularFile(Path.of(phar))) { + return new ProcessBuilder("php", phar, "install", "--quiet", "--no-interaction", + "--no-dev", "--prefer-dist") + .directory(dir).redirectErrorStream(true); + } + return null; + } + + private int runAndCheck(ProcessBuilder pb, long timeoutSeconds) throws IOException, InterruptedException { + Process p = pb.start(); + if (!p.waitFor(timeoutSeconds, java.util.concurrent.TimeUnit.SECONDS)) { + p.destroyForcibly(); + return -1; + } + p.getInputStream().transferTo(java.io.OutputStream.nullOutputStream()); + return p.exitValue(); + } + + private boolean isCommandAvailable(String... command) { + try { + Process p = new ProcessBuilder(command) + .redirectErrorStream(true).start(); + // wait before draining: a child that never exits would otherwise block + // the stream read forever + if (!p.waitFor(10, java.util.concurrent.TimeUnit.SECONDS)) { + p.destroyForcibly(); + return false; + } + p.getInputStream().transferTo(java.io.OutputStream.nullOutputStream()); + return p.exitValue() == 0; + } catch (IOException | InterruptedException e) { + return false; + } + } } \ No newline at end of file diff --git a/modules/openapi-generator/src/test/resources/3_2/php-guzzle-capture/capture.php b/modules/openapi-generator/src/test/resources/3_2/php-guzzle-capture/capture.php new file mode 100644 index 000000000000..ec71b59cfc64 --- /dev/null +++ b/modules/openapi-generator/src/test/resources/3_2/php-guzzle-capture/capture.php @@ -0,0 +1,104 @@ +`. +// +// A raw TCP listener (spawned as a child PHP process) records the HTTP request +// line for every generated call: standard methods go through Guzzle's normal +// dispatch, while query/additionalOperations methods and `in: querystring` +// parameters must reach the wire verbatim (no up-casing, no re-encoding). +$dir = $argv[1] ?? null; +if ($dir === null) { fwrite(STDERR, "usage: capture.php \n"); exit(1); } + +// --- raw TCP listener: prints "PORT " once, then "LINE " per +// connection. Reads the head + Content-Length body, answers 204, closes. +$serverCode = <<<'PHPEOF' +$srv = stream_socket_server("tcp://127.0.0.1:0", $errno, $errstr); +if (!$srv) { fwrite(STDERR, "listen failed: $errstr\n"); exit(1); } +$name = stream_socket_get_name($srv, false); +fwrite(STDOUT, "PORT " . substr($name, strrpos($name, ':') + 1) . "\n"); fflush(STDOUT); +while (true) { + $conn = @stream_socket_accept($srv, 30); + if (!$conn) break; + stream_set_timeout($conn, 5); + $buf = ''; + while (($pos = strpos($buf, "\r\n\r\n")) === false) { + $chunk = fread($conn, 8192); + if ($chunk === false || $chunk === '') break; + $buf .= $chunk; + } + $head = $pos !== false ? substr($buf, 0, $pos) : $buf; + $bodyStart = $pos !== false ? $pos + 4 : strlen($buf); + $len = 0; + if (preg_match('/^Content-Length:\s*(\d+)/mi', $head, $m)) $len = (int)$m[1]; + $body = substr($buf, $bodyStart); + while (strlen($body) < $len) { + $chunk = fread($conn, 8192); + if ($chunk === false || $chunk === '') break; + $body .= $chunk; + } + $lines = explode("\r\n", $head); + fwrite(STDOUT, "LINE " . $lines[0] . "\n"); fflush(STDOUT); + fwrite($conn, "HTTP/1.1 204 No Content\r\nContent-Length: 0\r\nConnection: close\r\n\r\n"); + fclose($conn); +} +PHPEOF; + +$proc = proc_open([PHP_BINARY, '-r', $serverCode], + [0 => ['pipe', 'r'], 1 => ['pipe', 'w'], 2 => ['pipe', 'w']], $pipes); +if (!is_resource($proc)) { fwrite(STDERR, "cannot spawn listener\n"); exit(1); } +fclose($pipes[0]); +$portLine = fgets($pipes[1]); +if (!preg_match('/^PORT (\d+)/', (string)$portLine, $m)) { + fwrite(STDERR, "no port from listener: $portLine\n"); exit(1); +} +$port = (int)$m[1]; +stream_set_blocking($pipes[1], false); + +require $dir . '/vendor/autoload.php'; + +$config = (new OpenAPI\Client\Configuration())->setHost("http://127.0.0.1:$port"); +$api = new OpenAPI\Client\Api\DefaultApi(new GuzzleHttp\Client(), $config); + +// `in: querystring` callers pass the query component without the leading `?` +$calls = [ + function () use ($api) { $api->queryPets('a=1&b=%20x'); }, + function () use ($api) { $api->customPets(); }, + function () use ($api) { $api->checkFetchPets(); }, + function () use ($api) { $api->purgePets(); }, + function () use ($api) { $api->hashPets(); }, + function () use ($api) { $api->listPets(); }, +]; +foreach ($calls as $call) { + try { $call(); } catch (\Throwable $e) { fwrite(STDERR, "call failed: {$e->getMessage()}\n"); } +} + +$expected = [ + 'QUERY /pets?a=1&b=%20x HTTP/1.1', + 'customMethod /pets HTTP/1.1', + 'CHECK&FETCH /pets HTTP/1.1', + 'PURGE /pets HTTP/1.1', + 'X#Y /pets HTTP/1.1', + 'GET /pets HTTP/1.1', +]; +$got = []; +$deadline = microtime(true) + 30; +while (count($got) < count($expected) && microtime(true) < $deadline) { + $line = fgets($pipes[1]); + if ($line !== false && preg_match('/^LINE (.*)/', rtrim($line), $m)) { + $got[] = $m[1]; + } else { + usleep(10000); + } +} +proc_terminate($proc); +proc_close($proc); + +$ok = $got === $expected; +foreach ($expected as $i => $want) { + if (($got[$i] ?? null) !== $want) { + fwrite(STDERR, "FAIL: got " . var_export($got[$i] ?? null, true) . ", want " . var_export($want, true) . "\n"); + } +} +fwrite(STDOUT, $ok ? "CAPTURE-PASS\n" : "CAPTURE-FAIL\n"); +exit($ok ? 0 : 1); From f30e9f3a4df2bf2fb73f58bd9db82b99a7f930f0 Mon Sep 17 00:00:00 2001 From: khayashi4337 Date: Wed, 23 Sep 2026 01:22:14 +0900 Subject: [PATCH 11/31] feat(csharp): generate OpenAPI 3.2 query/additionalOperations and in:querystring (generichost) Non-standard RFC 9110 method tokens are emitted as new HttpMethod("token") instead of HttpMethod.Xxx, which does not exist for e.g. QUERY and whose Normalize() would fold casing onto a standard method. Tokens that are not valid tchar, or case-insensitively match a standard method (cannot be preserved verbatim through HttpMethod), are warned about and skipped. `in: querystring` parameters append verbatim to the request query after UriBuilder and are excluded from ParseQueryString serialization. AbstractCSharpCodegen.getOperationInputModels also scans pathItem.getAdditionalOperations() so generichost webhooks get the same treatment. restsharp/httpclient/unityWebRequest remain unsupported. Adds a committed end-to-end test that builds the generated generichost client and verifies six request lines via raw TcpListener capture; dotnet restore failure or missing SDK skips, build/run failures fail. Generated with [Devin](https://devin.ai) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com> --- .../languages/AbstractCSharpCodegen.java | 7 +- .../languages/CSharpClientCodegen.java | 68 +++++++ .../src/main/resources/csharp/README.mustache | 2 +- .../main/resources/csharp/api_doc.mustache | 2 +- .../csharp/libraries/generichost/api.mustache | 26 +++ .../CSharpClientCodegenTest.java | 179 ++++++++++++++++++ .../csharp-generichost-capture/Capture.csproj | 20 ++ .../3_2/csharp-generichost-capture/Program.cs | 88 +++++++++ 8 files changed, 389 insertions(+), 3 deletions(-) create mode 100644 modules/openapi-generator/src/test/resources/3_2/csharp-generichost-capture/Capture.csproj create mode 100644 modules/openapi-generator/src/test/resources/3_2/csharp-generichost-capture/Program.cs diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractCSharpCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractCSharpCodegen.java index ab46ba2bb4b2..8b4a55220184 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractCSharpCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractCSharpCodegen.java @@ -736,7 +736,12 @@ private Set getOperationInputModels() { for (PathItem pathItem : openAPI.getPaths().values()) { collectOperationInputModels(pathItem.getParameters(), operationInputModels, visitedModels); - for (Operation operation : pathItem.readOperations()) { + // readOperations() covers `query` but not OpenAPI 3.2 additionalOperations + java.util.List operations = new java.util.ArrayList<>(pathItem.readOperations()); + if (pathItem.getAdditionalOperations() != null) { + operations.addAll(pathItem.getAdditionalOperations().values()); + } + for (Operation operation : operations) { collectOperationInputModels(operation.getParameters(), operationInputModels, visitedModels); RequestBody requestBody = ModelUtils.getReferencedRequestBody(openAPI, operation.getRequestBody()); if (requestBody != null) { diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/CSharpClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/CSharpClientCodegen.java index c7efbcc63cd4..68e210dfcc04 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/CSharpClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/CSharpClientCodegen.java @@ -27,6 +27,8 @@ import org.openapitools.codegen.meta.features.*; import org.openapitools.codegen.model.ModelMap; import org.openapitools.codegen.model.ModelsMap; +import org.openapitools.codegen.model.OperationsMap; +import org.openapitools.codegen.model.WebhooksMap; import org.openapitools.codegen.utils.ModelUtils; import org.openapitools.codegen.utils.ProcessUtils; import org.slf4j.Logger; @@ -1825,4 +1827,70 @@ public Map postProcessSupportingFileData(Map obj generateYAMLSpecFile(objs); return objs; } + + @Override + public boolean supportsAdditionalOperations() { + // only generichost emits methods verbatim: restsharp's Method enum rejects + // non-standard tokens, httpclient's shared sync/async interfaces would need + // extending, and unityWebRequest cannot be verified in this toolchain + return GENERICHOST.equals(getLibrary()); + } + + @Override + protected boolean supportsQueryStringParameters() { + return GENERICHOST.equals(getLibrary()); + } + + private static final Set STANDARD_HTTP_METHODS = new HashSet<>(Arrays.asList( + "GET", "PUT", "POST", "DELETE", "OPTIONS", "HEAD", "PATCH", "TRACE", "CONNECT")); + + // RFC 9110 tchar: method tokens HttpMethod(string) accepts without FormatException + private static final java.util.regex.Pattern HTTP_METHOD_TOKEN_PATTERN = + java.util.regex.Pattern.compile("[!#$%&'*+\\-.^_`|~0-9A-Za-z]+"); + + /** + * Marks OpenAPI 3.2 (query/additionalOperations) HTTP methods for verbatim emission via + * {@code x-csharp-http-method-literal}. Two categories are warned about and skipped: + * tokens that are not valid RFC 9110 tokens ({@code HttpMethod(string)} would throw + * {@code FormatException}), and tokens that case-insensitively match a standard method + * (e.g. {@code get}) because .NET's {@code HttpMethod.Normalize()} would silently fold + * them onto the standard method on the wire - unlike Rust/Ruby, verbatim casing cannot + * be preserved for those. + */ + private void flagVerbatimHttpMethods(List operationList) { + Iterator it = operationList.iterator(); + while (it.hasNext()) { + CodegenOperation op = it.next(); + if (op.httpMethod == null || STANDARD_HTTP_METHODS.contains(op.httpMethod)) { + continue; + } + if (!HTTP_METHOD_TOKEN_PATTERN.matcher(op.httpMethod).matches() + || STANDARD_HTTP_METHODS.stream() + .anyMatch(m -> m.equalsIgnoreCase(op.httpMethod))) { + LOGGER.warn("Skipping operation {}: HTTP method name '{}' is not a valid " + + "RFC 9110 token, or case-insensitively matches a standard method " + + "which .NET HttpMethod.Normalize() would collapse on the wire.", + op.operationId, op.httpMethod); + it.remove(); + continue; + } + op.vendorExtensions.put("x-csharp-http-method-literal", op.httpMethod); + // `|` is a valid RFC 9110 tchar but breaks markdown tables in doc templates + op.vendorExtensions.put("x-csharp-http-method-doc", op.httpMethod.replace("|", "\\|")); + } + } + + @Override + public OperationsMap postProcessOperationsWithModels(OperationsMap objs, List allModels) { + OperationsMap map = super.postProcessOperationsWithModels(objs, allModels); + flagVerbatimHttpMethods(map.getOperations().getOperation()); + return map; + } + + @Override + public WebhooksMap postProcessWebhooksWithModels(WebhooksMap objs, List allModels) { + WebhooksMap map = super.postProcessWebhooksWithModels(objs, allModels); + flagVerbatimHttpMethods(map.getWebhooks().getOperation()); + return map; + } } diff --git a/modules/openapi-generator/src/main/resources/csharp/README.mustache b/modules/openapi-generator/src/main/resources/csharp/README.mustache index 0ef94566a1db..79f3cfd0b558 100644 --- a/modules/openapi-generator/src/main/resources/csharp/README.mustache +++ b/modules/openapi-generator/src/main/resources/csharp/README.mustache @@ -223,7 +223,7 @@ All URIs are relative to *{{{basePath}}}* Class | Method | HTTP request | Description ------------ | ------------- | ------------- | ------------- -{{#apiInfo}}{{#apis}}{{#operations}}{{#operation}}*{{classname}}* | [**{{operationId}}**]({{apiDocPath}}{{classname}}.md#{{operationIdLowerCase}}) | **{{httpMethod}}** {{path}} | {{{summary}}} +{{#apiInfo}}{{#apis}}{{#operations}}{{#operation}}*{{classname}}* | [**{{operationId}}**]({{apiDocPath}}{{classname}}.md#{{operationIdLowerCase}}) | **{{#vendorExtensions.x-csharp-http-method-doc}}{{{vendorExtensions.x-csharp-http-method-doc}}}{{/vendorExtensions.x-csharp-http-method-doc}}{{^vendorExtensions.x-csharp-http-method-doc}}{{httpMethod}}{{/vendorExtensions.x-csharp-http-method-doc}}** {{path}} | {{{summary}}} {{/operation}}{{/operations}}{{/apis}}{{/apiInfo}} diff --git a/modules/openapi-generator/src/main/resources/csharp/api_doc.mustache b/modules/openapi-generator/src/main/resources/csharp/api_doc.mustache index ca85bfa7ffaa..00afb9e4e174 100644 --- a/modules/openapi-generator/src/main/resources/csharp/api_doc.mustache +++ b/modules/openapi-generator/src/main/resources/csharp/api_doc.mustache @@ -7,7 +7,7 @@ All URIs are relative to *{{{basePath}}}* |--------|--------------|-------------| {{#operations}} {{#operation}} -| [**{{operationId}}**]({{classname}}.md#{{operationIdLowerCase}}) | **{{httpMethod}}** {{path}} | {{summary}} | +| [**{{operationId}}**]({{classname}}.md#{{operationIdLowerCase}}) | **{{#vendorExtensions.x-csharp-http-method-doc}}{{{vendorExtensions.x-csharp-http-method-doc}}}{{/vendorExtensions.x-csharp-http-method-doc}}{{^vendorExtensions.x-csharp-http-method-doc}}{{httpMethod}}{{/vendorExtensions.x-csharp-http-method-doc}}** {{path}} | {{summary}} | {{/operation}} {{/operations}} diff --git a/modules/openapi-generator/src/main/resources/csharp/libraries/generichost/api.mustache b/modules/openapi-generator/src/main/resources/csharp/libraries/generichost/api.mustache index 9a12abf424bb..01ab4f7fdcb2 100644 --- a/modules/openapi-generator/src/main/resources/csharp/libraries/generichost/api.mustache +++ b/modules/openapi-generator/src/main/resources/csharp/libraries/generichost/api.mustache @@ -431,7 +431,9 @@ namespace {{packageName}}.{{apiPackage}} {{#-first}} {{/-first}} + {{^isQueryStringParam}} parseQueryStringLocalVar["{{baseName}}"] = ClientUtils.ParameterToString({{paramName}}); + {{/isQueryStringParam}} {{/required}} {{/queryParams}} @@ -443,9 +445,11 @@ namespace {{packageName}}.{{apiPackage}} {{/constantParams}} {{#queryParams}} {{^required}} + {{^isQueryStringParam}} if ({{paramName}}.IsSet) parseQueryStringLocalVar["{{baseName}}"] = ClientUtils.ParameterToString({{paramName}}.Value); + {{/isQueryStringParam}} {{/required}} {{#-last}} uriBuilderLocalVar.Query = parseQueryStringLocalVar.ToString(); @@ -624,6 +628,20 @@ namespace {{packageName}}.{{apiPackage}} {{/isKeyInQuery}} {{/isApiKey}} {{/authMethods}} + {{#allParams}} + {{#isQueryStringParam}} + // OpenAPI 3.2 `in: querystring`: the value IS the query component, + // appended verbatim - UriBuilder keeps pre-encoded escapes as-is + {{#required}} + uriBuilderLocalVar.Query = string.IsNullOrEmpty(uriBuilderLocalVar.Query) ? {{paramName}} : uriBuilderLocalVar.Query + "&" + {{paramName}}; + {{/required}} + {{^required}} + if ({{paramName}}.IsSet) + uriBuilderLocalVar.Query = string.IsNullOrEmpty(uriBuilderLocalVar.Query) ? {{paramName}}.Value : uriBuilderLocalVar.Query + "&" + {{paramName}}.Value; + + {{/required}} + {{/isQueryStringParam}} + {{/allParams}} httpRequestMessageLocalVar.RequestUri = uriBuilderLocalVar.Uri; {{#authMethods}} {{#isBasicBasic}} @@ -704,6 +722,13 @@ namespace {{packageName}}.{{apiPackage}} httpRequestMessageLocalVar.Headers.Accept.Add(acceptLocalVar); {{/-first}} {{/produces}} + {{#vendorExtensions.x-csharp-http-method-literal}} + + // OpenAPI 3.2: HttpMethod has no property for this verb and would + // normalize casing, so emit the RFC 9110 token verbatim + httpRequestMessageLocalVar.Method = new HttpMethod("{{{vendorExtensions.x-csharp-http-method-literal}}}"); + {{/vendorExtensions.x-csharp-http-method-literal}} + {{^vendorExtensions.x-csharp-http-method-literal}} {{#net60OrLater}} httpRequestMessageLocalVar.Method = HttpMethod.{{#lambda.titlecase}}{{#lambda.lowercase}}{{httpMethod}}{{/lambda.lowercase}}{{/lambda.titlecase}}; @@ -711,6 +736,7 @@ namespace {{packageName}}.{{apiPackage}} {{^net60OrLater}} httpRequestMessageLocalVar.Method = new HttpMethod("{{#lambda.uppercase}}{{httpMethod}}{{/lambda.uppercase}}"); {{/net60OrLater}} + {{/vendorExtensions.x-csharp-http-method-literal}} DateTime requestedAtLocalVar = DateTime.UtcNow; diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/csharpnetcore/CSharpClientCodegenTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/csharpnetcore/CSharpClientCodegenTest.java index f9de3e8af006..4662dedff0e6 100644 --- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/csharpnetcore/CSharpClientCodegenTest.java +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/csharpnetcore/CSharpClientCodegenTest.java @@ -21,7 +21,9 @@ import io.swagger.v3.oas.models.media.*; import io.swagger.v3.oas.models.responses.ApiResponse; import io.swagger.v3.oas.models.responses.ApiResponses; +import org.apache.commons.io.FileUtils; import org.openapitools.codegen.*; +import org.openapitools.codegen.config.CodegenConfigurator; import org.openapitools.codegen.languages.CSharpClientCodegen; import org.openapitools.codegen.languages.JavaCXFClientCodegen; import org.openapitools.codegen.model.OperationMap; @@ -32,7 +34,9 @@ import java.io.File; import java.io.IOException; +import java.nio.charset.StandardCharsets; import java.nio.file.Files; +import java.nio.file.Path; import java.nio.file.Paths; import java.util.Collections; import java.util.List; @@ -637,4 +641,179 @@ private File getGeneratedModel(Map files, File output, String mode assertNotNull(model, "Could not find generated model: " + path); return model; } + + @Test + public void testGenerichostOpenApi32OperationsAndQueryStringParam() throws IOException { + Path target = Files.createTempDirectory("test"); + try { + final CodegenConfigurator configurator = new CodegenConfigurator() + .setGeneratorName("csharp") + .setLibrary("generichost") + .setInputSpec("src/test/resources/3_2/query-operation.yaml") + .setSkipOverwrite(false) + .setOutputDir(target.toAbsolutePath().toString().replace("\\", "/")); + new DefaultGenerator().opts(configurator.toClientOptInput()).generate(); + Path apiPath = target.resolve("src/Org.OpenAPITools/Api/DefaultApi.cs"); + TestUtils.assertFileExists(apiPath); + String generated = new String(Files.readAllBytes(apiPath), StandardCharsets.UTF_8); + // non-standard methods are emitted verbatim; there is no HttpMethod.QUERY + for (String method : new String[]{"QUERY", "PURGE", "customMethod", "CHECK&FETCH", "X#Y"}) { + Assert.assertTrue(generated.contains("new HttpMethod(\"" + method + "\")"), + "expected verbatim HttpMethod literal for " + method); + } + Assert.assertTrue(generated.contains("httpRequestMessageLocalVar.Method = HttpMethod.Get"), + "standard method kept on the static singleton"); + // `in: querystring` appends verbatim after UriBuilder.Query, not via + // ParseQueryString (which would double-encode) + Assert.assertTrue(generated.contains("uriBuilderLocalVar.Query + \"&\" + qs"), + "querystring param should be appended verbatim"); + Assert.assertFalse(generated.contains("parseQueryStringLocalVar[\"qs\"]"), + "querystring param must not be serialized as a name=value pair"); + } finally { + FileUtils.deleteDirectory(target.toFile()); + } + } + + @Test + public void testRestsharpSkipsOpenApi32Operations() throws IOException { + Path target = Files.createTempDirectory("test"); + try { + final CodegenConfigurator configurator = new CodegenConfigurator() + .setGeneratorName("csharp") + .setLibrary("restsharp") + .setInputSpec("src/test/resources/3_2/query-operation.yaml") + .setSkipOverwrite(false) + .setOutputDir(target.toAbsolutePath().toString().replace("\\", "/")); + new DefaultGenerator().opts(configurator.toClientOptInput()).generate(); + Path apiPath = target.resolve("src/Org.OpenAPITools/Api/DefaultApi.cs"); + TestUtils.assertFileExists(apiPath); + String generated = new String(Files.readAllBytes(apiPath), StandardCharsets.UTF_8); + Assert.assertTrue(generated.contains("ListPets"), "GET operation should be kept"); + for (String op : new String[]{"QueryPets", "PurgePets", "CustomPets", "CheckFetchPets", "HashPets"}) { + Assert.assertFalse(generated.contains(op), + "restsharp must skip unsupported 3.2 operation " + op); + } + } finally { + FileUtils.deleteDirectory(target.toFile()); + } + } + + @Test + public void testGenerichostSkipsInvalidOrNormalizingMethodToken() throws IOException { + Path target = Files.createTempDirectory("test"); + try { + // "MY METHOD" is not a valid RFC 9110 token. (A case-variant like a + // lowercase "get" is additionally guarded in CSharpClientCodegen, but + // the parser already rejects it as a duplicate fixed-method name.) + String spec = "openapi: 3.2.0\n" + + "info: {title: t, version: '1'}\n" + + "paths:\n" + + " /pets:\n" + + " get:\n" + + " operationId: listPets\n" + + " responses: {'200': {description: ok}}\n" + + " additionalOperations:\n" + + " \"MY METHOD\":\n" + + " operationId: badMethod\n" + + " responses: {'204': {description: done}}\n"; + Path specFile = target.resolve("spec.yaml"); + Files.writeString(specFile, spec); + final CodegenConfigurator configurator = new CodegenConfigurator() + .setGeneratorName("csharp") + .setLibrary("generichost") + .setInputSpec(specFile.toString()) + .setSkipOverwrite(false) + .setOutputDir(target.resolve("out").toAbsolutePath().toString().replace("\\", "/")); + new DefaultGenerator().opts(configurator.toClientOptInput()).generate(); + Path apiPath = target.resolve("out/src/Org.OpenAPITools/Api/DefaultApi.cs"); + TestUtils.assertFileExists(apiPath); + String generated = new String(Files.readAllBytes(apiPath), StandardCharsets.UTF_8); + Assert.assertTrue(generated.contains("ListPets"), "GET operation should be kept"); + Assert.assertFalse(generated.contains("BadMethod"), + "invalid RFC 9110 method token must be skipped"); + } finally { + FileUtils.deleteDirectory(target.toFile()); + } + } + + /** + * End-to-end check: builds the generated generichost client and runs a raw + * TcpListener capture, verifying query/additionalOperations methods and + * `in: querystring` reach the wire verbatim. Skipped when dotnet is not on + * PATH or nuget restore fails. + */ + @Test + public void testGenerichostGeneratedClientSendsVerbatimMethods() throws IOException, InterruptedException { + if (!isCommandAvailable("dotnet", "--version")) { + throw new org.testng.SkipException("dotnet is not on PATH; skipping generated-client verification"); + } + Path target = Files.createTempDirectory("csharp32-verify"); + try { + final CodegenConfigurator configurator = new CodegenConfigurator() + .setGeneratorName("csharp") + .setLibrary("generichost") + .setInputSpec("src/test/resources/3_2/query-operation.yaml") + .setSkipOverwrite(false) + .setOutputDir(target.toAbsolutePath().toString().replace("\\", "/")) + .addAdditionalProperty("targetFramework", "net8.0"); + new DefaultGenerator().opts(configurator.toClientOptInput()).generate(); + + Path captureDir = target.resolve("capture"); + Files.createDirectories(captureDir); + for (String f : new String[]{"Program.cs", "Capture.csproj"}) { + Files.copy(Path.of("src/test/resources/3_2/csharp-generichost-capture/" + f), + captureDir.resolve(f)); + } + + // nuget restore is the only network-dependent step; only its failure + // is skippable - compile or capture failures must fail the test + Path restoreLog = target.resolve("restore.log"); + Process restore = new ProcessBuilder("dotnet", "restore", "capture/Capture.csproj") + .directory(target.toFile()) + .redirectErrorStream(true) + .redirectOutput(restoreLog.toFile()) + .start(); + if (!restore.waitFor(180, java.util.concurrent.TimeUnit.SECONDS) || restore.exitValue() != 0) { + restore.destroyForcibly(); + throw new org.testng.SkipException("dotnet restore failed (nuget unreachable?):\n" + + new String(Files.readAllBytes(restoreLog), StandardCharsets.UTF_8)); + } + + Path runLog = target.resolve("run.log"); + Process p = new ProcessBuilder("dotnet", "run", "--project", "capture/Capture.csproj", + "--no-restore") + .directory(target.toFile()) + .redirectErrorStream(true) + .redirectOutput(runLog.toFile()) + .start(); + boolean finished = p.waitFor(180, java.util.concurrent.TimeUnit.SECONDS); + if (!finished) { + p.destroyForcibly(); + } + String output = new String(Files.readAllBytes(runLog), StandardCharsets.UTF_8); + Assert.assertTrue(finished, "dotnet capture timed out:\n" + output); + Assert.assertTrue(output.contains("CAPTURE-PASS"), + "generated client did not send verbatim 3.2 methods/querystring:\n" + output); + } finally { + // bin/obj dirs are large; deleteOnExit cannot remove non-empty dirs + FileUtils.deleteDirectory(target.toFile()); + } + } + + private boolean isCommandAvailable(String... command) { + try { + Process p = new ProcessBuilder(command) + .redirectErrorStream(true).start(); + // wait before draining: a child that never exits would otherwise block + // the stream read forever + if (!p.waitFor(10, java.util.concurrent.TimeUnit.SECONDS)) { + p.destroyForcibly(); + return false; + } + p.getInputStream().transferTo(java.io.OutputStream.nullOutputStream()); + return p.exitValue() == 0; + } catch (IOException | InterruptedException e) { + return false; + } + } } diff --git a/modules/openapi-generator/src/test/resources/3_2/csharp-generichost-capture/Capture.csproj b/modules/openapi-generator/src/test/resources/3_2/csharp-generichost-capture/Capture.csproj new file mode 100644 index 000000000000..94a099c6039b --- /dev/null +++ b/modules/openapi-generator/src/test/resources/3_2/csharp-generichost-capture/Capture.csproj @@ -0,0 +1,20 @@ + + + + + Exe + net8.0 + enable + enable + Capture + + + + + + + diff --git a/modules/openapi-generator/src/test/resources/3_2/csharp-generichost-capture/Program.cs b/modules/openapi-generator/src/test/resources/3_2/csharp-generichost-capture/Program.cs new file mode 100644 index 000000000000..bb7a01ae3803 --- /dev/null +++ b/modules/openapi-generator/src/test/resources/3_2/csharp-generichost-capture/Program.cs @@ -0,0 +1,88 @@ +// Wire-level verification harness for OpenAPI 3.2 support in the generated +// `csharp` (generichost) client. CSharpClientCodegenTest copies this directory +// into the generated client directory and runs it with `dotnet run`. +// +// A raw TcpListener records the HTTP request line for every generated call: +// standard methods keep HttpMethod.* dispatch, while query/additionalOperations +// methods and `in: querystring` parameters must reach the wire verbatim +// (no normalization, no re-encoding). +using System.Collections.Concurrent; +using System.Net; +using System.Net.Sockets; +using System.Text; +using System.Text.Json; +using Microsoft.Extensions.Logging.Abstractions; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; + +var listener = new TcpListener(IPAddress.Loopback, 0); +listener.Start(); +int port = ((IPEndPoint)listener.LocalEndpoint).Port; +var lines = new ConcurrentQueue(); +var cts = new CancellationTokenSource(TimeSpan.FromSeconds(60)); + +var server = Task.Run(async () => +{ + while (!cts.IsCancellationRequested) + { + TcpClient conn; + try { conn = await listener.AcceptTcpClientAsync(cts.Token); } + catch (OperationCanceledException) { break; } + try + { + using var stream = conn.GetStream(); + using var reader = new StreamReader(stream, Encoding.ASCII, false, 1024, true); + var requestLine = await reader.ReadLineAsync(cts.Token); + if (requestLine != null) lines.Enqueue(requestLine); + // consume headers (no body in this fixture) + while (await reader.ReadLineAsync(cts.Token) is { } h && h.Length > 0) { } + var resp = Encoding.ASCII.GetBytes("HTTP/1.1 204 No Content\r\nContent-Length: 0\r\nConnection: close\r\n\r\n"); + await stream.WriteAsync(resp, cts.Token); + } + catch (OperationCanceledException) { break; } + finally { conn.Close(); } + } +}); + +using var handler = new SocketsHttpHandler { UseProxy = false, AllowAutoRedirect = false }; +using var httpClient = new HttpClient(handler) +{ + BaseAddress = new Uri($"http://127.0.0.1:{port}"), + DefaultRequestVersion = HttpVersion.Version11 +}; +var api = new DefaultApi( + NullLogger.Instance, + httpClient, + new JsonSerializerOptionsProvider(new JsonSerializerOptions()), + new DefaultApiEvents()); + +// `in: querystring` callers pass the query component without the leading `?` +await api.QueryPetsAsync("a=1&b=%20x", cts.Token); +await api.CustomPetsAsync(cts.Token); +await api.CheckFetchPetsAsync(cts.Token); +await api.PurgePetsAsync(cts.Token); +await api.HashPetsAsync(cts.Token); +await api.ListPetsAsync(cts.Token); + +var expected = new[] +{ + "QUERY /pets?a=1&b=%20x HTTP/1.1", + "customMethod /pets HTTP/1.1", + "CHECK&FETCH /pets HTTP/1.1", + "PURGE /pets HTTP/1.1", + "X#Y /pets HTTP/1.1", + "GET /pets HTTP/1.1" +}; +cts.Cancel(); +try { await server; } catch (OperationCanceledException) { } + +var got = lines.ToArray(); +var ok = got.SequenceEqual(expected); +for (int i = 0; i < expected.Length; i++) +{ + var actual = i < got.Length ? got[i] : ""; + if (actual != expected[i]) + Console.Error.WriteLine($"FAIL: got {actual}, want {expected[i]}"); +} +Console.WriteLine(ok ? "CAPTURE-PASS" : "CAPTURE-FAIL"); +return ok ? 0 : 1; From 5ca6a5e8b4404ee5476d8279f763041bc868582f Mon Sep 17 00:00:00 2001 From: khayashi4337 Date: Wed, 23 Sep 2026 02:12:21 +0900 Subject: [PATCH 12/31] feat(kotlin): generate OpenAPI 3.2 query/additionalOperations and in:querystring (jvm-okhttp4) The shared RequestMethod enum is untouched (adding QUERY would break exhaustive when expressions in ktor/multiplatform templates). Instead the jvm-okhttp-shadowed RequestConfig carries customMethod/encodedQueryString: non-standard RFC 9110 tokens are emitted verbatim through okhttp's Request.Builder.method(String, ...) which preserves casing, and QUERY always gets a possibly-empty body since OkHttp 5 rejects bodyless QUERY. in:querystring params are excluded from the name=value query map and appended verbatim via encodedQuery. '$' is escaped for Kotlin string literals, '|' for markdown tables; non-tchar tokens warn+skip. Infra changes are gated on bundle flags so non-3.2 output is byte-identical; the other 7 kotlin libraries warn+skip. The committed test compiles the generated client with a PATH-detected kotlinc and captures raw request lines over a ServerSocket. --- modules/openapi-generator/pom.xml | 32 +++ .../languages/KotlinClientCodegen.java | 115 ++++++++++ .../resources/kotlin-client/README.mustache | 2 +- .../resources/kotlin-client/api_doc.mustache | 2 +- .../libraries/jvm-okhttp/api.mustache | 11 + .../infrastructure/ApiClient.kt.mustache | 24 +- .../infrastructure/RequestConfig.kt.mustache | 28 +++ .../kotlin/KotlinClientCodegenApiTest.java | 217 ++++++++++++++++++ .../3_2/kotlin-okhttp-capture/Capture.kt | 80 +++++++ .../test/resources/3_2/query-operation.yaml | 12 + 10 files changed, 520 insertions(+), 3 deletions(-) create mode 100644 modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm-okhttp/infrastructure/RequestConfig.kt.mustache create mode 100644 modules/openapi-generator/src/test/resources/3_2/kotlin-okhttp-capture/Capture.kt diff --git a/modules/openapi-generator/pom.xml b/modules/openapi-generator/pom.xml index 673188e0fe61..b6694a0cf3af 100644 --- a/modules/openapi-generator/pom.xml +++ b/modules/openapi-generator/pom.xml @@ -463,6 +463,38 @@ ${kotlin.version} test + + + com.squareup.okhttp3 + okhttp-jvm + 5.4.0 + test + + + com.squareup.okio + okio-jvm + 3.17.0 + test + + + com.squareup.moshi + moshi + 1.15.2 + test + + + com.squareup.moshi + moshi-kotlin + 1.15.2 + test + + + com.squareup.moshi + moshi-adapters + 1.15.2 + test + com.google.guava guava-testlib diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/KotlinClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/KotlinClientCodegen.java index a6d859a7536d..a3b5c9c85093 100755 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/KotlinClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/KotlinClientCodegen.java @@ -22,19 +22,25 @@ import lombok.Setter; import org.apache.commons.lang3.StringUtils; import org.openapitools.codegen.*; +import org.openapitools.codegen.model.ApiInfoMap; import org.openapitools.codegen.model.ModelMap; import org.openapitools.codegen.model.ModelsMap; import org.openapitools.codegen.model.OperationMap; import org.openapitools.codegen.model.OperationsMap; +import org.openapitools.codegen.model.WebhooksMap; import org.openapitools.codegen.utils.ProcessUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.io.File; +import java.util.Arrays; import java.util.EnumSet; import java.util.HashMap; +import java.util.HashSet; +import java.util.Iterator; import java.util.List; import java.util.Map; +import java.util.Set; import java.util.function.Predicate; import java.util.stream.Collectors; import java.util.stream.Stream; @@ -1166,6 +1172,9 @@ public OperationsMap postProcessOperationsWithModels(OperationsMap objs, List getSupportedVendorExtensions() { extensions.add(VendorExtension.X_FIELD_EXTRA_ANNOTATION); return extensions; } + + @Override + public boolean supportsAdditionalOperations() { + // only jvm-okhttp(4) sends arbitrary methods verbatim through okhttp's + // Request.Builder.method(String, ...); the other variants dispatch via + // enum constants or annotations that cannot express non-standard tokens + return JVM_OKHTTP.equals(getLibrary()) || JVM_OKHTTP4.equals(getLibrary()); + } + + @Override + protected boolean supportsQueryStringParameters() { + return JVM_OKHTTP.equals(getLibrary()) || JVM_OKHTTP4.equals(getLibrary()); + } + + private static final Set STANDARD_HTTP_METHODS = new HashSet<>(Arrays.asList( + "GET", "DELETE", "HEAD", "OPTIONS", "PATCH", "POST", "PUT")); + + // RFC 9110 tchar: okhttp's Request.Builder.method() does not validate the token, + // so anything outside this set is warned about and skipped + private static final java.util.regex.Pattern HTTP_METHOD_TOKEN_PATTERN = + java.util.regex.Pattern.compile("[!#$%&'*+\\-.^_`|~0-9A-Za-z]+"); + + /** + * Marks OpenAPI 3.2 (query/additionalOperations) HTTP methods for verbatim emission via + * {@code x-kotlin-custom-method}. Unlike .NET's HttpMethod, okhttp preserves casing on + * the wire, so only non-tchar tokens are warned about and skipped. Also records + * {@code x-kotlin-querystring-params} for operations carrying {@code in: querystring} + * parameters, whose values are already-encoded and must not go through the + * name=value query serialization. + */ + private void flagVerbatimHttpMethods(List operationList) { + Iterator it = operationList.iterator(); + while (it.hasNext()) { + CodegenOperation op = it.next(); + if (op.httpMethod != null && !STANDARD_HTTP_METHODS.contains(op.httpMethod)) { + if (!HTTP_METHOD_TOKEN_PATTERN.matcher(op.httpMethod).matches()) { + LOGGER.warn("Skipping operation {}: HTTP method name '{}' is not a valid RFC 9110 token.", + op.operationId, op.httpMethod); + it.remove(); + continue; + } + // '$' is a valid tchar but would interpolate inside a Kotlin "..." literal + op.vendorExtensions.put("x-kotlin-custom-method", op.httpMethod.replace("$", "\\$")); + // '|' is a valid tchar but breaks markdown tables in doc templates + op.vendorExtensions.put("x-kotlin-http-method-doc", op.httpMethod.replace("|", "\\|")); + } + if (op.queryParams != null) { + String queryStringParams = op.queryParams.stream() + .filter(param -> param.isQueryStringParam) + .map(param -> param.paramName) + .collect(Collectors.joining(", ")); + if (!queryStringParams.isEmpty()) { + op.vendorExtensions.put("x-kotlin-querystring-params", queryStringParams); + } + } + } + } + + @Override + public WebhooksMap postProcessWebhooksWithModels(WebhooksMap objs, List allModels) { + WebhooksMap map = super.postProcessWebhooksWithModels(objs, allModels); + if (map.getWebhooks() != null) { + flagVerbatimHttpMethods(map.getWebhooks().getOperation()); + } + return map; + } + + @Override + @SuppressWarnings("unchecked") + public Map postProcessSupportingFileData(Map objs) { + super.postProcessSupportingFileData(objs); + // the jvm-okhttp infrastructure templates emit verbatim-method and + // querystring support only when a retained operation needs it, keeping + // output for specs without OpenAPI 3.2 features byte-identical + boolean hasVerbatimMethod = false; + boolean hasQueryStringParam = false; + List groups = new java.util.ArrayList<>(); + Object apis = objs.get("apiInfo"); + if (apis instanceof ApiInfoMap && ((ApiInfoMap) apis).getApis() != null) { + for (OperationsMap api : ((ApiInfoMap) apis).getApis()) { + groups.add(api.getOperations()); + } + } + Object webhooks = objs.get("webhooks"); + if (webhooks instanceof List) { + for (WebhooksMap webhook : (List) webhooks) { + groups.add(webhook.getWebhooks()); + } + } + for (OperationMap group : groups) { + if (group == null || group.getOperation() == null) { + continue; + } + for (CodegenOperation op : group.getOperation()) { + hasVerbatimMethod |= op.vendorExtensions.containsKey("x-kotlin-custom-method"); + hasQueryStringParam |= op.vendorExtensions.containsKey("x-kotlin-querystring-params"); + } + } + if (hasVerbatimMethod) { + objs.put("x-kotlin-verbatim-methods", true); + } + if (hasQueryStringParam) { + objs.put("x-kotlin-querystring", true); + } + return objs; + } } diff --git a/modules/openapi-generator/src/main/resources/kotlin-client/README.mustache b/modules/openapi-generator/src/main/resources/kotlin-client/README.mustache index 2f6ea7932919..6a2d1f88cf0e 100644 --- a/modules/openapi-generator/src/main/resources/kotlin-client/README.mustache +++ b/modules/openapi-generator/src/main/resources/kotlin-client/README.mustache @@ -61,7 +61,7 @@ All URIs are relative to *{{{basePath}}}* | Class | Method | HTTP request | Description | | ------------ | ------------- | ------------- | ------------- | -{{#apiInfo}}{{#apis}}{{#operations}}{{#operation}}| *{{classname}}* | [**{{operationId}}**]({{apiDocPath}}{{classname}}.md#{{operationIdLowerCase}}) | **{{httpMethod}}** {{path}} | {{{summary}}} | +{{#apiInfo}}{{#apis}}{{#operations}}{{#operation}}| *{{classname}}* | [**{{operationId}}**]({{apiDocPath}}{{classname}}.md#{{operationIdLowerCase}}) | **{{#vendorExtensions.x-kotlin-http-method-doc}}{{{vendorExtensions.x-kotlin-http-method-doc}}}{{/vendorExtensions.x-kotlin-http-method-doc}}{{^vendorExtensions.x-kotlin-http-method-doc}}{{httpMethod}}{{/vendorExtensions.x-kotlin-http-method-doc}}** {{path}} | {{{summary}}} | {{/operation}}{{/operations}}{{/apis}}{{/apiInfo}} {{/generateApiDocs}} 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 facfb481b9ec..67b628f74f74 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 @@ -5,7 +5,7 @@ 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}}) | **{{#vendorExtensions.x-kotlin-http-method-doc}}{{{vendorExtensions.x-kotlin-http-method-doc}}}{{/vendorExtensions.x-kotlin-http-method-doc}}{{^vendorExtensions.x-kotlin-http-method-doc}}{{httpMethod}}{{/vendorExtensions.x-kotlin-http-method-doc}}** {{path}} | {{summary}} | {{/operation}}{{/operations}} {{#operations}} 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 529bfc926130..22be7a92ce50 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 @@ -209,6 +209,7 @@ import {{packageName}}.infrastructure.Serializer {{/hasQueryParams}}{{#hasQueryParams}}mutableMapOf>() .apply { {{#queryParams}} + {{^isQueryStringParam}} {{^required}} if ({{{paramName}}} != null) { {{#isModel}} @@ -251,6 +252,7 @@ import {{packageName}}.infrastructure.Serializer {{/isModel}} {{/isNullable}} {{/required}} + {{/isQueryStringParam}} {{/queryParams}} } {{/hasQueryParams}} @@ -262,9 +264,18 @@ import {{packageName}}.infrastructure.Serializer {{/headerParams}} return RequestConfig( +{{#vendorExtensions.x-kotlin-custom-method}} + method = RequestMethod.GET, + customMethod = "{{{vendorExtensions.x-kotlin-custom-method}}}", +{{/vendorExtensions.x-kotlin-custom-method}} +{{^vendorExtensions.x-kotlin-custom-method}} method = RequestMethod.{{httpMethod}}, +{{/vendorExtensions.x-kotlin-custom-method}} path = "{{{path}}}"{{#pathParams}}.replace("{"+"{{#lambda.escapeDollar}}{{baseName}}{{/lambda.escapeDollar}}"+"}", encodeURIComponent({{#isContainer}}{{paramName}}.joinToString(","){{/isContainer}}{{^isContainer}}{{{paramName}}}{{#isEnum}}{{^required}}?{{/required}}.value{{/isEnum}}.toString(){{/isContainer}})){{/pathParams}}, query = localVariableQuery, +{{#vendorExtensions.x-kotlin-querystring-params}} + encodedQueryString = listOfNotNull({{{vendorExtensions.x-kotlin-querystring-params}}}).joinToString("&"), +{{/vendorExtensions.x-kotlin-querystring-params}} headers = localVariableHeaders, requiresAuthentication = {{#hasAuthMethods}}true{{/hasAuthMethods}}{{^hasAuthMethods}}false{{/hasAuthMethods}}, body = localVariableBody diff --git a/modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm-okhttp/infrastructure/ApiClient.kt.mustache b/modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm-okhttp/infrastructure/ApiClient.kt.mustache index 3b9223fd5380..6b89f2c6f729 100644 --- a/modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm-okhttp/infrastructure/ApiClient.kt.mustache +++ b/modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm-okhttp/infrastructure/ApiClient.kt.mustache @@ -506,6 +506,14 @@ import com.squareup.moshi.adapter addQueryParameter(query.key, queryValue) } } + {{#x-kotlin-querystring}} + // OpenAPI 3.2 `in: querystring`: the value is already encoded, so it is + // appended verbatim via encodedQuery (query() would percent-encode it again) + requestConfig.encodedQueryString?.takeIf { it.isNotEmpty() }?.let { raw -> + val existing = build().encodedQuery + encodedQuery(if (existing.isNullOrEmpty()) raw else "$existing&$raw") + } + {{/x-kotlin-querystring}} }.build() // take content-type/accept from spec or set to default (application/json) if not defined @@ -536,7 +544,21 @@ import com.squareup.moshi.adapter 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 { + }.{{#x-kotlin-verbatim-methods}}let { builder -> + if (requestConfig.customMethod == null) { + builder + } else { + // OpenAPI 3.2 query/additionalOperations: Request.Builder.method() sends the + // token verbatim. OkHttp >= 5 rejects a body-less QUERY, so QUERY always + // carries a (possibly empty) body. + val customBody = if (requestConfig.body != null || requestConfig.customMethod == "QUERY") { + requestBody(requestConfig.body, contentType) + } else { + null + } + builder.method(requestConfig.customMethod, customBody) + } + }.apply {{/x-kotlin-verbatim-methods}}{{^x-kotlin-verbatim-methods}}apply {{/x-kotlin-verbatim-methods}}{ val headersBuilder = Headers.Builder() headers.forEach { header -> {{#useNonAsciiHeaders}} diff --git a/modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm-okhttp/infrastructure/RequestConfig.kt.mustache b/modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm-okhttp/infrastructure/RequestConfig.kt.mustache new file mode 100644 index 000000000000..0639f616c8fd --- /dev/null +++ b/modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm-okhttp/infrastructure/RequestConfig.kt.mustache @@ -0,0 +1,28 @@ +package {{packageName}}.infrastructure + +/** + * Defines a config object for a given request. + * NOTE: This object doesn't include 'body' because it + * allows for caching of the constructed object + * for many request definitions. + * NOTE: Headers is a Map because rfc2616 defines + * multi-valued headers as csv-only. + */ +{{#nonPublicApi}}internal {{/nonPublicApi}}{{^nonPublicApi}}{{#explicitApi}}public {{/explicitApi}}{{/nonPublicApi}}data class RequestConfig( + val method: RequestMethod, + val path: String, + val headers: MutableMap = mutableMapOf(), + val params: MutableMap = mutableMapOf(), + val query: MutableMap> = mutableMapOf(), + val requiresAuthentication: Boolean, + val body: T? = null{{#x-kotlin-verbatim-methods}}, + /** + * OpenAPI 3.2 `query`/`additionalOperations`: non-standard HTTP method token, + * sent verbatim. Takes precedence over [method] when set. + */ + val customMethod: String? = null{{/x-kotlin-verbatim-methods}}{{#x-kotlin-querystring}}, + /** + * OpenAPI 3.2 `in: querystring`: already-encoded query string, appended verbatim. + */ + val encodedQueryString: String? = null{{/x-kotlin-querystring}} +) diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/kotlin/KotlinClientCodegenApiTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/kotlin/KotlinClientCodegenApiTest.java index 1bad07e5acf0..54602c5d2685 100644 --- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/kotlin/KotlinClientCodegenApiTest.java +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/kotlin/KotlinClientCodegenApiTest.java @@ -15,11 +15,17 @@ import java.io.File; import java.io.IOException; +import java.nio.charset.StandardCharsets; import java.nio.file.Files; +import java.nio.file.Path; import java.nio.file.Paths; +import java.util.ArrayList; +import java.util.Arrays; import java.util.List; import java.util.stream.Collectors; +import org.openapitools.codegen.config.CodegenConfigurator; + import static org.openapitools.codegen.TestUtils.assertFileContains; import static org.openapitools.codegen.TestUtils.assertFileNotContains; @@ -292,4 +298,215 @@ private KotlinClientCodegen createCodegen(ClientLibrary library) throws IOExcept codegen.additionalProperties().put(KotlinClientCodegen.DATE_LIBRARY, "kotlinx-datetime"); return codegen; } + + @Test + void testJvmOkhttp4OpenApi32OperationsAndQueryStringParam() throws IOException { + Path target = Files.createTempDirectory("kotlin32"); + try { + generate("jvm-okhttp4", "src/test/resources/3_2/query-operation.yaml", target); + + String api = new String(Files.readAllBytes( + target.resolve("src/main/kotlin/org/openapitools/client/apis/DefaultApi.kt")), StandardCharsets.UTF_8); + // non-standard methods are emitted verbatim via customMethod; there is no RequestMethod.QUERY + for (String method : new String[]{"QUERY", "PURGE", "customMethod", "CHECK&FETCH", "X#Y", "A|B"}) { + Assert.assertTrue(api.contains("customMethod = \"" + method + "\""), + "expected verbatim customMethod literal for " + method); + } + // '$' must be escaped so the Kotlin string literal keeps it verbatim + Assert.assertTrue(api.contains("customMethod = \"A\\$B\""), + "expected $-escaped customMethod literal for A$B"); + Assert.assertTrue(api.contains("method = RequestMethod.GET"), + "standard method kept on the RequestMethod enum"); + // `in: querystring` is wired verbatim, excluded from the name=value query map + Assert.assertTrue(api.contains("encodedQueryString = listOfNotNull(qs).joinToString"), + "querystring param should be passed verbatim"); + Assert.assertFalse(api.contains("put(\"qs\""), + "querystring param must not be serialized as a name=value pair"); + + String requestConfig = new String(Files.readAllBytes( + target.resolve("src/main/kotlin/org/openapitools/client/infrastructure/RequestConfig.kt")), StandardCharsets.UTF_8); + Assert.assertTrue(requestConfig.contains("val customMethod: String?"), + "RequestConfig should carry the verbatim method field"); + Assert.assertTrue(requestConfig.contains("val encodedQueryString: String?"), + "RequestConfig should carry the querystring field"); + + String apiClient = new String(Files.readAllBytes( + target.resolve("src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt")), StandardCharsets.UTF_8); + Assert.assertTrue(apiClient.contains("builder.method(requestConfig.customMethod, customBody)"), + "ApiClient should dispatch verbatim methods"); + Assert.assertTrue(apiClient.contains("encodedQuery("), + "ApiClient should append the querystring verbatim"); + + String docs = new String(Files.readAllBytes(target.resolve("docs/DefaultApi.md")), StandardCharsets.UTF_8); + Assert.assertTrue(docs.contains("**A\\|B**"), "doc table should escape |"); + } finally { + deleteRecursively(target); + } + } + + @Test + void testNonOkhttpLibrariesSkipOpenApi32Operations() throws IOException { + Path target = Files.createTempDirectory("kotlin32-skip"); + try { + generate("jvm-ktor", "src/test/resources/3_2/query-operation.yaml", target); + String api = new String(Files.readAllBytes( + target.resolve("src/main/kotlin/org/openapitools/client/apis/DefaultApi.kt")), StandardCharsets.UTF_8); + Assert.assertTrue(api.contains("listPets"), "GET operation should be kept"); + for (String op : new String[]{"queryPets", "purgePets", "customPets", "checkFetchPets", "hashPets", "pipePets", "dollarPets"}) { + Assert.assertFalse(api.contains(op + "RequestConfig"), + "jvm-ktor must skip unsupported 3.2 operation " + op); + } + } finally { + deleteRecursively(target); + } + } + + @Test + void testJvmOkhttp4SkipsInvalidMethodToken() throws IOException { + Path target = Files.createTempDirectory("kotlin32-invalid"); + try { + // "MY METHOD" is not a valid RFC 9110 token; okhttp does not validate + // tokens itself, so the generator must reject it + String spec = "openapi: 3.2.0\n" + + "info: {title: t, version: '1'}\n" + + "paths:\n" + + " /pets:\n" + + " get:\n" + + " operationId: listPets\n" + + " responses: {'200': {description: ok}}\n" + + " additionalOperations:\n" + + " \"MY METHOD\":\n" + + " operationId: badMethod\n" + + " responses: {'204': {description: done}}\n"; + Path specFile = target.resolve("spec.yaml"); + Files.writeString(specFile, spec); + generate("jvm-okhttp4", specFile.toString(), target.resolve("out")); + String api = new String(Files.readAllBytes( + target.resolve("out/src/main/kotlin/org/openapitools/client/apis/DefaultApi.kt")), StandardCharsets.UTF_8); + Assert.assertTrue(api.contains("listPets"), "GET operation should be kept"); + Assert.assertFalse(api.contains("badMethod"), + "invalid RFC 9110 method token must be skipped"); + } finally { + deleteRecursively(target); + } + } + + /** + * End-to-end check: compiles the generated jvm-okhttp4 client with kotlinc and + * runs a raw ServerSocket capture, verifying query/additionalOperations methods + * and `in: querystring` reach the wire verbatim. Skipped when kotlinc is not on + * PATH or the dependency jars cannot be located. + */ + @Test + void testJvmOkhttp4GeneratedClientSendsVerbatimMethods() throws IOException, InterruptedException { + Path kotlinc = findOnPath("kotlinc"); + if (kotlinc == null) { + throw new org.testng.SkipException("kotlinc is not on PATH; skipping generated-client verification"); + } + // PATH may hold a symlink into the install; resolve it so lib/ is found correctly + kotlinc = kotlinc.toRealPath(); + List jars; + try { + jars = new ArrayList<>(Arrays.asList( + jarOf(okhttp3.OkHttpClient.class), + jarOf(okio.Buffer.class), + jarOf(com.squareup.moshi.Moshi.class), + jarOf(com.squareup.moshi.kotlin.reflect.KotlinJsonAdapterFactory.class), + jarOf(com.squareup.moshi.adapters.Rfc3339DateJsonAdapter.class))); + } catch (Exception e) { + throw new org.testng.SkipException("okhttp/moshi jars not resolvable from test classpath: " + e); + } + // use the stdlib/reflect bundled with the detected kotlinc so versions match + // the compiler (the module's own test classpath pins an older kotlin.version) + Path kotlincLib = kotlinc.getParent().getParent().resolve("lib"); + for (String name : new String[]{"kotlin-stdlib.jar", "kotlin-reflect.jar"}) { + Path jar = kotlincLib.resolve(name); + if (!Files.exists(jar)) { + throw new org.testng.SkipException("kotlinc lib dir lacks " + name + ": " + kotlincLib); + } + jars.add(jar.toString()); + } + + Path target = Files.createTempDirectory("kotlin32-verify"); + try { + generate("jvm-okhttp4", "src/test/resources/3_2/query-operation.yaml", target); + Path srcDir = target.resolve("src/main/kotlin"); + Path capture = target.resolve("Capture.kt"); + Files.copy(Path.of("src/test/resources/3_2/kotlin-okhttp-capture/Capture.kt"), capture); + + List sources = Files.walk(srcDir) + .filter(p -> p.toString().endsWith(".kt")) + .map(Path::toString) + .collect(Collectors.toList()); + sources.add(capture.toString()); + + String classPath = String.join(File.pathSeparator, jars); + Path classesDir = target.resolve("classes"); + List compile = new ArrayList<>(List.of( + kotlinc.toString(), "-cp", classPath, "-d", classesDir.toString(), "-jvm-target", "17")); + compile.addAll(sources); + runProcess(target, "kotlinc.log", 300, compile.toArray(new String[0])); + + String javaBin = Path.of(System.getProperty("java.home"), "bin", "java").toString(); + String output = runProcess(target, "run.log", 120, + javaBin, "-cp", classesDir + File.pathSeparator + classPath, "CaptureKt"); + Assert.assertTrue(output.contains("CAPTURE-PASS"), + "generated client did not send verbatim 3.2 methods/querystring:\n" + output); + } finally { + deleteRecursively(target); + } + } + + private static void generate(String library, String spec, Path outputDir) { + final CodegenConfigurator configurator = new CodegenConfigurator() + .setGeneratorName("kotlin") + .setLibrary(library) + .setInputSpec(spec) + .setSkipOverwrite(false) + .setOutputDir(outputDir.toAbsolutePath().toString().replace("\\", "/")); + new DefaultGenerator().opts(configurator.toClientOptInput()).generate(); + } + + private static Path findOnPath(String executable) { + for (String dir : System.getenv("PATH").split(File.pathSeparator)) { + for (String name : new String[]{executable, executable + ".bat", executable + ".exe"}) { + Path candidate = Path.of(dir, name); + if (Files.isExecutable(candidate)) { + return candidate; + } + } + } + return null; + } + + private static String jarOf(Class marker) throws Exception { + return Path.of(marker.getProtectionDomain().getCodeSource().getLocation().toURI()).toString(); + } + + private static String runProcess(Path workDir, String logName, long timeoutSeconds, String... command) + throws IOException, InterruptedException { + Path log = workDir.resolve(logName); + Process p = new ProcessBuilder(command) + .directory(workDir.toFile()) + .redirectErrorStream(true) + .redirectOutput(log.toFile()) + .start(); + if (!p.waitFor(timeoutSeconds, java.util.concurrent.TimeUnit.SECONDS)) { + p.destroyForcibly(); + Assert.fail("process timed out: " + String.join(" ", command) + + "\n" + new String(Files.readAllBytes(log), StandardCharsets.UTF_8)); + } + String output = new String(Files.readAllBytes(log), StandardCharsets.UTF_8); + Assert.assertEquals(p.exitValue(), 0, "process failed: " + String.join(" ", command) + "\n" + output); + return output; + } + + private static void deleteRecursively(Path dir) throws IOException { + if (Files.exists(dir)) { + try (var stream = Files.walk(dir)) { + stream.sorted(java.util.Comparator.reverseOrder()) + .forEach(p -> p.toFile().delete()); + } + } + } } diff --git a/modules/openapi-generator/src/test/resources/3_2/kotlin-okhttp-capture/Capture.kt b/modules/openapi-generator/src/test/resources/3_2/kotlin-okhttp-capture/Capture.kt new file mode 100644 index 000000000000..1d9bdedd9d34 --- /dev/null +++ b/modules/openapi-generator/src/test/resources/3_2/kotlin-okhttp-capture/Capture.kt @@ -0,0 +1,80 @@ +import org.openapitools.client.apis.DefaultApi +import java.io.BufferedReader +import java.io.InputStreamReader +import java.net.ServerSocket +import java.net.Socket +import java.util.concurrent.CopyOnWriteArrayList +import kotlin.concurrent.thread + +/** + * Raw-TCP capture: verifies the generated jvm-okhttp client puts OpenAPI 3.2 + * query/additionalOperations method tokens and in:querystring values on the + * wire verbatim (same approach as the Rust/Ruby/PHP/C# capture harnesses). + */ +val captured = CopyOnWriteArrayList() + +fun handle(s: Socket) { + s.use { + val reader = BufferedReader(InputStreamReader(it.getInputStream(), Charsets.ISO_8859_1)) + val requestLine = reader.readLine() ?: return + var contentLength = 0 + while (true) { + val h = reader.readLine() ?: break + if (h.isEmpty()) break + if (h.lowercase().startsWith("content-length:")) contentLength = h.substring(15).trim().toInt() + } + repeat(contentLength) { reader.read() } + captured.add("$requestLine [Content-Length=$contentLength]") + val out = it.getOutputStream() + out.write("HTTP/1.1 204 No Content\r\nContent-Length: 0\r\nConnection: close\r\n\r\n".toByteArray(Charsets.ISO_8859_1)) + out.flush() + } +} + +fun main() { + val server = ServerSocket(0) + val port = server.localPort + thread(isDaemon = true) { + try { + while (true) handle(server.accept()) + } catch (_: Exception) { + } + } + + val api = DefaultApi(basePath = "http://127.0.0.1:$port") + + fun run(label: String, block: () -> Unit) { + try { + block() + println("$label -> wire=\"${captured.last()}\"") + } catch (e: Throwable) { + println("$label -> EXCEPTION ${e::class.simpleName}: ${e.message}") + } + } + + run("GET listPets (regression)") { api.listPetsWithHttpInfo() } + run("QUERY queryPets(qs)") { api.queryPetsWithHttpInfo("a=1&b=%20x&c=x+y&d=%2F") } + run("PURGE purgePets") { api.purgePetsWithHttpInfo() } + run("customMethod customPets") { api.customPetsWithHttpInfo() } + run("CHECK&FETCH checkFetchPets") { api.checkFetchPetsWithHttpInfo() } + run("X#Y hashPets") { api.hashPetsWithHttpInfo() } + run("A|B pipePets") { api.pipePetsWithHttpInfo() } + run("A\$B dollarPets") { api.dollarPetsWithHttpInfo() } + + val expected = listOf( + "GET /pets HTTP/1.1 [Content-Length=0]", + "QUERY /pets?a=1&b=%20x&c=x+y&d=%2F HTTP/1.1 [Content-Length=0]", + "PURGE /pets HTTP/1.1 [Content-Length=0]", + "customMethod /pets HTTP/1.1 [Content-Length=0]", + "CHECK&FETCH /pets HTTP/1.1 [Content-Length=0]", + "X#Y /pets HTTP/1.1 [Content-Length=0]", + "A|B /pets HTTP/1.1 [Content-Length=0]", + "A\$B /pets HTTP/1.1 [Content-Length=0]" + ) + if (captured.toList() == expected) { + println("CAPTURE-PASS") + } else { + println("CAPTURE-FAIL\n expected=$expected\n actual=${captured.toList()}") + } + server.close() +} diff --git a/modules/openapi-generator/src/test/resources/3_2/query-operation.yaml b/modules/openapi-generator/src/test/resources/3_2/query-operation.yaml index d4644e5007ad..a4f69c70585b 100644 --- a/modules/openapi-generator/src/test/resources/3_2/query-operation.yaml +++ b/modules/openapi-generator/src/test/resources/3_2/query-operation.yaml @@ -45,3 +45,15 @@ paths: responses: '204': description: done + # `|` is valid tchar but breaks markdown tables in generated docs + "A|B": + operationId: pipePets + responses: + '204': + description: done + # `$` is valid tchar but would interpolate inside a Kotlin "..." literal + "A$B": + operationId: dollarPets + responses: + '204': + description: done From 51fa9b99c00c0908300c436ad4f7db60916997a4 Mon Sep 17 00:00:00 2001 From: khayashi4337 Date: Wed, 23 Sep 2026 08:09:23 +0900 Subject: [PATCH 13/31] fix(ruby): keep bodies on 3.2 verbs, preserve '//' in querystring, gate verbatim path to httpx - build_request now builds a body for non-standard methods too, so QUERY/additionalOperations with request bodies no longer drop them - build_request_url normalizes slashes on the path component only, so a querystring value containing '//' survives verbatim - isQueryStringParam is cleared for libraries other than httpx, so faraday/typhoeus fall back to normal name=value serialization instead of silently losing the parameter (fixed on both allParams and queryParams, which are independent copies) - fix debug logging in the httpx partial referencing undefined req_body (body_params is the local), which crashed debugging on 3.2 verbs - expand the shared 3.2 fixture with body-bearing QUERY, REPORT, PROPPATCH, a querystring param named 'uri', and a find op for unsupported-library fallback checks; extend the httpx wire capture to 9 cases incl. bodies and '//' preservation Generated with [Devin](https://devin.ai) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com> --- .../codegen/languages/RubyClientCodegen.java | 29 ++++++++ .../resources/ruby-client/api_client.mustache | 9 ++- .../api_client_httpx_partial.mustache | 6 +- .../codegen/ruby/RubyClientCodegenTest.java | 38 +++++++++++ .../test/resources/3_2/query-operation.yaml | 67 +++++++++++++++++++ .../3_2/ruby-httpx-capture/capture.rb | 45 ++++++++----- 6 files changed, 173 insertions(+), 21 deletions(-) diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/RubyClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/RubyClientCodegen.java index 26c4d475a30c..8e43c43fe4d3 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/RubyClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/RubyClientCodegen.java @@ -653,10 +653,38 @@ private void flagVerbatimHttpMethods(List operationList) { } } + /** + * For libraries without querystring support the verbatim-concat template path + * must not run; clearing the flag degrades the parameter to an ordinary + * name=value query parameter (same shape as generators without 3.2 support). + */ + private void degradeQueryStringParams(List operationList) { + if (supportsQueryStringParameters()) { + return; + } + for (CodegenOperation op : operationList) { + // queryParams holds copies (p.copy()), so the flag must be cleared + // on both lists or the parameter vanishes from generated code entirely + for (CodegenParameter p : op.allParams) { + if (p.isQueryStringParam) { + p.isQueryStringParam = false; + p.isQueryParam = true; + } + } + for (CodegenParameter p : op.queryParams) { + if (p.isQueryStringParam) { + p.isQueryStringParam = false; + p.isQueryParam = true; + } + } + } + } + @Override public WebhooksMap postProcessWebhooksWithModels(WebhooksMap objs, List allModels) { WebhooksMap map = super.postProcessWebhooksWithModels(objs, allModels); flagVerbatimHttpMethods(map.getWebhooks().getOperation()); + degradeQueryStringParams(map.getWebhooks().getOperation()); return map; } @@ -669,6 +697,7 @@ public OperationsMap postProcessOperationsWithModels(OperationsMap objs, List operationList = operations.getOperation(); flagVerbatimHttpMethods(operationList); + degradeQueryStringParams(operationList); for (CodegenOperation op : operationList) { for (CodegenParameter p : op.allParams) { p.vendorExtensions.put("x-ruby-example", constructExampleCode(p, modelMaps, processedModelMaps)); diff --git a/modules/openapi-generator/src/main/resources/ruby-client/api_client.mustache b/modules/openapi-generator/src/main/resources/ruby-client/api_client.mustache index a4609a59fc27..7513a21e187c 100644 --- a/modules/openapi-generator/src/main/resources/ruby-client/api_client.mustache +++ b/modules/openapi-generator/src/main/resources/ruby-client/api_client.mustache @@ -155,9 +155,12 @@ module {{moduleName}} end def build_request_url(path, opts = {}) - # Add leading and trailing slashes to path - path = "/#{path}".gsub(/\/+/, '/') - @config.base_url(opts[:operation]) + path + # Add leading and trailing slashes to path. An OpenAPI 3.2 + # `in: querystring` value is appended verbatim to `path`, so only the + # part before '?' may have its slashes collapsed. + path_only, sep, query = path.partition('?') + path_only = "/#{path_only}".gsub(/\/+/, '/') + @config.base_url(opts[:operation]) + path_only + sep + query end # Update header and query params based on authentication settings. diff --git a/modules/openapi-generator/src/main/resources/ruby-client/api_client_httpx_partial.mustache b/modules/openapi-generator/src/main/resources/ruby-client/api_client_httpx_partial.mustache index 1f62ee6baabb..ad3c1bf0e214 100644 --- a/modules/openapi-generator/src/main/resources/ruby-client/api_client_httpx_partial.mustache +++ b/modules/openapi-generator/src/main/resources/ruby-client/api_client_httpx_partial.mustache @@ -55,10 +55,12 @@ update_params_for_auth! header_params, query_params, opts[:auth_names] - if %w[POST PATCH PUT DELETE].include?(http_method) + # OpenAPI 3.2 query/additionalOperations verbs may carry a body too; for + # non-standard methods we always attempt to build one (nil when absent). + if %w[POST PATCH PUT DELETE].include?(http_method) || !STANDARD_HTTP_METHODS.include?(http_method.to_s) body_params = build_request_body(header_params, form_params, opts[:body]) if config.debugging - config.logger.debug "HTTP request body param ~BEGIN~\n#{req_body}\n~END~\n" + config.logger.debug "HTTP request body param ~BEGIN~\n#{body_params}\n~END~\n" end end req_opts = { diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/ruby/RubyClientCodegenTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/ruby/RubyClientCodegenTest.java index e30c48bd9ea4..1ad5d5217125 100644 --- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/ruby/RubyClientCodegenTest.java +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/ruby/RubyClientCodegenTest.java @@ -794,6 +794,11 @@ public void testHttpxOpenApi32OperationsAndQueryStringParam() throws IOException "querystring param should be appended verbatim"); Assert.assertFalse(generated.contains("query_params[:'qs']"), "querystring param must not be serialized as a name=value pair"); + // QUERY may carry a body (OpenAPI 3.2): it must reach opts[:body] + Assert.assertTrue(generated.contains("def search_items(uri, request_body, opts = {})"), + "QUERY-with-body operation should take the body parameter"); + Assert.assertTrue(generated.contains("call_api(:\"REPORT\""), + "REPORT additionalOperation should emit a verbatim symbol"); Path clientPath = target.resolve("lib/openapi_client/api_client.rb"); String client = new String(Files.readAllBytes(clientPath), StandardCharsets.UTF_8); Assert.assertTrue(client.contains("instance_variable_set(:@verb, http_method.to_s)"), @@ -822,6 +827,39 @@ public void testTyphoeusSkipsOpenApi32Operations() throws IOException { Assert.assertFalse(generated.contains("def " + op), "typhoeus must skip unsupported 3.2 operation " + op); } + // `in: querystring` on a standard method degrades to a name=value + // parameter - the verbatim-append path is httpx-only + Assert.assertTrue(generated.contains("def find_pets"), + "GET+querystring operation should be kept"); + Assert.assertTrue(generated.contains("query_params[:'q'] = q"), + "unsupported library must degrade querystring to name=value"); + Assert.assertFalse(generated.contains("+ q.to_s"), + "unsupported library must not emit the verbatim querystring append"); + } finally { + FileUtils.deleteDirectory(target.toFile()); + } + } + + @Test + public void testFaradayDegradesQueryStringParam() throws IOException { + Path target = Files.createTempDirectory("test"); + try { + final CodegenConfigurator configurator = new CodegenConfigurator() + .setGeneratorName("ruby") + .setLibrary("faraday") + .setInputSpec("src/test/resources/3_2/query-operation.yaml") + .setSkipOverwrite(false) + .setOutputDir(target.toAbsolutePath().toString().replace("\\", "/")); + new DefaultGenerator().opts(configurator.toClientOptInput()).generate(); + Path apiPath = target.resolve("lib/openapi_client/api/default_api.rb"); + TestUtils.assertFileExists(apiPath); + String generated = new String(Files.readAllBytes(apiPath), StandardCharsets.UTF_8); + Assert.assertTrue(generated.contains("def find_pets"), + "GET+querystring operation should be kept"); + Assert.assertTrue(generated.contains("query_params[:'q'] = q"), + "faraday must degrade querystring to an ordinary name=value pair"); + Assert.assertFalse(generated.contains("+ q.to_s"), + "faraday must not emit the verbatim querystring append"); } finally { FileUtils.deleteDirectory(target.toFile()); } diff --git a/modules/openapi-generator/src/test/resources/3_2/query-operation.yaml b/modules/openapi-generator/src/test/resources/3_2/query-operation.yaml index a4f69c70585b..24ff299b7197 100644 --- a/modules/openapi-generator/src/test/resources/3_2/query-operation.yaml +++ b/modules/openapi-generator/src/test/resources/3_2/query-operation.yaml @@ -57,3 +57,70 @@ paths: responses: '204': description: done + /find: + # a standard-method op carrying `in: querystring`: libraries without + # querystring support must degrade it to an ordinary name=value param + get: + operationId: findPets + parameters: + - name: q + in: querystring + required: true + content: + application/x-www-form-urlencoded: + schema: + type: string + responses: + '200': + description: ok + /items: + # QUERY carrying a body; the querystring param is named `uri`, which + # collides with template-internal variables in several generators + query: + operationId: searchItems + parameters: + - name: uri + in: querystring + required: true + content: + application/x-www-form-urlencoded: + schema: + type: string + requestBody: + required: true + content: + application/json: + schema: + type: object + additionalProperties: true + responses: + '200': + description: ok + /report: + additionalOperations: + # OkHttp 5 requires a body for REPORT/PROPPATCH just like for QUERY + REPORT: + operationId: reportItems + parameters: + # `localVariableQuery` collides with kotlin template-internal locals + - name: localVariableQuery + in: querystring + required: true + content: + application/x-www-form-urlencoded: + schema: + type: string + responses: + '207': + description: multi + PROPPATCH: + operationId: propPatch + requestBody: + required: true + content: + application/xml: + schema: + type: string + responses: + '207': + description: multi diff --git a/modules/openapi-generator/src/test/resources/3_2/ruby-httpx-capture/capture.rb b/modules/openapi-generator/src/test/resources/3_2/ruby-httpx-capture/capture.rb index 313b837f824f..202247197787 100644 --- a/modules/openapi-generator/src/test/resources/3_2/ruby-httpx-capture/capture.rb +++ b/modules/openapi-generator/src/test/resources/3_2/ruby-httpx-capture/capture.rb @@ -4,10 +4,11 @@ # `ruby` (httpx) client. RubyClientCodegenTest copies this file into the # generated client directory and runs it with `ruby capture.rb `. # -# A raw TCP listener records the HTTP request line for every generated call: -# standard methods keep the normal HTTPX dispatch, while query/ -# additionalOperations methods and `in: querystring` parameters must reach the -# wire verbatim (no up-casing, no re-encoding). +# A raw TCP listener records the HTTP request line (and body, when present) +# for every generated call: standard methods keep the normal HTTPX dispatch, +# while query/ additionalOperations methods and `in: querystring` parameters +# must reach the wire verbatim (no up-casing, no re-encoding, no `//` +# collapsing inside the query component). $LOAD_PATH.unshift ARGV[0] || raise('usage: capture.rb ') require 'socket' @@ -20,9 +21,12 @@ loop do s = server.accept line = s.gets - lines << line - # consume request headers (no body in this fixture) - while (h = s.gets) && h != "\r\n"; end + cl = 0 + while (h = s.gets) && h != "\r\n" + cl = h.split(':', 2)[1].strip.to_i if h.downcase.start_with?('content-length:') + end + body = cl.positive? ? (s.read(cl) || '') : '' + lines << "#{line.strip} [CL=#{cl}]#{body.empty? ? '' : " BODY=#{body}"}" s.write "HTTP/1.1 200 OK\r\nContent-Length: 2\r\nConnection: close\r\n\r\n{}" s.close end @@ -34,23 +38,32 @@ config.debugging = false api = OpenapiClient::DefaultApi.new(OpenapiClient::ApiClient.new(config)) -# `in: querystring` callers pass the query component without the leading `?` -api.query_pets('a=1&b=%20x') +# `in: querystring` callers pass the query component without the leading `?`; +# embedded `//` must reach the wire intact (path-only slash collapsing). +api.query_pets('a=1&u=http://h//p') api.custom_pets api.check_fetch_pets api.purge_pets api.hash_pets api.list_pets +# QUERY carrying a request body, querystring param named `uri` +api.search_items('k=v', { 'a' => 1 }) +# additionalOperations: REPORT with querystring, PROPPATCH with a body +api.report_items('r=1') +api.prop_patch('') expected = [ - 'QUERY /pets?a=1&b=%20x HTTP/1.1', - 'customMethod /pets HTTP/1.1', - 'CHECK&FETCH /pets HTTP/1.1', - 'PURGE /pets HTTP/1.1', - 'X#Y /pets HTTP/1.1', - 'GET /pets HTTP/1.1' + 'QUERY /pets?a=1&u=http://h//p HTTP/1.1 [CL=0]', + 'customMethod /pets HTTP/1.1 [CL=0]', + 'CHECK&FETCH /pets HTTP/1.1 [CL=0]', + 'PURGE /pets HTTP/1.1 [CL=0]', + 'X#Y /pets HTTP/1.1 [CL=0]', + 'GET /pets HTTP/1.1 [CL=0]', + 'QUERY /items?k=v HTTP/1.1 [CL=7] BODY={"a":1}', + 'REPORT /report?r=1 HTTP/1.1 [CL=0]', + 'PROPPATCH /report HTTP/1.1 [CL=4] BODY=' ] -got = 6.times.map { lines.pop.strip } +got = expected.size.times.map { lines.pop } got.each_with_index do |line, i| warn("FAIL: got #{line.inspect}, want #{expected[i].inspect}") unless line == expected[i] end From 62a98c232aee917a75795d87658a24597511a316 Mon Sep 17 00:00:00 2001 From: khayashi4337 Date: Wed, 23 Sep 2026 08:09:38 +0900 Subject: [PATCH 14/31] fix(php): require psr/http-message ^2.10, avoid \$uri collision in 3.2 ops - bump guzzle psr-7 constraint to ^2.10: 1.x could reconstruct the request and lose the verbatim-method anonymous subclass. This is a compatibility break for consumers pinned to psr-7 1.x - rename the internal \$uri variable to \$__requestUri so an 'in: querystring' parameter literally named 'uri' no longer collides - extend the guzzle wire capture for the uri-named param and body-bearing QUERY/REPORT/PROPPATCH cases Generated with [Devin](https://devin.ai) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com> --- .../src/main/resources/php/api.mustache | 11 ++++---- .../src/main/resources/php/composer.mustache | 2 +- .../codegen/php/PhpClientCodegenTest.java | 15 +++++++++-- .../3_2/php-guzzle-capture/capture.php | 27 ++++++++++++------- 4 files changed, 38 insertions(+), 17 deletions(-) diff --git a/modules/openapi-generator/src/main/resources/php/api.mustache b/modules/openapi-generator/src/main/resources/php/api.mustache index c0e393caef7e..ac11c607ebee 100644 --- a/modules/openapi-generator/src/main/resources/php/api.mustache +++ b/modules/openapi-generator/src/main/resources/php/api.mustache @@ -780,16 +780,17 @@ use {{invokerPackage}}\ObjectSerializer; {{/servers.0}} $query = ObjectSerializer::buildQuery($queryParams); {{#vendorExtensions.x-php-has-querystring-param}} - $uri = $operationHost . $resourcePath . ($query ? "?{$query}" : ''); + // $__-prefixed so a spec parameter named e.g. `uri` cannot shadow it + $__requestUri = $operationHost . $resourcePath . ($query ? "?{$query}" : ''); {{#allParams}} {{#isQueryStringParam}} // OpenAPI 3.2 `in: querystring`: the value IS the query component, appended verbatim {{#required}} - $uri .= (str_contains($uri, '?') ? '&' : '?') . ${{paramName}}; + $__requestUri .= (str_contains($__requestUri, '?') ? '&' : '?') . ${{paramName}}; {{/required}} {{^required}} if (${{paramName}} !== null) { - $uri .= (str_contains($uri, '?') ? '&' : '?') . ${{paramName}}; + $__requestUri .= (str_contains($__requestUri, '?') ? '&' : '?') . ${{paramName}}; } {{/required}} {{/isQueryStringParam}} @@ -801,7 +802,7 @@ use {{invokerPackage}}\ObjectSerializer; // RequestInterface::getMethod(), so keep the verbatim token in a subclass. return new class( '{{{vendorExtensions.x-php-http-method-literal}}}', - {{#vendorExtensions.x-php-has-querystring-param}}$uri{{/vendorExtensions.x-php-has-querystring-param}}{{^vendorExtensions.x-php-has-querystring-param}}$operationHost . $resourcePath . ($query ? "?{$query}" : ''){{/vendorExtensions.x-php-has-querystring-param}}, + {{#vendorExtensions.x-php-has-querystring-param}}$__requestUri{{/vendorExtensions.x-php-has-querystring-param}}{{^vendorExtensions.x-php-has-querystring-param}}$operationHost . $resourcePath . ($query ? "?{$query}" : ''){{/vendorExtensions.x-php-has-querystring-param}}, $headers, $httpBody ) extends Request { @@ -829,7 +830,7 @@ use {{invokerPackage}}\ObjectSerializer; {{^vendorExtensions.x-php-verbatim-method}} return new Request( '{{httpMethod}}', - {{#vendorExtensions.x-php-has-querystring-param}}$uri{{/vendorExtensions.x-php-has-querystring-param}}{{^vendorExtensions.x-php-has-querystring-param}}$operationHost . $resourcePath . ($query ? "?{$query}" : ''){{/vendorExtensions.x-php-has-querystring-param}}, + {{#vendorExtensions.x-php-has-querystring-param}}$__requestUri{{/vendorExtensions.x-php-has-querystring-param}}{{^vendorExtensions.x-php-has-querystring-param}}$operationHost . $resourcePath . ($query ? "?{$query}" : ''){{/vendorExtensions.x-php-has-querystring-param}}, $headers, $httpBody ); diff --git a/modules/openapi-generator/src/main/resources/php/composer.mustache b/modules/openapi-generator/src/main/resources/php/composer.mustache index 3137dc473dd2..e2e2f811c11c 100644 --- a/modules/openapi-generator/src/main/resources/php/composer.mustache +++ b/modules/openapi-generator/src/main/resources/php/composer.mustache @@ -29,7 +29,7 @@ "ext-json": "*", "ext-mbstring": "*", "guzzlehttp/guzzle": "^7.3", - "guzzlehttp/psr7": "^1.7 || ^2.0" + "guzzlehttp/psr7": "^2.10" }, "require-dev": { "phpunit/phpunit": "^8.0 || ^9.0", diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/php/PhpClientCodegenTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/php/PhpClientCodegenTest.java index b2e9b2595d5d..c57f1b1819ab 100644 --- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/php/PhpClientCodegenTest.java +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/php/PhpClientCodegenTest.java @@ -220,11 +220,22 @@ public void testGuzzleOpenApi32OperationsAndQueryStringParam() throws IOExceptio } Assert.assertTrue(generated.contains("new class("), "verbatim Request subclass expected"); Assert.assertTrue(generated.contains("'GET'"), "standard method kept on plain Request"); - // `in: querystring` appends verbatim with ?/& handling, not via query params - Assert.assertTrue(generated.contains("(str_contains($uri, '?') ? '&' : '?') . $qs"), + // `in: querystring` appends verbatim with ?/& handling, not via query params; + // the accumulator is $__-prefixed so a parameter named `uri` cannot shadow it + Assert.assertTrue(generated.contains("(str_contains($__requestUri, '?') ? '&' : '?') . $qs"), "querystring param should be appended verbatim"); + Assert.assertTrue(generated.contains(". $uri;"), + "a querystring parameter literally named `uri` must still reach the wire"); Assert.assertFalse(generated.contains("toQueryValue(\n $qs"), "querystring param must not be serialized as a name=value pair"); + // QUERY may carry a body; REPORT/PROPPATCH need one on some stacks + Assert.assertTrue(generated.contains("'REPORT'"), "REPORT should emit a verbatim literal"); + Path composerPath = target.resolve("composer.json"); + String composer = new String(Files.readAllBytes(composerPath), StandardCharsets.UTF_8); + // psr7 < 2.10 Utils::modifyRequest() rebuilds a plain Request and + // drops the verbatim subclass - pin the floor high enough + Assert.assertTrue(composer.contains("\"guzzlehttp/psr7\": \"^2.10\""), + "psr7 constraint must exclude versions that rebuild plain Requests"); } finally { FileUtils.deleteDirectory(target.toFile()); } diff --git a/modules/openapi-generator/src/test/resources/3_2/php-guzzle-capture/capture.php b/modules/openapi-generator/src/test/resources/3_2/php-guzzle-capture/capture.php index ec71b59cfc64..c3ae52cb1046 100644 --- a/modules/openapi-generator/src/test/resources/3_2/php-guzzle-capture/capture.php +++ b/modules/openapi-generator/src/test/resources/3_2/php-guzzle-capture/capture.php @@ -38,7 +38,7 @@ $body .= $chunk; } $lines = explode("\r\n", $head); - fwrite(STDOUT, "LINE " . $lines[0] . "\n"); fflush(STDOUT); + fwrite(STDOUT, "LINE " . $lines[0] . " [CL=$len]" . ($body !== '' ? " BODY=$body" : '') . "\n"); fflush(STDOUT); fwrite($conn, "HTTP/1.1 204 No Content\r\nContent-Length: 0\r\nConnection: close\r\n\r\n"); fclose($conn); } @@ -60,26 +60,35 @@ $config = (new OpenAPI\Client\Configuration())->setHost("http://127.0.0.1:$port"); $api = new OpenAPI\Client\Api\DefaultApi(new GuzzleHttp\Client(), $config); -// `in: querystring` callers pass the query component without the leading `?` +// `in: querystring` callers pass the query component without the leading `?`; +// embedded `//` must reach the wire intact. $calls = [ - function () use ($api) { $api->queryPets('a=1&b=%20x'); }, + function () use ($api) { $api->queryPets('a=1&u=http://h//p'); }, function () use ($api) { $api->customPets(); }, function () use ($api) { $api->checkFetchPets(); }, function () use ($api) { $api->purgePets(); }, function () use ($api) { $api->hashPets(); }, function () use ($api) { $api->listPets(); }, + // QUERY carrying a request body; its querystring param is named `uri`, + // which collides with the template-internal request-uri variable + function () use ($api) { $api->searchItems('k=v', ['a' => 1]); }, + function () use ($api) { $api->reportItems('r=1'); }, + function () use ($api) { $api->propPatch(''); }, ]; foreach ($calls as $call) { try { $call(); } catch (\Throwable $e) { fwrite(STDERR, "call failed: {$e->getMessage()}\n"); } } $expected = [ - 'QUERY /pets?a=1&b=%20x HTTP/1.1', - 'customMethod /pets HTTP/1.1', - 'CHECK&FETCH /pets HTTP/1.1', - 'PURGE /pets HTTP/1.1', - 'X#Y /pets HTTP/1.1', - 'GET /pets HTTP/1.1', + 'QUERY /pets?a=1&u=http://h//p HTTP/1.1 [CL=0]', + 'customMethod /pets HTTP/1.1 [CL=0]', + 'CHECK&FETCH /pets HTTP/1.1 [CL=0]', + 'PURGE /pets HTTP/1.1 [CL=0]', + 'X#Y /pets HTTP/1.1 [CL=0]', + 'GET /pets HTTP/1.1 [CL=0]', + 'QUERY /items?k=v HTTP/1.1 [CL=7] BODY={"a":1}', + 'REPORT /report?r=1 HTTP/1.1 [CL=0]', + 'PROPPATCH /report HTTP/1.1 [CL=4] BODY=', ]; $got = []; $deadline = microtime(true) + 30; From e49e09ea48fde7ccd93f39d090e9e4925a8a25c9 Mon Sep 17 00:00:00 2001 From: khayashi4337 Date: Wed, 23 Sep 2026 08:09:38 +0900 Subject: [PATCH 15/31] fix(csharp): scan webhooks for operation-input models, skip normalized case-variants - getOperationInputModels dropped its redundant additionalOperations traversal (PathItem.readOperations() already includes them) and now also traverses openAPI.getWebhooks(), so models referenced only by top-level webhooks get public ctors instead of internal - verified on real SDKs: net8 has no HttpMethod.Query and sends 'qUeRy' verbatim, net10 exposes HttpMethod.Query and normalizes 'qUeRy' to QUERY on the wire. Since generichost multi-targets, case-variants of normalized methods now warn+skip; uppercase QUERY stays verbatim via the literal path on both TFMs - wire capture extended to read request bodies and cover body-bearing QUERY/REPORT/PROPPATCH and the verbatim querystring-with-body case Generated with [Devin](https://devin.ai) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com> --- .../languages/AbstractCSharpCodegen.java | 21 ++++-- .../languages/CSharpClientCodegen.java | 24 ++++-- .../csharp/libraries/generichost/api.mustache | 5 +- .../CSharpClientCodegenTest.java | 74 ++++++++++++++++++- .../3_2/csharp-generichost-capture/Program.cs | 43 ++++++++--- .../resources/3_2/go-webhook-operations.yaml | 23 ++++++ 6 files changed, 159 insertions(+), 31 deletions(-) diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractCSharpCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractCSharpCodegen.java index 8b4a55220184..3eb6626609b3 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractCSharpCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractCSharpCodegen.java @@ -730,18 +730,23 @@ public Map postProcessAllModels(Map objs) private Set getOperationInputModels() { Set operationInputModels = new HashSet<>(); Set visitedModels = new HashSet<>(); - if (openAPI == null || openAPI.getPaths() == null) { + if (openAPI == null) { return operationInputModels; } - for (PathItem pathItem : openAPI.getPaths().values()) { + List pathItems = new ArrayList<>(); + if (openAPI.getPaths() != null) { + pathItems.addAll(openAPI.getPaths().values()); + } + // OpenAPI 3.2: top-level webhooks are PathItems and may reference models + if (openAPI.getWebhooks() != null) { + pathItems.addAll(openAPI.getWebhooks().values()); + } + + for (PathItem pathItem : pathItems) { collectOperationInputModels(pathItem.getParameters(), operationInputModels, visitedModels); - // readOperations() covers `query` but not OpenAPI 3.2 additionalOperations - java.util.List operations = new java.util.ArrayList<>(pathItem.readOperations()); - if (pathItem.getAdditionalOperations() != null) { - operations.addAll(pathItem.getAdditionalOperations().values()); - } - for (Operation operation : operations) { + // readOperations() covers `query` and OpenAPI 3.2 additionalOperations + for (Operation operation : pathItem.readOperations()) { collectOperationInputModels(operation.getParameters(), operationInputModels, visitedModels); RequestBody requestBody = ModelUtils.getReferencedRequestBody(openAPI, operation.getRequestBody()); if (requestBody != null) { diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/CSharpClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/CSharpClientCodegen.java index 68e210dfcc04..3a692b449a27 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/CSharpClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/CSharpClientCodegen.java @@ -1844,6 +1844,15 @@ protected boolean supportsQueryStringParameters() { private static final Set STANDARD_HTTP_METHODS = new HashSet<>(Arrays.asList( "GET", "PUT", "POST", "DELETE", "OPTIONS", "HEAD", "PATCH", "TRACE", "CONNECT")); + // Methods .NET normalizes to canonical casing on the wire (verified on net8/net10): + // case-variants like "get" or "qUeRy" cannot be sent verbatim. QUERY is not a + // "standard" template method (HttpMethod.Query only exists on net10+) but the + // same wire normalization applies to its case-variants there. + private static final Set WIRE_NORMALIZED_METHODS = new HashSet<>(STANDARD_HTTP_METHODS); + static { + WIRE_NORMALIZED_METHODS.add("QUERY"); + } + // RFC 9110 tchar: method tokens HttpMethod(string) accepts without FormatException private static final java.util.regex.Pattern HTTP_METHOD_TOKEN_PATTERN = java.util.regex.Pattern.compile("[!#$%&'*+\\-.^_`|~0-9A-Za-z]+"); @@ -1852,10 +1861,9 @@ protected boolean supportsQueryStringParameters() { * Marks OpenAPI 3.2 (query/additionalOperations) HTTP methods for verbatim emission via * {@code x-csharp-http-method-literal}. Two categories are warned about and skipped: * tokens that are not valid RFC 9110 tokens ({@code HttpMethod(string)} would throw - * {@code FormatException}), and tokens that case-insensitively match a standard method - * (e.g. {@code get}) because .NET's {@code HttpMethod.Normalize()} would silently fold - * them onto the standard method on the wire - unlike Rust/Ruby, verbatim casing cannot - * be preserved for those. + * {@code FormatException}), and tokens that case-insensitively match a normalized + * method (e.g. {@code get} or {@code qUeRy}) because HttpClient folds them onto the + * canonical method on the wire - verbatim casing cannot be preserved for those. */ private void flagVerbatimHttpMethods(List operationList) { Iterator it = operationList.iterator(); @@ -1865,11 +1873,11 @@ private void flagVerbatimHttpMethods(List operationList) { continue; } if (!HTTP_METHOD_TOKEN_PATTERN.matcher(op.httpMethod).matches() - || STANDARD_HTTP_METHODS.stream() - .anyMatch(m -> m.equalsIgnoreCase(op.httpMethod))) { + || WIRE_NORMALIZED_METHODS.stream() + .anyMatch(m -> !m.equals(op.httpMethod) && m.equalsIgnoreCase(op.httpMethod))) { LOGGER.warn("Skipping operation {}: HTTP method name '{}' is not a valid " - + "RFC 9110 token, or case-insensitively matches a standard method " - + "which .NET HttpMethod.Normalize() would collapse on the wire.", + + "RFC 9110 token, or case-insensitively matches a method which " + + ".NET normalizes on the wire (verbatim casing impossible).", op.operationId, op.httpMethod); it.remove(); continue; diff --git a/modules/openapi-generator/src/main/resources/csharp/libraries/generichost/api.mustache b/modules/openapi-generator/src/main/resources/csharp/libraries/generichost/api.mustache index 01ab4f7fdcb2..0224efa02b41 100644 --- a/modules/openapi-generator/src/main/resources/csharp/libraries/generichost/api.mustache +++ b/modules/openapi-generator/src/main/resources/csharp/libraries/generichost/api.mustache @@ -724,8 +724,9 @@ namespace {{packageName}}.{{apiPackage}} {{/produces}} {{#vendorExtensions.x-csharp-http-method-literal}} - // OpenAPI 3.2: HttpMethod has no property for this verb and would - // normalize casing, so emit the RFC 9110 token verbatim + // OpenAPI 3.2: emit the RFC 9110 token verbatim. HttpMethod.Query + // only exists on net10+ and HttpClient normalizes case-variants, + // so a literal keeps identical wire behavior across TFMs httpRequestMessageLocalVar.Method = new HttpMethod("{{{vendorExtensions.x-csharp-http-method-literal}}}"); {{/vendorExtensions.x-csharp-http-method-literal}} {{^vendorExtensions.x-csharp-http-method-literal}} diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/csharpnetcore/CSharpClientCodegenTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/csharpnetcore/CSharpClientCodegenTest.java index 4662dedff0e6..221d9c33e054 100644 --- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/csharpnetcore/CSharpClientCodegenTest.java +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/csharpnetcore/CSharpClientCodegenTest.java @@ -656,8 +656,9 @@ public void testGenerichostOpenApi32OperationsAndQueryStringParam() throws IOExc Path apiPath = target.resolve("src/Org.OpenAPITools/Api/DefaultApi.cs"); TestUtils.assertFileExists(apiPath); String generated = new String(Files.readAllBytes(apiPath), StandardCharsets.UTF_8); - // non-standard methods are emitted verbatim; there is no HttpMethod.QUERY - for (String method : new String[]{"QUERY", "PURGE", "customMethod", "CHECK&FETCH", "X#Y"}) { + // non-standard methods are emitted verbatim; HttpMethod.Query only + // exists on net10+, so QUERY also goes through the literal path + for (String method : new String[]{"QUERY", "PURGE", "customMethod", "CHECK&FETCH", "X#Y", "REPORT", "PROPPATCH"}) { Assert.assertTrue(generated.contains("new HttpMethod(\"" + method + "\")"), "expected verbatim HttpMethod literal for " + method); } @@ -669,6 +670,12 @@ public void testGenerichostOpenApi32OperationsAndQueryStringParam() throws IOExc "querystring param should be appended verbatim"); Assert.assertFalse(generated.contains("parseQueryStringLocalVar[\"qs\"]"), "querystring param must not be serialized as a name=value pair"); + // QUERY may carry a body; a querystring param named `uri` must not + // collide with UriBuilder + Assert.assertTrue(generated.contains("SearchItemsAsync(string uri, Dictionary requestBody"), + "QUERY-with-body operation should take uri + body parameters"); + Assert.assertTrue(generated.contains("? localVariableQuery :"), + "a querystring param named `localVariableQuery` must reach the wire verbatim"); } finally { FileUtils.deleteDirectory(target.toFile()); } @@ -736,6 +743,69 @@ public void testGenerichostSkipsInvalidOrNormalizingMethodToken() throws IOExcep } } + @Test + public void testGenerichostSkipsCaseVariantOfNormalizedMethod() throws IOException { + Path target = Files.createTempDirectory("test"); + try { + // .NET 10 knows HttpMethod.Query, so HttpClient folds "qUeRy" onto + // QUERY on the wire (verified on net8 vs net10: net8 sends it + // verbatim). Since the generated library is multi-target, the only + // uniform-honest behavior is warn+skip. The spec validator rejects + // the key as a duplicate fixed method, so validation is bypassed. + String spec = "openapi: 3.2.0\n" + + "info: {title: t, version: '1'}\n" + + "paths:\n" + + " /pets:\n" + + " additionalOperations:\n" + + " \"qUeRy\":\n" + + " operationId: caseQueryPets\n" + + " responses: {'204': {description: done}}\n"; + Path specFile = target.resolve("spec.yaml"); + Files.writeString(specFile, spec); + final CodegenConfigurator configurator = new CodegenConfigurator() + .setGeneratorName("csharp") + .setLibrary("generichost") + .setInputSpec(specFile.toString()) + .setValidateSpec(false) + .setSkipOverwrite(false) + .setOutputDir(target.resolve("out").toAbsolutePath().toString().replace("\\", "/")); + new DefaultGenerator().opts(configurator.toClientOptInput()).generate(); + Path apiPath = target.resolve("out/src/Org.OpenAPITools/Api/DefaultApi.cs"); + TestUtils.assertFileExists(apiPath); + String generated = new String(Files.readAllBytes(apiPath), StandardCharsets.UTF_8); + Assert.assertFalse(generated.contains("CaseQueryPets"), + "case-variant of a normalized method must be skipped"); + } finally { + FileUtils.deleteDirectory(target.toFile()); + } + } + + @Test + public void testGenerichostWebhookModelGetsPublicCtor() throws IOException { + Path target = Files.createTempDirectory("test"); + try { + // the Pet schema is referenced only by a webhook operation; models + // reachable only via openAPI.getWebhooks() must still be marked as + // operation inputs or their ctor stays `internal` + final CodegenConfigurator configurator = new CodegenConfigurator() + .setGeneratorName("csharp") + .setLibrary("generichost") + .setInputSpec("src/test/resources/3_2/go-webhook-operations.yaml") + .setSkipOverwrite(false) + .setOutputDir(target.toAbsolutePath().toString().replace("\\", "/")); + new DefaultGenerator().opts(configurator.toClientOptInput()).generate(); + Path modelPath = target.resolve("src/Org.OpenAPITools/Model/Pet.cs"); + TestUtils.assertFileExists(modelPath); + String model = new String(Files.readAllBytes(modelPath), StandardCharsets.UTF_8); + Assert.assertTrue(model.contains("public Pet("), + "webhook-referenced model must get a public ctor"); + Assert.assertFalse(model.contains("internal Pet("), + "webhook-referenced model must not keep an internal ctor"); + } finally { + FileUtils.deleteDirectory(target.toFile()); + } + } + /** * End-to-end check: builds the generated generichost client and runs a raw * TcpListener capture, verifying query/additionalOperations methods and diff --git a/modules/openapi-generator/src/test/resources/3_2/csharp-generichost-capture/Program.cs b/modules/openapi-generator/src/test/resources/3_2/csharp-generichost-capture/Program.cs index bb7a01ae3803..eefa90155036 100644 --- a/modules/openapi-generator/src/test/resources/3_2/csharp-generichost-capture/Program.cs +++ b/modules/openapi-generator/src/test/resources/3_2/csharp-generichost-capture/Program.cs @@ -33,9 +33,18 @@ using var stream = conn.GetStream(); using var reader = new StreamReader(stream, Encoding.ASCII, false, 1024, true); var requestLine = await reader.ReadLineAsync(cts.Token); - if (requestLine != null) lines.Enqueue(requestLine); - // consume headers (no body in this fixture) - while (await reader.ReadLineAsync(cts.Token) is { } h && h.Length > 0) { } + var cl = 0; + while (await reader.ReadLineAsync(cts.Token) is { } h && h.Length > 0) + { + if (h.StartsWith("Content-Length:", StringComparison.OrdinalIgnoreCase)) + cl = int.Parse(h.Substring(15).Trim()); + } + var bodyBuf = new char[cl]; + var read = 0; + while (read < cl) read += await reader.ReadBlockAsync(bodyBuf.AsMemory(read), cts.Token); + var body = new string(bodyBuf); + if (requestLine != null) + lines.Enqueue($"{requestLine} [CL={cl}]" + (body.Length > 0 ? $" BODY={body}" : "")); var resp = Encoding.ASCII.GetBytes("HTTP/1.1 204 No Content\r\nContent-Length: 0\r\nConnection: close\r\n\r\n"); await stream.WriteAsync(resp, cts.Token); } @@ -56,22 +65,34 @@ new JsonSerializerOptionsProvider(new JsonSerializerOptions()), new DefaultApiEvents()); -// `in: querystring` callers pass the query component without the leading `?` -await api.QueryPetsAsync("a=1&b=%20x", cts.Token); +// `in: querystring` callers pass the query component without the leading `?`; +// embedded `//` must reach the wire intact. +await api.QueryPetsAsync("a=1&u=http://h//p", cts.Token); await api.CustomPetsAsync(cts.Token); await api.CheckFetchPetsAsync(cts.Token); await api.PurgePetsAsync(cts.Token); await api.HashPetsAsync(cts.Token); await api.ListPetsAsync(cts.Token); +// GET with an `in: querystring` parameter +await api.FindPetsAsync("z=9", cts.Token); +// QUERY carrying a request body; its querystring param is named `uri` +await api.SearchItemsAsync("k=v", new Dictionary { ["a"] = 1 }, cts.Token); +// additionalOperations: REPORT with querystring, PROPPATCH with a body +await api.ReportItemsAsync("r=1", cts.Token); +await api.PropPatchAsync("", cts.Token); var expected = new[] { - "QUERY /pets?a=1&b=%20x HTTP/1.1", - "customMethod /pets HTTP/1.1", - "CHECK&FETCH /pets HTTP/1.1", - "PURGE /pets HTTP/1.1", - "X#Y /pets HTTP/1.1", - "GET /pets HTTP/1.1" + "QUERY /pets?a=1&u=http://h//p HTTP/1.1 [CL=0]", + "customMethod /pets HTTP/1.1 [CL=0]", + "CHECK&FETCH /pets HTTP/1.1 [CL=0]", + "PURGE /pets HTTP/1.1 [CL=0]", + "X#Y /pets HTTP/1.1 [CL=0]", + "GET /pets HTTP/1.1 [CL=0]", + "GET /find?z=9 HTTP/1.1 [CL=0]", + "QUERY /items?k=v HTTP/1.1 [CL=7] BODY={\"a\":1}", + "REPORT /report?r=1 HTTP/1.1 [CL=0]", + "PROPPATCH /report HTTP/1.1 [CL=16] BODY=\"\\u003Cx/\\u003E\"" }; cts.Cancel(); try { await server; } catch (OperationCanceledException) { } diff --git a/modules/openapi-generator/src/test/resources/3_2/go-webhook-operations.yaml b/modules/openapi-generator/src/test/resources/3_2/go-webhook-operations.yaml index 2f7747abbcda..a6d8d664ef4d 100644 --- a/modules/openapi-generator/src/test/resources/3_2/go-webhook-operations.yaml +++ b/modules/openapi-generator/src/test/resources/3_2/go-webhook-operations.yaml @@ -24,3 +24,26 @@ webhooks: responses: '204': description: done + # webhook referencing a component model: generators that only scan + # openAPI.getPaths() for operation input models would miss this + petUpdated: + post: + operationId: onPetUpdated + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/Pet' + responses: + '200': + description: ok +components: + schemas: + Pet: + type: object + properties: + id: + type: integer + name: + type: string From 6b8267443f4c0acc4b1c4996526361a731a78b76 Mon Sep 17 00:00:00 2001 From: khayashi4337 Date: Wed, 23 Sep 2026 08:40:33 +0900 Subject: [PATCH 16/31] fix(kotlin): rename params colliding with template locals, body set for 3.2 verbs - toParamName now renames params named localVariableBody/ localVariableQuery/localVariableHeaders to param* (same pattern as the existing callback -> paramCallback escape), fixing compile-breaking collisions in generated api functions across all kotlin libraries - jvm-okhttp deepObject serialization now prefixes wire keys with the spec baseName (via x-kotlin-param-base-name) instead of paramName, so the rename no longer leaks into query keys - body-required custom methods handled as OkHttp 5's requiresRequestBody set (QUERY/REPORT/PROPPATCH) instead of QUERY alone, so REPORT and PROPPATCH no longer throw 'must have a request body' - fixture gains a /collide op with the three colliding query-param names plus a kotlin-only deepObject collision spec (shared fixture stays scalar-only: rust reqwest cannot serialize deepObject params) - wire capture extended to read bodies and cover REPORT/PROPPATCH, a body-bearing QUERY, and the collision op Generated with [Devin](https://devin.ai) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com> --- .../languages/AbstractKotlinCodegen.java | 7 ++++ .../libraries/jvm-okhttp/api.mustache | 6 ++-- .../infrastructure/ApiClient.kt.mustache | 13 +++++-- .../kotlin/KotlinClientCodegenApiTest.java | 36 +++++++++++++++++-- .../3_2/kotlin-deep-object-collision.yaml | 25 +++++++++++++ .../3_2/kotlin-okhttp-capture/Capture.kt | 25 +++++++++++-- .../test/resources/3_2/query-operation.yaml | 25 +++++++++++++ 7 files changed, 126 insertions(+), 11 deletions(-) create mode 100644 modules/openapi-generator/src/test/resources/3_2/kotlin-deep-object-collision.yaml 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 2deee2a275ee..c66b04c06513 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 @@ -1125,6 +1125,13 @@ public String toParamName(String name) { return "paramCallback"; } + // to avoid conflicts with the template-internal locals generated api + // functions declare (localVariableBody/localVariableQuery/localVariableHeaders) + if ("localVariableBody".equals(name) || "localVariableQuery".equals(name) + || "localVariableHeaders".equals(name)) { + return camelize("param_" + name, LOWERCASE_FIRST_LETTER); + } + // should be the same as variable name return toVariableName(name); } 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 22be7a92ce50..2937b18e940a 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 @@ -215,7 +215,7 @@ import {{packageName}}.infrastructure.Serializer {{#isModel}} {{#vars}} if ({{{paramName}}}.{{name}} != null) { - put("{{#isDeepObject}}{{{paramName}}}[{{/isDeepObject}}{{#lambda.escapeDollar}}{{baseName}}{{/lambda.escapeDollar}}{{#isDeepObject}}]{{/isDeepObject}}", {{#isContainer}}toMultiValue({{{paramName}}}.{{name}}.toList(), "{{collectionFormat}}"){{/isContainer}}{{^isContainer}}listOf({{#isDateTime}}parseDateToQueryString<{{{dataType}}}>({{{paramName}}}.{{name}}){{/isDateTime}}{{#isDate}}parseDateToQueryString<{{{dataType}}}>({{{paramName}}}.{{name}}){{/isDate}}{{#isEnum}}{{#isString}}{{{paramName}}}.{{name}}.value{{/isString}}{{^isString}}{{{paramName}}}.{{name}}.toString(){{/isString}}{{/isEnum}}{{^isEnum}}{{^isDateTime}}{{^isDate}}{{{paramName}}}.{{name}}.toString(){{/isDate}}{{/isDateTime}}{{/isEnum}}){{/isContainer}}) + put("{{#isDeepObject}}{{#lambda.escapeDollar}}{{vendorExtensions.x-kotlin-param-base-name}}{{/lambda.escapeDollar}}[{{/isDeepObject}}{{#lambda.escapeDollar}}{{baseName}}{{/lambda.escapeDollar}}{{#isDeepObject}}]{{/isDeepObject}}", {{#isContainer}}toMultiValue({{{paramName}}}.{{name}}.toList(), "{{collectionFormat}}"){{/isContainer}}{{^isContainer}}listOf({{#isDateTime}}parseDateToQueryString<{{{dataType}}}>({{{paramName}}}.{{name}}){{/isDateTime}}{{#isDate}}parseDateToQueryString<{{{dataType}}}>({{{paramName}}}.{{name}}){{/isDate}}{{#isEnum}}{{#isString}}{{{paramName}}}.{{name}}.value{{/isString}}{{^isString}}{{{paramName}}}.{{name}}.toString(){{/isString}}{{/isEnum}}{{^isEnum}}{{^isDateTime}}{{^isDate}}{{{paramName}}}.{{name}}.toString(){{/isDate}}{{/isDateTime}}{{/isEnum}}){{/isContainer}}) } {{/vars}} {{/isModel}} @@ -230,7 +230,7 @@ import {{packageName}}.infrastructure.Serializer {{#isModel}} {{#vars}} if ({{{paramName}}}.{{name}} != null) { - put("{{#isDeepObject}}{{{paramName}}}[{{/isDeepObject}}{{#lambda.escapeDollar}}{{baseName}}{{/lambda.escapeDollar}}{{#isDeepObject}}]{{/isDeepObject}}", {{#isContainer}}toMultiValue({{{paramName}}}.{{name}}.toList(), "{{collectionFormat}}"){{/isContainer}}{{^isContainer}}listOf({{#isDateTime}}parseDateToQueryString<{{{dataType}}}>({{{paramName}}}.{{name}}){{/isDateTime}}{{#isDate}}parseDateToQueryString<{{{dataType}}}>({{{paramName}}}.{{name}}){{/isDate}}{{#isEnum}}{{#isString}}{{{paramName}}}.{{name}}.value{{/isString}}{{^isString}}{{{paramName}}}.{{name}}.toString(){{/isString}}{{/isEnum}}{{^isEnum}}{{^isDateTime}}{{^isDate}}{{{paramName}}}.{{name}}.toString(){{/isDate}}{{/isDateTime}}{{/isEnum}}){{/isContainer}}) + put("{{#isDeepObject}}{{#lambda.escapeDollar}}{{vendorExtensions.x-kotlin-param-base-name}}{{/lambda.escapeDollar}}[{{/isDeepObject}}{{#lambda.escapeDollar}}{{baseName}}{{/lambda.escapeDollar}}{{#isDeepObject}}]{{/isDeepObject}}", {{#isContainer}}toMultiValue({{{paramName}}}.{{name}}.toList(), "{{collectionFormat}}"){{/isContainer}}{{^isContainer}}listOf({{#isDateTime}}parseDateToQueryString<{{{dataType}}}>({{{paramName}}}.{{name}}){{/isDateTime}}{{#isDate}}parseDateToQueryString<{{{dataType}}}>({{{paramName}}}.{{name}}){{/isDate}}{{#isEnum}}{{#isString}}{{{paramName}}}.{{name}}.value{{/isString}}{{^isString}}{{{paramName}}}.{{name}}.toString(){{/isString}}{{/isEnum}}{{^isEnum}}{{^isDateTime}}{{^isDate}}{{{paramName}}}.{{name}}.toString(){{/isDate}}{{/isDateTime}}{{/isEnum}}){{/isContainer}}) } {{/vars}} {{/isModel}} @@ -243,7 +243,7 @@ import {{packageName}}.infrastructure.Serializer {{#isModel}} {{#vars}} if ({{{paramName}}}.{{name}} != null) { - put("{{#isDeepObject}}{{{paramName}}}[{{/isDeepObject}}{{#lambda.escapeDollar}}{{baseName}}{{/lambda.escapeDollar}}{{#isDeepObject}}]{{/isDeepObject}}", {{#isContainer}}toMultiValue({{{paramName}}}.{{name}}.toList(), "{{collectionFormat}}"){{/isContainer}}{{^isContainer}}listOf({{#isDateTime}}parseDateToQueryString<{{{dataType}}}>({{{paramName}}}.{{name}}){{/isDateTime}}{{#isDate}}parseDateToQueryString<{{{dataType}}}>({{{paramName}}}.{{name}}){{/isDate}}{{#isEnum}}{{#isString}}{{{paramName}}}.{{name}}.value{{/isString}}{{^isString}}{{{paramName}}}.{{name}}.toString(){{/isString}}{{/isEnum}}{{^isEnum}}{{^isDateTime}}{{^isDate}}{{{paramName}}}.{{name}}.toString(){{/isDate}}{{/isDateTime}}{{/isEnum}}){{/isContainer}}) + put("{{#isDeepObject}}{{#lambda.escapeDollar}}{{vendorExtensions.x-kotlin-param-base-name}}{{/lambda.escapeDollar}}[{{/isDeepObject}}{{#lambda.escapeDollar}}{{baseName}}{{/lambda.escapeDollar}}{{#isDeepObject}}]{{/isDeepObject}}", {{#isContainer}}toMultiValue({{{paramName}}}.{{name}}.toList(), "{{collectionFormat}}"){{/isContainer}}{{^isContainer}}listOf({{#isDateTime}}parseDateToQueryString<{{{dataType}}}>({{{paramName}}}.{{name}}){{/isDateTime}}{{#isDate}}parseDateToQueryString<{{{dataType}}}>({{{paramName}}}.{{name}}){{/isDate}}{{#isEnum}}{{#isString}}{{{paramName}}}.{{name}}.value{{/isString}}{{^isString}}{{{paramName}}}.{{name}}.toString(){{/isString}}{{/isEnum}}{{^isEnum}}{{^isDateTime}}{{^isDate}}{{{paramName}}}.{{name}}.toString(){{/isDate}}{{/isDateTime}}{{/isEnum}}){{/isContainer}}) } {{/vars}} {{/isModel}} diff --git a/modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm-okhttp/infrastructure/ApiClient.kt.mustache b/modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm-okhttp/infrastructure/ApiClient.kt.mustache index 6b89f2c6f729..6cf5be1aba6d 100644 --- a/modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm-okhttp/infrastructure/ApiClient.kt.mustache +++ b/modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm-okhttp/infrastructure/ApiClient.kt.mustache @@ -84,6 +84,13 @@ import com.squareup.moshi.adapter ) protected const val Authorization: String = AUTHORIZATION + {{#x-kotlin-verbatim-methods}} + // OpenAPI 3.2: OkHttp 5 rejects a null body for these methods + // (its requiresRequestBody set), so they always carry a possibly-empty body + @PublishedApi + internal val REQUIRES_REQUEST_BODY_METHODS = setOf("QUERY", "REPORT", "PROPPATCH") + + {{/x-kotlin-verbatim-methods}} protected const val JSON_MEDIA_TYPE: String = "application/json" @Deprecated( message = "Please use the capitalized constant `JSON_MEDIA_TYPE` instead.", @@ -549,9 +556,9 @@ import com.squareup.moshi.adapter builder } else { // OpenAPI 3.2 query/additionalOperations: Request.Builder.method() sends the - // token verbatim. OkHttp >= 5 rejects a body-less QUERY, so QUERY always - // carries a (possibly empty) body. - val customBody = if (requestConfig.body != null || requestConfig.customMethod == "QUERY") { + // token verbatim. OkHttp >= 5 rejects a body-less QUERY/REPORT/PROPPATCH, + // so methods in its requiresRequestBody set always carry a (possibly empty) body. + val customBody = if (requestConfig.body != null || requestConfig.customMethod in REQUIRES_REQUEST_BODY_METHODS) { requestBody(requestConfig.body, contentType) } else { null diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/kotlin/KotlinClientCodegenApiTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/kotlin/KotlinClientCodegenApiTest.java index 54602c5d2685..899133edf083 100644 --- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/kotlin/KotlinClientCodegenApiTest.java +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/kotlin/KotlinClientCodegenApiTest.java @@ -308,7 +308,7 @@ void testJvmOkhttp4OpenApi32OperationsAndQueryStringParam() throws IOException { String api = new String(Files.readAllBytes( target.resolve("src/main/kotlin/org/openapitools/client/apis/DefaultApi.kt")), StandardCharsets.UTF_8); // non-standard methods are emitted verbatim via customMethod; there is no RequestMethod.QUERY - for (String method : new String[]{"QUERY", "PURGE", "customMethod", "CHECK&FETCH", "X#Y", "A|B"}) { + for (String method : new String[]{"QUERY", "PURGE", "customMethod", "CHECK&FETCH", "X#Y", "A|B", "REPORT", "PROPPATCH"}) { Assert.assertTrue(api.contains("customMethod = \"" + method + "\""), "expected verbatim customMethod literal for " + method); } @@ -322,6 +322,13 @@ void testJvmOkhttp4OpenApi32OperationsAndQueryStringParam() throws IOException { "querystring param should be passed verbatim"); Assert.assertFalse(api.contains("put(\"qs\""), "querystring param must not be serialized as a name=value pair"); + // params named like template-internal locals are renamed, wire names stay + Assert.assertTrue(api.contains("fun collidePetsRequestConfig(paramLocalVariableQuery"), + "colliding param names must be renamed"); + Assert.assertTrue(api.contains("put(\"localVariableQuery\", listOf(paramLocalVariableQuery.toString()))"), + "renamed param must keep its wire name"); + Assert.assertTrue(api.contains("encodedQueryString = listOfNotNull(paramLocalVariableQuery).joinToString"), + "renamed querystring param must still be wired verbatim"); String requestConfig = new String(Files.readAllBytes( target.resolve("src/main/kotlin/org/openapitools/client/infrastructure/RequestConfig.kt")), StandardCharsets.UTF_8); @@ -336,6 +343,9 @@ void testJvmOkhttp4OpenApi32OperationsAndQueryStringParam() throws IOException { "ApiClient should dispatch verbatim methods"); Assert.assertTrue(apiClient.contains("encodedQuery("), "ApiClient should append the querystring verbatim"); + // OkHttp 5 rejects a null body for QUERY/REPORT/PROPPATCH, not just QUERY + Assert.assertTrue(apiClient.contains("requestConfig.customMethod in REQUIRES_REQUEST_BODY_METHODS"), + "body-required methods must be handled as a set, not just QUERY"); String docs = new String(Files.readAllBytes(target.resolve("docs/DefaultApi.md")), StandardCharsets.UTF_8); Assert.assertTrue(docs.contains("**A\\|B**"), "doc table should escape |"); @@ -344,6 +354,28 @@ void testJvmOkhttp4OpenApi32OperationsAndQueryStringParam() throws IOException { } } + @Test + void testJvmOkhttp4DeepObjectCollisionKeepsSpecWireName() throws IOException { + Path target = Files.createTempDirectory("kotlin32-deepobj"); + try { + generate("jvm-okhttp4", "src/test/resources/3_2/kotlin-deep-object-collision.yaml", target); + String api = new String(Files.readAllBytes( + target.resolve("src/main/kotlin/org/openapitools/client/apis/DefaultApi.kt")), StandardCharsets.UTF_8); + // the kotlin parameter is renamed to avoid the localVariableBody local, + // but the `name[prop]` wire prefix must stay the spec baseName + Assert.assertTrue(api.contains("paramLocalVariableBody:"), + "colliding param name must be renamed"); + Assert.assertTrue(api.contains("put(\"localVariableBody[foo]\""), + "deepObject wire prefix must use the spec baseName, not the renamed param"); + Assert.assertFalse(api.contains("put(\"paramLocalVariableBody[foo]\""), + "deepObject wire prefix must not leak the renamed param"); + Assert.assertFalse(api.contains("put(\"foo[foo]\""), + "deepObject wire prefix must not collapse to the property name"); + } finally { + deleteRecursively(target); + } + } + @Test void testNonOkhttpLibrariesSkipOpenApi32Operations() throws IOException { Path target = Files.createTempDirectory("kotlin32-skip"); @@ -352,7 +384,7 @@ void testNonOkhttpLibrariesSkipOpenApi32Operations() throws IOException { String api = new String(Files.readAllBytes( target.resolve("src/main/kotlin/org/openapitools/client/apis/DefaultApi.kt")), StandardCharsets.UTF_8); Assert.assertTrue(api.contains("listPets"), "GET operation should be kept"); - for (String op : new String[]{"queryPets", "purgePets", "customPets", "checkFetchPets", "hashPets", "pipePets", "dollarPets"}) { + for (String op : new String[]{"queryPets", "purgePets", "customPets", "checkFetchPets", "hashPets", "pipePets", "dollarPets", "reportItems", "propPatch", "searchItems"}) { Assert.assertFalse(api.contains(op + "RequestConfig"), "jvm-ktor must skip unsupported 3.2 operation " + op); } diff --git a/modules/openapi-generator/src/test/resources/3_2/kotlin-deep-object-collision.yaml b/modules/openapi-generator/src/test/resources/3_2/kotlin-deep-object-collision.yaml new file mode 100644 index 000000000000..8236aa5d44a9 --- /dev/null +++ b/modules/openapi-generator/src/test/resources/3_2/kotlin-deep-object-collision.yaml @@ -0,0 +1,25 @@ +openapi: 3.2.0 +info: + title: kotlin deepObject param-name collision test + version: '1.0' +paths: + /collide: + # a deepObject query param whose name collides with the kotlin + # template-internal local `localVariableBody`: the parameter is renamed, + # but the `name[prop]` wire prefix must stay the spec baseName + get: + operationId: collidePets + parameters: + - name: localVariableBody + in: query + required: true + style: deepObject + explode: true + schema: + type: object + properties: + foo: + type: string + responses: + '200': + description: ok diff --git a/modules/openapi-generator/src/test/resources/3_2/kotlin-okhttp-capture/Capture.kt b/modules/openapi-generator/src/test/resources/3_2/kotlin-okhttp-capture/Capture.kt index 1d9bdedd9d34..32d781132160 100644 --- a/modules/openapi-generator/src/test/resources/3_2/kotlin-okhttp-capture/Capture.kt +++ b/modules/openapi-generator/src/test/resources/3_2/kotlin-okhttp-capture/Capture.kt @@ -23,8 +23,11 @@ fun handle(s: Socket) { if (h.isEmpty()) break if (h.lowercase().startsWith("content-length:")) contentLength = h.substring(15).trim().toInt() } - repeat(contentLength) { reader.read() } - captured.add("$requestLine [Content-Length=$contentLength]") + val bodyChars = CharArray(contentLength) + var read = 0 + while (read < contentLength) read += reader.read(bodyChars, read, contentLength - read) + captured.add("$requestLine [Content-Length=$contentLength]" + + if (contentLength > 0) " BODY=${String(bodyChars)}" else "") val out = it.getOutputStream() out.write("HTTP/1.1 204 No Content\r\nContent-Length: 0\r\nConnection: close\r\n\r\n".toByteArray(Charsets.ISO_8859_1)) out.flush() @@ -60,6 +63,18 @@ fun main() { run("X#Y hashPets") { api.hashPetsWithHttpInfo() } run("A|B pipePets") { api.pipePetsWithHttpInfo() } run("A\$B dollarPets") { api.dollarPetsWithHttpInfo() } + // querystring param named `uri`; QUERY carries a JSON body + run("QUERY searchItems(uri, body)") { + api.searchItemsWithHttpInfo("k=v", mapOf("a" to 1)) + } + // REPORT must carry a body on OkHttp 5 even when the op has none; the + // querystring param is named `localVariableQuery` -> renamed param + run("REPORT reportItems(localVariableQuery)") { api.reportItemsWithHttpInfo("r=1") } + run("PROPPATCH propPatch(body)") { api.propPatchWithHttpInfo("") } + // params named like template-internal locals are renamed; wire names stay + run("GET collidePets(collision params)") { + api.collidePetsWithHttpInfo("a", "b", "c") + } val expected = listOf( "GET /pets HTTP/1.1 [Content-Length=0]", @@ -69,7 +84,11 @@ fun main() { "CHECK&FETCH /pets HTTP/1.1 [Content-Length=0]", "X#Y /pets HTTP/1.1 [Content-Length=0]", "A|B /pets HTTP/1.1 [Content-Length=0]", - "A\$B /pets HTTP/1.1 [Content-Length=0]" + "A\$B /pets HTTP/1.1 [Content-Length=0]", + "QUERY /items?k=v HTTP/1.1 [Content-Length=7] BODY={\"a\":1}", + "REPORT /report?r=1 HTTP/1.1 [Content-Length=0]", + "PROPPATCH /report HTTP/1.1 [Content-Length=6] BODY=\"\"", + "GET /collide?localVariableQuery=a&localVariableHeaders=b&localVariableBody=c HTTP/1.1 [Content-Length=0]" ) if (captured.toList() == expected) { println("CAPTURE-PASS") diff --git a/modules/openapi-generator/src/test/resources/3_2/query-operation.yaml b/modules/openapi-generator/src/test/resources/3_2/query-operation.yaml index 24ff299b7197..9ab187648905 100644 --- a/modules/openapi-generator/src/test/resources/3_2/query-operation.yaml +++ b/modules/openapi-generator/src/test/resources/3_2/query-operation.yaml @@ -124,3 +124,28 @@ paths: responses: '207': description: multi + /collide: + # query params whose names collide with kotlin template-internal locals + # (localVariableBody/localVariableQuery/localVariableHeaders); the kotlin + # generator renames the parameters, the wire names stay unchanged + get: + operationId: collidePets + parameters: + - name: localVariableQuery + in: query + required: true + schema: + type: string + - name: localVariableHeaders + in: query + required: true + schema: + type: string + - name: localVariableBody + in: query + required: true + schema: + type: string + responses: + '200': + description: ok From 9f2676e95c542501a96c3118651a7e41ad7d66ea Mon Sep 17 00:00:00 2001 From: khayashi4337 Date: Wed, 23 Sep 2026 12:51:49 +0900 Subject: [PATCH 17/31] fix(php): rename spec params that collide with generated function locals A spec parameter named e.g. `query`, `headers`, `multipart`, `operationHost`, `hostIndex`, `returnType` or `options` landed in the same scope as the internal locals the generated api functions declare, silently dropping the caller's value (or producing duplicate declarations / array-to-string errors). Renaming only the `$uri` accumulator was a symptom-level patch. toParamName now compares the normalized parameter name against the full set of function-scope internal names in php/api.mustache (signature internals, xxxRequest locals, sync/async wrapper locals, $__requestUri, and the illegal `$this`) and prefixes colliding parameters with `param_`, keeping the wire baseName unchanged. Verified with a raw-TCP wire capture for required and optional/null `query`, `headers`, `multipart`, `uri` querystring params and a `headers` body param: the caller's value reaches the wire in every case. --- .../codegen/languages/PhpClientCodegen.java | 37 ++++++++++ .../codegen/php/PhpClientCodegenTest.java | 15 ++++ .../3_2/php-guzzle-capture/capture.php | 19 +++++ .../test/resources/3_2/query-operation.yaml | 73 +++++++++++++++++++ 4 files changed, 144 insertions(+) diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PhpClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PhpClientCodegen.java index 780517d6f312..b370c5aeb0ea 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PhpClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PhpClientCodegen.java @@ -168,6 +168,43 @@ protected boolean supportsQueryStringParameters() { private static final Set STANDARD_HTTP_METHODS = new HashSet<>(Arrays.asList( "GET", "PUT", "POST", "DELETE", "OPTIONS", "HEAD", "PATCH", "TRACE", "CONNECT")); + /** + * Local variable names declared inside the generated api functions + * (php/api.mustache). A spec parameter whose final param name matches any of + * these collides with the internal variable in the same function scope - e.g. + * a parameter named {@code query} is overwritten by + * {@code $query = ObjectSerializer::buildQuery($queryParams)} before the + * {@code in: querystring} append would read it, silently dropping the caller's + * value. Such parameters are renamed by {@link #toParamName(String)}. + */ + private static final Set INTERNAL_VARIABLE_NAMES = new HashSet<>(Arrays.asList( + // signature internals appended after the spec params + "hostIndex", "variables", "contentType", "associative_array", + // xxxRequest() locals + "resourcePath", "formParams", "queryParams", "headerParams", "httpBody", + "multipart", "formDataProcessor", "formData", "multipartContents", + "formParamName", "formParamValue", "formParamValueItems", "formParamValueItem", + "headers", "apiKey", "defaultHeaders", "hostSettings", "operationHost", "query", + "returnType", + // verbatim-method request accumulator + "__requestUri", + // $this is not a legal parameter name in PHP + "this", + // sync/async wrapper locals + "request", "options", "response", "statusCode", "data", "content", "e", "exception")); + + @Override + public String toParamName(String name) { + if (parameterNameMapping.containsKey(name)) { + return parameterNameMapping.get(name); + } + String paramName = super.toParamName(name); + if (INTERNAL_VARIABLE_NAMES.contains(paramName)) { + paramName = toVarName("param_" + name); + } + return paramName; + } + // RFC 9110 tchar: method tokens the generated client can send verbatim private static final java.util.regex.Pattern HTTP_METHOD_TOKEN_PATTERN = java.util.regex.Pattern.compile("[!#$%&'*+\\-.^_`|~0-9A-Za-z]+"); diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/php/PhpClientCodegenTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/php/PhpClientCodegenTest.java index c57f1b1819ab..a273085cb3e0 100644 --- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/php/PhpClientCodegenTest.java +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/php/PhpClientCodegenTest.java @@ -228,8 +228,23 @@ public void testGuzzleOpenApi32OperationsAndQueryStringParam() throws IOExceptio "a querystring parameter literally named `uri` must still reach the wire"); Assert.assertFalse(generated.contains("toQueryValue(\n $qs"), "querystring param must not be serialized as a name=value pair"); + // params named after function-scope internal variables are renamed so + // the caller's value cannot be shadowed by e.g. `$query = buildQuery()` + Assert.assertTrue(generated.contains("function shadowQueryParam($param_query"), + "param `query` must be renamed off the internal $query local"); + Assert.assertTrue(generated.contains("'?') . $param_query"), + "renamed `query` param must still be appended verbatim"); + Assert.assertTrue(generated.contains("function shadowHeadersParam($param_headers"), + "param `headers` must be renamed off the internal $headers local"); + Assert.assertTrue(generated.contains("function shadowMultipartParam($param_multipart"), + "param `multipart` must be renamed off the internal $multipart local"); + Assert.assertTrue(generated.contains("function shadowBodyParam($param_headers"), + "a body param named `headers` must be renamed too"); + Assert.assertFalse(generated.contains("function shadowQueryParam($query"), + "the colliding spec name must not leak into the signature"); // QUERY may carry a body; REPORT/PROPPATCH need one on some stacks Assert.assertTrue(generated.contains("'REPORT'"), "REPORT should emit a verbatim literal"); + Assert.assertTrue(generated.contains("'PROPPATCH'"), "PROPPATCH should emit a verbatim literal"); Path composerPath = target.resolve("composer.json"); String composer = new String(Files.readAllBytes(composerPath), StandardCharsets.UTF_8); // psr7 < 2.10 Utils::modifyRequest() rebuilds a plain Request and diff --git a/modules/openapi-generator/src/test/resources/3_2/php-guzzle-capture/capture.php b/modules/openapi-generator/src/test/resources/3_2/php-guzzle-capture/capture.php index c3ae52cb1046..560c872ea3c7 100644 --- a/modules/openapi-generator/src/test/resources/3_2/php-guzzle-capture/capture.php +++ b/modules/openapi-generator/src/test/resources/3_2/php-guzzle-capture/capture.php @@ -74,6 +74,18 @@ function () use ($api) { $api->listPets(); }, function () use ($api) { $api->searchItems('k=v', ['a' => 1]); }, function () use ($api) { $api->reportItems('r=1'); }, function () use ($api) { $api->propPatch(''); }, + // querystring params named after template-internal locals ($query/$headers/ + // $multipart/$uri). PHP renames them to param_*; the caller's value must + // still reach the wire verbatim, for required and optional(null) params. + function () use ($api) { $api->shadowQueryParam('k=v'); }, + function () use ($api) { $api->shadowHeadersParam('a=b'); }, + function () use ($api) { $api->shadowHeadersParam(null); }, + function () use ($api) { $api->shadowMultipartParam('x=1'); }, + function () use ($api) { $api->shadowUriParam('z=9'); }, + function () use ($api) { $api->shadowUriParam(null); }, + // a body parameter named `headers` must not be shadowed by the internal + // $headers array + function () use ($api) { $api->shadowBodyParam('ok'); }, ]; foreach ($calls as $call) { try { $call(); } catch (\Throwable $e) { fwrite(STDERR, "call failed: {$e->getMessage()}\n"); } @@ -89,6 +101,13 @@ function () use ($api) { $api->propPatch(''); }, 'QUERY /items?k=v HTTP/1.1 [CL=7] BODY={"a":1}', 'REPORT /report?r=1 HTTP/1.1 [CL=0]', 'PROPPATCH /report HTTP/1.1 [CL=4] BODY=', + 'GET /shadow-query?k=v HTTP/1.1 [CL=0]', + 'GET /shadow-headers?a=b HTTP/1.1 [CL=0]', + 'GET /shadow-headers HTTP/1.1 [CL=0]', + 'GET /shadow-multipart?x=1 HTTP/1.1 [CL=0]', + 'GET /shadow-uri?z=9 HTTP/1.1 [CL=0]', + 'GET /shadow-uri HTTP/1.1 [CL=0]', + 'POST /shadow-body HTTP/1.1 [CL=4] BODY="ok"', ]; $got = []; $deadline = microtime(true) + 30; diff --git a/modules/openapi-generator/src/test/resources/3_2/query-operation.yaml b/modules/openapi-generator/src/test/resources/3_2/query-operation.yaml index 9ab187648905..88cd41c382d7 100644 --- a/modules/openapi-generator/src/test/resources/3_2/query-operation.yaml +++ b/modules/openapi-generator/src/test/resources/3_2/query-operation.yaml @@ -149,3 +149,76 @@ paths: responses: '200': description: ok + # `in: querystring` params named after template-internal locals. Each name + # needs its own operation (one querystring param per operation); PHP renames + # them to param_*/paramXxx, other generators keep the plain name. + /shadow-query: + get: + operationId: shadowQueryParam + parameters: + - name: query + in: querystring + required: true + content: + application/x-www-form-urlencoded: + schema: + type: string + responses: + '200': + description: ok + /shadow-headers: + get: + operationId: shadowHeadersParam + parameters: + - name: headers + in: querystring + required: false + content: + application/x-www-form-urlencoded: + schema: + type: string + responses: + '200': + description: ok + /shadow-multipart: + get: + operationId: shadowMultipartParam + parameters: + - name: multipart + in: querystring + required: true + content: + application/x-www-form-urlencoded: + schema: + type: string + responses: + '200': + description: ok + /shadow-uri: + get: + operationId: shadowUriParam + parameters: + - name: uri + in: querystring + required: false + content: + application/x-www-form-urlencoded: + schema: + type: string + responses: + '200': + description: ok + /shadow-body: + # a body parameter named after a template-internal local (`headers`) + post: + operationId: shadowBodyParam + requestBody: + required: true + x-codegen-request-body-name: headers + content: + application/json: + schema: + type: string + responses: + '200': + description: ok From 910b59001e6ac42a3eefc918307eaa561f5f7ce2 Mon Sep 17 00:00:00 2001 From: khayashi4337 Date: Wed, 23 Sep 2026 12:51:56 +0900 Subject: [PATCH 18/31] fix(kotlin): clone shared deepObject vars, guard normalized name collisions MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit propagateParamBaseNameToVars wrote x-kotlin-param-base-name onto CodegenProperty instances that come from DefaultCodegen.fromProperty()'s cache, so two deepObject parameters sharing a model/property overwrote each other's wire-key prefix. Vars are now cloned before the parameter-local extension is attached; verified with a two-parameter fixture sharing the same property — each wire key keeps its own baseName. The collision guard in toParamName compared raw spec names, so variants like local_variable_body or LocalVariableBody normalized to the same localVariableBody/localVariableQuery/localVariableHeaders identifiers but slipped past the check and collided with template locals at codegen time. The guard now compares the normalized identifier; a /variants fixture exercises the spelling variants. --- .../languages/AbstractKotlinCodegen.java | 17 +++++----- .../languages/KotlinClientCodegen.java | 12 ++++++- .../kotlin/KotlinClientCodegenApiTest.java | 12 +++++++ .../3_2/kotlin-deep-object-collision.yaml | 33 +++++++++++++++++++ 4 files changed, 65 insertions(+), 9 deletions(-) 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 c66b04c06513..5863ea6aa180 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 @@ -1125,15 +1125,16 @@ public String toParamName(String name) { return "paramCallback"; } + String paramName = toVariableName(name); // to avoid conflicts with the template-internal locals generated api - // functions declare (localVariableBody/localVariableQuery/localVariableHeaders) - if ("localVariableBody".equals(name) || "localVariableQuery".equals(name) - || "localVariableHeaders".equals(name)) { - return camelize("param_" + name, LOWERCASE_FIRST_LETTER); - } - - // should be the same as variable name - return toVariableName(name); + // functions declare: compare the *normalized* name, so spelling variants + // (local_variable_body, LocalVariableBody, ...) cannot slip through and + // collide downstream + if ("localVariableBody".equals(paramName) || "localVariableQuery".equals(paramName) + || "localVariableHeaders".equals(paramName)) { + return toVariableName("param_" + name); + } + return paramName; } @Override diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/KotlinClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/KotlinClientCodegen.java index a3b5c9c85093..bcadd561fcbc 100755 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/KotlinClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/KotlinClientCodegen.java @@ -33,6 +33,7 @@ import org.slf4j.LoggerFactory; import java.io.File; +import java.util.ArrayList; import java.util.Arrays; import java.util.EnumSet; import java.util.HashMap; @@ -1216,14 +1217,23 @@ public void postProcessParameter(CodegenParameter parameter) { * `vars` (e.g. jvm-ktor) need the outer baseName to build URL keys like * `paramBaseName[fieldBaseName]` per the OAS deepObject style, and * Mustache provides no access to the outer scope from inside `{{#vars}}`. + * + *

The vars come from {@code DefaultCodegen.fromProperty()}'s cache, so + * the same instance can back multiple parameters; they are cloned before + * the parameter-local extension is attached to avoid leaking one + * parameter's baseName into another's wire keys. */ private void propagateParamBaseNameToVars(CodegenParameter param) { if (!param.isQueryParam || !param.isModel || param.vars == null) { return; } + List vars = new ArrayList<>(param.vars.size()); for (CodegenProperty v : param.vars) { - v.vendorExtensions.put("x-kotlin-param-base-name", param.baseName); + CodegenProperty copy = v.clone(); + copy.vendorExtensions.put("x-kotlin-param-base-name", param.baseName); + vars.add(copy); } + param.vars = vars; } /** diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/kotlin/KotlinClientCodegenApiTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/kotlin/KotlinClientCodegenApiTest.java index 899133edf083..f9fa804d8ba2 100644 --- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/kotlin/KotlinClientCodegenApiTest.java +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/kotlin/KotlinClientCodegenApiTest.java @@ -371,6 +371,18 @@ void testJvmOkhttp4DeepObjectCollisionKeepsSpecWireName() throws IOException { "deepObject wire prefix must not leak the renamed param"); Assert.assertFalse(api.contains("put(\"foo[foo]\""), "deepObject wire prefix must not collapse to the property name"); + // two deepObject params share the same cached property instance; + // each must keep its own baseName on the wire (no cross-leak) + Assert.assertTrue(api.contains("put(\"localVariableQuery[foo]\""), + "second deepObject param must keep its own baseName on the wire"); + Assert.assertTrue(api.contains("paramLocalVariableQuery:"), + "second colliding param name must be renamed"); + // spelling variants normalize to the same internal local names and + // must hit the collision guard, keeping spec baseNames on the wire + Assert.assertTrue(api.contains("put(\"local_variable_headers\", listOf(paramLocalVariableHeaders.toString()))"), + "snake_case variant must be renamed but keep spec wire name"); + Assert.assertTrue(api.contains("put(\"LocalVariableQuery\", listOf(paramLocalVariableQuery.toString()))"), + "PascalCase variant must be renamed but keep spec wire name"); } finally { deleteRecursively(target); } diff --git a/modules/openapi-generator/src/test/resources/3_2/kotlin-deep-object-collision.yaml b/modules/openapi-generator/src/test/resources/3_2/kotlin-deep-object-collision.yaml index 8236aa5d44a9..c113fc6af1d3 100644 --- a/modules/openapi-generator/src/test/resources/3_2/kotlin-deep-object-collision.yaml +++ b/modules/openapi-generator/src/test/resources/3_2/kotlin-deep-object-collision.yaml @@ -20,6 +20,39 @@ paths: properties: foo: type: string + # a second deepObject param sharing the same property name: the + # property CodegenProperty instance is cache-shared, so the wire + # prefixes must stay parameter-local (localVariableQuery[foo] must + # not be overwritten to localVariableBody[foo] or vice versa) + - name: localVariableQuery + in: query + required: true + style: deepObject + explode: true + schema: + type: object + properties: + foo: + type: string + responses: + '200': + description: ok + /variants: + # spelling variants normalize to the same internal local names and must + # hit the same collision guard + get: + operationId: variantPets + parameters: + - name: local_variable_headers + in: query + required: true + schema: + type: string + - name: LocalVariableQuery + in: query + required: true + schema: + type: string responses: '200': description: ok From 2f0ffbfca1ef1fab8cbc24828e05436990303a1d Mon Sep 17 00:00:00 2001 From: khayashi4337 Date: Wed, 23 Sep 2026 15:48:20 +0900 Subject: [PATCH 19/31] test(rust): delete temp dirs reliably in all codegen tests Eight of the nine temp-directory sites still used File.deleteOnExit, which cannot remove non-empty directories and left generated output behind on every run. Wrap them in try/finally + FileUtils.deleteDirectory like the wire-level test already does. --- .../codegen/rust/RustClientCodegenTest.java | 327 ++++++++++-------- 1 file changed, 177 insertions(+), 150 deletions(-) diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/rust/RustClientCodegenTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/rust/RustClientCodegenTest.java index e02c3df29a7d..f4fb98fcbd74 100644 --- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/rust/RustClientCodegenTest.java +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/rust/RustClientCodegenTest.java @@ -288,199 +288,226 @@ public void testWithIntegerFittingAndPreferUnsigned() { @Test public void testMultipleArrayTypesEnum() throws IOException { Path target = Files.createTempDirectory("test"); - final CodegenConfigurator configurator = new CodegenConfigurator() - .setGeneratorName("rust") - .setInputSpec("src/test/resources/3_1/issue_18527.yaml") - .setSkipOverwrite(false) - .setOutputDir(target.toAbsolutePath().toString().replace("\\", "/")); - List files = new DefaultGenerator().opts(configurator.toClientOptInput()).generate(); - files.forEach(File::deleteOnExit); - Path outputPath = Path.of(target.toString(), "/src/models/option1_or_option2_options.rs"); - String enumSpec = linearize("pub enum Option1OrOption2Options { " + - "ArrayVecString(Vec), " + - "ArrayVeci32(Vec)," + - "}"); - TestUtils.assertFileExists(outputPath); - TestUtils.assertFileContains(outputPath, enumSpec); + try { + final CodegenConfigurator configurator = new CodegenConfigurator() + .setGeneratorName("rust") + .setInputSpec("src/test/resources/3_1/issue_18527.yaml") + .setSkipOverwrite(false) + .setOutputDir(target.toAbsolutePath().toString().replace("\\", "/")); + new DefaultGenerator().opts(configurator.toClientOptInput()).generate(); + Path outputPath = Path.of(target.toString(), "/src/models/option1_or_option2_options.rs"); + String enumSpec = linearize("pub enum Option1OrOption2Options { " + + "ArrayVecString(Vec), " + + "ArrayVeci32(Vec)," + + "}"); + TestUtils.assertFileExists(outputPath); + TestUtils.assertFileContains(outputPath, enumSpec); + } finally { + FileUtils.deleteDirectory(target.toFile()); + } } @Test public void testIntegerPropertyEnum() throws IOException { Path target = Files.createTempDirectory("test"); - target.toFile().deleteOnExit(); - final CodegenConfigurator configurator = new CodegenConfigurator() - .setGeneratorName("rust") - .setInputSpec("src/test/resources/3_1/rust_integer_property_enum.yaml") - .setSkipOverwrite(false) - .setOutputDir(target.toAbsolutePath().toString().replace("\\", "/")); - new DefaultGenerator().opts(configurator.toClientOptInput()).generate(); - Path outputPath = Path.of(target.toString(), "/src/models/signed_message_signature.rs"); - TestUtils.assertFileExists(outputPath); - // The integer-enum property must use serde_repr (not string rename) - TestUtils.assertFileContains(outputPath, "use serde_repr::{Serialize_repr,Deserialize_repr}"); - TestUtils.assertFileContains(outputPath, "Serialize_repr, Deserialize_repr"); - TestUtils.assertFileContains(outputPath, "= 0"); - TestUtils.assertFileContains(outputPath, "= 1"); - // Must NOT contain a string rename for an integer variant - TestUtils.assertFileNotContains(outputPath, linearize("#[serde(rename = \"0\")]")); + try { + final CodegenConfigurator configurator = new CodegenConfigurator() + .setGeneratorName("rust") + .setInputSpec("src/test/resources/3_1/rust_integer_property_enum.yaml") + .setSkipOverwrite(false) + .setOutputDir(target.toAbsolutePath().toString().replace("\\", "/")); + new DefaultGenerator().opts(configurator.toClientOptInput()).generate(); + Path outputPath = Path.of(target.toString(), "/src/models/signed_message_signature.rs"); + TestUtils.assertFileExists(outputPath); + // The integer-enum property must use serde_repr (not string rename) + TestUtils.assertFileContains(outputPath, "use serde_repr::{Serialize_repr,Deserialize_repr}"); + TestUtils.assertFileContains(outputPath, "Serialize_repr, Deserialize_repr"); + TestUtils.assertFileContains(outputPath, "= 0"); + TestUtils.assertFileContains(outputPath, "= 1"); + // Must NOT contain a string rename for an integer variant + TestUtils.assertFileNotContains(outputPath, linearize("#[serde(rename = \"0\")]")); + } finally { + FileUtils.deleteDirectory(target.toFile()); + } } @Test public void testArrayWithObjectEnumValues() throws IOException { Path target = Files.createTempDirectory("test"); - target.toFile().deleteOnExit(); - final CodegenConfigurator configurator = new CodegenConfigurator() - .setGeneratorName("rust") - .setInputSpec("src/test/resources/3_1/issue_23278.yaml") - .setSkipOverwrite(false) - .setOutputDir(target.toAbsolutePath().toString().replace("\\", "/")); - new DefaultGenerator().opts(configurator.toClientOptInput()).generate(); - Path outputPath = Path.of(target.toString(), "/src/models/object_arrays_options.rs"); - String enumSpec = linearize("pub enum ObjectArraysOptions { " + - "ArrayVecTestObject(Vec), " + - "ArrayVecTestArray(Vec)," + - "}"); - TestUtils.assertFileExists(outputPath); - TestUtils.assertFileContains(outputPath, enumSpec); + try { + final CodegenConfigurator configurator = new CodegenConfigurator() + .setGeneratorName("rust") + .setInputSpec("src/test/resources/3_1/issue_23278.yaml") + .setSkipOverwrite(false) + .setOutputDir(target.toAbsolutePath().toString().replace("\\", "/")); + new DefaultGenerator().opts(configurator.toClientOptInput()).generate(); + Path outputPath = Path.of(target.toString(), "/src/models/object_arrays_options.rs"); + String enumSpec = linearize("pub enum ObjectArraysOptions { " + + "ArrayVecTestObject(Vec), " + + "ArrayVecTestArray(Vec)," + + "}"); + TestUtils.assertFileExists(outputPath); + TestUtils.assertFileContains(outputPath, enumSpec); + } finally { + FileUtils.deleteDirectory(target.toFile()); + } } @Test public void testReqwestTraitUuidParamsUseNamedLifetimes() throws IOException { Path target = Files.createTempDirectory("test"); - target.toFile().deleteOnExit(); - final CodegenConfigurator configurator = new CodegenConfigurator() - .setGeneratorName("rust") - .setLibrary("reqwest-trait") - .addAdditionalProperty("mockall", true) - .setInputSpec("src/test/resources/3_0/rust/reqwest-trait-uuid-params.yaml") - .setSkipOverwrite(false) - .setOutputDir(target.toAbsolutePath().toString().replace("\\", "/")); - new DefaultGenerator().opts(configurator.toClientOptInput()).generate(); - Path outputPath = Path.of(target.toString(), "/src/apis/widget_api.rs"); - TestUtils.assertFileExists(outputPath); - // mockall's #[automock] cannot elide the lifetime of a reference nested in Option<..> - TestUtils.assertFileContains(outputPath, - "async fn list_widget_items<'id, 'run_id>(&self, id: &'id str, run_id: Option<&'run_id str>)"); - TestUtils.assertFileNotContains(outputPath, "Option<&str>"); + try { + final CodegenConfigurator configurator = new CodegenConfigurator() + .setGeneratorName("rust") + .setLibrary("reqwest-trait") + .addAdditionalProperty("mockall", true) + .setInputSpec("src/test/resources/3_0/rust/reqwest-trait-uuid-params.yaml") + .setSkipOverwrite(false) + .setOutputDir(target.toAbsolutePath().toString().replace("\\", "/")); + new DefaultGenerator().opts(configurator.toClientOptInput()).generate(); + Path outputPath = Path.of(target.toString(), "/src/apis/widget_api.rs"); + TestUtils.assertFileExists(outputPath); + // mockall's #[automock] cannot elide the lifetime of a reference nested in Option<..> + TestUtils.assertFileContains(outputPath, + "async fn list_widget_items<'id, 'run_id>(&self, id: &'id str, run_id: Option<&'run_id str>)"); + TestUtils.assertFileNotContains(outputPath, "Option<&str>"); + } finally { + FileUtils.deleteDirectory(target.toFile()); + } } @Test public void testReqwestOpenApi32OperationsAndQueryStringParam() throws IOException { Path target = Files.createTempDirectory("test"); - target.toFile().deleteOnExit(); - final CodegenConfigurator configurator = new CodegenConfigurator() - .setGeneratorName("rust") - .setLibrary("reqwest") - .setInputSpec("src/test/resources/3_2/query-operation.yaml") - .setSkipOverwrite(false) - .setOutputDir(target.toAbsolutePath().toString().replace("\\", "/")); - new DefaultGenerator().opts(configurator.toClientOptInput()).generate(); - Path outputPath = Path.of(target.toString(), "src/apis/default_api.rs"); - TestUtils.assertFileExists(outputPath); - String generated = new String(Files.readAllBytes(outputPath), StandardCharsets.UTF_8); - // standard methods still use the typed constants - Assert.assertTrue(generated.contains("reqwest::Method::GET"), - "list_pets should use reqwest::Method::GET"); - // query and additionalOperations methods are emitted verbatim via Method::from_bytes - for (String method : new String[]{"QUERY", "PURGE", "customMethod", "CHECK&FETCH"}) { - Assert.assertTrue(generated.contains("reqwest::Method::from_bytes(b\"" + method + "\")"), - "expected verbatim method literal for " + method); + try { + final CodegenConfigurator configurator = new CodegenConfigurator() + .setGeneratorName("rust") + .setLibrary("reqwest") + .setInputSpec("src/test/resources/3_2/query-operation.yaml") + .setSkipOverwrite(false) + .setOutputDir(target.toAbsolutePath().toString().replace("\\", "/")); + new DefaultGenerator().opts(configurator.toClientOptInput()).generate(); + Path outputPath = Path.of(target.toString(), "src/apis/default_api.rs"); + TestUtils.assertFileExists(outputPath); + String generated = new String(Files.readAllBytes(outputPath), StandardCharsets.UTF_8); + // standard methods still use the typed constants + Assert.assertTrue(generated.contains("reqwest::Method::GET"), + "list_pets should use reqwest::Method::GET"); + // query and additionalOperations methods are emitted verbatim via Method::from_bytes + for (String method : new String[]{"QUERY", "PURGE", "customMethod", "CHECK&FETCH"}) { + Assert.assertTrue(generated.contains("reqwest::Method::from_bytes(b\"" + method + "\")"), + "expected verbatim method literal for " + method); + } + // `in: querystring` is appended to the URI verbatim, not sent through .query() + Assert.assertTrue(generated.contains("uri_str.push_str(&p_qs);"), + "querystring param should be appended verbatim"); + Assert.assertTrue(generated.contains("qs: &str"), + "query_pets signature must expose the querystring parameter"); + Assert.assertFalse(generated.contains("\"qs\""), + "querystring param must not be serialized as a name=value query pair"); + } finally { + FileUtils.deleteDirectory(target.toFile()); } - // `in: querystring` is appended to the URI verbatim, not sent through .query() - Assert.assertTrue(generated.contains("uri_str.push_str(&p_qs);"), - "querystring param should be appended verbatim"); - Assert.assertTrue(generated.contains("qs: &str"), - "query_pets signature must expose the querystring parameter"); - Assert.assertFalse(generated.contains("\"qs\""), - "querystring param must not be serialized as a name=value query pair"); } @Test public void testReqwestOpenApi32QueryStringParamGrouped() throws IOException { Path target = Files.createTempDirectory("test"); - target.toFile().deleteOnExit(); - final CodegenConfigurator configurator = new CodegenConfigurator() - .setGeneratorName("rust") - .setLibrary("reqwest") - .addAdditionalProperty("useSingleRequestParameter", true) - .setInputSpec("src/test/resources/3_2/query-operation.yaml") - .setSkipOverwrite(false) - .setOutputDir(target.toAbsolutePath().toString().replace("\\", "/")); - new DefaultGenerator().opts(configurator.toClientOptInput()).generate(); - Path outputPath = Path.of(target.toString(), "src/apis/default_api.rs"); - TestUtils.assertFileExists(outputPath); - // grouped params struct stores String fields; the borrow is required to compile - TestUtils.assertFileContains(outputPath, "uri_str.push_str(¶ms.qs);"); + try { + final CodegenConfigurator configurator = new CodegenConfigurator() + .setGeneratorName("rust") + .setLibrary("reqwest") + .addAdditionalProperty("useSingleRequestParameter", true) + .setInputSpec("src/test/resources/3_2/query-operation.yaml") + .setSkipOverwrite(false) + .setOutputDir(target.toAbsolutePath().toString().replace("\\", "/")); + new DefaultGenerator().opts(configurator.toClientOptInput()).generate(); + Path outputPath = Path.of(target.toString(), "src/apis/default_api.rs"); + TestUtils.assertFileExists(outputPath); + // grouped params struct stores String fields; the borrow is required to compile + TestUtils.assertFileContains(outputPath, "uri_str.push_str(¶ms.qs);"); + } finally { + FileUtils.deleteDirectory(target.toFile()); + } } @Test public void testReqwestSkipsInvalidMethodNames() throws IOException { Path target = Files.createTempDirectory("test"); - target.toFile().deleteOnExit(); - final CodegenConfigurator configurator = new CodegenConfigurator() - .setGeneratorName("rust") - .setLibrary("reqwest") - .setInputSpec("src/test/resources/3_2/rust-invalid-method.yaml") - .setSkipOverwrite(false) - .setOutputDir(target.toAbsolutePath().toString().replace("\\", "/")); - new DefaultGenerator().opts(configurator.toClientOptInput()).generate(); - Path outputPath = Path.of(target.toString(), "src/apis/default_api.rs"); - TestUtils.assertFileExists(outputPath); - String generated = new String(Files.readAllBytes(outputPath), StandardCharsets.UTF_8); - Assert.assertTrue(generated.contains("fn list_pets"), "GET operation should be kept"); - Assert.assertFalse(generated.contains("bad_method"), - "operation with an invalid RFC 9110 method name must be skipped"); + try { + final CodegenConfigurator configurator = new CodegenConfigurator() + .setGeneratorName("rust") + .setLibrary("reqwest") + .setInputSpec("src/test/resources/3_2/rust-invalid-method.yaml") + .setSkipOverwrite(false) + .setOutputDir(target.toAbsolutePath().toString().replace("\\", "/")); + new DefaultGenerator().opts(configurator.toClientOptInput()).generate(); + Path outputPath = Path.of(target.toString(), "src/apis/default_api.rs"); + TestUtils.assertFileExists(outputPath); + String generated = new String(Files.readAllBytes(outputPath), StandardCharsets.UTF_8); + Assert.assertTrue(generated.contains("fn list_pets"), "GET operation should be kept"); + Assert.assertFalse(generated.contains("bad_method"), + "operation with an invalid RFC 9110 method name must be skipped"); + } finally { + FileUtils.deleteDirectory(target.toFile()); + } } @Test public void testReqwestWebhookOpenApi32Operations() throws IOException { Path target = Files.createTempDirectory("test"); - target.toFile().deleteOnExit(); - final CodegenConfigurator configurator = new CodegenConfigurator() - .setGeneratorName("rust") - .setLibrary("reqwest") - .setInputSpec("src/test/resources/3_2/go-webhook-operations.yaml") - .setSkipOverwrite(false) - .setOutputDir(target.toAbsolutePath().toString().replace("\\", "/")); - new DefaultGenerator().opts(configurator.toClientOptInput()).generate(); - Path apiDir = Path.of(target.toString(), "src/apis"); - File webhookFile = null; - for (File f : Objects.requireNonNull(apiDir.toFile().listFiles())) { - String content = new String(Files.readAllBytes(f.toPath()), StandardCharsets.UTF_8); - if (content.contains("on_pet_custom")) { - webhookFile = f; - break; + try { + final CodegenConfigurator configurator = new CodegenConfigurator() + .setGeneratorName("rust") + .setLibrary("reqwest") + .setInputSpec("src/test/resources/3_2/go-webhook-operations.yaml") + .setSkipOverwrite(false) + .setOutputDir(target.toAbsolutePath().toString().replace("\\", "/")); + new DefaultGenerator().opts(configurator.toClientOptInput()).generate(); + Path apiDir = Path.of(target.toString(), "src/apis"); + File webhookFile = null; + for (File f : Objects.requireNonNull(apiDir.toFile().listFiles())) { + String content = new String(Files.readAllBytes(f.toPath()), StandardCharsets.UTF_8); + if (content.contains("on_pet_custom")) { + webhookFile = f; + break; + } } + Assert.assertNotNull(webhookFile, "expected a generated file containing webhook ops"); + String generated = new String(Files.readAllBytes(webhookFile.toPath()), StandardCharsets.UTF_8); + Assert.assertTrue(generated.contains("reqwest::Method::from_bytes(b\"QUERY\")"), + "webhook query op should emit a verbatim method"); + Assert.assertTrue(generated.contains("reqwest::Method::from_bytes(b\"customMethod\")"), + "webhook additionalOperations should emit verbatim methods"); + Assert.assertTrue(generated.contains("uri_str.push_str(&p_qs);"), + "webhook querystring param should be appended verbatim"); + } finally { + FileUtils.deleteDirectory(target.toFile()); } - Assert.assertNotNull(webhookFile, "expected a generated file containing webhook ops"); - String generated = new String(Files.readAllBytes(webhookFile.toPath()), StandardCharsets.UTF_8); - Assert.assertTrue(generated.contains("reqwest::Method::from_bytes(b\"QUERY\")"), - "webhook query op should emit a verbatim method"); - Assert.assertTrue(generated.contains("reqwest::Method::from_bytes(b\"customMethod\")"), - "webhook additionalOperations should emit verbatim methods"); - Assert.assertTrue(generated.contains("uri_str.push_str(&p_qs);"), - "webhook querystring param should be appended verbatim"); } @Test public void testHyperSkipsOpenApi32Operations() throws IOException { Path target = Files.createTempDirectory("test"); - target.toFile().deleteOnExit(); - final CodegenConfigurator configurator = new CodegenConfigurator() - .setGeneratorName("rust") - .setLibrary("hyper") - .setInputSpec("src/test/resources/3_2/query-operation.yaml") - .setSkipOverwrite(false) - .setOutputDir(target.toAbsolutePath().toString().replace("\\", "/")); - new DefaultGenerator().opts(configurator.toClientOptInput()).generate(); - Path outputPath = Path.of(target.toString(), "src/apis/default_api.rs"); - TestUtils.assertFileExists(outputPath); - String generated = new String(Files.readAllBytes(outputPath), StandardCharsets.UTF_8); - // hyper templates cannot express arbitrary method names -> warned and skipped - Assert.assertTrue(generated.contains("list_pets"), "GET operation should be kept"); - for (String op : new String[]{"query_pets", "purge_pets", "custom_pets", "check_fetch_pets"}) { - Assert.assertFalse(generated.contains("fn " + op), - "hyper library must skip unsupported 3.2 operation " + op); + try { + final CodegenConfigurator configurator = new CodegenConfigurator() + .setGeneratorName("rust") + .setLibrary("hyper") + .setInputSpec("src/test/resources/3_2/query-operation.yaml") + .setSkipOverwrite(false) + .setOutputDir(target.toAbsolutePath().toString().replace("\\", "/")); + new DefaultGenerator().opts(configurator.toClientOptInput()).generate(); + Path outputPath = Path.of(target.toString(), "src/apis/default_api.rs"); + TestUtils.assertFileExists(outputPath); + String generated = new String(Files.readAllBytes(outputPath), StandardCharsets.UTF_8); + // hyper templates cannot express arbitrary method names -> warned and skipped + Assert.assertTrue(generated.contains("list_pets"), "GET operation should be kept"); + for (String op : new String[]{"query_pets", "purge_pets", "custom_pets", "check_fetch_pets"}) { + Assert.assertFalse(generated.contains("fn " + op), + "hyper library must skip unsupported 3.2 operation " + op); + } + } finally { + FileUtils.deleteDirectory(target.toFile()); } } From bc20a2c12d3880987379b37561d9a127bd7246b8 Mon Sep 17 00:00:00 2001 From: khayashi4337 Date: Wed, 23 Sep 2026 15:55:06 +0900 Subject: [PATCH 20/31] fix(codegen): match allOf-inherited form required flags by baseName fromRequestBodyToFormParameters compared each allOf member's required entries against the normalized paramName, so any property whose paramName differs from its schema name (snake_case -> camelCase, or a collision rename) silently lost its required flag. A top-level required list also bypassed the allOf-member lists entirely. allRequired already unions the top-level and allOf-member required lists; compare it against the schema property name and also honor a single-allOf wrapper's own required list. --- .../openapitools/codegen/DefaultCodegen.java | 13 +++-- .../codegen/DefaultCodegenTest.java | 44 ++++++++++++++ .../resources/3_0/form-allof-required.yaml | 57 +++++++++++++++++++ 3 files changed, 109 insertions(+), 5 deletions(-) create mode 100644 modules/openapi-generator/src/test/resources/3_0/form-allof-required.yaml 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 3b96423876b9..7e5705349789 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 @@ -7915,12 +7915,15 @@ public List fromRequestBodyToFormParameters(RequestBody body, // for oneOf/anyOf, mark all the properties collected from the sub-schemas as optional // so that users can choose which property to include in the form parameters codegenParameter.required = false; - } else if (!codegenParameter.required && schema.getRequired() != null) { - // Set 'required' flag defined in the schema element - codegenParameter.required = schema.getRequired().contains(entry.getKey()); } else if (!codegenParameter.required) { - // Set 'required' flag for properties declared inside the allOf - codegenParameter.required = allRequired.stream().anyMatch(r -> r.equals(codegenParameter.paramName)); + // 'required' applies to the schema property name (baseName); comparing + // against the normalized paramName would silently drop the flag for + // e.g. snake_case names or collision-renamed parameters. allRequired + // already unions the top-level and allOf-member 'required' lists, and + // 'original' covers a single-allOf wrapper's own required list. + codegenParameter.required = allRequired.contains(entry.getKey()) + || (original != null && original.getRequired() != null + && original.getRequired().contains(entry.getKey())); } parameters.add(codegenParameter); diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/DefaultCodegenTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/DefaultCodegenTest.java index ceda4c12b38f..a38ac6ac57cc 100644 --- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/DefaultCodegenTest.java +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/DefaultCodegenTest.java @@ -389,6 +389,50 @@ public void testOAS31ContentMediaTypeBinaryFormParameter() { assertFalse(image.isFile); } + @Test + public void testAllOfFormRequiredMatchesByBaseName() { + // required matching must use the schema property name (baseName), not the + // normalized paramName: `user_id` -> `userId` used to silently drop the flag + final OpenAPI openAPI = TestUtils.parseSpec("src/test/resources/3_0/form-allof-required.yaml"); + + final DefaultCodegen codegen = new DefaultCodegen(); + codegen.setOpenAPI(openAPI); + + RequestBody requestBody = openAPI.getPaths().get("/register").getPost().getRequestBody(); + List formParams = codegen.fromRequestBodyToFormParameters(requestBody, new HashSet<>()); + Map paramsByBaseName = formParams.stream() + .collect(Collectors.toMap(param -> param.baseName, param -> param)); + + assertTrue(paramsByBaseName.get("query").required, + "allOf member required must apply"); + assertTrue(paramsByBaseName.get("user_id").required, + "required must match the schema name even when paramName is normalized to userId"); + assertFalse(paramsByBaseName.get("nickname").required, + "non-required allOf member stays optional"); + } + + @Test + public void testTopLevelRequiredDoesNotMaskAllOfMemberRequired() { + // sibling bug: a top-level `required` used to bypass the allOf-member + // required lists entirely + final OpenAPI openAPI = TestUtils.parseSpec("src/test/resources/3_0/form-allof-required.yaml"); + + final DefaultCodegen codegen = new DefaultCodegen(); + codegen.setOpenAPI(openAPI); + + RequestBody requestBody = openAPI.getPaths().get("/register-top").getPost().getRequestBody(); + List formParams = codegen.fromRequestBodyToFormParameters(requestBody, new HashSet<>()); + Map paramsByBaseName = formParams.stream() + .collect(Collectors.toMap(param -> param.baseName, param -> param)); + + assertTrue(paramsByBaseName.get("top").required, + "top-level required must apply"); + assertTrue(paramsByBaseName.get("member_req").required, + "allOf member required must apply alongside top-level required"); + assertFalse(paramsByBaseName.get("member_opt").required, + "non-required member stays optional"); + } + @Test public void testOriginalOpenApiDocumentVersion() { // Test with OAS 2.0 document. diff --git a/modules/openapi-generator/src/test/resources/3_0/form-allof-required.yaml b/modules/openapi-generator/src/test/resources/3_0/form-allof-required.yaml new file mode 100644 index 000000000000..51e37375e6e2 --- /dev/null +++ b/modules/openapi-generator/src/test/resources/3_0/form-allof-required.yaml @@ -0,0 +1,57 @@ +openapi: 3.0.0 +info: + title: form allOf required + version: 1.0.0 +paths: + /register: + post: + operationId: register + requestBody: + required: true + content: + application/x-www-form-urlencoded: + schema: + allOf: + - type: object + required: + - query + properties: + query: + type: string + - type: object + required: + - user_id + properties: + user_id: + type: string + nickname: + type: string + responses: + '200': + description: ok + /register-top: + post: + operationId: registerTop + requestBody: + required: true + content: + application/x-www-form-urlencoded: + schema: + type: object + required: + - top + properties: + top: + type: string + allOf: + - type: object + required: + - member_req + properties: + member_req: + type: string + member_opt: + type: string + responses: + '200': + description: ok From a00d51c1caaaa98293ba19021686f656d45bc300 Mon Sep 17 00:00:00 2001 From: khayashi4337 Date: Wed, 23 Sep 2026 15:55:08 +0900 Subject: [PATCH 21/31] test(php): pin unique signature under prependFormOrBodyParameters MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit A form field `param_query` plus a query param `query` (renamed to `param_query` by the internal-variable collision guard) already resolves to distinct names under prependFormOrBodyParameters=true — the parameters-loop uniqueness pass sees the prepended form params in allParams. Add a fixture and assertion so a future regression cannot silently reintroduce a duplicate signature. --- .../codegen/php/PhpClientCodegenTest.java | 32 +++++++++++++++++++ .../resources/3_0/form-prepend-collision.yaml | 28 ++++++++++++++++ 2 files changed, 60 insertions(+) create mode 100644 modules/openapi-generator/src/test/resources/3_0/form-prepend-collision.yaml diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/php/PhpClientCodegenTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/php/PhpClientCodegenTest.java index a273085cb3e0..ef975c7614b7 100644 --- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/php/PhpClientCodegenTest.java +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/php/PhpClientCodegenTest.java @@ -325,6 +325,38 @@ public void testGuzzleWebhookOperationsEmitVerbatimMethods() throws IOException } } + @Test + public void testPrependFormOrBodyParametersCollisionStaysUnique() throws IOException { + // regression pin: a form field `param_query` plus a query param `query` + // (renamed to `param_query` by the internal-variable collision guard) + // must not produce a duplicate signature when form params are prepended + Path target = Files.createTempDirectory("test"); + try { + final CodegenConfigurator configurator = new CodegenConfigurator() + .setGeneratorName("php") + .setLibrary("guzzle") + .setInputSpec("src/test/resources/3_0/form-prepend-collision.yaml") + .addAdditionalProperty("prependFormOrBodyParameters", true) + .setSkipOverwrite(false) + .setOutputDir(target.toAbsolutePath().toString().replace("\\", "/")); + new DefaultGenerator().opts(configurator.toClientOptInput()).generate(); + Path apiPath = target.resolve("lib/Api/DefaultApi.php"); + TestUtils.assertFileExists(apiPath); + String generated = new String(Files.readAllBytes(apiPath), StandardCharsets.UTF_8); + java.util.regex.Matcher m = java.util.regex.Pattern + .compile("function prependCollide\\(([^)]*)\\)") + .matcher(generated); + Assert.assertTrue(m.find(), "prependCollide signature should exist"); + String signature = m.group(1); + Assert.assertTrue(signature.contains("$param_query"), + "collision-renamed query param should be in the signature: " + signature); + Assert.assertTrue(signature.contains("$param_query2"), + "form param must be de-duplicated to param_query2: " + signature); + } finally { + FileUtils.deleteDirectory(target.toFile()); + } + } + /** * End-to-end check: runs the generated guzzle client against a raw TCP * capture listener, verifying query/additionalOperations methods and diff --git a/modules/openapi-generator/src/test/resources/3_0/form-prepend-collision.yaml b/modules/openapi-generator/src/test/resources/3_0/form-prepend-collision.yaml new file mode 100644 index 000000000000..794d97a1876e --- /dev/null +++ b/modules/openapi-generator/src/test/resources/3_0/form-prepend-collision.yaml @@ -0,0 +1,28 @@ +openapi: 3.0.0 +info: + title: prepend collision + version: 1.0.0 +paths: + /prepend-collide: + post: + operationId: prependCollide + parameters: + - name: query + in: query + required: true + schema: + type: string + requestBody: + required: true + content: + application/x-www-form-urlencoded: + schema: + type: object + required: + - param_query + properties: + param_query: + type: string + responses: + '200': + description: ok From 94aca3a96f24229e04669f7211a3849392ebf8aa Mon Sep 17 00:00:00 2001 From: khayashi4337 Date: Wed, 23 Sep 2026 16:58:51 +0900 Subject: [PATCH 22/31] fix(kotlin-client): prevent template-local/member collisions with spec parameters Spec parameters named after generated operation locals (body, query, headers, ...) or api members (basePath, vertx, request, ...) previously collided with or shadowed them in the generated Kotlin source, producing uncompilable or miswired clients. - AbstractKotlinCodegen.toParamName: treat any normalized name starting with `localVar` as reserved (covers both the localVar* and localVariable* template-local families) and rename such parameters with a `param` prefix; wire names are preserved. - Operation templates: prefix every generated statement-level local with `localVariable` across jvm-okhttp, jvm-vertx, jvm-volley, jvm-spring-restclient and jvm-spring-webclient. - Qualify api-member references with `this.` so same-named parameters cannot shadow them (vertx auth/vertx/basePath/handleResponse/ responseBody/encodeURIComponent/parseDateToQueryString, volley requestFactory/postProcessors/requestQueue/basePath, spring request()). - jvm-okhttp: use a labeled `this@{{classname}}.` receiver for member calls made inside `apply {}` blocks, where plain `this` would bind to the map receiver. - jvm-spring-*: parseDateToQueryString is a top-level helper, so call it package-qualified (`{{packageName}}.infrastructure.`) instead of `this.`-qualified. - Add a template lint test enforcing the localVar prefix on all operation-scope val/var declarations (mustache tags stripped, partials included) and a cross-library canary spec + test asserting param renames, preserved wire names and member qualifications. - pom.xml: move the okhttp5/moshi jars used by the generated-client capture test out of the shared test classpath into a copied dependency dir; okhttp5's Kotlin 2.x metadata broke the embedded Kotlin 1.6 test compiler used by KotlinTestUtils. - Regenerate all kotlin samples. Generated jvm-vertx, jvm-spring-restclient, jvm-spring-webclient and jvm-okhttp4 outputs verified to compile with kotlinc against real dependency jars. Generated with [Devin](https://devin.ai) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com> --- modules/openapi-generator/pom.xml | 73 ++--- .../languages/AbstractKotlinCodegen.java | 12 +- .../libraries/jvm-okhttp/api.mustache | 14 +- .../jvm-spring-restclient/api.mustache | 16 +- .../jvm-spring-webclient/api.mustache | 12 +- .../libraries/jvm-vertx/api.mustache | 66 ++--- .../libraries/jvm-volley/api.mustache | 50 ++-- .../kotlin/KotlinClientCodegenApiTest.java | 169 ++++++++++- .../3_0/kotlin/kotlin-member-collision.yaml | 163 +++++++++++ .../org/openapitools/client/apis/PathApi.kt | 2 +- .../org/openapitools/client/apis/QueryApi.kt | 16 +- .../org/openapitools/client/apis/AuthApi.kt | 20 +- .../org/openapitools/client/apis/BodyApi.kt | 80 +++--- .../org/openapitools/client/apis/FormApi.kt | 20 +- .../org/openapitools/client/apis/HeaderApi.kt | 10 +- .../org/openapitools/client/apis/PathApi.kt | 10 +- .../org/openapitools/client/apis/QueryApi.kt | 64 ++--- .../org/openapitools/client/apis/AuthApi.kt | 12 +- .../org/openapitools/client/apis/BodyApi.kt | 48 ++-- .../org/openapitools/client/apis/FormApi.kt | 12 +- .../org/openapitools/client/apis/HeaderApi.kt | 6 +- .../org/openapitools/client/apis/PathApi.kt | 6 +- .../org/openapitools/client/apis/QueryApi.kt | 40 +-- .../org/openapitools/client/apis/PetApi.kt | 8 +- .../org/openapitools/client/apis/StoreApi.kt | 4 +- .../org/openapitools/client/apis/UserApi.kt | 6 +- .../openapitools/client/apis/DefaultApi.kt | 2 +- .../openapitools/client/apis/DefaultApi.kt | 16 +- .../org/openapitools/client/apis/BirdApi.kt | 2 +- .../org/openapitools/client/apis/BirdApi.kt | 2 +- .../org/openapitools/client/apis/BirdApi.kt | 2 +- .../openapitools/client/apis/DefaultApi.kt | 2 +- .../openapitools/client/apis/DefaultApi.kt | 2 +- .../org/openapitools/client/apis/PetApi.kt | 8 +- .../org/openapitools/client/apis/StoreApi.kt | 4 +- .../org/openapitools/client/apis/UserApi.kt | 6 +- .../org/openapitools/client/apis/PetApi.kt | 8 +- .../org/openapitools/client/apis/StoreApi.kt | 4 +- .../org/openapitools/client/apis/UserApi.kt | 6 +- .../org/openapitools/client/apis/PetApi.kt | 8 +- .../org/openapitools/client/apis/StoreApi.kt | 4 +- .../org/openapitools/client/apis/UserApi.kt | 6 +- .../org/openapitools/client/apis/PetApi.kt | 8 +- .../org/openapitools/client/apis/StoreApi.kt | 4 +- .../org/openapitools/client/apis/UserApi.kt | 6 +- .../org/openapitools/client/apis/PetApi.kt | 10 +- .../org/openapitools/client/apis/StoreApi.kt | 4 +- .../org/openapitools/client/apis/UserApi.kt | 6 +- .../org/openapitools/client/apis/PetApi.kt | 8 +- .../org/openapitools/client/apis/StoreApi.kt | 4 +- .../org/openapitools/client/apis/UserApi.kt | 6 +- .../org/openapitools/client/apis/PetApi.kt | 48 ++-- .../org/openapitools/client/apis/StoreApi.kt | 24 +- .../org/openapitools/client/apis/UserApi.kt | 48 ++-- .../org/openapitools/client/apis/PetApi.kt | 72 ++--- .../org/openapitools/client/apis/StoreApi.kt | 36 +-- .../org/openapitools/client/apis/UserApi.kt | 56 ++-- .../org/openapitools/client/apis/PetApi.kt | 48 ++-- .../org/openapitools/client/apis/StoreApi.kt | 24 +- .../org/openapitools/client/apis/UserApi.kt | 48 ++-- .../org/openapitools/client/apis/PetApi.kt | 72 ++--- .../org/openapitools/client/apis/StoreApi.kt | 36 +-- .../org/openapitools/client/apis/UserApi.kt | 56 ++-- .../org/openapitools/client/apis/PetApi.kt | 270 +++++++++--------- .../org/openapitools/client/apis/StoreApi.kt | 112 ++++---- .../org/openapitools/client/apis/UserApi.kt | 252 ++++++++-------- .../org/openapitools/client/apis/PetApi.kt | 270 +++++++++--------- .../org/openapitools/client/apis/StoreApi.kt | 112 ++++---- .../org/openapitools/client/apis/UserApi.kt | 252 ++++++++-------- .../org/openapitools/client/apis/PetApi.kt | 270 +++++++++--------- .../org/openapitools/client/apis/StoreApi.kt | 112 ++++---- .../org/openapitools/client/apis/UserApi.kt | 252 ++++++++-------- .../org/openapitools/client/apis/PetApi.kt | 270 +++++++++--------- .../org/openapitools/client/apis/StoreApi.kt | 112 ++++---- .../org/openapitools/client/apis/UserApi.kt | 252 ++++++++-------- .../org/openapitools/client/apis/PetApi.kt | 8 +- .../org/openapitools/client/apis/StoreApi.kt | 4 +- .../org/openapitools/client/apis/UserApi.kt | 6 +- .../org/openapitools/client/apis/PetApi.kt | 8 +- .../org/openapitools/client/apis/StoreApi.kt | 4 +- .../org/openapitools/client/apis/UserApi.kt | 6 +- .../org/openapitools/client/apis/PetApi.kt | 8 +- .../org/openapitools/client/apis/StoreApi.kt | 4 +- .../org/openapitools/client/apis/UserApi.kt | 6 +- .../org/openapitools/client/apis/PetApi.kt | 8 +- .../org/openapitools/client/apis/StoreApi.kt | 4 +- .../org/openapitools/client/apis/UserApi.kt | 6 +- .../org/openapitools/client/apis/PetApi.kt | 8 +- .../org/openapitools/client/apis/StoreApi.kt | 4 +- .../org/openapitools/client/apis/UserApi.kt | 6 +- .../org/openapitools/client/apis/PetApi.kt | 8 +- .../org/openapitools/client/apis/StoreApi.kt | 4 +- .../org/openapitools/client/apis/UserApi.kt | 6 +- .../org/openapitools/client/apis/PetApi.kt | 8 +- .../org/openapitools/client/apis/StoreApi.kt | 4 +- .../org/openapitools/client/apis/UserApi.kt | 6 +- .../org/openapitools/client/apis/PetApi.kt | 8 +- .../org/openapitools/client/apis/StoreApi.kt | 4 +- .../org/openapitools/client/apis/UserApi.kt | 6 +- 99 files changed, 2319 insertions(+), 2006 deletions(-) create mode 100644 modules/openapi-generator/src/test/resources/3_0/kotlin/kotlin-member-collision.yaml diff --git a/modules/openapi-generator/pom.xml b/modules/openapi-generator/pom.xml index b6694a0cf3af..33c30f2b0887 100644 --- a/modules/openapi-generator/pom.xml +++ b/modules/openapi-generator/pom.xml @@ -103,6 +103,47 @@ ${project.build.directory}/lib + + + kotlin-capture-deps + process-test-classes + + copy + + + + + com.squareup.okhttp3 + okhttp-jvm + 5.4.0 + + + com.squareup.okio + okio-jvm + 3.17.0 + + + com.squareup.moshi + moshi + 1.15.2 + + + com.squareup.moshi + moshi-kotlin + 1.15.2 + + + com.squareup.moshi + moshi-adapters + 1.15.2 + + + ${project.build.directory}/kotlin-capture-deps + + @@ -463,38 +504,6 @@ ${kotlin.version} test - - - com.squareup.okhttp3 - okhttp-jvm - 5.4.0 - test - - - com.squareup.okio - okio-jvm - 3.17.0 - test - - - com.squareup.moshi - moshi - 1.15.2 - test - - - com.squareup.moshi - moshi-kotlin - 1.15.2 - test - - - com.squareup.moshi - moshi-adapters - 1.15.2 - test - com.google.guava guava-testlib 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 5863ea6aa180..70140fe42276 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 @@ -1126,12 +1126,12 @@ public String toParamName(String name) { } String paramName = toVariableName(name); - // to avoid conflicts with the template-internal locals generated api - // functions declare: compare the *normalized* name, so spelling variants - // (local_variable_body, LocalVariableBody, ...) cannot slip through and - // collide downstream - if ("localVariableBody".equals(paramName) || "localVariableQuery".equals(paramName) - || "localVariableHeaders".equals(paramName)) { + // All generated api-function locals use the `localVar`/`localVariable` + // prefix (enforced by a template lint test). Compare the *normalized* + // name against that prefix so spelling variants (local_variable_body, + // LocalVariableBody, ...) cannot slip through and collide downstream, + // and future template locals are covered without maintaining a list. + if (paramName.startsWith("localVar")) { return toVariableName("param_" + name); } return paramName; 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 2937b18e940a..04bc1ed1b816 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 @@ -215,12 +215,12 @@ import {{packageName}}.infrastructure.Serializer {{#isModel}} {{#vars}} if ({{{paramName}}}.{{name}} != null) { - put("{{#isDeepObject}}{{#lambda.escapeDollar}}{{vendorExtensions.x-kotlin-param-base-name}}{{/lambda.escapeDollar}}[{{/isDeepObject}}{{#lambda.escapeDollar}}{{baseName}}{{/lambda.escapeDollar}}{{#isDeepObject}}]{{/isDeepObject}}", {{#isContainer}}toMultiValue({{{paramName}}}.{{name}}.toList(), "{{collectionFormat}}"){{/isContainer}}{{^isContainer}}listOf({{#isDateTime}}parseDateToQueryString<{{{dataType}}}>({{{paramName}}}.{{name}}){{/isDateTime}}{{#isDate}}parseDateToQueryString<{{{dataType}}}>({{{paramName}}}.{{name}}){{/isDate}}{{#isEnum}}{{#isString}}{{{paramName}}}.{{name}}.value{{/isString}}{{^isString}}{{{paramName}}}.{{name}}.toString(){{/isString}}{{/isEnum}}{{^isEnum}}{{^isDateTime}}{{^isDate}}{{{paramName}}}.{{name}}.toString(){{/isDate}}{{/isDateTime}}{{/isEnum}}){{/isContainer}}) + put("{{#isDeepObject}}{{#lambda.escapeDollar}}{{vendorExtensions.x-kotlin-param-base-name}}{{/lambda.escapeDollar}}[{{/isDeepObject}}{{#lambda.escapeDollar}}{{baseName}}{{/lambda.escapeDollar}}{{#isDeepObject}}]{{/isDeepObject}}", {{#isContainer}}toMultiValue({{{paramName}}}.{{name}}.toList(), "{{collectionFormat}}"){{/isContainer}}{{^isContainer}}listOf({{#isDateTime}}this@{{classname}}.parseDateToQueryString<{{{dataType}}}>({{{paramName}}}.{{name}}){{/isDateTime}}{{#isDate}}this@{{classname}}.parseDateToQueryString<{{{dataType}}}>({{{paramName}}}.{{name}}){{/isDate}}{{#isEnum}}{{#isString}}{{{paramName}}}.{{name}}.value{{/isString}}{{^isString}}{{{paramName}}}.{{name}}.toString(){{/isString}}{{/isEnum}}{{^isEnum}}{{^isDateTime}}{{^isDate}}{{{paramName}}}.{{name}}.toString(){{/isDate}}{{/isDateTime}}{{/isEnum}}){{/isContainer}}) } {{/vars}} {{/isModel}} {{^isModel}} - put("{{#lambda.escapeDollar}}{{baseName}}{{/lambda.escapeDollar}}", {{#isContainer}}toMultiValue({{{paramName}}}.toList(), "{{collectionFormat}}"){{/isContainer}}{{^isContainer}}listOf({{#isDateTime}}parseDateToQueryString<{{{dataType}}}>({{{paramName}}}){{/isDateTime}}{{#isDate}}parseDateToQueryString<{{{dataType}}}>({{{paramName}}}){{/isDate}}{{#isEnum}}{{#isString}}{{{paramName}}}.value{{/isString}}{{^isString}}{{{paramName}}}.toString(){{/isString}}{{/isEnum}}{{^isEnum}}{{^isDateTime}}{{^isDate}}{{{paramName}}}.toString(){{/isDate}}{{/isDateTime}}{{/isEnum}}){{/isContainer}}) + put("{{#lambda.escapeDollar}}{{baseName}}{{/lambda.escapeDollar}}", {{#isContainer}}toMultiValue({{{paramName}}}.toList(), "{{collectionFormat}}"){{/isContainer}}{{^isContainer}}listOf({{#isDateTime}}this@{{classname}}.parseDateToQueryString<{{{dataType}}}>({{{paramName}}}){{/isDateTime}}{{#isDate}}this@{{classname}}.parseDateToQueryString<{{{dataType}}}>({{{paramName}}}){{/isDate}}{{#isEnum}}{{#isString}}{{{paramName}}}.value{{/isString}}{{^isString}}{{{paramName}}}.toString(){{/isString}}{{/isEnum}}{{^isEnum}}{{^isDateTime}}{{^isDate}}{{{paramName}}}.toString(){{/isDate}}{{/isDateTime}}{{/isEnum}}){{/isContainer}}) {{/isModel}} } {{/required}} @@ -230,12 +230,12 @@ import {{packageName}}.infrastructure.Serializer {{#isModel}} {{#vars}} if ({{{paramName}}}.{{name}} != null) { - put("{{#isDeepObject}}{{#lambda.escapeDollar}}{{vendorExtensions.x-kotlin-param-base-name}}{{/lambda.escapeDollar}}[{{/isDeepObject}}{{#lambda.escapeDollar}}{{baseName}}{{/lambda.escapeDollar}}{{#isDeepObject}}]{{/isDeepObject}}", {{#isContainer}}toMultiValue({{{paramName}}}.{{name}}.toList(), "{{collectionFormat}}"){{/isContainer}}{{^isContainer}}listOf({{#isDateTime}}parseDateToQueryString<{{{dataType}}}>({{{paramName}}}.{{name}}){{/isDateTime}}{{#isDate}}parseDateToQueryString<{{{dataType}}}>({{{paramName}}}.{{name}}){{/isDate}}{{#isEnum}}{{#isString}}{{{paramName}}}.{{name}}.value{{/isString}}{{^isString}}{{{paramName}}}.{{name}}.toString(){{/isString}}{{/isEnum}}{{^isEnum}}{{^isDateTime}}{{^isDate}}{{{paramName}}}.{{name}}.toString(){{/isDate}}{{/isDateTime}}{{/isEnum}}){{/isContainer}}) + put("{{#isDeepObject}}{{#lambda.escapeDollar}}{{vendorExtensions.x-kotlin-param-base-name}}{{/lambda.escapeDollar}}[{{/isDeepObject}}{{#lambda.escapeDollar}}{{baseName}}{{/lambda.escapeDollar}}{{#isDeepObject}}]{{/isDeepObject}}", {{#isContainer}}toMultiValue({{{paramName}}}.{{name}}.toList(), "{{collectionFormat}}"){{/isContainer}}{{^isContainer}}listOf({{#isDateTime}}this@{{classname}}.parseDateToQueryString<{{{dataType}}}>({{{paramName}}}.{{name}}){{/isDateTime}}{{#isDate}}this@{{classname}}.parseDateToQueryString<{{{dataType}}}>({{{paramName}}}.{{name}}){{/isDate}}{{#isEnum}}{{#isString}}{{{paramName}}}.{{name}}.value{{/isString}}{{^isString}}{{{paramName}}}.{{name}}.toString(){{/isString}}{{/isEnum}}{{^isEnum}}{{^isDateTime}}{{^isDate}}{{{paramName}}}.{{name}}.toString(){{/isDate}}{{/isDateTime}}{{/isEnum}}){{/isContainer}}) } {{/vars}} {{/isModel}} {{^isModel}} - put("{{#lambda.escapeDollar}}{{baseName}}{{/lambda.escapeDollar}}", {{#isContainer}}toMultiValue({{{paramName}}}.toList(), "{{collectionFormat}}"){{/isContainer}}{{^isContainer}}listOf({{#isDateTime}}parseDateToQueryString<{{{dataType}}}>({{{paramName}}}){{/isDateTime}}{{#isDate}}parseDateToQueryString<{{{dataType}}}>({{{paramName}}}){{/isDate}}{{#isEnum}}{{#isString}}{{{paramName}}}.value{{/isString}}{{^isString}}{{{paramName}}}.toString(){{/isString}}{{/isEnum}}{{^isEnum}}{{^isDateTime}}{{^isDate}}{{{paramName}}}.toString(){{/isDate}}{{/isDateTime}}{{/isEnum}}){{/isContainer}}) + put("{{#lambda.escapeDollar}}{{baseName}}{{/lambda.escapeDollar}}", {{#isContainer}}toMultiValue({{{paramName}}}.toList(), "{{collectionFormat}}"){{/isContainer}}{{^isContainer}}listOf({{#isDateTime}}this@{{classname}}.parseDateToQueryString<{{{dataType}}}>({{{paramName}}}){{/isDateTime}}{{#isDate}}this@{{classname}}.parseDateToQueryString<{{{dataType}}}>({{{paramName}}}){{/isDate}}{{#isEnum}}{{#isString}}{{{paramName}}}.value{{/isString}}{{^isString}}{{{paramName}}}.toString(){{/isString}}{{/isEnum}}{{^isEnum}}{{^isDateTime}}{{^isDate}}{{{paramName}}}.toString(){{/isDate}}{{/isDateTime}}{{/isEnum}}){{/isContainer}}) {{/isModel}} } {{/isNullable}} @@ -243,12 +243,12 @@ import {{packageName}}.infrastructure.Serializer {{#isModel}} {{#vars}} if ({{{paramName}}}.{{name}} != null) { - put("{{#isDeepObject}}{{#lambda.escapeDollar}}{{vendorExtensions.x-kotlin-param-base-name}}{{/lambda.escapeDollar}}[{{/isDeepObject}}{{#lambda.escapeDollar}}{{baseName}}{{/lambda.escapeDollar}}{{#isDeepObject}}]{{/isDeepObject}}", {{#isContainer}}toMultiValue({{{paramName}}}.{{name}}.toList(), "{{collectionFormat}}"){{/isContainer}}{{^isContainer}}listOf({{#isDateTime}}parseDateToQueryString<{{{dataType}}}>({{{paramName}}}.{{name}}){{/isDateTime}}{{#isDate}}parseDateToQueryString<{{{dataType}}}>({{{paramName}}}.{{name}}){{/isDate}}{{#isEnum}}{{#isString}}{{{paramName}}}.{{name}}.value{{/isString}}{{^isString}}{{{paramName}}}.{{name}}.toString(){{/isString}}{{/isEnum}}{{^isEnum}}{{^isDateTime}}{{^isDate}}{{{paramName}}}.{{name}}.toString(){{/isDate}}{{/isDateTime}}{{/isEnum}}){{/isContainer}}) + put("{{#isDeepObject}}{{#lambda.escapeDollar}}{{vendorExtensions.x-kotlin-param-base-name}}{{/lambda.escapeDollar}}[{{/isDeepObject}}{{#lambda.escapeDollar}}{{baseName}}{{/lambda.escapeDollar}}{{#isDeepObject}}]{{/isDeepObject}}", {{#isContainer}}toMultiValue({{{paramName}}}.{{name}}.toList(), "{{collectionFormat}}"){{/isContainer}}{{^isContainer}}listOf({{#isDateTime}}this@{{classname}}.parseDateToQueryString<{{{dataType}}}>({{{paramName}}}.{{name}}){{/isDateTime}}{{#isDate}}this@{{classname}}.parseDateToQueryString<{{{dataType}}}>({{{paramName}}}.{{name}}){{/isDate}}{{#isEnum}}{{#isString}}{{{paramName}}}.{{name}}.value{{/isString}}{{^isString}}{{{paramName}}}.{{name}}.toString(){{/isString}}{{/isEnum}}{{^isEnum}}{{^isDateTime}}{{^isDate}}{{{paramName}}}.{{name}}.toString(){{/isDate}}{{/isDateTime}}{{/isEnum}}){{/isContainer}}) } {{/vars}} {{/isModel}} {{^isModel}} - put("{{#lambda.escapeDollar}}{{baseName}}{{/lambda.escapeDollar}}", {{#isContainer}}toMultiValue({{{paramName}}}.toList(), "{{collectionFormat}}"){{/isContainer}}{{^isContainer}}listOf({{#isDateTime}}parseDateToQueryString<{{{dataType}}}>({{{paramName}}}){{/isDateTime}}{{#isDate}}parseDateToQueryString<{{{dataType}}}>({{{paramName}}}){{/isDate}}{{#isEnum}}{{#isString}}{{{paramName}}}.value{{/isString}}{{^isString}}{{{paramName}}}.toString(){{/isString}}{{/isEnum}}{{^isEnum}}{{^isDateTime}}{{^isDate}}{{{paramName}}}.toString(){{/isDate}}{{/isDateTime}}{{/isEnum}}){{/isContainer}}) + put("{{#lambda.escapeDollar}}{{baseName}}{{/lambda.escapeDollar}}", {{#isContainer}}toMultiValue({{{paramName}}}.toList(), "{{collectionFormat}}"){{/isContainer}}{{^isContainer}}listOf({{#isDateTime}}this@{{classname}}.parseDateToQueryString<{{{dataType}}}>({{{paramName}}}){{/isDateTime}}{{#isDate}}this@{{classname}}.parseDateToQueryString<{{{dataType}}}>({{{paramName}}}){{/isDate}}{{#isEnum}}{{#isString}}{{{paramName}}}.value{{/isString}}{{^isString}}{{{paramName}}}.toString(){{/isString}}{{/isEnum}}{{^isEnum}}{{^isDateTime}}{{^isDate}}{{{paramName}}}.toString(){{/isDate}}{{/isDateTime}}{{/isEnum}}){{/isContainer}}) {{/isModel}} {{/isNullable}} {{/required}} @@ -271,7 +271,7 @@ import {{packageName}}.infrastructure.Serializer {{^vendorExtensions.x-kotlin-custom-method}} method = RequestMethod.{{httpMethod}}, {{/vendorExtensions.x-kotlin-custom-method}} - 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 = "{{{path}}}"{{#pathParams}}.replace("{"+"{{#lambda.escapeDollar}}{{baseName}}{{/lambda.escapeDollar}}"+"}", this@{{classname}}.encodeURIComponent({{#isContainer}}{{paramName}}.joinToString(","){{/isContainer}}{{^isContainer}}{{{paramName}}}{{#isEnum}}{{^required}}?{{/required}}.value{{/isEnum}}.toString(){{/isContainer}})){{/pathParams}}, query = localVariableQuery, {{#vendorExtensions.x-kotlin-querystring-params}} encodedQueryString = listOfNotNull({{{vendorExtensions.x-kotlin-querystring-params}}}).joinToString("&"), 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 ece096ef5788..6f2e7a5537dc 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 @@ -82,9 +82,9 @@ import {{packageName}}.infrastructure.* @Deprecated(message = "This operation is deprecated.") {{/isDeprecated}} {{^nonPublicApi}}{{#explicitApi}}public {{/explicitApi}}{{/nonPublicApi}}fun {{operationId}}({{#allParams}}{{{paramName}}}: {{#isEnum}}{{#isContainer}}kotlin.collections.List<{{enumName}}{{operationIdCamelCase}}>{{/isContainer}}{{^isContainer}}{{enumName}}{{operationIdCamelCase}}{{/isContainer}}{{/isEnum}}{{^isEnum}}{{{dataType}}}{{/isEnum}}{{^required}}?{{#defaultValue}} = {{>param_default_value}}{{/defaultValue}}{{^defaultValue}} = null{{/defaultValue}}{{/required}}{{^-last}}, {{/-last}}{{/allParams}}): {{#returnType}}{{{returnType}}}{{#nullableReturnType}}?{{/nullableReturnType}}{{/returnType}}{{^returnType}}Unit{{/returnType}} { - {{#returnType}}val result = {{/returnType}}{{operationId}}WithHttpInfo({{#allParams}}{{{paramName}}} = {{{paramName}}}{{^-last}}, {{/-last}}{{/allParams}}) + {{#returnType}}val localVariableResult = {{/returnType}}{{operationId}}WithHttpInfo({{#allParams}}{{{paramName}}} = {{{paramName}}}{{^-last}}, {{/-last}}{{/allParams}}) {{#returnType}} - return result.body{{^nullableReturnType}}!!{{/nullableReturnType}} + return localVariableResult.body{{^nullableReturnType}}!!{{/nullableReturnType}} {{/returnType}} } @@ -94,7 +94,7 @@ 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}}?{{#defaultValue}} = {{>param_default_value}}{{/defaultValue}}{{^defaultValue}} = null{{/defaultValue}}{{/required}}{{^-last}}, {{/-last}}{{/allParams}}): ResponseEntity<{{#returnType}}{{{returnType}}}{{#nullableReturnType}}?{{/nullableReturnType}}{{/returnType}}{{^returnType}}Unit{{/returnType}}> { val localVariableConfig = {{operationId}}RequestConfig({{#allParams}}{{{paramName}}} = {{{paramName}}}{{^-last}}, {{/-last}}{{/allParams}}) - return request<{{#hasBodyParam}}{{#bodyParams}}{{{dataType}}}{{/bodyParams}}{{/hasBodyParam}}{{^hasBodyParam}}{{^hasFormParams}}Unit{{/hasFormParams}}{{#hasFormParams}}Map>{{/hasFormParams}}{{/hasBodyParam}}, {{#returnType}}{{{returnType}}}{{#nullableReturnType}}?{{/nullableReturnType}}{{/returnType}}{{^returnType}}Unit{{/returnType}}>( + return this.request<{{#hasBodyParam}}{{#bodyParams}}{{{dataType}}}{{/bodyParams}}{{/hasBodyParam}}{{^hasBodyParam}}{{^hasFormParams}}Unit{{/hasFormParams}}{{#hasFormParams}}Map>{{/hasFormParams}}{{/hasBodyParam}}, {{#returnType}}{{{returnType}}}{{#nullableReturnType}}?{{/nullableReturnType}}{{/returnType}}{{^returnType}}Unit{{/returnType}}>( localVariableConfig ) } @@ -116,17 +116,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("{{baseName}}", {{#isContainer}}toMultiValue({{{paramName}}}.toList(), "{{collectionFormat}}"){{/isContainer}}{{^isContainer}}listOf({{#isDateTime}}{{packageName}}.infrastructure.parseDateToQueryString<{{{dataType}}}>({{{paramName}}}){{/isDateTime}}{{#isDate}}{{packageName}}.infrastructure.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("{{baseName}}", {{#isContainer}}toMultiValue({{{paramName}}}.toList(), "{{collectionFormat}}"){{/isContainer}}{{^isContainer}}listOf({{#isDateTime}}{{packageName}}.infrastructure.parseDateToQueryString<{{{dataType}}}>({{{paramName}}}){{/isDateTime}}{{#isDate}}{{packageName}}.infrastructure.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("{{baseName}}", {{#isContainer}}toMultiValue({{{paramName}}}.toList(), "{{collectionFormat}}"){{/isContainer}}{{^isContainer}}listOf({{#isDateTime}}{{packageName}}.infrastructure.parseDateToQueryString<{{{dataType}}}>({{{paramName}}}){{/isDateTime}}{{#isDate}}{{packageName}}.infrastructure.parseDateToQueryString<{{{dataType}}}>({{{paramName}}}){{/isDate}}{{^isDateTime}}{{^isDate}}{{{paramName}}}.toString(){{/isDate}}{{/isDateTime}}){{/isContainer}}) {{/isNullable}} {{/required}} {{/queryParams}} @@ -139,7 +139,7 @@ import {{packageName}}.infrastructure.* {{{paramName}}}{{^required}}?{{/required}}.apply { localVariableHeaders["{{baseName}}"] = {{#isContainer}}this.joinToString(separator = collectionDelimiter("{{collectionFormat}}")){{/isContainer}}{{^isContainer}}this.toString(){{/isContainer}} } {{/headerParams}} - val params = mutableMapOf( + val localVariableParams = mutableMapOf( {{#pathParams}} "{{baseName}}" to {{#isContainer}}{{paramName}}.joinToString(","){{/isContainer}}{{^isContainer}}{{{paramName}}}{{#isEnum}}{{^required}}?{{/required}}.value{{/isEnum}}{{/isContainer}}, {{/pathParams}} @@ -148,7 +148,7 @@ import {{packageName}}.infrastructure.* return RequestConfig( method = RequestMethod.{{httpMethod}}, path = "{{{path}}}", - params = params, + params = localVariableParams, query = localVariableQuery, headers = localVariableHeaders, requiresAuthentication = {{#hasAuthMethods}}true{{/hasAuthMethods}}{{^hasAuthMethods}}false{{/hasAuthMethods}}, 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 dfe2b36cd6b9..feafa6468c98 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 @@ -81,7 +81,7 @@ 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}}?{{#defaultValue}} = {{>param_default_value}}{{/defaultValue}}{{^defaultValue}} = null{{/defaultValue}}{{/required}}{{^-last}}, {{/-last}}{{/allParams}}): Mono> { val localVariableConfig = {{operationId}}RequestConfig({{#allParams}}{{{paramName}}} = {{{paramName}}}{{^-last}}, {{/-last}}{{/allParams}}) - return request<{{#hasBodyParam}}{{#bodyParams}}{{{dataType}}}{{/bodyParams}}{{/hasBodyParam}}{{^hasBodyParam}}{{^hasFormParams}}Unit{{/hasFormParams}}{{#hasFormParams}}Map>{{/hasFormParams}}{{/hasBodyParam}}, {{{returnType}}}{{^returnType}}Unit{{/returnType}}>( + return this.request<{{#hasBodyParam}}{{#bodyParams}}{{{dataType}}}{{/bodyParams}}{{/hasBodyParam}}{{^hasBodyParam}}{{^hasFormParams}}Unit{{/hasFormParams}}{{#hasFormParams}}Map>{{/hasFormParams}}{{/hasBodyParam}}, {{{returnType}}}{{^returnType}}Unit{{/returnType}}>( localVariableConfig ) } @@ -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("{{baseName}}", {{#isContainer}}toMultiValue({{{paramName}}}.toList(), "{{collectionFormat}}"){{/isContainer}}{{^isContainer}}listOf({{#isDateTime}}{{packageName}}.infrastructure.parseDateToQueryString<{{{dataType}}}>({{{paramName}}}){{/isDateTime}}{{#isDate}}{{packageName}}.infrastructure.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("{{baseName}}", {{#isContainer}}toMultiValue({{{paramName}}}.toList(), "{{collectionFormat}}"){{/isContainer}}{{^isContainer}}listOf({{#isDateTime}}{{packageName}}.infrastructure.parseDateToQueryString<{{{dataType}}}>({{{paramName}}}){{/isDateTime}}{{#isDate}}{{packageName}}.infrastructure.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("{{baseName}}", {{#isContainer}}toMultiValue({{{paramName}}}.toList(), "{{collectionFormat}}"){{/isContainer}}{{^isContainer}}listOf({{#isDateTime}}{{packageName}}.infrastructure.parseDateToQueryString<{{{dataType}}}>({{{paramName}}}){{/isDateTime}}{{#isDate}}{{packageName}}.infrastructure.parseDateToQueryString<{{{dataType}}}>({{{paramName}}}){{/isDate}}{{^isDateTime}}{{^isDate}}{{{paramName}}}.toString(){{/isDate}}{{/isDateTime}}){{/isContainer}}) {{/isNullable}} {{/required}} {{/queryParams}} @@ -126,7 +126,7 @@ import {{packageName}}.infrastructure.* {{{paramName}}}{{^required}}?{{/required}}.apply { localVariableHeaders["{{baseName}}"] = {{#isContainer}}this.joinToString(separator = collectionDelimiter("{{collectionFormat}}")){{/isContainer}}{{^isContainer}}this.toString(){{/isContainer}} } {{/headerParams}} - val params = mutableMapOf( + val localVariableParams = mutableMapOf( {{#pathParams}} "{{baseName}}" to {{#isContainer}}{{paramName}}.joinToString(","){{/isContainer}}{{^isContainer}}{{{paramName}}}{{#isEnum}}{{^required}}?{{/required}}.value{{/isEnum}}{{/isContainer}}, {{/pathParams}} @@ -135,7 +135,7 @@ import {{packageName}}.infrastructure.* return RequestConfig( method = RequestMethod.{{httpMethod}}, path = "{{{path}}}", - params = params, + params = localVariableParams, query = localVariableQuery, headers = localVariableHeaders, requiresAuthentication = {{#hasAuthMethods}}true{{/hasAuthMethods}}{{^hasAuthMethods}}false{{/hasAuthMethods}}, 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..db7cb1843031 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 @@ -105,18 +105,18 @@ import {{packageName}}.infrastructure.* @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}} { - 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}} + return {{operationId}}WithHttpInfo({{#allParams}}{{{paramName}}} = {{{paramName}}}{{^-last}}, {{/-last}}{{/allParams}}).map { localVariableResponse -> + when (localVariableResponse.responseType) { + ResponseType.Success -> {{#returnType}}(localVariableResponse as Success<*>).data as {{{returnType}}}{{#nullableReturnType}}{{^isResponseOptional}}?{{/isResponseOptional}}{{/nullableReturnType}}{{#isResponseOptional}}?{{/isResponseOptional}}{{/returnType}}{{^returnType}}Unit{{/returnType}} 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) + val localVariableError = localVariableResponse as ClientError<*> + throw ClientException("Client error : ${localVariableError.statusCode} ${localVariableError.message.orEmpty()}", localVariableError.statusCode, localVariableResponse) } ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) + val localVariableError = localVariableResponse as ServerError<*> + throw ServerException("Server error : ${localVariableError.statusCode} ${localVariableError.message.orEmpty()}", localVariableError.statusCode, localVariableResponse) } } }{{#useCoroutines}}.coAwait(){{/useCoroutines}} @@ -137,82 +137,82 @@ import {{packageName}}.infrastructure.* @Deprecated(message = "This operation is deprecated.") {{/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 localVariableClient = WebClient.create(this.vertx) + val localVariableRequest = localVariableClient.requestAbs(HttpMethod.{{httpMethod}}, UriTemplate.of("${this.basePath}{{{path}}}"{{#pathParams}}.replace("{"+"{{baseName}}"+"}", this.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}} + {{#hasFormParams}}localVariableRequest.putHeader("Content-Type", {{^consumes}}"multipart/form-data"{{/consumes}}{{#consumes.0}}"{{{mediaType}}}"{{/consumes.0}}){{/hasFormParams}} + {{#headerParams}}{{{paramName}}}{{^required}}?{{/required}}.apply { localVariableRequest.putHeader("{{baseName}}", {{#isContainer}}this.joinToString(separator = collectionDelimiter("{{collectionFormat}}")){{/isContainer}}{{^isContainer}}this.toString(){{/isContainer}})}{{/headerParams}} {{^hasFormParams}}{{#hasConsumes}} {{#consumes}} - request.putHeader("Content-Type", "{{{mediaType}}}") + localVariableRequest.putHeader("Content-Type", "{{{mediaType}}}") {{/consumes}} {{/hasConsumes}}{{/hasFormParams}} - {{#hasProduces}}request.putHeader("Accept", "{{#produces}}{{{mediaType}}}{{^-last}}, {{/-last}}{{/produces}}"){{/hasProduces}} + {{#hasProduces}}localVariableRequest.putHeader("Accept", "{{#produces}}{{{mediaType}}}{{^-last}}, {{/-last}}{{/produces}}"){{/hasProduces}} {{#hasFormParams}} - val form = io.vertx.core.MultiMap.caseInsensitiveMultiMap(); + val localVariableForm = io.vertx.core.MultiMap.caseInsensitiveMultiMap(); {{#formParams}} - {{{paramName}}}{{^required}}?{{/required}}.let { form.add("{{{baseName}}}", {{{paramName}}}{{#isEnum}}{{^required}}?{{/required}}.value{{/isEnum}}{{^isString}}.toString(){{/isString}}) } + {{{paramName}}}{{^required}}?{{/required}}.let { localVariableForm.add("{{{baseName}}}", {{{paramName}}}{{#isEnum}}{{^required}}?{{/required}}.value{{/isEnum}}{{^isString}}.toString(){{/isString}}) } {{/formParams}} {{/hasFormParams}} {{#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 { localVariableRequest.queryParams().add("{{baseName}}", {{#isContainer}}toMultiValue(it.toList(), "{{collectionFormat}}"){{/isContainer}}{{^isContainer}}listOf({{#isDateTime}}this.parseDateToQueryString<{{{dataType}}}>(it){{/isDateTime}}{{#isDate}}this.parseDateToQueryString<{{{dataType}}}>(it){{/isDate}}{{^isDateTime}}{{^isDate}}it.toString(){{/isDate}}{{/isDateTime}}){{/isContainer}}) } {{/queryParams}} {{/hasQueryParams}} {{#authMethods}} {{#isApiKey}} - if (apiKey["{{keyParamName}}"] != null) { - if (apiKeyPrefix["{{keyParamName}}"] != null) { + if (this.apiKey["{{keyParamName}}"] != null) { + if (this.apiKeyPrefix["{{keyParamName}}"] != null) { {{#isKeyInHeader}} - request.putHeader("{{keyParamName}}", apiKeyPrefix["{{keyParamName}}"]!! + " " + apiKey["{{keyParamName}}"]!!) + localVariableRequest.putHeader("{{keyParamName}}", this.apiKeyPrefix["{{keyParamName}}"]!! + " " + this.apiKey["{{keyParamName}}"]!!) {{/isKeyInHeader}} {{#isKeyInQuery}} - request.queryParams().add("{{keyParamName}}", apiKeyPrefix["{{keyParamName}}"]!! + " " + apiKey["{{keyParamName}}"]!!) + localVariableRequest.queryParams().add("{{keyParamName}}", this.apiKeyPrefix["{{keyParamName}}"]!! + " " + this.apiKey["{{keyParamName}}"]!!) {{/isKeyInQuery}} } else { {{#isKeyInHeader}} - request.putHeader("{{keyParamName}}", apiKey["{{keyParamName}}"]!!) + localVariableRequest.putHeader("{{keyParamName}}", this.apiKey["{{keyParamName}}"]!!) {{/isKeyInHeader}} {{#isKeyInQuery}} - request.queryParams().add("{{keyParamName}}", apiKey["{{keyParamName}}"]!!) + localVariableRequest.queryParams().add("{{keyParamName}}", this.apiKey["{{keyParamName}}"]!!) {{/isKeyInQuery}} } } {{/isApiKey}} {{#isBasic}} {{#isBasicBasic}} - username?.let { username -> - password?.let { password -> - request.basicAuthentication(username, password) + this.username?.let { username -> + this.password?.let { password -> + localVariableRequest.basicAuthentication(username, password) } } {{/isBasicBasic}} {{#isBasicBearer}} - accessToken?.let { accessToken -> - request.bearerTokenAuthentication(accessToken) + this.accessToken?.let { accessToken -> + localVariableRequest.bearerTokenAuthentication(accessToken) } {{/isBasicBearer}} {{/isBasic}} {{#isOAuth}} - accessToken?.let { accessToken -> - request.bearerTokenAuthentication(accessToken) + this.accessToken?.let { accessToken -> + localVariableRequest.bearerTokenAuthentication(accessToken) } {{/isOAuth}} {{/authMethods}} - return request + return localVariableRequest {{#hasBodyParam}} - .sendBuffer(responseBody({{#bodyParams}}{{{paramName}}}{{/bodyParams}})) + .sendBuffer(this.responseBody({{#bodyParams}}{{{paramName}}}{{/bodyParams}})) {{/hasBodyParam}} {{^hasBodyParam}} .send() {{/hasBodyParam}} .map { - val apiResponse: ApiResponse<{{#returnType}}{{{returnType}}}?{{/returnType}}{{^returnType}}Unit?{{/returnType}}> = handleResponse(it) - apiResponse + val localVariableApiResponse: ApiResponse<{{#returnType}}{{{returnType}}}?{{/returnType}}{{^returnType}}Unit?{{/returnType}}> = this.handleResponse(it) + localVariableApiResponse } } 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..52e179535a04 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 @@ -48,14 +48,14 @@ import {{packageName}}.infrastructure.CollectionFormats.* {{/isDeprecated}} {{^nonPublicApi}}{{#explicitApi}}public {{/explicitApi}}{{/nonPublicApi}}suspend fun {{operationId}}({{^allParams}}){{/allParams}}{{#allParams}}{{>queryParams}}{{>pathParams}}{{>headerParams}}{{>bodyParams}}{{>formParams}}{{^-last}}, {{/-last}}{{#-last}}{{#operationAuthMethod}}, opAuthHeaderFactory = () -> map{{/operationAuthMethod}}){{/-last}}{{/allParams}}: {{#returnType}}{{{returnType}}}?{{/returnType}}{{^returnType}}Unit{{/returnType}} { {{#bodyParam}} - val body: Any? = {{paramName}} + val localVariableBody: Any? = {{paramName}} {{/bodyParam}} {{^bodyParam}} - val body: Any? = null + val localVariableBody: Any? = null {{/bodyParam}} - val contentTypes : Array = arrayOf({{#consumes}}"{{{mediaType}}}"{{^-last}},{{/-last}}{{/consumes}}) - val contentType: String = if (contentTypes.isNotEmpty()) { contentTypes.first() } else { "application/json" } + val localVariableContentTypes : Array = arrayOf({{#consumes}}"{{{mediaType}}}"{{^-last}},{{/-last}}{{/consumes}}) + val localVariableContentType: String = if (localVariableContentTypes.isNotEmpty()) { localVariableContentTypes.first() } else { "application/json" } // Do some work or avoid some work based on what we know about the model, // before we delegate to a pluggable request factory template @@ -63,9 +63,9 @@ 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 localVariablePath = "{{{path}}}"{{#pathParams}}.replace("{" + "{{baseName}}" + "}", {{#isContainer}}{{paramName}}.joinToString(","){{/isContainer}}{{^isContainer}}IRequestFactory.escapeString({{{paramName}}}.toString()){{/isContainer}}){{/pathParams}} - val formParams = mapOf({{^formParams}}){{/formParams}}{{#formParams}} + val localVariableFormParams = mapOf({{^formParams}}){{/formParams}}{{#formParams}} "{{baseName}}" to IRequestFactory.parameterToString({{paramName}}){{^-last}},{{/-last}}{{#-last}} ){{/-last}}{{/formParams}} @@ -73,43 +73,43 @@ import {{packageName}}.infrastructure.CollectionFormats.* // TODO: Cater for allowing empty values // 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}} + val localVariableQueryParams = mapOf({{^queryParams}}){{/queryParams}}{{#queryParams}} "{{baseName}}" to IRequestFactory.parameterToString({{paramName}}){{^-last}},{{/-last}}{{#-last}} ){{/-last}}{{/queryParams}} .filter { it.value.isNotEmpty() } - val headerParams: Map = mapOf({{^headerParams}}){{/headerParams}}{{#headerParams}} + val localVariableHeaderParams: Map = mapOf({{^headerParams}}){{/headerParams}}{{#headerParams}} "{{baseName}}" to IRequestFactory.parameterToString({{paramName}}){{^-last}},{{/-last}}{{#-last}} ){{/-last}}{{/headerParams}} return suspendCoroutine { continuation -> - val responseListener = Response.Listener<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}Unit{{/returnType}}> { response -> + val localVariableResponseListener = Response.Listener<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}Unit{{/returnType}}> { response -> continuation.resume(response) } - val errorListener = Response.ErrorListener { error -> + val localVariableErrorListener = Response.ErrorListener { error -> continuation.resumeWithException(error) } - val responseType = object : TypeToken<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}Unit{{/returnType}}>() {}.type + val localVariableResponseType = object : TypeToken<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}Unit{{/returnType}}>() {}.type // Call the correct request builder based on whether we have a return type or a body. // All other switching on types must be done in code inside the builder - val request: Request<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}Unit{{/returnType}}> = requestFactory.build( + val localVariableRequest: Request<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}Unit{{/returnType}}> = this.requestFactory.build( Request.Method.{{httpMethod}}, - "$basePath$path", - body, - headerParams, - queryParams, - formParams, - contentType, - responseType, - responseListener, - errorListener) - - postProcessors.forEach { it.invoke(request) } - - requestQueue.value.add(request) + "${this.basePath}$localVariablePath", + localVariableBody, + localVariableHeaderParams, + localVariableQueryParams, + localVariableFormParams, + localVariableContentType, + localVariableResponseType, + localVariableResponseListener, + localVariableErrorListener) + + this.postProcessors.forEach { it.invoke(localVariableRequest) } + + this.requestQueue.value.add(localVariableRequest) } } {{/operation}} diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/kotlin/KotlinClientCodegenApiTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/kotlin/KotlinClientCodegenApiTest.java index f9fa804d8ba2..508db61b574e 100644 --- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/kotlin/KotlinClientCodegenApiTest.java +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/kotlin/KotlinClientCodegenApiTest.java @@ -22,6 +22,8 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.List; +import java.util.regex.Matcher; +import java.util.regex.Pattern; import java.util.stream.Collectors; import org.openapitools.codegen.config.CodegenConfigurator; @@ -388,6 +390,140 @@ void testJvmOkhttp4DeepObjectCollisionKeepsSpecWireName() throws IOException { } } + /** + * Canary for issue #15: spec parameters named after template-internal locals + * (the localVar prefix family) must be renamed while keeping their wire + * names, and class members must be qualified with `this.` so same-named + * parameters cannot shadow them. Covers every kotlin-client library. + */ + @Test + void testKotlinLibrariesAvoidTemplateLocalCollisions() throws IOException { + String spec = "src/test/resources/3_0/kotlin/kotlin-member-collision.yaml"; + String[][] libraries = { + // {library, api source path, additionalProperties} + {"jvm-vertx", "src/main/kotlin/org/openapitools/client/apis/DefaultApi.kt", "serializationLibrary=jackson"}, + {"jvm-volley", "src/main/java/org/openapitools/client/apis/DefaultApi.kt", "serializationLibrary=gson"}, + {"jvm-spring-restclient", "src/main/kotlin/org/openapitools/client/apis/DefaultApi.kt", "useSpringBoot3=true", "serializationLibrary=jackson"}, + {"jvm-spring-webclient", "src/main/kotlin/org/openapitools/client/apis/DefaultApi.kt", "useSpringBoot3=true", "serializationLibrary=jackson"}, + {"jvm-ktor", "src/main/kotlin/org/openapitools/client/apis/DefaultApi.kt", "serializationLibrary=jackson"}, + {"jvm-retrofit2", "src/main/kotlin/org/openapitools/client/apis/DefaultApi.kt", "serializationLibrary=jackson"}, + {"jvm-okhttp4", "src/main/kotlin/org/openapitools/client/apis/DefaultApi.kt", "serializationLibrary=jackson"}, + {"multiplatform", "src/commonMain/kotlin/org/openapitools/client/apis/DefaultApi.kt", "dateLibrary=kotlinx-datetime"}, + }; + // every library: colliding params are renamed but keep their wire names + String[][] renames = { + {"localVariableAuthNames", "paramLocalVariableAuthNames"}, + {"local_variable_body", "paramLocalVariableBody"}, + {"local_variable_query", "paramLocalVariableQuery"}, + {"localVariableHeaders", "paramLocalVariableHeaders"}, + {"local_variable_response", "paramLocalVariableResponse"}, + }; + for (String[] lib : libraries) { + Path target = Files.createTempDirectory("kotlin-collide-" + lib[0]); + try { + generate(lib[0], spec, target, Arrays.copyOfRange(lib, 2, lib.length)); + Path apiFile = target.resolve(lib[1]); + Assert.assertTrue(Files.exists(apiFile), lib[0] + " must emit " + lib[1]); + String api = new String(Files.readAllBytes(apiFile), StandardCharsets.UTF_8); + for (String[] rename : renames) { + Assert.assertTrue(api.contains(rename[1] + ":"), + lib[0] + ": param " + rename[0] + " must be renamed to " + rename[1]); + Assert.assertTrue(api.contains("\"" + rename[0] + "\""), + lib[0] + ": wire name " + rename[0] + " must be preserved"); + } + switch (lib[0]) { + case "jvm-vertx": + // member refs must be qualified so same-named params cannot shadow them + for (String member : new String[]{"this.vertx", "this.basePath", "this.apiKey", + "this.apiKeyPrefix", "this.username", "this.password", "this.accessToken", + "this.handleResponse(", "this.responseBody(", "this.encodeURIComponent(", + "this.parseDateToQueryString<"}) { + Assert.assertTrue(api.contains(member), "jvm-vertx must qualify " + member); + } + Assert.assertTrue(api.contains("fun basicAuthCollide(username: kotlin.String?"), + "jvm-vertx: spec param names must stay public"); + Assert.assertTrue(api.contains("vertx?.let { localVariableRequest.queryParams().add(\"vertx\""), + "jvm-vertx: vertx param must be wired under its own name"); + Assert.assertTrue(api.contains("localVariableForm.add(\"form\", form)"), + "jvm-vertx: form param must reach the form map"); + break; + case "jvm-volley": + for (String member : new String[]{"this.requestFactory", "this.basePath", + "this.postProcessors", "this.requestQueue"}) { + Assert.assertTrue(api.contains(member), "jvm-volley must qualify " + member); + } + Assert.assertTrue(api.contains("\"form\" to IRequestFactory.parameterToString(form)"), + "jvm-volley: form param must reach the form map"); + Assert.assertTrue(api.contains("\"request\" to IRequestFactory.parameterToString(request)"), + "jvm-volley: request param must reach the request"); + break; + case "jvm-spring-restclient": + Assert.assertTrue(api.contains("this.request<"), + "jvm-spring-restclient: member request() must be qualified"); + Assert.assertTrue(api.contains("val localVariableResult ="), + "jvm-spring-restclient: result local must be prefixed"); + Assert.assertTrue(api.contains("val localVariableParams ="), + "jvm-spring-restclient: params local must be prefixed"); + // parseDateToQueryString is top-level in spring infra, so it must be + // package-qualified (not `this.`) to survive a same-named parameter + Assert.assertTrue(api.contains(".infrastructure.parseDateToQueryString(dueDate)"), + "jvm-spring-restclient: date conversion must call the top-level helper"); + break; + case "jvm-spring-webclient": + Assert.assertTrue(api.contains("this.request<"), + "jvm-spring-webclient: member request() must be qualified"); + Assert.assertTrue(api.contains("val localVariableParams ="), + "jvm-spring-webclient: params local must be prefixed"); + Assert.assertTrue(api.contains(".infrastructure.parseDateToQueryString(dueDate)"), + "jvm-spring-webclient: date conversion must call the top-level helper"); + break; + case "jvm-okhttp4": + // pre-existing locals keep their localVar* spelling + Assert.assertTrue(api.contains("localVarResponse") && api.contains("localVarError"), + "jvm-okhttp4: localVarResponse/localVarError must remain"); + // member calls inside apply{} blocks need a labeled receiver + Assert.assertTrue(api.contains("this@DefaultApi.parseDateToQueryString(dueDate)"), + "jvm-okhttp4: date conversion must reach the api class inside apply{}"); + Assert.assertTrue(api.contains("this@DefaultApi.encodeURIComponent(path.toString())"), + "jvm-okhttp4: path encoding must reach the api class"); + break; + default: + break; + } + } finally { + deleteRecursively(target); + } + } + } + + /** + * Lint guard for issue #15: every `val`/`var` declared at statement level in + * an operation template must use the `localVar` prefix, so spec parameters + * (which are renamed by the toParamName prefix rule) can never collide with + * template-internal locals again. + */ + @Test + void testKotlinApiTemplatesUseLocalVariablePrefix() throws IOException { + Path libs = Path.of("src/main/resources/kotlin-client/libraries"); + Pattern localDecl = Pattern.compile("^\\s*(?:val|var)\\s+([a-zA-Z_]\\w*)"); + List violations = new ArrayList<>(); + try (var stream = Files.walk(libs)) { + for (Path template : stream.filter(p -> p.getFileName().toString().equals("api.mustache") + || p.getFileName().toString().matches("(queryParams|queryParam|explodedQueryParam|pathParams|headerParams|bodyParams|formParams|paramJavadoc)\\.mustache")).toList()) { + int lineNo = 0; + for (String line : Files.readAllLines(template, StandardCharsets.UTF_8)) { + lineNo++; + Matcher m = localDecl.matcher(line.replaceAll("\\{\\{[^}]*\\}\\}", "")); + if (m.find() && !m.group(1).startsWith("localVar")) { + violations.add(template + ":" + lineNo + " declares `" + m.group(1) + "`"); + } + } + } + } + Assert.assertTrue(violations.isEmpty(), + "operation-scope locals must use the localVar prefix:\n" + String.join("\n", violations)); + } + @Test void testNonOkhttpLibrariesSkipOpenApi32Operations() throws IOException { Path target = Files.createTempDirectory("kotlin32-skip"); @@ -449,16 +585,21 @@ void testJvmOkhttp4GeneratedClientSendsVerbatimMethods() throws IOException, Int } // PATH may hold a symlink into the install; resolve it so lib/ is found correctly kotlinc = kotlinc.toRealPath(); + // okhttp5/moshi jars are copied out-of-band by maven-dependency-plugin + // (kotlin-capture-deps): they carry Kotlin 1.8+/2.x metadata that the + // embedded 1.6 compiler in KotlinTestUtils cannot read, so they must + // never sit on the shared test classpath + Path depDir = Path.of("target/kotlin-capture-deps"); List jars; - try { - jars = new ArrayList<>(Arrays.asList( - jarOf(okhttp3.OkHttpClient.class), - jarOf(okio.Buffer.class), - jarOf(com.squareup.moshi.Moshi.class), - jarOf(com.squareup.moshi.kotlin.reflect.KotlinJsonAdapterFactory.class), - jarOf(com.squareup.moshi.adapters.Rfc3339DateJsonAdapter.class))); - } catch (Exception e) { - throw new org.testng.SkipException("okhttp/moshi jars not resolvable from test classpath: " + e); + try (var stream = Files.list(depDir)) { + jars = stream.filter(p -> p.toString().endsWith(".jar")) + .map(p -> p.toAbsolutePath().toString()) + .collect(Collectors.toCollection(ArrayList::new)); + } catch (IOException e) { + throw new org.testng.SkipException("kotlin-capture-deps missing (dependency:copy did not run): " + e); + } + if (jars.size() < 5) { + throw new org.testng.SkipException("expected okhttp/okio/moshi jars in " + depDir + ", found " + jars); } // use the stdlib/reflect bundled with the detected kotlinc so versions match // the compiler (the module's own test classpath pins an older kotlin.version) @@ -501,13 +642,17 @@ void testJvmOkhttp4GeneratedClientSendsVerbatimMethods() throws IOException, Int } } - private static void generate(String library, String spec, Path outputDir) { + private static void generate(String library, String spec, Path outputDir, String... additionalProperties) { final CodegenConfigurator configurator = new CodegenConfigurator() .setGeneratorName("kotlin") .setLibrary(library) .setInputSpec(spec) .setSkipOverwrite(false) .setOutputDir(outputDir.toAbsolutePath().toString().replace("\\", "/")); + for (String kv : additionalProperties) { + int eq = kv.indexOf('='); + configurator.addAdditionalProperty(kv.substring(0, eq), kv.substring(eq + 1)); + } new DefaultGenerator().opts(configurator.toClientOptInput()).generate(); } @@ -523,10 +668,6 @@ private static Path findOnPath(String executable) { return null; } - private static String jarOf(Class marker) throws Exception { - return Path.of(marker.getProtectionDomain().getCodeSource().getLocation().toURI()).toString(); - } - private static String runProcess(Path workDir, String logName, long timeoutSeconds, String... command) throws IOException, InterruptedException { Path log = workDir.resolve(logName); diff --git a/modules/openapi-generator/src/test/resources/3_0/kotlin/kotlin-member-collision.yaml b/modules/openapi-generator/src/test/resources/3_0/kotlin/kotlin-member-collision.yaml new file mode 100644 index 000000000000..83454fc55b4c --- /dev/null +++ b/modules/openapi-generator/src/test/resources/3_0/kotlin/kotlin-member-collision.yaml @@ -0,0 +1,163 @@ +openapi: 3.0.0 +info: + title: member/local collision canary + version: '1' +paths: + /auth-basic: + get: + operationId: basicAuthCollide + security: + - basicAuth: [] + parameters: + - name: username + in: query + schema: {type: string} + - name: password + in: query + schema: {type: string} + - name: basePath + in: query + schema: {type: string} + - name: vertx + in: query + schema: {type: string} + - name: requestFactory + in: query + schema: {type: string} + - name: requestQueue + in: query + schema: {type: string} + - name: postProcessors + in: query + schema: {type: string} + responses: + '200': {description: ok} + /auth-bearer: + get: + operationId: bearerCollide + security: + - bearerAuth: [] + parameters: + - name: accessToken + in: query + schema: {type: string} + responses: + '200': {description: ok} + /auth-apikey: + get: + operationId: apiKeyCollide + security: + - apiKeyAuth: [] + parameters: + - name: apiKey + in: query + schema: {type: string} + - name: apiKeyPrefix + in: query + schema: {type: string} + responses: + '200': {description: ok} + /locals/{path}: + post: + operationId: localsCollide + parameters: + - name: path + in: path + required: true + schema: {type: string} + - name: dueDate + in: query + schema: {type: string, format: date} + - name: localVariableAuthNames + in: query + schema: {type: string} + - name: local_variable_body + in: query + schema: {type: string} + - name: local_variable_query + in: query + schema: {type: string} + - name: localVariableHeaders + in: header + schema: {type: string} + - name: local_variable_response + in: query + schema: {type: string} + - name: request + in: query + schema: {type: string} + - name: responseBody + in: query + schema: {type: string} + - name: handleResponse + in: query + schema: {type: string} + - name: encodeURIComponent + in: query + schema: {type: string} + - name: body + in: query + schema: {type: string} + - name: contentType + in: query + schema: {type: string} + - name: queryParams + in: query + schema: {type: string} + - name: formParams + in: query + schema: {type: string} + - name: headerParams + in: query + schema: {type: string} + - name: result + in: query + schema: {type: string} + - name: params + in: query + schema: {type: string} + - name: responseListener + in: query + schema: {type: string} + - name: errorListener + in: query + schema: {type: string} + - name: responseType + in: query + schema: {type: string} + - name: config + in: query + schema: {type: string} + - name: client + in: query + schema: {type: string} + requestBody: + content: + application/json: + schema: {type: string} + responses: + '200': + description: ok + content: + application/json: + schema: {type: string} + /form-locals: + post: + operationId: formLocalsCollide + requestBody: + content: + application/x-www-form-urlencoded: + schema: + type: object + properties: + form: + type: string + request: + type: string + responses: + '200': {description: ok} +components: + securitySchemes: + basicAuth: {type: http, scheme: basic} + bearerAuth: {type: http, scheme: bearer} + apiKeyAuth: {type: apiKey, in: query, name: X-API-Key} diff --git a/samples/client/echo_api/kotlin-jvm-okhttp/src/main/kotlin/org/openapitools/client/apis/PathApi.kt b/samples/client/echo_api/kotlin-jvm-okhttp/src/main/kotlin/org/openapitools/client/apis/PathApi.kt index fd03755d3f24..40fa1689d636 100644 --- a/samples/client/echo_api/kotlin-jvm-okhttp/src/main/kotlin/org/openapitools/client/apis/PathApi.kt +++ b/samples/client/echo_api/kotlin-jvm-okhttp/src/main/kotlin/org/openapitools/client/apis/PathApi.kt @@ -145,7 +145,7 @@ open class PathApi(basePath: kotlin.String = defaultBasePath, client: Call.Facto return RequestConfig( method = RequestMethod.GET, - path = "/path/string/{path_string}/integer/{path_integer}/{enum_nonref_string_path}/{enum_ref_string_path}".replace("{"+"path_string"+"}", encodeURIComponent(pathString.toString())).replace("{"+"path_integer"+"}", encodeURIComponent(pathInteger.toString())).replace("{"+"enum_nonref_string_path"+"}", encodeURIComponent(enumNonrefStringPath.value.toString())).replace("{"+"enum_ref_string_path"+"}", encodeURIComponent(enumRefStringPath.toString())), + path = "/path/string/{path_string}/integer/{path_integer}/{enum_nonref_string_path}/{enum_ref_string_path}".replace("{"+"path_string"+"}", this@PathApi.encodeURIComponent(pathString.toString())).replace("{"+"path_integer"+"}", this@PathApi.encodeURIComponent(pathInteger.toString())).replace("{"+"enum_nonref_string_path"+"}", this@PathApi.encodeURIComponent(enumNonrefStringPath.value.toString())).replace("{"+"enum_ref_string_path"+"}", this@PathApi.encodeURIComponent(enumRefStringPath.toString())), query = localVariableQuery, headers = localVariableHeaders, requiresAuthentication = false, diff --git a/samples/client/echo_api/kotlin-jvm-okhttp/src/main/kotlin/org/openapitools/client/apis/QueryApi.kt b/samples/client/echo_api/kotlin-jvm-okhttp/src/main/kotlin/org/openapitools/client/apis/QueryApi.kt index 28caeef71df9..fa9572747abe 100644 --- a/samples/client/echo_api/kotlin-jvm-okhttp/src/main/kotlin/org/openapitools/client/apis/QueryApi.kt +++ b/samples/client/echo_api/kotlin-jvm-okhttp/src/main/kotlin/org/openapitools/client/apis/QueryApi.kt @@ -225,10 +225,10 @@ open class QueryApi(basePath: kotlin.String = defaultBasePath, client: Call.Fact val localVariableQuery: MultiValueMap = mutableMapOf>() .apply { if (datetimeQuery != null) { - put("datetime_query", listOf(parseDateToQueryString(datetimeQuery))) + put("datetime_query", listOf(this@QueryApi.parseDateToQueryString(datetimeQuery))) } if (dateQuery != null) { - put("date_query", listOf(parseDateToQueryString(dateQuery))) + put("date_query", listOf(this@QueryApi.parseDateToQueryString(dateQuery))) } if (stringQuery != null) { put("string_query", listOf(stringQuery.toString())) @@ -400,22 +400,22 @@ open class QueryApi(basePath: kotlin.String = defaultBasePath, client: Call.Fact .apply { if (queryObject != null) { if (queryObject.id != null) { - put("queryObject[id]", listOf(queryObject.id.toString())) + put("query_object[id]", listOf(queryObject.id.toString())) } if (queryObject.name != null) { - put("queryObject[name]", listOf(queryObject.name.toString())) + put("query_object[name]", listOf(queryObject.name.toString())) } if (queryObject.category != null) { - put("queryObject[category]", listOf(queryObject.category.toString())) + put("query_object[category]", listOf(queryObject.category.toString())) } if (queryObject.photoUrls != null) { - put("queryObject[photoUrls]", toMultiValue(queryObject.photoUrls.toList(), "")) + put("query_object[photoUrls]", toMultiValue(queryObject.photoUrls.toList(), "")) } if (queryObject.tags != null) { - put("queryObject[tags]", toMultiValue(queryObject.tags.toList(), "")) + put("query_object[tags]", toMultiValue(queryObject.tags.toList(), "")) } if (queryObject.status != null) { - put("queryObject[status]", listOf(queryObject.status.value)) + put("query_object[status]", listOf(queryObject.status.value)) } } } diff --git a/samples/client/echo_api/kotlin-jvm-spring-3-restclient/src/main/kotlin/org/openapitools/client/apis/AuthApi.kt b/samples/client/echo_api/kotlin-jvm-spring-3-restclient/src/main/kotlin/org/openapitools/client/apis/AuthApi.kt index e0d235141ca2..e17285dad04b 100644 --- a/samples/client/echo_api/kotlin-jvm-spring-3-restclient/src/main/kotlin/org/openapitools/client/apis/AuthApi.kt +++ b/samples/client/echo_api/kotlin-jvm-spring-3-restclient/src/main/kotlin/org/openapitools/client/apis/AuthApi.kt @@ -46,14 +46,14 @@ open class AuthApi(client: RestClient) : ApiClient(client) { @Throws(RestClientResponseException::class) fun testAuthHttpBasic(): kotlin.String { - val result = testAuthHttpBasicWithHttpInfo() - return result.body!! + val localVariableResult = testAuthHttpBasicWithHttpInfo() + return localVariableResult.body!! } @Throws(RestClientResponseException::class) fun testAuthHttpBasicWithHttpInfo(): ResponseEntity { val localVariableConfig = testAuthHttpBasicRequestConfig() - return request( + return this.request( localVariableConfig ) } @@ -64,13 +64,13 @@ open class AuthApi(client: RestClient) : ApiClient(client) { val localVariableHeaders: MutableMap = mutableMapOf() localVariableHeaders["Accept"] = "text/plain" - val params = mutableMapOf( + val localVariableParams = mutableMapOf( ) return RequestConfig( method = RequestMethod.POST, path = "/auth/http/basic", - params = params, + params = localVariableParams, query = localVariableQuery, headers = localVariableHeaders, requiresAuthentication = true, @@ -81,14 +81,14 @@ open class AuthApi(client: RestClient) : ApiClient(client) { @Throws(RestClientResponseException::class) fun testAuthHttpBearer(): kotlin.String { - val result = testAuthHttpBearerWithHttpInfo() - return result.body!! + val localVariableResult = testAuthHttpBearerWithHttpInfo() + return localVariableResult.body!! } @Throws(RestClientResponseException::class) fun testAuthHttpBearerWithHttpInfo(): ResponseEntity { val localVariableConfig = testAuthHttpBearerRequestConfig() - return request( + return this.request( localVariableConfig ) } @@ -99,13 +99,13 @@ open class AuthApi(client: RestClient) : ApiClient(client) { val localVariableHeaders: MutableMap = mutableMapOf() localVariableHeaders["Accept"] = "text/plain" - val params = mutableMapOf( + val localVariableParams = mutableMapOf( ) return RequestConfig( method = RequestMethod.POST, path = "/auth/http/bearer", - params = params, + params = localVariableParams, query = localVariableQuery, headers = localVariableHeaders, requiresAuthentication = true, diff --git a/samples/client/echo_api/kotlin-jvm-spring-3-restclient/src/main/kotlin/org/openapitools/client/apis/BodyApi.kt b/samples/client/echo_api/kotlin-jvm-spring-3-restclient/src/main/kotlin/org/openapitools/client/apis/BodyApi.kt index 58730fb29ffd..e8844e7f6b40 100644 --- a/samples/client/echo_api/kotlin-jvm-spring-3-restclient/src/main/kotlin/org/openapitools/client/apis/BodyApi.kt +++ b/samples/client/echo_api/kotlin-jvm-spring-3-restclient/src/main/kotlin/org/openapitools/client/apis/BodyApi.kt @@ -48,14 +48,14 @@ open class BodyApi(client: RestClient) : ApiClient(client) { @Throws(RestClientResponseException::class) fun testBinaryGif(): java.io.File { - val result = testBinaryGifWithHttpInfo() - return result.body!! + val localVariableResult = testBinaryGifWithHttpInfo() + return localVariableResult.body!! } @Throws(RestClientResponseException::class) fun testBinaryGifWithHttpInfo(): ResponseEntity { val localVariableConfig = testBinaryGifRequestConfig() - return request( + return this.request( localVariableConfig ) } @@ -66,13 +66,13 @@ open class BodyApi(client: RestClient) : ApiClient(client) { val localVariableHeaders: MutableMap = mutableMapOf() localVariableHeaders["Accept"] = "image/gif" - val params = mutableMapOf( + val localVariableParams = mutableMapOf( ) return RequestConfig( method = RequestMethod.POST, path = "/binary/gif", - params = params, + params = localVariableParams, query = localVariableQuery, headers = localVariableHeaders, requiresAuthentication = false, @@ -83,14 +83,14 @@ open class BodyApi(client: RestClient) : ApiClient(client) { @Throws(RestClientResponseException::class) fun testBodyApplicationOctetstreamBinary(body: java.io.File? = null): kotlin.String { - val result = testBodyApplicationOctetstreamBinaryWithHttpInfo(body = body) - return result.body!! + val localVariableResult = testBodyApplicationOctetstreamBinaryWithHttpInfo(body = body) + return localVariableResult.body!! } @Throws(RestClientResponseException::class) fun testBodyApplicationOctetstreamBinaryWithHttpInfo(body: java.io.File? = null): ResponseEntity { val localVariableConfig = testBodyApplicationOctetstreamBinaryRequestConfig(body = body) - return request( + return this.request( localVariableConfig ) } @@ -102,13 +102,13 @@ open class BodyApi(client: RestClient) : ApiClient(client) { localVariableHeaders["Content-Type"] = "application/octet-stream" localVariableHeaders["Accept"] = "text/plain" - val params = mutableMapOf( + val localVariableParams = mutableMapOf( ) return RequestConfig( method = RequestMethod.POST, path = "/body/application/octetstream/binary", - params = params, + params = localVariableParams, query = localVariableQuery, headers = localVariableHeaders, requiresAuthentication = false, @@ -119,14 +119,14 @@ open class BodyApi(client: RestClient) : ApiClient(client) { @Throws(RestClientResponseException::class) fun testBodyMultipartFormdataArrayOfBinary(files: kotlin.collections.List): kotlin.String { - val result = testBodyMultipartFormdataArrayOfBinaryWithHttpInfo(files = files) - return result.body!! + val localVariableResult = testBodyMultipartFormdataArrayOfBinaryWithHttpInfo(files = files) + return localVariableResult.body!! } @Throws(RestClientResponseException::class) fun testBodyMultipartFormdataArrayOfBinaryWithHttpInfo(files: kotlin.collections.List): ResponseEntity { val localVariableConfig = testBodyMultipartFormdataArrayOfBinaryRequestConfig(files = files) - return request>, kotlin.String>( + return this.request>, kotlin.String>( localVariableConfig ) } @@ -138,13 +138,13 @@ open class BodyApi(client: RestClient) : ApiClient(client) { val localVariableHeaders: MutableMap = mutableMapOf("Content-Type" to "multipart/form-data") localVariableHeaders["Accept"] = "text/plain" - val params = mutableMapOf( + val localVariableParams = mutableMapOf( ) return RequestConfig( method = RequestMethod.POST, path = "/body/application/octetstream/array_of_binary", - params = params, + params = localVariableParams, query = localVariableQuery, headers = localVariableHeaders, requiresAuthentication = false, @@ -155,14 +155,14 @@ open class BodyApi(client: RestClient) : ApiClient(client) { @Throws(RestClientResponseException::class) fun testBodyMultipartFormdataSingleBinary(myFile: java.io.File? = null): kotlin.String { - val result = testBodyMultipartFormdataSingleBinaryWithHttpInfo(myFile = myFile) - return result.body!! + val localVariableResult = testBodyMultipartFormdataSingleBinaryWithHttpInfo(myFile = myFile) + return localVariableResult.body!! } @Throws(RestClientResponseException::class) fun testBodyMultipartFormdataSingleBinaryWithHttpInfo(myFile: java.io.File? = null): ResponseEntity { val localVariableConfig = testBodyMultipartFormdataSingleBinaryRequestConfig(myFile = myFile) - return request>, kotlin.String>( + return this.request>, kotlin.String>( localVariableConfig ) } @@ -174,13 +174,13 @@ open class BodyApi(client: RestClient) : ApiClient(client) { val localVariableHeaders: MutableMap = mutableMapOf("Content-Type" to "multipart/form-data") localVariableHeaders["Accept"] = "text/plain" - val params = mutableMapOf( + val localVariableParams = mutableMapOf( ) return RequestConfig( method = RequestMethod.POST, path = "/body/application/octetstream/single_binary", - params = params, + params = localVariableParams, query = localVariableQuery, headers = localVariableHeaders, requiresAuthentication = false, @@ -191,14 +191,14 @@ open class BodyApi(client: RestClient) : ApiClient(client) { @Throws(RestClientResponseException::class) fun testEchoBodyFreeFormObjectResponseString(body: kotlin.Any? = null): kotlin.String { - val result = testEchoBodyFreeFormObjectResponseStringWithHttpInfo(body = body) - return result.body!! + val localVariableResult = testEchoBodyFreeFormObjectResponseStringWithHttpInfo(body = body) + return localVariableResult.body!! } @Throws(RestClientResponseException::class) fun testEchoBodyFreeFormObjectResponseStringWithHttpInfo(body: kotlin.Any? = null): ResponseEntity { val localVariableConfig = testEchoBodyFreeFormObjectResponseStringRequestConfig(body = body) - return request( + return this.request( localVariableConfig ) } @@ -210,13 +210,13 @@ open class BodyApi(client: RestClient) : ApiClient(client) { localVariableHeaders["Content-Type"] = "application/json" localVariableHeaders["Accept"] = "text/plain" - val params = mutableMapOf( + val localVariableParams = mutableMapOf( ) return RequestConfig( method = RequestMethod.POST, path = "/echo/body/FreeFormObject/response_string", - params = params, + params = localVariableParams, query = localVariableQuery, headers = localVariableHeaders, requiresAuthentication = false, @@ -227,14 +227,14 @@ open class BodyApi(client: RestClient) : ApiClient(client) { @Throws(RestClientResponseException::class) fun testEchoBodyPet(pet: Pet? = null): Pet { - val result = testEchoBodyPetWithHttpInfo(pet = pet) - return result.body!! + val localVariableResult = testEchoBodyPetWithHttpInfo(pet = pet) + return localVariableResult.body!! } @Throws(RestClientResponseException::class) fun testEchoBodyPetWithHttpInfo(pet: Pet? = null): ResponseEntity { val localVariableConfig = testEchoBodyPetRequestConfig(pet = pet) - return request( + return this.request( localVariableConfig ) } @@ -246,13 +246,13 @@ open class BodyApi(client: RestClient) : ApiClient(client) { localVariableHeaders["Content-Type"] = "application/json" localVariableHeaders["Accept"] = "application/json" - val params = mutableMapOf( + val localVariableParams = mutableMapOf( ) return RequestConfig( method = RequestMethod.POST, path = "/echo/body/Pet", - params = params, + params = localVariableParams, query = localVariableQuery, headers = localVariableHeaders, requiresAuthentication = false, @@ -263,14 +263,14 @@ open class BodyApi(client: RestClient) : ApiClient(client) { @Throws(RestClientResponseException::class) fun testEchoBodyPetResponseString(pet: Pet? = null): kotlin.String { - val result = testEchoBodyPetResponseStringWithHttpInfo(pet = pet) - return result.body!! + val localVariableResult = testEchoBodyPetResponseStringWithHttpInfo(pet = pet) + return localVariableResult.body!! } @Throws(RestClientResponseException::class) fun testEchoBodyPetResponseStringWithHttpInfo(pet: Pet? = null): ResponseEntity { val localVariableConfig = testEchoBodyPetResponseStringRequestConfig(pet = pet) - return request( + return this.request( localVariableConfig ) } @@ -282,13 +282,13 @@ open class BodyApi(client: RestClient) : ApiClient(client) { localVariableHeaders["Content-Type"] = "application/json" localVariableHeaders["Accept"] = "text/plain" - val params = mutableMapOf( + val localVariableParams = mutableMapOf( ) return RequestConfig( method = RequestMethod.POST, path = "/echo/body/Pet/response_string", - params = params, + params = localVariableParams, query = localVariableQuery, headers = localVariableHeaders, requiresAuthentication = false, @@ -299,14 +299,14 @@ open class BodyApi(client: RestClient) : ApiClient(client) { @Throws(RestClientResponseException::class) fun testEchoBodyTagResponseString(tag: Tag? = null): kotlin.String { - val result = testEchoBodyTagResponseStringWithHttpInfo(tag = tag) - return result.body!! + val localVariableResult = testEchoBodyTagResponseStringWithHttpInfo(tag = tag) + return localVariableResult.body!! } @Throws(RestClientResponseException::class) fun testEchoBodyTagResponseStringWithHttpInfo(tag: Tag? = null): ResponseEntity { val localVariableConfig = testEchoBodyTagResponseStringRequestConfig(tag = tag) - return request( + return this.request( localVariableConfig ) } @@ -318,13 +318,13 @@ open class BodyApi(client: RestClient) : ApiClient(client) { localVariableHeaders["Content-Type"] = "application/json" localVariableHeaders["Accept"] = "text/plain" - val params = mutableMapOf( + val localVariableParams = mutableMapOf( ) return RequestConfig( method = RequestMethod.POST, path = "/echo/body/Tag/response_string", - params = params, + params = localVariableParams, query = localVariableQuery, headers = localVariableHeaders, requiresAuthentication = false, diff --git a/samples/client/echo_api/kotlin-jvm-spring-3-restclient/src/main/kotlin/org/openapitools/client/apis/FormApi.kt b/samples/client/echo_api/kotlin-jvm-spring-3-restclient/src/main/kotlin/org/openapitools/client/apis/FormApi.kt index 8ad7abcf78af..0f1bdea59122 100644 --- a/samples/client/echo_api/kotlin-jvm-spring-3-restclient/src/main/kotlin/org/openapitools/client/apis/FormApi.kt +++ b/samples/client/echo_api/kotlin-jvm-spring-3-restclient/src/main/kotlin/org/openapitools/client/apis/FormApi.kt @@ -46,14 +46,14 @@ open class FormApi(client: RestClient) : ApiClient(client) { @Throws(RestClientResponseException::class) fun testFormIntegerBooleanString(integerForm: kotlin.Int? = null, booleanForm: kotlin.Boolean? = null, stringForm: kotlin.String? = null): kotlin.String { - val result = testFormIntegerBooleanStringWithHttpInfo(integerForm = integerForm, booleanForm = booleanForm, stringForm = stringForm) - return result.body!! + val localVariableResult = testFormIntegerBooleanStringWithHttpInfo(integerForm = integerForm, booleanForm = booleanForm, stringForm = stringForm) + return localVariableResult.body!! } @Throws(RestClientResponseException::class) fun testFormIntegerBooleanStringWithHttpInfo(integerForm: kotlin.Int? = null, booleanForm: kotlin.Boolean? = null, stringForm: kotlin.String? = null): ResponseEntity { val localVariableConfig = testFormIntegerBooleanStringRequestConfig(integerForm = integerForm, booleanForm = booleanForm, stringForm = stringForm) - return request>, kotlin.String>( + return this.request>, kotlin.String>( localVariableConfig ) } @@ -67,13 +67,13 @@ open class FormApi(client: RestClient) : ApiClient(client) { val localVariableHeaders: MutableMap = mutableMapOf("Content-Type" to "application/x-www-form-urlencoded") localVariableHeaders["Accept"] = "text/plain" - val params = mutableMapOf( + val localVariableParams = mutableMapOf( ) return RequestConfig( method = RequestMethod.POST, path = "/form/integer/boolean/string", - params = params, + params = localVariableParams, query = localVariableQuery, headers = localVariableHeaders, requiresAuthentication = false, @@ -84,14 +84,14 @@ open class FormApi(client: RestClient) : ApiClient(client) { @Throws(RestClientResponseException::class) fun testFormOneof(form1: kotlin.String? = null, form2: kotlin.Int? = null, form3: kotlin.String? = null, form4: kotlin.Boolean? = null, id: kotlin.Long? = null, name: kotlin.String? = null): kotlin.String { - val result = testFormOneofWithHttpInfo(form1 = form1, form2 = form2, form3 = form3, form4 = form4, id = id, name = name) - return result.body!! + val localVariableResult = testFormOneofWithHttpInfo(form1 = form1, form2 = form2, form3 = form3, form4 = form4, id = id, name = name) + return localVariableResult.body!! } @Throws(RestClientResponseException::class) fun testFormOneofWithHttpInfo(form1: kotlin.String? = null, form2: kotlin.Int? = null, form3: kotlin.String? = null, form4: kotlin.Boolean? = null, id: kotlin.Long? = null, name: kotlin.String? = null): ResponseEntity { val localVariableConfig = testFormOneofRequestConfig(form1 = form1, form2 = form2, form3 = form3, form4 = form4, id = id, name = name) - return request>, kotlin.String>( + return this.request>, kotlin.String>( localVariableConfig ) } @@ -108,13 +108,13 @@ open class FormApi(client: RestClient) : ApiClient(client) { val localVariableHeaders: MutableMap = mutableMapOf("Content-Type" to "application/x-www-form-urlencoded") localVariableHeaders["Accept"] = "text/plain" - val params = mutableMapOf( + val localVariableParams = mutableMapOf( ) return RequestConfig( method = RequestMethod.POST, path = "/form/oneof", - params = params, + params = localVariableParams, query = localVariableQuery, headers = localVariableHeaders, requiresAuthentication = false, diff --git a/samples/client/echo_api/kotlin-jvm-spring-3-restclient/src/main/kotlin/org/openapitools/client/apis/HeaderApi.kt b/samples/client/echo_api/kotlin-jvm-spring-3-restclient/src/main/kotlin/org/openapitools/client/apis/HeaderApi.kt index 3e8e6cc0cd25..53bc6a34013b 100644 --- a/samples/client/echo_api/kotlin-jvm-spring-3-restclient/src/main/kotlin/org/openapitools/client/apis/HeaderApi.kt +++ b/samples/client/echo_api/kotlin-jvm-spring-3-restclient/src/main/kotlin/org/openapitools/client/apis/HeaderApi.kt @@ -56,14 +56,14 @@ open class HeaderApi(client: RestClient) : ApiClient(client) { @Throws(RestClientResponseException::class) fun testHeaderIntegerBooleanStringEnums(integerHeader: kotlin.Int? = null, booleanHeader: kotlin.Boolean? = null, stringHeader: kotlin.String? = null, enumNonrefStringHeader: EnumNonrefStringHeaderTestHeaderIntegerBooleanStringEnums? = null, enumRefStringHeader: StringEnumRef? = null): kotlin.String { - val result = testHeaderIntegerBooleanStringEnumsWithHttpInfo(integerHeader = integerHeader, booleanHeader = booleanHeader, stringHeader = stringHeader, enumNonrefStringHeader = enumNonrefStringHeader, enumRefStringHeader = enumRefStringHeader) - return result.body!! + val localVariableResult = testHeaderIntegerBooleanStringEnumsWithHttpInfo(integerHeader = integerHeader, booleanHeader = booleanHeader, stringHeader = stringHeader, enumNonrefStringHeader = enumNonrefStringHeader, enumRefStringHeader = enumRefStringHeader) + return localVariableResult.body!! } @Throws(RestClientResponseException::class) fun testHeaderIntegerBooleanStringEnumsWithHttpInfo(integerHeader: kotlin.Int? = null, booleanHeader: kotlin.Boolean? = null, stringHeader: kotlin.String? = null, enumNonrefStringHeader: EnumNonrefStringHeaderTestHeaderIntegerBooleanStringEnums? = null, enumRefStringHeader: StringEnumRef? = null): ResponseEntity { val localVariableConfig = testHeaderIntegerBooleanStringEnumsRequestConfig(integerHeader = integerHeader, booleanHeader = booleanHeader, stringHeader = stringHeader, enumNonrefStringHeader = enumNonrefStringHeader, enumRefStringHeader = enumRefStringHeader) - return request( + return this.request( localVariableConfig ) } @@ -79,13 +79,13 @@ open class HeaderApi(client: RestClient) : ApiClient(client) { enumNonrefStringHeader?.apply { localVariableHeaders["enum_nonref_string_header"] = this.toString() } enumRefStringHeader?.apply { localVariableHeaders["enum_ref_string_header"] = this.toString() } - val params = mutableMapOf( + val localVariableParams = mutableMapOf( ) return RequestConfig( method = RequestMethod.GET, path = "/header/integer/boolean/string/enums", - params = params, + params = localVariableParams, query = localVariableQuery, headers = localVariableHeaders, requiresAuthentication = false, diff --git a/samples/client/echo_api/kotlin-jvm-spring-3-restclient/src/main/kotlin/org/openapitools/client/apis/PathApi.kt b/samples/client/echo_api/kotlin-jvm-spring-3-restclient/src/main/kotlin/org/openapitools/client/apis/PathApi.kt index 4f32bb0f39c3..356779d4ddcd 100644 --- a/samples/client/echo_api/kotlin-jvm-spring-3-restclient/src/main/kotlin/org/openapitools/client/apis/PathApi.kt +++ b/samples/client/echo_api/kotlin-jvm-spring-3-restclient/src/main/kotlin/org/openapitools/client/apis/PathApi.kt @@ -56,14 +56,14 @@ open class PathApi(client: RestClient) : ApiClient(client) { @Throws(RestClientResponseException::class) fun testsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPath(pathString: kotlin.String, pathInteger: kotlin.Int, enumNonrefStringPath: EnumNonrefStringPathTestsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPath, enumRefStringPath: StringEnumRef): kotlin.String { - val result = testsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPathWithHttpInfo(pathString = pathString, pathInteger = pathInteger, enumNonrefStringPath = enumNonrefStringPath, enumRefStringPath = enumRefStringPath) - return result.body!! + val localVariableResult = testsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPathWithHttpInfo(pathString = pathString, pathInteger = pathInteger, enumNonrefStringPath = enumNonrefStringPath, enumRefStringPath = enumRefStringPath) + return localVariableResult.body!! } @Throws(RestClientResponseException::class) fun testsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPathWithHttpInfo(pathString: kotlin.String, pathInteger: kotlin.Int, enumNonrefStringPath: EnumNonrefStringPathTestsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPath, enumRefStringPath: StringEnumRef): ResponseEntity { val localVariableConfig = testsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPathRequestConfig(pathString = pathString, pathInteger = pathInteger, enumNonrefStringPath = enumNonrefStringPath, enumRefStringPath = enumRefStringPath) - return request( + return this.request( localVariableConfig ) } @@ -74,7 +74,7 @@ open class PathApi(client: RestClient) : ApiClient(client) { val localVariableHeaders: MutableMap = mutableMapOf() localVariableHeaders["Accept"] = "text/plain" - val params = mutableMapOf( + val localVariableParams = mutableMapOf( "path_string" to pathString, "path_integer" to pathInteger, "enum_nonref_string_path" to enumNonrefStringPath.value, @@ -84,7 +84,7 @@ open class PathApi(client: RestClient) : ApiClient(client) { return RequestConfig( method = RequestMethod.GET, path = "/path/string/{path_string}/integer/{path_integer}/{enum_nonref_string_path}/{enum_ref_string_path}", - params = params, + params = localVariableParams, query = localVariableQuery, headers = localVariableHeaders, requiresAuthentication = false, diff --git a/samples/client/echo_api/kotlin-jvm-spring-3-restclient/src/main/kotlin/org/openapitools/client/apis/QueryApi.kt b/samples/client/echo_api/kotlin-jvm-spring-3-restclient/src/main/kotlin/org/openapitools/client/apis/QueryApi.kt index d08625d6a804..556c019df1ca 100644 --- a/samples/client/echo_api/kotlin-jvm-spring-3-restclient/src/main/kotlin/org/openapitools/client/apis/QueryApi.kt +++ b/samples/client/echo_api/kotlin-jvm-spring-3-restclient/src/main/kotlin/org/openapitools/client/apis/QueryApi.kt @@ -58,14 +58,14 @@ open class QueryApi(client: RestClient) : ApiClient(client) { @Throws(RestClientResponseException::class) fun testEnumRefString(enumNonrefStringQuery: EnumNonrefStringQueryTestEnumRefString? = null, enumRefStringQuery: StringEnumRef? = null): kotlin.String { - val result = testEnumRefStringWithHttpInfo(enumNonrefStringQuery = enumNonrefStringQuery, enumRefStringQuery = enumRefStringQuery) - return result.body!! + val localVariableResult = testEnumRefStringWithHttpInfo(enumNonrefStringQuery = enumNonrefStringQuery, enumRefStringQuery = enumRefStringQuery) + return localVariableResult.body!! } @Throws(RestClientResponseException::class) fun testEnumRefStringWithHttpInfo(enumNonrefStringQuery: EnumNonrefStringQueryTestEnumRefString? = null, enumRefStringQuery: StringEnumRef? = null): ResponseEntity { val localVariableConfig = testEnumRefStringRequestConfig(enumNonrefStringQuery = enumNonrefStringQuery, enumRefStringQuery = enumRefStringQuery) - return request( + return this.request( localVariableConfig ) } @@ -84,13 +84,13 @@ open class QueryApi(client: RestClient) : ApiClient(client) { val localVariableHeaders: MutableMap = mutableMapOf() localVariableHeaders["Accept"] = "text/plain" - val params = mutableMapOf( + val localVariableParams = mutableMapOf( ) return RequestConfig( method = RequestMethod.GET, path = "/query/enum_ref_string", - params = params, + params = localVariableParams, query = localVariableQuery, headers = localVariableHeaders, requiresAuthentication = false, @@ -101,14 +101,14 @@ open class QueryApi(client: RestClient) : ApiClient(client) { @Throws(RestClientResponseException::class) fun testQueryDatetimeDateString(datetimeQuery: java.time.OffsetDateTime? = null, dateQuery: java.time.LocalDate? = null, stringQuery: kotlin.String? = null): kotlin.String { - val result = testQueryDatetimeDateStringWithHttpInfo(datetimeQuery = datetimeQuery, dateQuery = dateQuery, stringQuery = stringQuery) - return result.body!! + val localVariableResult = testQueryDatetimeDateStringWithHttpInfo(datetimeQuery = datetimeQuery, dateQuery = dateQuery, stringQuery = stringQuery) + return localVariableResult.body!! } @Throws(RestClientResponseException::class) fun testQueryDatetimeDateStringWithHttpInfo(datetimeQuery: java.time.OffsetDateTime? = null, dateQuery: java.time.LocalDate? = null, stringQuery: kotlin.String? = null): ResponseEntity { val localVariableConfig = testQueryDatetimeDateStringRequestConfig(datetimeQuery = datetimeQuery, dateQuery = dateQuery, stringQuery = stringQuery) - return request( + return this.request( localVariableConfig ) } @@ -118,10 +118,10 @@ open class QueryApi(client: RestClient) : ApiClient(client) { val localVariableQuery = mutableMapOf>() .apply { if (datetimeQuery != null) { - put("datetime_query", listOf(parseDateToQueryString(datetimeQuery))) + put("datetime_query", listOf(org.openapitools.client.infrastructure.parseDateToQueryString(datetimeQuery))) } if (dateQuery != null) { - put("date_query", listOf(parseDateToQueryString(dateQuery))) + put("date_query", listOf(org.openapitools.client.infrastructure.parseDateToQueryString(dateQuery))) } if (stringQuery != null) { put("string_query", listOf(stringQuery.toString())) @@ -130,13 +130,13 @@ open class QueryApi(client: RestClient) : ApiClient(client) { val localVariableHeaders: MutableMap = mutableMapOf() localVariableHeaders["Accept"] = "text/plain" - val params = mutableMapOf( + val localVariableParams = mutableMapOf( ) return RequestConfig( method = RequestMethod.GET, path = "/query/datetime/date/string", - params = params, + params = localVariableParams, query = localVariableQuery, headers = localVariableHeaders, requiresAuthentication = false, @@ -147,14 +147,14 @@ open class QueryApi(client: RestClient) : ApiClient(client) { @Throws(RestClientResponseException::class) fun testQueryIntegerBooleanString(integerQuery: kotlin.Int? = null, booleanQuery: kotlin.Boolean? = null, stringQuery: kotlin.String? = null): kotlin.String { - val result = testQueryIntegerBooleanStringWithHttpInfo(integerQuery = integerQuery, booleanQuery = booleanQuery, stringQuery = stringQuery) - return result.body!! + val localVariableResult = testQueryIntegerBooleanStringWithHttpInfo(integerQuery = integerQuery, booleanQuery = booleanQuery, stringQuery = stringQuery) + return localVariableResult.body!! } @Throws(RestClientResponseException::class) fun testQueryIntegerBooleanStringWithHttpInfo(integerQuery: kotlin.Int? = null, booleanQuery: kotlin.Boolean? = null, stringQuery: kotlin.String? = null): ResponseEntity { val localVariableConfig = testQueryIntegerBooleanStringRequestConfig(integerQuery = integerQuery, booleanQuery = booleanQuery, stringQuery = stringQuery) - return request( + return this.request( localVariableConfig ) } @@ -176,13 +176,13 @@ open class QueryApi(client: RestClient) : ApiClient(client) { val localVariableHeaders: MutableMap = mutableMapOf() localVariableHeaders["Accept"] = "text/plain" - val params = mutableMapOf( + val localVariableParams = mutableMapOf( ) return RequestConfig( method = RequestMethod.GET, path = "/query/integer/boolean/string", - params = params, + params = localVariableParams, query = localVariableQuery, headers = localVariableHeaders, requiresAuthentication = false, @@ -193,14 +193,14 @@ open class QueryApi(client: RestClient) : ApiClient(client) { @Throws(RestClientResponseException::class) fun testQueryStyleDeepObjectExplodeTrueObject(queryObject: Pet? = null): kotlin.String { - val result = testQueryStyleDeepObjectExplodeTrueObjectWithHttpInfo(queryObject = queryObject) - return result.body!! + val localVariableResult = testQueryStyleDeepObjectExplodeTrueObjectWithHttpInfo(queryObject = queryObject) + return localVariableResult.body!! } @Throws(RestClientResponseException::class) fun testQueryStyleDeepObjectExplodeTrueObjectWithHttpInfo(queryObject: Pet? = null): ResponseEntity { val localVariableConfig = testQueryStyleDeepObjectExplodeTrueObjectRequestConfig(queryObject = queryObject) - return request( + return this.request( localVariableConfig ) } @@ -216,13 +216,13 @@ open class QueryApi(client: RestClient) : ApiClient(client) { val localVariableHeaders: MutableMap = mutableMapOf() localVariableHeaders["Accept"] = "text/plain" - val params = mutableMapOf( + val localVariableParams = mutableMapOf( ) return RequestConfig( method = RequestMethod.GET, path = "/query/style_deepObject/explode_true/object", - params = params, + params = localVariableParams, query = localVariableQuery, headers = localVariableHeaders, requiresAuthentication = false, @@ -233,14 +233,14 @@ open class QueryApi(client: RestClient) : ApiClient(client) { @Throws(RestClientResponseException::class) fun testQueryStyleFormExplodeTrueArrayString(queryObject: TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter? = null): kotlin.String { - val result = testQueryStyleFormExplodeTrueArrayStringWithHttpInfo(queryObject = queryObject) - return result.body!! + val localVariableResult = testQueryStyleFormExplodeTrueArrayStringWithHttpInfo(queryObject = queryObject) + return localVariableResult.body!! } @Throws(RestClientResponseException::class) fun testQueryStyleFormExplodeTrueArrayStringWithHttpInfo(queryObject: TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter? = null): ResponseEntity { val localVariableConfig = testQueryStyleFormExplodeTrueArrayStringRequestConfig(queryObject = queryObject) - return request( + return this.request( localVariableConfig ) } @@ -256,13 +256,13 @@ open class QueryApi(client: RestClient) : ApiClient(client) { val localVariableHeaders: MutableMap = mutableMapOf() localVariableHeaders["Accept"] = "text/plain" - val params = mutableMapOf( + val localVariableParams = mutableMapOf( ) return RequestConfig( method = RequestMethod.GET, path = "/query/style_form/explode_true/array_string", - params = params, + params = localVariableParams, query = localVariableQuery, headers = localVariableHeaders, requiresAuthentication = false, @@ -273,14 +273,14 @@ open class QueryApi(client: RestClient) : ApiClient(client) { @Throws(RestClientResponseException::class) fun testQueryStyleFormExplodeTrueObject(queryObject: Pet? = null): kotlin.String { - val result = testQueryStyleFormExplodeTrueObjectWithHttpInfo(queryObject = queryObject) - return result.body!! + val localVariableResult = testQueryStyleFormExplodeTrueObjectWithHttpInfo(queryObject = queryObject) + return localVariableResult.body!! } @Throws(RestClientResponseException::class) fun testQueryStyleFormExplodeTrueObjectWithHttpInfo(queryObject: Pet? = null): ResponseEntity { val localVariableConfig = testQueryStyleFormExplodeTrueObjectRequestConfig(queryObject = queryObject) - return request( + return this.request( localVariableConfig ) } @@ -296,13 +296,13 @@ open class QueryApi(client: RestClient) : ApiClient(client) { val localVariableHeaders: MutableMap = mutableMapOf() localVariableHeaders["Accept"] = "text/plain" - val params = mutableMapOf( + val localVariableParams = mutableMapOf( ) return RequestConfig( method = RequestMethod.GET, path = "/query/style_form/explode_true/object", - params = params, + params = localVariableParams, query = localVariableQuery, headers = localVariableHeaders, requiresAuthentication = false, diff --git a/samples/client/echo_api/kotlin-jvm-spring-3-webclient/src/main/kotlin/org/openapitools/client/apis/AuthApi.kt b/samples/client/echo_api/kotlin-jvm-spring-3-webclient/src/main/kotlin/org/openapitools/client/apis/AuthApi.kt index 323a7a3ceec0..afee3f32d858 100644 --- a/samples/client/echo_api/kotlin-jvm-spring-3-webclient/src/main/kotlin/org/openapitools/client/apis/AuthApi.kt +++ b/samples/client/echo_api/kotlin-jvm-spring-3-webclient/src/main/kotlin/org/openapitools/client/apis/AuthApi.kt @@ -57,7 +57,7 @@ open class AuthApi(client: WebClient) : ApiClient(client) { @Throws(WebClientResponseException::class) fun testAuthHttpBasicWithHttpInfo(): Mono> { val localVariableConfig = testAuthHttpBasicRequestConfig() - return request( + return this.request( localVariableConfig ) } @@ -68,13 +68,13 @@ open class AuthApi(client: WebClient) : ApiClient(client) { val localVariableHeaders: MutableMap = mutableMapOf() localVariableHeaders["Accept"] = "text/plain" - val params = mutableMapOf( + val localVariableParams = mutableMapOf( ) return RequestConfig( method = RequestMethod.POST, path = "/auth/http/basic", - params = params, + params = localVariableParams, query = localVariableQuery, headers = localVariableHeaders, requiresAuthentication = true, @@ -92,7 +92,7 @@ open class AuthApi(client: WebClient) : ApiClient(client) { @Throws(WebClientResponseException::class) fun testAuthHttpBearerWithHttpInfo(): Mono> { val localVariableConfig = testAuthHttpBearerRequestConfig() - return request( + return this.request( localVariableConfig ) } @@ -103,13 +103,13 @@ open class AuthApi(client: WebClient) : ApiClient(client) { val localVariableHeaders: MutableMap = mutableMapOf() localVariableHeaders["Accept"] = "text/plain" - val params = mutableMapOf( + val localVariableParams = mutableMapOf( ) return RequestConfig( method = RequestMethod.POST, path = "/auth/http/bearer", - params = params, + params = localVariableParams, query = localVariableQuery, headers = localVariableHeaders, requiresAuthentication = true, diff --git a/samples/client/echo_api/kotlin-jvm-spring-3-webclient/src/main/kotlin/org/openapitools/client/apis/BodyApi.kt b/samples/client/echo_api/kotlin-jvm-spring-3-webclient/src/main/kotlin/org/openapitools/client/apis/BodyApi.kt index e406c140847a..2a0f2fb88785 100644 --- a/samples/client/echo_api/kotlin-jvm-spring-3-webclient/src/main/kotlin/org/openapitools/client/apis/BodyApi.kt +++ b/samples/client/echo_api/kotlin-jvm-spring-3-webclient/src/main/kotlin/org/openapitools/client/apis/BodyApi.kt @@ -59,7 +59,7 @@ open class BodyApi(client: WebClient) : ApiClient(client) { @Throws(WebClientResponseException::class) fun testBinaryGifWithHttpInfo(): Mono> { val localVariableConfig = testBinaryGifRequestConfig() - return request( + return this.request( localVariableConfig ) } @@ -70,13 +70,13 @@ open class BodyApi(client: WebClient) : ApiClient(client) { val localVariableHeaders: MutableMap = mutableMapOf() localVariableHeaders["Accept"] = "image/gif" - val params = mutableMapOf( + val localVariableParams = mutableMapOf( ) return RequestConfig( method = RequestMethod.POST, path = "/binary/gif", - params = params, + params = localVariableParams, query = localVariableQuery, headers = localVariableHeaders, requiresAuthentication = false, @@ -94,7 +94,7 @@ open class BodyApi(client: WebClient) : ApiClient(client) { @Throws(WebClientResponseException::class) fun testBodyApplicationOctetstreamBinaryWithHttpInfo(body: java.io.File? = null): Mono> { val localVariableConfig = testBodyApplicationOctetstreamBinaryRequestConfig(body = body) - return request( + return this.request( localVariableConfig ) } @@ -106,13 +106,13 @@ open class BodyApi(client: WebClient) : ApiClient(client) { localVariableHeaders["Content-Type"] = "application/octet-stream" localVariableHeaders["Accept"] = "text/plain" - val params = mutableMapOf( + val localVariableParams = mutableMapOf( ) return RequestConfig( method = RequestMethod.POST, path = "/body/application/octetstream/binary", - params = params, + params = localVariableParams, query = localVariableQuery, headers = localVariableHeaders, requiresAuthentication = false, @@ -130,7 +130,7 @@ open class BodyApi(client: WebClient) : ApiClient(client) { @Throws(WebClientResponseException::class) fun testBodyMultipartFormdataArrayOfBinaryWithHttpInfo(files: kotlin.collections.List): Mono> { val localVariableConfig = testBodyMultipartFormdataArrayOfBinaryRequestConfig(files = files) - return request>, kotlin.String>( + return this.request>, kotlin.String>( localVariableConfig ) } @@ -142,13 +142,13 @@ open class BodyApi(client: WebClient) : ApiClient(client) { val localVariableHeaders: MutableMap = mutableMapOf("Content-Type" to "multipart/form-data") localVariableHeaders["Accept"] = "text/plain" - val params = mutableMapOf( + val localVariableParams = mutableMapOf( ) return RequestConfig( method = RequestMethod.POST, path = "/body/application/octetstream/array_of_binary", - params = params, + params = localVariableParams, query = localVariableQuery, headers = localVariableHeaders, requiresAuthentication = false, @@ -166,7 +166,7 @@ open class BodyApi(client: WebClient) : ApiClient(client) { @Throws(WebClientResponseException::class) fun testBodyMultipartFormdataSingleBinaryWithHttpInfo(myFile: java.io.File? = null): Mono> { val localVariableConfig = testBodyMultipartFormdataSingleBinaryRequestConfig(myFile = myFile) - return request>, kotlin.String>( + return this.request>, kotlin.String>( localVariableConfig ) } @@ -178,13 +178,13 @@ open class BodyApi(client: WebClient) : ApiClient(client) { val localVariableHeaders: MutableMap = mutableMapOf("Content-Type" to "multipart/form-data") localVariableHeaders["Accept"] = "text/plain" - val params = mutableMapOf( + val localVariableParams = mutableMapOf( ) return RequestConfig( method = RequestMethod.POST, path = "/body/application/octetstream/single_binary", - params = params, + params = localVariableParams, query = localVariableQuery, headers = localVariableHeaders, requiresAuthentication = false, @@ -202,7 +202,7 @@ open class BodyApi(client: WebClient) : ApiClient(client) { @Throws(WebClientResponseException::class) fun testEchoBodyFreeFormObjectResponseStringWithHttpInfo(body: kotlin.Any? = null): Mono> { val localVariableConfig = testEchoBodyFreeFormObjectResponseStringRequestConfig(body = body) - return request( + return this.request( localVariableConfig ) } @@ -214,13 +214,13 @@ open class BodyApi(client: WebClient) : ApiClient(client) { localVariableHeaders["Content-Type"] = "application/json" localVariableHeaders["Accept"] = "text/plain" - val params = mutableMapOf( + val localVariableParams = mutableMapOf( ) return RequestConfig( method = RequestMethod.POST, path = "/echo/body/FreeFormObject/response_string", - params = params, + params = localVariableParams, query = localVariableQuery, headers = localVariableHeaders, requiresAuthentication = false, @@ -238,7 +238,7 @@ open class BodyApi(client: WebClient) : ApiClient(client) { @Throws(WebClientResponseException::class) fun testEchoBodyPetWithHttpInfo(pet: Pet? = null): Mono> { val localVariableConfig = testEchoBodyPetRequestConfig(pet = pet) - return request( + return this.request( localVariableConfig ) } @@ -250,13 +250,13 @@ open class BodyApi(client: WebClient) : ApiClient(client) { localVariableHeaders["Content-Type"] = "application/json" localVariableHeaders["Accept"] = "application/json" - val params = mutableMapOf( + val localVariableParams = mutableMapOf( ) return RequestConfig( method = RequestMethod.POST, path = "/echo/body/Pet", - params = params, + params = localVariableParams, query = localVariableQuery, headers = localVariableHeaders, requiresAuthentication = false, @@ -274,7 +274,7 @@ open class BodyApi(client: WebClient) : ApiClient(client) { @Throws(WebClientResponseException::class) fun testEchoBodyPetResponseStringWithHttpInfo(pet: Pet? = null): Mono> { val localVariableConfig = testEchoBodyPetResponseStringRequestConfig(pet = pet) - return request( + return this.request( localVariableConfig ) } @@ -286,13 +286,13 @@ open class BodyApi(client: WebClient) : ApiClient(client) { localVariableHeaders["Content-Type"] = "application/json" localVariableHeaders["Accept"] = "text/plain" - val params = mutableMapOf( + val localVariableParams = mutableMapOf( ) return RequestConfig( method = RequestMethod.POST, path = "/echo/body/Pet/response_string", - params = params, + params = localVariableParams, query = localVariableQuery, headers = localVariableHeaders, requiresAuthentication = false, @@ -310,7 +310,7 @@ open class BodyApi(client: WebClient) : ApiClient(client) { @Throws(WebClientResponseException::class) fun testEchoBodyTagResponseStringWithHttpInfo(tag: Tag? = null): Mono> { val localVariableConfig = testEchoBodyTagResponseStringRequestConfig(tag = tag) - return request( + return this.request( localVariableConfig ) } @@ -322,13 +322,13 @@ open class BodyApi(client: WebClient) : ApiClient(client) { localVariableHeaders["Content-Type"] = "application/json" localVariableHeaders["Accept"] = "text/plain" - val params = mutableMapOf( + val localVariableParams = mutableMapOf( ) return RequestConfig( method = RequestMethod.POST, path = "/echo/body/Tag/response_string", - params = params, + params = localVariableParams, query = localVariableQuery, headers = localVariableHeaders, requiresAuthentication = false, diff --git a/samples/client/echo_api/kotlin-jvm-spring-3-webclient/src/main/kotlin/org/openapitools/client/apis/FormApi.kt b/samples/client/echo_api/kotlin-jvm-spring-3-webclient/src/main/kotlin/org/openapitools/client/apis/FormApi.kt index 80d01edfbb1e..0a25aa84eb63 100644 --- a/samples/client/echo_api/kotlin-jvm-spring-3-webclient/src/main/kotlin/org/openapitools/client/apis/FormApi.kt +++ b/samples/client/echo_api/kotlin-jvm-spring-3-webclient/src/main/kotlin/org/openapitools/client/apis/FormApi.kt @@ -57,7 +57,7 @@ open class FormApi(client: WebClient) : ApiClient(client) { @Throws(WebClientResponseException::class) fun testFormIntegerBooleanStringWithHttpInfo(integerForm: kotlin.Int? = null, booleanForm: kotlin.Boolean? = null, stringForm: kotlin.String? = null): Mono> { val localVariableConfig = testFormIntegerBooleanStringRequestConfig(integerForm = integerForm, booleanForm = booleanForm, stringForm = stringForm) - return request>, kotlin.String>( + return this.request>, kotlin.String>( localVariableConfig ) } @@ -71,13 +71,13 @@ open class FormApi(client: WebClient) : ApiClient(client) { val localVariableHeaders: MutableMap = mutableMapOf("Content-Type" to "application/x-www-form-urlencoded") localVariableHeaders["Accept"] = "text/plain" - val params = mutableMapOf( + val localVariableParams = mutableMapOf( ) return RequestConfig( method = RequestMethod.POST, path = "/form/integer/boolean/string", - params = params, + params = localVariableParams, query = localVariableQuery, headers = localVariableHeaders, requiresAuthentication = false, @@ -95,7 +95,7 @@ open class FormApi(client: WebClient) : ApiClient(client) { @Throws(WebClientResponseException::class) fun testFormOneofWithHttpInfo(form1: kotlin.String? = null, form2: kotlin.Int? = null, form3: kotlin.String? = null, form4: kotlin.Boolean? = null, id: kotlin.Long? = null, name: kotlin.String? = null): Mono> { val localVariableConfig = testFormOneofRequestConfig(form1 = form1, form2 = form2, form3 = form3, form4 = form4, id = id, name = name) - return request>, kotlin.String>( + return this.request>, kotlin.String>( localVariableConfig ) } @@ -112,13 +112,13 @@ open class FormApi(client: WebClient) : ApiClient(client) { val localVariableHeaders: MutableMap = mutableMapOf("Content-Type" to "application/x-www-form-urlencoded") localVariableHeaders["Accept"] = "text/plain" - val params = mutableMapOf( + val localVariableParams = mutableMapOf( ) return RequestConfig( method = RequestMethod.POST, path = "/form/oneof", - params = params, + params = localVariableParams, query = localVariableQuery, headers = localVariableHeaders, requiresAuthentication = false, diff --git a/samples/client/echo_api/kotlin-jvm-spring-3-webclient/src/main/kotlin/org/openapitools/client/apis/HeaderApi.kt b/samples/client/echo_api/kotlin-jvm-spring-3-webclient/src/main/kotlin/org/openapitools/client/apis/HeaderApi.kt index 467313beafb4..74d5f58e6b56 100644 --- a/samples/client/echo_api/kotlin-jvm-spring-3-webclient/src/main/kotlin/org/openapitools/client/apis/HeaderApi.kt +++ b/samples/client/echo_api/kotlin-jvm-spring-3-webclient/src/main/kotlin/org/openapitools/client/apis/HeaderApi.kt @@ -67,7 +67,7 @@ open class HeaderApi(client: WebClient) : ApiClient(client) { @Throws(WebClientResponseException::class) fun testHeaderIntegerBooleanStringEnumsWithHttpInfo(integerHeader: kotlin.Int? = null, booleanHeader: kotlin.Boolean? = null, stringHeader: kotlin.String? = null, enumNonrefStringHeader: EnumNonrefStringHeaderTestHeaderIntegerBooleanStringEnums? = null, enumRefStringHeader: StringEnumRef? = null): Mono> { val localVariableConfig = testHeaderIntegerBooleanStringEnumsRequestConfig(integerHeader = integerHeader, booleanHeader = booleanHeader, stringHeader = stringHeader, enumNonrefStringHeader = enumNonrefStringHeader, enumRefStringHeader = enumRefStringHeader) - return request( + return this.request( localVariableConfig ) } @@ -83,13 +83,13 @@ open class HeaderApi(client: WebClient) : ApiClient(client) { enumNonrefStringHeader?.apply { localVariableHeaders["enum_nonref_string_header"] = this.toString() } enumRefStringHeader?.apply { localVariableHeaders["enum_ref_string_header"] = this.toString() } - val params = mutableMapOf( + val localVariableParams = mutableMapOf( ) return RequestConfig( method = RequestMethod.GET, path = "/header/integer/boolean/string/enums", - params = params, + params = localVariableParams, query = localVariableQuery, headers = localVariableHeaders, requiresAuthentication = false, diff --git a/samples/client/echo_api/kotlin-jvm-spring-3-webclient/src/main/kotlin/org/openapitools/client/apis/PathApi.kt b/samples/client/echo_api/kotlin-jvm-spring-3-webclient/src/main/kotlin/org/openapitools/client/apis/PathApi.kt index 650a151a7e7d..b5c812607e17 100644 --- a/samples/client/echo_api/kotlin-jvm-spring-3-webclient/src/main/kotlin/org/openapitools/client/apis/PathApi.kt +++ b/samples/client/echo_api/kotlin-jvm-spring-3-webclient/src/main/kotlin/org/openapitools/client/apis/PathApi.kt @@ -67,7 +67,7 @@ open class PathApi(client: WebClient) : ApiClient(client) { @Throws(WebClientResponseException::class) fun testsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPathWithHttpInfo(pathString: kotlin.String, pathInteger: kotlin.Int, enumNonrefStringPath: EnumNonrefStringPathTestsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPath, enumRefStringPath: StringEnumRef): Mono> { val localVariableConfig = testsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPathRequestConfig(pathString = pathString, pathInteger = pathInteger, enumNonrefStringPath = enumNonrefStringPath, enumRefStringPath = enumRefStringPath) - return request( + return this.request( localVariableConfig ) } @@ -78,7 +78,7 @@ open class PathApi(client: WebClient) : ApiClient(client) { val localVariableHeaders: MutableMap = mutableMapOf() localVariableHeaders["Accept"] = "text/plain" - val params = mutableMapOf( + val localVariableParams = mutableMapOf( "path_string" to pathString, "path_integer" to pathInteger, "enum_nonref_string_path" to enumNonrefStringPath.value, @@ -88,7 +88,7 @@ open class PathApi(client: WebClient) : ApiClient(client) { return RequestConfig( method = RequestMethod.GET, path = "/path/string/{path_string}/integer/{path_integer}/{enum_nonref_string_path}/{enum_ref_string_path}", - params = params, + params = localVariableParams, query = localVariableQuery, headers = localVariableHeaders, requiresAuthentication = false, diff --git a/samples/client/echo_api/kotlin-jvm-spring-3-webclient/src/main/kotlin/org/openapitools/client/apis/QueryApi.kt b/samples/client/echo_api/kotlin-jvm-spring-3-webclient/src/main/kotlin/org/openapitools/client/apis/QueryApi.kt index 00349c72b6ad..0b77e283e73f 100644 --- a/samples/client/echo_api/kotlin-jvm-spring-3-webclient/src/main/kotlin/org/openapitools/client/apis/QueryApi.kt +++ b/samples/client/echo_api/kotlin-jvm-spring-3-webclient/src/main/kotlin/org/openapitools/client/apis/QueryApi.kt @@ -69,7 +69,7 @@ open class QueryApi(client: WebClient) : ApiClient(client) { @Throws(WebClientResponseException::class) fun testEnumRefStringWithHttpInfo(enumNonrefStringQuery: EnumNonrefStringQueryTestEnumRefString? = null, enumRefStringQuery: StringEnumRef? = null): Mono> { val localVariableConfig = testEnumRefStringRequestConfig(enumNonrefStringQuery = enumNonrefStringQuery, enumRefStringQuery = enumRefStringQuery) - return request( + return this.request( localVariableConfig ) } @@ -88,13 +88,13 @@ open class QueryApi(client: WebClient) : ApiClient(client) { val localVariableHeaders: MutableMap = mutableMapOf() localVariableHeaders["Accept"] = "text/plain" - val params = mutableMapOf( + val localVariableParams = mutableMapOf( ) return RequestConfig( method = RequestMethod.GET, path = "/query/enum_ref_string", - params = params, + params = localVariableParams, query = localVariableQuery, headers = localVariableHeaders, requiresAuthentication = false, @@ -112,7 +112,7 @@ open class QueryApi(client: WebClient) : ApiClient(client) { @Throws(WebClientResponseException::class) fun testQueryDatetimeDateStringWithHttpInfo(datetimeQuery: java.time.OffsetDateTime? = null, dateQuery: java.time.LocalDate? = null, stringQuery: kotlin.String? = null): Mono> { val localVariableConfig = testQueryDatetimeDateStringRequestConfig(datetimeQuery = datetimeQuery, dateQuery = dateQuery, stringQuery = stringQuery) - return request( + return this.request( localVariableConfig ) } @@ -122,10 +122,10 @@ open class QueryApi(client: WebClient) : ApiClient(client) { val localVariableQuery = mutableMapOf>() .apply { if (datetimeQuery != null) { - put("datetime_query", listOf(parseDateToQueryString(datetimeQuery))) + put("datetime_query", listOf(org.openapitools.client.infrastructure.parseDateToQueryString(datetimeQuery))) } if (dateQuery != null) { - put("date_query", listOf(parseDateToQueryString(dateQuery))) + put("date_query", listOf(org.openapitools.client.infrastructure.parseDateToQueryString(dateQuery))) } if (stringQuery != null) { put("string_query", listOf(stringQuery.toString())) @@ -134,13 +134,13 @@ open class QueryApi(client: WebClient) : ApiClient(client) { val localVariableHeaders: MutableMap = mutableMapOf() localVariableHeaders["Accept"] = "text/plain" - val params = mutableMapOf( + val localVariableParams = mutableMapOf( ) return RequestConfig( method = RequestMethod.GET, path = "/query/datetime/date/string", - params = params, + params = localVariableParams, query = localVariableQuery, headers = localVariableHeaders, requiresAuthentication = false, @@ -158,7 +158,7 @@ open class QueryApi(client: WebClient) : ApiClient(client) { @Throws(WebClientResponseException::class) fun testQueryIntegerBooleanStringWithHttpInfo(integerQuery: kotlin.Int? = null, booleanQuery: kotlin.Boolean? = null, stringQuery: kotlin.String? = null): Mono> { val localVariableConfig = testQueryIntegerBooleanStringRequestConfig(integerQuery = integerQuery, booleanQuery = booleanQuery, stringQuery = stringQuery) - return request( + return this.request( localVariableConfig ) } @@ -180,13 +180,13 @@ open class QueryApi(client: WebClient) : ApiClient(client) { val localVariableHeaders: MutableMap = mutableMapOf() localVariableHeaders["Accept"] = "text/plain" - val params = mutableMapOf( + val localVariableParams = mutableMapOf( ) return RequestConfig( method = RequestMethod.GET, path = "/query/integer/boolean/string", - params = params, + params = localVariableParams, query = localVariableQuery, headers = localVariableHeaders, requiresAuthentication = false, @@ -204,7 +204,7 @@ open class QueryApi(client: WebClient) : ApiClient(client) { @Throws(WebClientResponseException::class) fun testQueryStyleDeepObjectExplodeTrueObjectWithHttpInfo(queryObject: Pet? = null): Mono> { val localVariableConfig = testQueryStyleDeepObjectExplodeTrueObjectRequestConfig(queryObject = queryObject) - return request( + return this.request( localVariableConfig ) } @@ -220,13 +220,13 @@ open class QueryApi(client: WebClient) : ApiClient(client) { val localVariableHeaders: MutableMap = mutableMapOf() localVariableHeaders["Accept"] = "text/plain" - val params = mutableMapOf( + val localVariableParams = mutableMapOf( ) return RequestConfig( method = RequestMethod.GET, path = "/query/style_deepObject/explode_true/object", - params = params, + params = localVariableParams, query = localVariableQuery, headers = localVariableHeaders, requiresAuthentication = false, @@ -244,7 +244,7 @@ open class QueryApi(client: WebClient) : ApiClient(client) { @Throws(WebClientResponseException::class) fun testQueryStyleFormExplodeTrueArrayStringWithHttpInfo(queryObject: TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter? = null): Mono> { val localVariableConfig = testQueryStyleFormExplodeTrueArrayStringRequestConfig(queryObject = queryObject) - return request( + return this.request( localVariableConfig ) } @@ -260,13 +260,13 @@ open class QueryApi(client: WebClient) : ApiClient(client) { val localVariableHeaders: MutableMap = mutableMapOf() localVariableHeaders["Accept"] = "text/plain" - val params = mutableMapOf( + val localVariableParams = mutableMapOf( ) return RequestConfig( method = RequestMethod.GET, path = "/query/style_form/explode_true/array_string", - params = params, + params = localVariableParams, query = localVariableQuery, headers = localVariableHeaders, requiresAuthentication = false, @@ -284,7 +284,7 @@ open class QueryApi(client: WebClient) : ApiClient(client) { @Throws(WebClientResponseException::class) fun testQueryStyleFormExplodeTrueObjectWithHttpInfo(queryObject: Pet? = null): Mono> { val localVariableConfig = testQueryStyleFormExplodeTrueObjectRequestConfig(queryObject = queryObject) - return request( + return this.request( localVariableConfig ) } @@ -300,13 +300,13 @@ open class QueryApi(client: WebClient) : ApiClient(client) { val localVariableHeaders: MutableMap = mutableMapOf() localVariableHeaders["Accept"] = "text/plain" - val params = mutableMapOf( + val localVariableParams = mutableMapOf( ) return RequestConfig( method = RequestMethod.GET, path = "/query/style_form/explode_true/object", - params = params, + params = localVariableParams, query = localVariableQuery, headers = localVariableHeaders, requiresAuthentication = false, diff --git a/samples/client/others/kotlin-jvm-okhttp-non-ascii-headers/src/main/kotlin/org/openapitools/client/apis/PetApi.kt b/samples/client/others/kotlin-jvm-okhttp-non-ascii-headers/src/main/kotlin/org/openapitools/client/apis/PetApi.kt index f58f89bc2b9f..cc3b9c4ecd1d 100644 --- a/samples/client/others/kotlin-jvm-okhttp-non-ascii-headers/src/main/kotlin/org/openapitools/client/apis/PetApi.kt +++ b/samples/client/others/kotlin-jvm-okhttp-non-ascii-headers/src/main/kotlin/org/openapitools/client/apis/PetApi.kt @@ -195,7 +195,7 @@ open class PetApi(basePath: kotlin.String = defaultBasePath, client: Call.Factor return RequestConfig( method = RequestMethod.DELETE, - path = "/pet/{petId}".replace("{"+"petId"+"}", encodeURIComponent(petId.toString())), + path = "/pet/{petId}".replace("{"+"petId"+"}", this@PetApi.encodeURIComponent(petId.toString())), query = localVariableQuery, headers = localVariableHeaders, requiresAuthentication = true, @@ -443,7 +443,7 @@ open class PetApi(basePath: kotlin.String = defaultBasePath, client: Call.Factor return RequestConfig( method = RequestMethod.GET, - path = "/pet/{petId}".replace("{"+"petId"+"}", encodeURIComponent(petId.toString())), + path = "/pet/{petId}".replace("{"+"petId"+"}", this@PetApi.encodeURIComponent(petId.toString())), query = localVariableQuery, headers = localVariableHeaders, requiresAuthentication = true, @@ -596,7 +596,7 @@ open class PetApi(basePath: kotlin.String = defaultBasePath, client: Call.Factor return RequestConfig( method = RequestMethod.POST, - path = "/pet/{petId}".replace("{"+"petId"+"}", encodeURIComponent(petId.toString())), + path = "/pet/{petId}".replace("{"+"petId"+"}", this@PetApi.encodeURIComponent(petId.toString())), query = localVariableQuery, headers = localVariableHeaders, requiresAuthentication = true, @@ -677,7 +677,7 @@ open class PetApi(basePath: kotlin.String = defaultBasePath, client: Call.Factor return RequestConfig( method = RequestMethod.POST, - path = "/pet/{petId}/uploadImage".replace("{"+"petId"+"}", encodeURIComponent(petId.toString())), + path = "/pet/{petId}/uploadImage".replace("{"+"petId"+"}", this@PetApi.encodeURIComponent(petId.toString())), query = localVariableQuery, headers = localVariableHeaders, requiresAuthentication = true, diff --git a/samples/client/others/kotlin-jvm-okhttp-non-ascii-headers/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt b/samples/client/others/kotlin-jvm-okhttp-non-ascii-headers/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt index c51b68aa25b8..2109bb7ff3f4 100644 --- a/samples/client/others/kotlin-jvm-okhttp-non-ascii-headers/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt +++ b/samples/client/others/kotlin-jvm-okhttp-non-ascii-headers/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt @@ -116,7 +116,7 @@ open class StoreApi(basePath: kotlin.String = defaultBasePath, client: Call.Fact return RequestConfig( method = RequestMethod.DELETE, - path = "/store/order/{orderId}".replace("{"+"orderId"+"}", encodeURIComponent(orderId.toString())), + path = "/store/order/{orderId}".replace("{"+"orderId"+"}", this@StoreApi.encodeURIComponent(orderId.toString())), query = localVariableQuery, headers = localVariableHeaders, requiresAuthentication = false, @@ -259,7 +259,7 @@ open class StoreApi(basePath: kotlin.String = defaultBasePath, client: Call.Fact return RequestConfig( method = RequestMethod.GET, - path = "/store/order/{orderId}".replace("{"+"orderId"+"}", encodeURIComponent(orderId.toString())), + path = "/store/order/{orderId}".replace("{"+"orderId"+"}", this@StoreApi.encodeURIComponent(orderId.toString())), query = localVariableQuery, headers = localVariableHeaders, requiresAuthentication = false, diff --git a/samples/client/others/kotlin-jvm-okhttp-non-ascii-headers/src/main/kotlin/org/openapitools/client/apis/UserApi.kt b/samples/client/others/kotlin-jvm-okhttp-non-ascii-headers/src/main/kotlin/org/openapitools/client/apis/UserApi.kt index 5741e44a4173..e3f47b421be8 100644 --- a/samples/client/others/kotlin-jvm-okhttp-non-ascii-headers/src/main/kotlin/org/openapitools/client/apis/UserApi.kt +++ b/samples/client/others/kotlin-jvm-okhttp-non-ascii-headers/src/main/kotlin/org/openapitools/client/apis/UserApi.kt @@ -332,7 +332,7 @@ open class UserApi(basePath: kotlin.String = defaultBasePath, client: Call.Facto return RequestConfig( method = RequestMethod.DELETE, - path = "/user/{username}".replace("{"+"username"+"}", encodeURIComponent(username.toString())), + path = "/user/{username}".replace("{"+"username"+"}", this@UserApi.encodeURIComponent(username.toString())), query = localVariableQuery, headers = localVariableHeaders, requiresAuthentication = true, @@ -405,7 +405,7 @@ open class UserApi(basePath: kotlin.String = defaultBasePath, client: Call.Facto return RequestConfig( method = RequestMethod.GET, - path = "/user/{username}".replace("{"+"username"+"}", encodeURIComponent(username.toString())), + path = "/user/{username}".replace("{"+"username"+"}", this@UserApi.encodeURIComponent(username.toString())), query = localVariableQuery, headers = localVariableHeaders, requiresAuthentication = false, @@ -628,7 +628,7 @@ open class UserApi(basePath: kotlin.String = defaultBasePath, client: Call.Facto return RequestConfig( method = RequestMethod.PUT, - path = "/user/{username}".replace("{"+"username"+"}", encodeURIComponent(username.toString())), + path = "/user/{username}".replace("{"+"username"+"}", this@UserApi.encodeURIComponent(username.toString())), query = localVariableQuery, headers = localVariableHeaders, requiresAuthentication = true, diff --git a/samples/client/others/kotlin-jvm-okhttp-parameter-tests/src/main/kotlin/org/openapitools/client/apis/DefaultApi.kt b/samples/client/others/kotlin-jvm-okhttp-parameter-tests/src/main/kotlin/org/openapitools/client/apis/DefaultApi.kt index a60a6968b7eb..2c802849b090 100644 --- a/samples/client/others/kotlin-jvm-okhttp-parameter-tests/src/main/kotlin/org/openapitools/client/apis/DefaultApi.kt +++ b/samples/client/others/kotlin-jvm-okhttp-parameter-tests/src/main/kotlin/org/openapitools/client/apis/DefaultApi.kt @@ -232,7 +232,7 @@ open class DefaultApi(basePath: kotlin.String = defaultBasePath, client: Call.Fa return RequestConfig( method = RequestMethod.GET, - path = "/test/parameters/{path_default}/{path_nullable}".replace("{"+"path_default"+"}", encodeURIComponent(pathDefault.toString())).replace("{"+"path_nullable"+"}", encodeURIComponent(pathNullable.toString())), + path = "/test/parameters/{path_default}/{path_nullable}".replace("{"+"path_default"+"}", this@DefaultApi.encodeURIComponent(pathDefault.toString())).replace("{"+"path_nullable"+"}", this@DefaultApi.encodeURIComponent(pathNullable.toString())), query = localVariableQuery, headers = localVariableHeaders, requiresAuthentication = false, diff --git a/samples/client/others/kotlin-jvm-spring-3-restclient-nullable-return/src/main/kotlin/org/openapitools/client/apis/DefaultApi.kt b/samples/client/others/kotlin-jvm-spring-3-restclient-nullable-return/src/main/kotlin/org/openapitools/client/apis/DefaultApi.kt index 6b3c4123b397..b7e3056c2fa3 100644 --- a/samples/client/others/kotlin-jvm-spring-3-restclient-nullable-return/src/main/kotlin/org/openapitools/client/apis/DefaultApi.kt +++ b/samples/client/others/kotlin-jvm-spring-3-restclient-nullable-return/src/main/kotlin/org/openapitools/client/apis/DefaultApi.kt @@ -53,7 +53,7 @@ open class DefaultApi(client: RestClient) : ApiClient(client) { @Throws(RestClientResponseException::class) fun returnNothingWithHttpInfo(): ResponseEntity { val localVariableConfig = returnNothingRequestConfig() - return request( + return this.request( localVariableConfig ) } @@ -64,13 +64,13 @@ open class DefaultApi(client: RestClient) : ApiClient(client) { val localVariableHeaders: MutableMap = mutableMapOf() - val params = mutableMapOf( + val localVariableParams = mutableMapOf( ) return RequestConfig( method = RequestMethod.GET, path = "/always-empty", - params = params, + params = localVariableParams, query = localVariableQuery, headers = localVariableHeaders, requiresAuthentication = false, @@ -81,14 +81,14 @@ open class DefaultApi(client: RestClient) : ApiClient(client) { @Throws(RestClientResponseException::class) fun returnNullableString(pingRequest: PingRequest): kotlin.String? { - val result = returnNullableStringWithHttpInfo(pingRequest = pingRequest) - return result.body + val localVariableResult = returnNullableStringWithHttpInfo(pingRequest = pingRequest) + return localVariableResult.body } @Throws(RestClientResponseException::class) fun returnNullableStringWithHttpInfo(pingRequest: PingRequest): ResponseEntity { val localVariableConfig = returnNullableStringRequestConfig(pingRequest = pingRequest) - return request( + return this.request( localVariableConfig ) } @@ -100,13 +100,13 @@ open class DefaultApi(client: RestClient) : ApiClient(client) { localVariableHeaders["Content-Type"] = "application/json" localVariableHeaders["Accept"] = "text/html" - val params = mutableMapOf( + val localVariableParams = mutableMapOf( ) return RequestConfig( method = RequestMethod.POST, path = "/nullable-string", - params = params, + params = localVariableParams, query = localVariableQuery, headers = localVariableHeaders, requiresAuthentication = false, diff --git a/samples/client/petstore/kotlin-allOf-discriminator-kotlinx-serialization/src/main/kotlin/org/openapitools/client/apis/BirdApi.kt b/samples/client/petstore/kotlin-allOf-discriminator-kotlinx-serialization/src/main/kotlin/org/openapitools/client/apis/BirdApi.kt index b2ca15e4ae4a..ff9617b9699e 100644 --- a/samples/client/petstore/kotlin-allOf-discriminator-kotlinx-serialization/src/main/kotlin/org/openapitools/client/apis/BirdApi.kt +++ b/samples/client/petstore/kotlin-allOf-discriminator-kotlinx-serialization/src/main/kotlin/org/openapitools/client/apis/BirdApi.kt @@ -120,7 +120,7 @@ open class BirdApi(basePath: kotlin.String = defaultBasePath, client: Call.Facto return RequestConfig( method = RequestMethod.GET, - path = "/v1/bird/{id}".replace("{"+"id"+"}", encodeURIComponent(id.toString())), + path = "/v1/bird/{id}".replace("{"+"id"+"}", this@BirdApi.encodeURIComponent(id.toString())), query = localVariableQuery, headers = localVariableHeaders, requiresAuthentication = false, diff --git a/samples/client/petstore/kotlin-allOf-discriminator/src/main/kotlin/org/openapitools/client/apis/BirdApi.kt b/samples/client/petstore/kotlin-allOf-discriminator/src/main/kotlin/org/openapitools/client/apis/BirdApi.kt index c016ac4216a2..5137c014ecb4 100644 --- a/samples/client/petstore/kotlin-allOf-discriminator/src/main/kotlin/org/openapitools/client/apis/BirdApi.kt +++ b/samples/client/petstore/kotlin-allOf-discriminator/src/main/kotlin/org/openapitools/client/apis/BirdApi.kt @@ -118,7 +118,7 @@ open class BirdApi(basePath: kotlin.String = defaultBasePath, client: Call.Facto return RequestConfig( method = RequestMethod.GET, - path = "/v1/bird/{id}".replace("{"+"id"+"}", encodeURIComponent(id.toString())), + path = "/v1/bird/{id}".replace("{"+"id"+"}", this@BirdApi.encodeURIComponent(id.toString())), query = localVariableQuery, headers = localVariableHeaders, requiresAuthentication = false, diff --git a/samples/client/petstore/kotlin-allOf-special-discriminator-kotlinx-serialization/src/main/kotlin/org/openapitools/client/apis/BirdApi.kt b/samples/client/petstore/kotlin-allOf-special-discriminator-kotlinx-serialization/src/main/kotlin/org/openapitools/client/apis/BirdApi.kt index b2ca15e4ae4a..ff9617b9699e 100644 --- a/samples/client/petstore/kotlin-allOf-special-discriminator-kotlinx-serialization/src/main/kotlin/org/openapitools/client/apis/BirdApi.kt +++ b/samples/client/petstore/kotlin-allOf-special-discriminator-kotlinx-serialization/src/main/kotlin/org/openapitools/client/apis/BirdApi.kt @@ -120,7 +120,7 @@ open class BirdApi(basePath: kotlin.String = defaultBasePath, client: Call.Facto return RequestConfig( method = RequestMethod.GET, - path = "/v1/bird/{id}".replace("{"+"id"+"}", encodeURIComponent(id.toString())), + path = "/v1/bird/{id}".replace("{"+"id"+"}", this@BirdApi.encodeURIComponent(id.toString())), query = localVariableQuery, headers = localVariableHeaders, requiresAuthentication = false, diff --git a/samples/client/petstore/kotlin-array-simple-string-jvm-okhttp4/src/main/kotlin/org/openapitools/client/apis/DefaultApi.kt b/samples/client/petstore/kotlin-array-simple-string-jvm-okhttp4/src/main/kotlin/org/openapitools/client/apis/DefaultApi.kt index f83bd5f60dc3..1274b71f9176 100644 --- a/samples/client/petstore/kotlin-array-simple-string-jvm-okhttp4/src/main/kotlin/org/openapitools/client/apis/DefaultApi.kt +++ b/samples/client/petstore/kotlin-array-simple-string-jvm-okhttp4/src/main/kotlin/org/openapitools/client/apis/DefaultApi.kt @@ -115,7 +115,7 @@ open class DefaultApi(basePath: kotlin.String = defaultBasePath, client: Call.Fa return RequestConfig( method = RequestMethod.GET, - path = "/{ids}".replace("{"+"ids"+"}", encodeURIComponent(ids.joinToString(","))), + path = "/{ids}".replace("{"+"ids"+"}", this@DefaultApi.encodeURIComponent(ids.joinToString(","))), query = localVariableQuery, headers = localVariableHeaders, requiresAuthentication = false, 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 1b41cf19a967..17ffbf187eee 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 @@ -234,7 +234,7 @@ open class DefaultApi(basePath: kotlin.String = defaultBasePath, client: Call.Fa return RequestConfig( method = RequestMethod.POST, - path = "/test".replace("{"+"pi0"+"}", encodeURIComponent(pi0.toString())).replace("{"+"pi1"+"}", encodeURIComponent(pi1.toString())).replace("{"+"pn0"+"}", encodeURIComponent(pn0.toString())).replace("{"+"pn1"+"}", encodeURIComponent(pn1.toString())), + path = "/test".replace("{"+"pi0"+"}", this@DefaultApi.encodeURIComponent(pi0.toString())).replace("{"+"pi1"+"}", this@DefaultApi.encodeURIComponent(pi1.toString())).replace("{"+"pn0"+"}", this@DefaultApi.encodeURIComponent(pn0.toString())).replace("{"+"pn1"+"}", this@DefaultApi.encodeURIComponent(pn1.toString())), query = localVariableQuery, headers = localVariableHeaders, requiresAuthentication = false, diff --git a/samples/client/petstore/kotlin-explicit/src/main/kotlin/org/openapitools/client/apis/PetApi.kt b/samples/client/petstore/kotlin-explicit/src/main/kotlin/org/openapitools/client/apis/PetApi.kt index 7b79979e25ae..d742498c53fb 100644 --- a/samples/client/petstore/kotlin-explicit/src/main/kotlin/org/openapitools/client/apis/PetApi.kt +++ b/samples/client/petstore/kotlin-explicit/src/main/kotlin/org/openapitools/client/apis/PetApi.kt @@ -193,7 +193,7 @@ public open class PetApi(basePath: kotlin.String = defaultBasePath, client: Call return RequestConfig( method = RequestMethod.DELETE, - path = "/pet/{petId}".replace("{"+"petId"+"}", encodeURIComponent(petId.toString())), + path = "/pet/{petId}".replace("{"+"petId"+"}", this@PetApi.encodeURIComponent(petId.toString())), query = localVariableQuery, headers = localVariableHeaders, requiresAuthentication = true, @@ -441,7 +441,7 @@ public open class PetApi(basePath: kotlin.String = defaultBasePath, client: Call return RequestConfig( method = RequestMethod.GET, - path = "/pet/{petId}".replace("{"+"petId"+"}", encodeURIComponent(petId.toString())), + path = "/pet/{petId}".replace("{"+"petId"+"}", this@PetApi.encodeURIComponent(petId.toString())), query = localVariableQuery, headers = localVariableHeaders, requiresAuthentication = true, @@ -592,7 +592,7 @@ public open class PetApi(basePath: kotlin.String = defaultBasePath, client: Call return RequestConfig( method = RequestMethod.POST, - path = "/pet/{petId}".replace("{"+"petId"+"}", encodeURIComponent(petId.toString())), + path = "/pet/{petId}".replace("{"+"petId"+"}", this@PetApi.encodeURIComponent(petId.toString())), query = localVariableQuery, headers = localVariableHeaders, requiresAuthentication = true, @@ -673,7 +673,7 @@ public open class PetApi(basePath: kotlin.String = defaultBasePath, client: Call return RequestConfig( method = RequestMethod.POST, - path = "/pet/{petId}/uploadImage".replace("{"+"petId"+"}", encodeURIComponent(petId.toString())), + path = "/pet/{petId}/uploadImage".replace("{"+"petId"+"}", this@PetApi.encodeURIComponent(petId.toString())), query = localVariableQuery, headers = localVariableHeaders, requiresAuthentication = true, diff --git a/samples/client/petstore/kotlin-explicit/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt b/samples/client/petstore/kotlin-explicit/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt index e300fa814b9b..3267b9475725 100644 --- a/samples/client/petstore/kotlin-explicit/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt +++ b/samples/client/petstore/kotlin-explicit/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt @@ -116,7 +116,7 @@ public open class StoreApi(basePath: kotlin.String = defaultBasePath, client: Ca return RequestConfig( method = RequestMethod.DELETE, - path = "/store/order/{orderId}".replace("{"+"orderId"+"}", encodeURIComponent(orderId.toString())), + path = "/store/order/{orderId}".replace("{"+"orderId"+"}", this@StoreApi.encodeURIComponent(orderId.toString())), query = localVariableQuery, headers = localVariableHeaders, requiresAuthentication = false, @@ -259,7 +259,7 @@ public open class StoreApi(basePath: kotlin.String = defaultBasePath, client: Ca return RequestConfig( method = RequestMethod.GET, - path = "/store/order/{orderId}".replace("{"+"orderId"+"}", encodeURIComponent(orderId.toString())), + path = "/store/order/{orderId}".replace("{"+"orderId"+"}", this@StoreApi.encodeURIComponent(orderId.toString())), query = localVariableQuery, headers = localVariableHeaders, requiresAuthentication = false, diff --git a/samples/client/petstore/kotlin-explicit/src/main/kotlin/org/openapitools/client/apis/UserApi.kt b/samples/client/petstore/kotlin-explicit/src/main/kotlin/org/openapitools/client/apis/UserApi.kt index c66d7ec32955..4d47aa211482 100644 --- a/samples/client/petstore/kotlin-explicit/src/main/kotlin/org/openapitools/client/apis/UserApi.kt +++ b/samples/client/petstore/kotlin-explicit/src/main/kotlin/org/openapitools/client/apis/UserApi.kt @@ -329,7 +329,7 @@ public open class UserApi(basePath: kotlin.String = defaultBasePath, client: Cal return RequestConfig( method = RequestMethod.DELETE, - path = "/user/{username}".replace("{"+"username"+"}", encodeURIComponent(username.toString())), + path = "/user/{username}".replace("{"+"username"+"}", this@UserApi.encodeURIComponent(username.toString())), query = localVariableQuery, headers = localVariableHeaders, requiresAuthentication = false, @@ -402,7 +402,7 @@ public open class UserApi(basePath: kotlin.String = defaultBasePath, client: Cal return RequestConfig( method = RequestMethod.GET, - path = "/user/{username}".replace("{"+"username"+"}", encodeURIComponent(username.toString())), + path = "/user/{username}".replace("{"+"username"+"}", this@UserApi.encodeURIComponent(username.toString())), query = localVariableQuery, headers = localVariableHeaders, requiresAuthentication = false, @@ -624,7 +624,7 @@ public open class UserApi(basePath: kotlin.String = defaultBasePath, client: Cal return RequestConfig( method = RequestMethod.PUT, - path = "/user/{username}".replace("{"+"username"+"}", encodeURIComponent(username.toString())), + path = "/user/{username}".replace("{"+"username"+"}", this@UserApi.encodeURIComponent(username.toString())), query = localVariableQuery, headers = localVariableHeaders, requiresAuthentication = false, diff --git a/samples/client/petstore/kotlin-gson/src/main/kotlin/org/openapitools/client/apis/PetApi.kt b/samples/client/petstore/kotlin-gson/src/main/kotlin/org/openapitools/client/apis/PetApi.kt index a7330b7706ba..66788984070b 100644 --- a/samples/client/petstore/kotlin-gson/src/main/kotlin/org/openapitools/client/apis/PetApi.kt +++ b/samples/client/petstore/kotlin-gson/src/main/kotlin/org/openapitools/client/apis/PetApi.kt @@ -195,7 +195,7 @@ open class PetApi(basePath: kotlin.String = defaultBasePath, client: Call.Factor return RequestConfig( method = RequestMethod.DELETE, - path = "/pet/{petId}".replace("{"+"petId"+"}", encodeURIComponent(petId.toString())), + path = "/pet/{petId}".replace("{"+"petId"+"}", this@PetApi.encodeURIComponent(petId.toString())), query = localVariableQuery, headers = localVariableHeaders, requiresAuthentication = true, @@ -443,7 +443,7 @@ open class PetApi(basePath: kotlin.String = defaultBasePath, client: Call.Factor return RequestConfig( method = RequestMethod.GET, - path = "/pet/{petId}".replace("{"+"petId"+"}", encodeURIComponent(petId.toString())), + path = "/pet/{petId}".replace("{"+"petId"+"}", this@PetApi.encodeURIComponent(petId.toString())), query = localVariableQuery, headers = localVariableHeaders, requiresAuthentication = true, @@ -596,7 +596,7 @@ open class PetApi(basePath: kotlin.String = defaultBasePath, client: Call.Factor return RequestConfig( method = RequestMethod.POST, - path = "/pet/{petId}".replace("{"+"petId"+"}", encodeURIComponent(petId.toString())), + path = "/pet/{petId}".replace("{"+"petId"+"}", this@PetApi.encodeURIComponent(petId.toString())), query = localVariableQuery, headers = localVariableHeaders, requiresAuthentication = true, @@ -677,7 +677,7 @@ open class PetApi(basePath: kotlin.String = defaultBasePath, client: Call.Factor return RequestConfig( method = RequestMethod.POST, - path = "/pet/{petId}/uploadImage".replace("{"+"petId"+"}", encodeURIComponent(petId.toString())), + path = "/pet/{petId}/uploadImage".replace("{"+"petId"+"}", this@PetApi.encodeURIComponent(petId.toString())), query = localVariableQuery, headers = localVariableHeaders, requiresAuthentication = true, diff --git a/samples/client/petstore/kotlin-gson/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt b/samples/client/petstore/kotlin-gson/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt index 587b849147c3..3519e5e7b940 100644 --- a/samples/client/petstore/kotlin-gson/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt +++ b/samples/client/petstore/kotlin-gson/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt @@ -116,7 +116,7 @@ open class StoreApi(basePath: kotlin.String = defaultBasePath, client: Call.Fact return RequestConfig( method = RequestMethod.DELETE, - path = "/store/order/{orderId}".replace("{"+"orderId"+"}", encodeURIComponent(orderId.toString())), + path = "/store/order/{orderId}".replace("{"+"orderId"+"}", this@StoreApi.encodeURIComponent(orderId.toString())), query = localVariableQuery, headers = localVariableHeaders, requiresAuthentication = false, @@ -259,7 +259,7 @@ open class StoreApi(basePath: kotlin.String = defaultBasePath, client: Call.Fact return RequestConfig( method = RequestMethod.GET, - path = "/store/order/{orderId}".replace("{"+"orderId"+"}", encodeURIComponent(orderId.toString())), + path = "/store/order/{orderId}".replace("{"+"orderId"+"}", this@StoreApi.encodeURIComponent(orderId.toString())), query = localVariableQuery, headers = localVariableHeaders, requiresAuthentication = false, diff --git a/samples/client/petstore/kotlin-gson/src/main/kotlin/org/openapitools/client/apis/UserApi.kt b/samples/client/petstore/kotlin-gson/src/main/kotlin/org/openapitools/client/apis/UserApi.kt index 27a16877c7d8..efe8f328078b 100644 --- a/samples/client/petstore/kotlin-gson/src/main/kotlin/org/openapitools/client/apis/UserApi.kt +++ b/samples/client/petstore/kotlin-gson/src/main/kotlin/org/openapitools/client/apis/UserApi.kt @@ -332,7 +332,7 @@ open class UserApi(basePath: kotlin.String = defaultBasePath, client: Call.Facto return RequestConfig( method = RequestMethod.DELETE, - path = "/user/{username}".replace("{"+"username"+"}", encodeURIComponent(username.toString())), + path = "/user/{username}".replace("{"+"username"+"}", this@UserApi.encodeURIComponent(username.toString())), query = localVariableQuery, headers = localVariableHeaders, requiresAuthentication = true, @@ -405,7 +405,7 @@ open class UserApi(basePath: kotlin.String = defaultBasePath, client: Call.Facto return RequestConfig( method = RequestMethod.GET, - path = "/user/{username}".replace("{"+"username"+"}", encodeURIComponent(username.toString())), + path = "/user/{username}".replace("{"+"username"+"}", this@UserApi.encodeURIComponent(username.toString())), query = localVariableQuery, headers = localVariableHeaders, requiresAuthentication = false, @@ -628,7 +628,7 @@ open class UserApi(basePath: kotlin.String = defaultBasePath, client: Call.Facto return RequestConfig( method = RequestMethod.PUT, - path = "/user/{username}".replace("{"+"username"+"}", encodeURIComponent(username.toString())), + path = "/user/{username}".replace("{"+"username"+"}", this@UserApi.encodeURIComponent(username.toString())), query = localVariableQuery, headers = localVariableHeaders, requiresAuthentication = true, diff --git a/samples/client/petstore/kotlin-jackson/src/main/kotlin/org/openapitools/client/apis/PetApi.kt b/samples/client/petstore/kotlin-jackson/src/main/kotlin/org/openapitools/client/apis/PetApi.kt index bdd1808f2f3a..bc263b23c905 100644 --- a/samples/client/petstore/kotlin-jackson/src/main/kotlin/org/openapitools/client/apis/PetApi.kt +++ b/samples/client/petstore/kotlin-jackson/src/main/kotlin/org/openapitools/client/apis/PetApi.kt @@ -193,7 +193,7 @@ open class PetApi(basePath: kotlin.String = defaultBasePath, client: Call.Factor return RequestConfig( method = RequestMethod.DELETE, - path = "/pet/{petId}".replace("{"+"petId"+"}", encodeURIComponent(petId.toString())), + path = "/pet/{petId}".replace("{"+"petId"+"}", this@PetApi.encodeURIComponent(petId.toString())), query = localVariableQuery, headers = localVariableHeaders, requiresAuthentication = true, @@ -442,7 +442,7 @@ open class PetApi(basePath: kotlin.String = defaultBasePath, client: Call.Factor return RequestConfig( method = RequestMethod.GET, - path = "/pet/{petId}".replace("{"+"petId"+"}", encodeURIComponent(petId.toString())), + path = "/pet/{petId}".replace("{"+"petId"+"}", this@PetApi.encodeURIComponent(petId.toString())), query = localVariableQuery, headers = localVariableHeaders, requiresAuthentication = true, @@ -593,7 +593,7 @@ open class PetApi(basePath: kotlin.String = defaultBasePath, client: Call.Factor return RequestConfig( method = RequestMethod.POST, - path = "/pet/{petId}".replace("{"+"petId"+"}", encodeURIComponent(petId.toString())), + path = "/pet/{petId}".replace("{"+"petId"+"}", this@PetApi.encodeURIComponent(petId.toString())), query = localVariableQuery, headers = localVariableHeaders, requiresAuthentication = true, @@ -674,7 +674,7 @@ open class PetApi(basePath: kotlin.String = defaultBasePath, client: Call.Factor return RequestConfig( method = RequestMethod.POST, - path = "/pet/{petId}/uploadImage".replace("{"+"petId"+"}", encodeURIComponent(petId.toString())), + path = "/pet/{petId}/uploadImage".replace("{"+"petId"+"}", this@PetApi.encodeURIComponent(petId.toString())), query = localVariableQuery, headers = localVariableHeaders, requiresAuthentication = true, diff --git a/samples/client/petstore/kotlin-jackson/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt b/samples/client/petstore/kotlin-jackson/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt index cb077dcd19d5..d02abfb73e61 100644 --- a/samples/client/petstore/kotlin-jackson/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt +++ b/samples/client/petstore/kotlin-jackson/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt @@ -116,7 +116,7 @@ open class StoreApi(basePath: kotlin.String = defaultBasePath, client: Call.Fact return RequestConfig( method = RequestMethod.DELETE, - path = "/store/order/{orderId}".replace("{"+"orderId"+"}", encodeURIComponent(orderId.toString())), + path = "/store/order/{orderId}".replace("{"+"orderId"+"}", this@StoreApi.encodeURIComponent(orderId.toString())), query = localVariableQuery, headers = localVariableHeaders, requiresAuthentication = false, @@ -259,7 +259,7 @@ open class StoreApi(basePath: kotlin.String = defaultBasePath, client: Call.Fact return RequestConfig( method = RequestMethod.GET, - path = "/store/order/{orderId}".replace("{"+"orderId"+"}", encodeURIComponent(orderId.toString())), + path = "/store/order/{orderId}".replace("{"+"orderId"+"}", this@StoreApi.encodeURIComponent(orderId.toString())), query = localVariableQuery, headers = localVariableHeaders, requiresAuthentication = false, diff --git a/samples/client/petstore/kotlin-jackson/src/main/kotlin/org/openapitools/client/apis/UserApi.kt b/samples/client/petstore/kotlin-jackson/src/main/kotlin/org/openapitools/client/apis/UserApi.kt index d9b344aeac02..7a8094c35612 100644 --- a/samples/client/petstore/kotlin-jackson/src/main/kotlin/org/openapitools/client/apis/UserApi.kt +++ b/samples/client/petstore/kotlin-jackson/src/main/kotlin/org/openapitools/client/apis/UserApi.kt @@ -329,7 +329,7 @@ open class UserApi(basePath: kotlin.String = defaultBasePath, client: Call.Facto return RequestConfig( method = RequestMethod.DELETE, - path = "/user/{username}".replace("{"+"username"+"}", encodeURIComponent(username.toString())), + path = "/user/{username}".replace("{"+"username"+"}", this@UserApi.encodeURIComponent(username.toString())), query = localVariableQuery, headers = localVariableHeaders, requiresAuthentication = false, @@ -402,7 +402,7 @@ open class UserApi(basePath: kotlin.String = defaultBasePath, client: Call.Facto return RequestConfig( method = RequestMethod.GET, - path = "/user/{username}".replace("{"+"username"+"}", encodeURIComponent(username.toString())), + path = "/user/{username}".replace("{"+"username"+"}", this@UserApi.encodeURIComponent(username.toString())), query = localVariableQuery, headers = localVariableHeaders, requiresAuthentication = false, @@ -624,7 +624,7 @@ open class UserApi(basePath: kotlin.String = defaultBasePath, client: Call.Facto return RequestConfig( method = RequestMethod.PUT, - path = "/user/{username}".replace("{"+"username"+"}", encodeURIComponent(username.toString())), + path = "/user/{username}".replace("{"+"username"+"}", this@UserApi.encodeURIComponent(username.toString())), query = localVariableQuery, headers = localVariableHeaders, requiresAuthentication = false, diff --git a/samples/client/petstore/kotlin-jackson3/src/main/kotlin/org/openapitools/client/apis/PetApi.kt b/samples/client/petstore/kotlin-jackson3/src/main/kotlin/org/openapitools/client/apis/PetApi.kt index bdd1808f2f3a..bc263b23c905 100644 --- a/samples/client/petstore/kotlin-jackson3/src/main/kotlin/org/openapitools/client/apis/PetApi.kt +++ b/samples/client/petstore/kotlin-jackson3/src/main/kotlin/org/openapitools/client/apis/PetApi.kt @@ -193,7 +193,7 @@ open class PetApi(basePath: kotlin.String = defaultBasePath, client: Call.Factor return RequestConfig( method = RequestMethod.DELETE, - path = "/pet/{petId}".replace("{"+"petId"+"}", encodeURIComponent(petId.toString())), + path = "/pet/{petId}".replace("{"+"petId"+"}", this@PetApi.encodeURIComponent(petId.toString())), query = localVariableQuery, headers = localVariableHeaders, requiresAuthentication = true, @@ -442,7 +442,7 @@ open class PetApi(basePath: kotlin.String = defaultBasePath, client: Call.Factor return RequestConfig( method = RequestMethod.GET, - path = "/pet/{petId}".replace("{"+"petId"+"}", encodeURIComponent(petId.toString())), + path = "/pet/{petId}".replace("{"+"petId"+"}", this@PetApi.encodeURIComponent(petId.toString())), query = localVariableQuery, headers = localVariableHeaders, requiresAuthentication = true, @@ -593,7 +593,7 @@ open class PetApi(basePath: kotlin.String = defaultBasePath, client: Call.Factor return RequestConfig( method = RequestMethod.POST, - path = "/pet/{petId}".replace("{"+"petId"+"}", encodeURIComponent(petId.toString())), + path = "/pet/{petId}".replace("{"+"petId"+"}", this@PetApi.encodeURIComponent(petId.toString())), query = localVariableQuery, headers = localVariableHeaders, requiresAuthentication = true, @@ -674,7 +674,7 @@ open class PetApi(basePath: kotlin.String = defaultBasePath, client: Call.Factor return RequestConfig( method = RequestMethod.POST, - path = "/pet/{petId}/uploadImage".replace("{"+"petId"+"}", encodeURIComponent(petId.toString())), + path = "/pet/{petId}/uploadImage".replace("{"+"petId"+"}", this@PetApi.encodeURIComponent(petId.toString())), query = localVariableQuery, headers = localVariableHeaders, requiresAuthentication = true, diff --git a/samples/client/petstore/kotlin-jackson3/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt b/samples/client/petstore/kotlin-jackson3/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt index cb077dcd19d5..d02abfb73e61 100644 --- a/samples/client/petstore/kotlin-jackson3/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt +++ b/samples/client/petstore/kotlin-jackson3/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt @@ -116,7 +116,7 @@ open class StoreApi(basePath: kotlin.String = defaultBasePath, client: Call.Fact return RequestConfig( method = RequestMethod.DELETE, - path = "/store/order/{orderId}".replace("{"+"orderId"+"}", encodeURIComponent(orderId.toString())), + path = "/store/order/{orderId}".replace("{"+"orderId"+"}", this@StoreApi.encodeURIComponent(orderId.toString())), query = localVariableQuery, headers = localVariableHeaders, requiresAuthentication = false, @@ -259,7 +259,7 @@ open class StoreApi(basePath: kotlin.String = defaultBasePath, client: Call.Fact return RequestConfig( method = RequestMethod.GET, - path = "/store/order/{orderId}".replace("{"+"orderId"+"}", encodeURIComponent(orderId.toString())), + path = "/store/order/{orderId}".replace("{"+"orderId"+"}", this@StoreApi.encodeURIComponent(orderId.toString())), query = localVariableQuery, headers = localVariableHeaders, requiresAuthentication = false, diff --git a/samples/client/petstore/kotlin-jackson3/src/main/kotlin/org/openapitools/client/apis/UserApi.kt b/samples/client/petstore/kotlin-jackson3/src/main/kotlin/org/openapitools/client/apis/UserApi.kt index d9b344aeac02..7a8094c35612 100644 --- a/samples/client/petstore/kotlin-jackson3/src/main/kotlin/org/openapitools/client/apis/UserApi.kt +++ b/samples/client/petstore/kotlin-jackson3/src/main/kotlin/org/openapitools/client/apis/UserApi.kt @@ -329,7 +329,7 @@ open class UserApi(basePath: kotlin.String = defaultBasePath, client: Call.Facto return RequestConfig( method = RequestMethod.DELETE, - path = "/user/{username}".replace("{"+"username"+"}", encodeURIComponent(username.toString())), + path = "/user/{username}".replace("{"+"username"+"}", this@UserApi.encodeURIComponent(username.toString())), query = localVariableQuery, headers = localVariableHeaders, requiresAuthentication = false, @@ -402,7 +402,7 @@ open class UserApi(basePath: kotlin.String = defaultBasePath, client: Call.Facto return RequestConfig( method = RequestMethod.GET, - path = "/user/{username}".replace("{"+"username"+"}", encodeURIComponent(username.toString())), + path = "/user/{username}".replace("{"+"username"+"}", this@UserApi.encodeURIComponent(username.toString())), query = localVariableQuery, headers = localVariableHeaders, requiresAuthentication = false, @@ -624,7 +624,7 @@ open class UserApi(basePath: kotlin.String = defaultBasePath, client: Call.Facto return RequestConfig( method = RequestMethod.PUT, - path = "/user/{username}".replace("{"+"username"+"}", encodeURIComponent(username.toString())), + path = "/user/{username}".replace("{"+"username"+"}", this@UserApi.encodeURIComponent(username.toString())), query = localVariableQuery, headers = localVariableHeaders, requiresAuthentication = false, diff --git a/samples/client/petstore/kotlin-json-request-string/src/main/kotlin/org/openapitools/client/apis/PetApi.kt b/samples/client/petstore/kotlin-json-request-string/src/main/kotlin/org/openapitools/client/apis/PetApi.kt index 92273772e115..f1b6bcf8f315 100644 --- a/samples/client/petstore/kotlin-json-request-string/src/main/kotlin/org/openapitools/client/apis/PetApi.kt +++ b/samples/client/petstore/kotlin-json-request-string/src/main/kotlin/org/openapitools/client/apis/PetApi.kt @@ -195,7 +195,7 @@ open class PetApi(basePath: kotlin.String = defaultBasePath, client: Call.Factor return RequestConfig( method = RequestMethod.DELETE, - path = "/pet/{petId}".replace("{"+"petId"+"}", encodeURIComponent(petId.toString())), + path = "/pet/{petId}".replace("{"+"petId"+"}", this@PetApi.encodeURIComponent(petId.toString())), query = localVariableQuery, headers = localVariableHeaders, requiresAuthentication = true, @@ -346,7 +346,7 @@ open class PetApi(basePath: kotlin.String = defaultBasePath, client: Call.Factor val localVariableQuery: MultiValueMap = mutableMapOf>() .apply { if (lastUpdated != null) { - put("lastUpdated", listOf(parseDateToQueryString(lastUpdated))) + put("lastUpdated", listOf(this@PetApi.parseDateToQueryString(lastUpdated))) } } val localVariableHeaders: MutableMap = mutableMapOf() @@ -427,7 +427,7 @@ open class PetApi(basePath: kotlin.String = defaultBasePath, client: Call.Factor return RequestConfig( method = RequestMethod.GET, - path = "/pet/{petId}".replace("{"+"petId"+"}", encodeURIComponent(petId.toString())), + path = "/pet/{petId}".replace("{"+"petId"+"}", this@PetApi.encodeURIComponent(petId.toString())), query = localVariableQuery, headers = localVariableHeaders, requiresAuthentication = true, @@ -578,7 +578,7 @@ open class PetApi(basePath: kotlin.String = defaultBasePath, client: Call.Factor return RequestConfig( method = RequestMethod.POST, - path = "/pet/{petId}".replace("{"+"petId"+"}", encodeURIComponent(petId.toString())), + path = "/pet/{petId}".replace("{"+"petId"+"}", this@PetApi.encodeURIComponent(petId.toString())), query = localVariableQuery, headers = localVariableHeaders, requiresAuthentication = true, @@ -659,7 +659,7 @@ open class PetApi(basePath: kotlin.String = defaultBasePath, client: Call.Factor return RequestConfig( method = RequestMethod.POST, - path = "/pet/{petId}/uploadImage".replace("{"+"petId"+"}", encodeURIComponent(petId.toString())), + path = "/pet/{petId}/uploadImage".replace("{"+"petId"+"}", this@PetApi.encodeURIComponent(petId.toString())), query = localVariableQuery, headers = localVariableHeaders, requiresAuthentication = true, diff --git a/samples/client/petstore/kotlin-json-request-string/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt b/samples/client/petstore/kotlin-json-request-string/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt index 95e88c8a36e3..0a9b5810f48e 100644 --- a/samples/client/petstore/kotlin-json-request-string/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt +++ b/samples/client/petstore/kotlin-json-request-string/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt @@ -118,7 +118,7 @@ open class StoreApi(basePath: kotlin.String = defaultBasePath, client: Call.Fact return RequestConfig( method = RequestMethod.DELETE, - path = "/store/order/{orderId}".replace("{"+"orderId"+"}", encodeURIComponent(orderId.toString())), + path = "/store/order/{orderId}".replace("{"+"orderId"+"}", this@StoreApi.encodeURIComponent(orderId.toString())), query = localVariableQuery, headers = localVariableHeaders, requiresAuthentication = false, @@ -261,7 +261,7 @@ open class StoreApi(basePath: kotlin.String = defaultBasePath, client: Call.Fact return RequestConfig( method = RequestMethod.GET, - path = "/store/order/{orderId}".replace("{"+"orderId"+"}", encodeURIComponent(orderId.toString())), + path = "/store/order/{orderId}".replace("{"+"orderId"+"}", this@StoreApi.encodeURIComponent(orderId.toString())), query = localVariableQuery, headers = localVariableHeaders, requiresAuthentication = false, diff --git a/samples/client/petstore/kotlin-json-request-string/src/main/kotlin/org/openapitools/client/apis/UserApi.kt b/samples/client/petstore/kotlin-json-request-string/src/main/kotlin/org/openapitools/client/apis/UserApi.kt index 4d806023e63d..32505194d192 100644 --- a/samples/client/petstore/kotlin-json-request-string/src/main/kotlin/org/openapitools/client/apis/UserApi.kt +++ b/samples/client/petstore/kotlin-json-request-string/src/main/kotlin/org/openapitools/client/apis/UserApi.kt @@ -331,7 +331,7 @@ open class UserApi(basePath: kotlin.String = defaultBasePath, client: Call.Facto return RequestConfig( method = RequestMethod.DELETE, - path = "/user/{username}".replace("{"+"username"+"}", encodeURIComponent(username.toString())), + path = "/user/{username}".replace("{"+"username"+"}", this@UserApi.encodeURIComponent(username.toString())), query = localVariableQuery, headers = localVariableHeaders, requiresAuthentication = false, @@ -404,7 +404,7 @@ open class UserApi(basePath: kotlin.String = defaultBasePath, client: Call.Facto return RequestConfig( method = RequestMethod.GET, - path = "/user/{username}".replace("{"+"username"+"}", encodeURIComponent(username.toString())), + path = "/user/{username}".replace("{"+"username"+"}", this@UserApi.encodeURIComponent(username.toString())), query = localVariableQuery, headers = localVariableHeaders, requiresAuthentication = false, @@ -626,7 +626,7 @@ open class UserApi(basePath: kotlin.String = defaultBasePath, client: Call.Facto return RequestConfig( method = RequestMethod.PUT, - path = "/user/{username}".replace("{"+"username"+"}", encodeURIComponent(username.toString())), + path = "/user/{username}".replace("{"+"username"+"}", this@UserApi.encodeURIComponent(username.toString())), query = localVariableQuery, headers = localVariableHeaders, requiresAuthentication = false, diff --git a/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/src/main/kotlin/org/openapitools/client/apis/PetApi.kt b/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/src/main/kotlin/org/openapitools/client/apis/PetApi.kt index 484699cecc07..bf92d49bbab8 100644 --- a/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/src/main/kotlin/org/openapitools/client/apis/PetApi.kt +++ b/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/src/main/kotlin/org/openapitools/client/apis/PetApi.kt @@ -195,7 +195,7 @@ open class PetApi(basePath: kotlin.String = defaultBasePath, client: Call.Factor return RequestConfig( method = RequestMethod.DELETE, - path = "/pet/{petId}".replace("{"+"petId"+"}", encodeURIComponent(petId.toString())), + path = "/pet/{petId}".replace("{"+"petId"+"}", this@PetApi.encodeURIComponent(petId.toString())), query = localVariableQuery, headers = localVariableHeaders, requiresAuthentication = true, @@ -443,7 +443,7 @@ open class PetApi(basePath: kotlin.String = defaultBasePath, client: Call.Factor return RequestConfig( method = RequestMethod.GET, - path = "/pet/{petId}".replace("{"+"petId"+"}", encodeURIComponent(petId.toString())), + path = "/pet/{petId}".replace("{"+"petId"+"}", this@PetApi.encodeURIComponent(petId.toString())), query = localVariableQuery, headers = localVariableHeaders, requiresAuthentication = true, @@ -594,7 +594,7 @@ open class PetApi(basePath: kotlin.String = defaultBasePath, client: Call.Factor return RequestConfig( method = RequestMethod.POST, - path = "/pet/{petId}".replace("{"+"petId"+"}", encodeURIComponent(petId.toString())), + path = "/pet/{petId}".replace("{"+"petId"+"}", this@PetApi.encodeURIComponent(petId.toString())), query = localVariableQuery, headers = localVariableHeaders, requiresAuthentication = true, @@ -675,7 +675,7 @@ open class PetApi(basePath: kotlin.String = defaultBasePath, client: Call.Factor return RequestConfig( method = RequestMethod.POST, - path = "/pet/{petId}/uploadImage".replace("{"+"petId"+"}", encodeURIComponent(petId.toString())), + path = "/pet/{petId}/uploadImage".replace("{"+"petId"+"}", this@PetApi.encodeURIComponent(petId.toString())), query = localVariableQuery, headers = localVariableHeaders, requiresAuthentication = true, diff --git a/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt b/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt index 365d17eaec8a..6d486c3e0a92 100644 --- a/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt +++ b/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt @@ -118,7 +118,7 @@ open class StoreApi(basePath: kotlin.String = defaultBasePath, client: Call.Fact return RequestConfig( method = RequestMethod.DELETE, - path = "/store/order/{orderId}".replace("{"+"orderId"+"}", encodeURIComponent(orderId.toString())), + path = "/store/order/{orderId}".replace("{"+"orderId"+"}", this@StoreApi.encodeURIComponent(orderId.toString())), query = localVariableQuery, headers = localVariableHeaders, requiresAuthentication = false, @@ -261,7 +261,7 @@ open class StoreApi(basePath: kotlin.String = defaultBasePath, client: Call.Fact return RequestConfig( method = RequestMethod.GET, - path = "/store/order/{orderId}".replace("{"+"orderId"+"}", encodeURIComponent(orderId.toString())), + path = "/store/order/{orderId}".replace("{"+"orderId"+"}", this@StoreApi.encodeURIComponent(orderId.toString())), query = localVariableQuery, headers = localVariableHeaders, requiresAuthentication = false, diff --git a/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/src/main/kotlin/org/openapitools/client/apis/UserApi.kt b/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/src/main/kotlin/org/openapitools/client/apis/UserApi.kt index 981b4377210d..f93db662e03b 100644 --- a/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/src/main/kotlin/org/openapitools/client/apis/UserApi.kt +++ b/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/src/main/kotlin/org/openapitools/client/apis/UserApi.kt @@ -331,7 +331,7 @@ open class UserApi(basePath: kotlin.String = defaultBasePath, client: Call.Facto return RequestConfig( method = RequestMethod.DELETE, - path = "/user/{username}".replace("{"+"username"+"}", encodeURIComponent(username.toString())), + path = "/user/{username}".replace("{"+"username"+"}", this@UserApi.encodeURIComponent(username.toString())), query = localVariableQuery, headers = localVariableHeaders, requiresAuthentication = false, @@ -404,7 +404,7 @@ open class UserApi(basePath: kotlin.String = defaultBasePath, client: Call.Facto return RequestConfig( method = RequestMethod.GET, - path = "/user/{username}".replace("{"+"username"+"}", encodeURIComponent(username.toString())), + path = "/user/{username}".replace("{"+"username"+"}", this@UserApi.encodeURIComponent(username.toString())), query = localVariableQuery, headers = localVariableHeaders, requiresAuthentication = false, @@ -626,7 +626,7 @@ open class UserApi(basePath: kotlin.String = defaultBasePath, client: Call.Facto return RequestConfig( method = RequestMethod.PUT, - path = "/user/{username}".replace("{"+"username"+"}", encodeURIComponent(username.toString())), + path = "/user/{username}".replace("{"+"username"+"}", this@UserApi.encodeURIComponent(username.toString())), query = localVariableQuery, headers = localVariableHeaders, requiresAuthentication = false, diff --git a/samples/client/petstore/kotlin-jvm-spring-2-webclient/src/main/kotlin/org/openapitools/client/apis/PetApi.kt b/samples/client/petstore/kotlin-jvm-spring-2-webclient/src/main/kotlin/org/openapitools/client/apis/PetApi.kt index 0f50e55c233b..e628f38f89c6 100644 --- a/samples/client/petstore/kotlin-jvm-spring-2-webclient/src/main/kotlin/org/openapitools/client/apis/PetApi.kt +++ b/samples/client/petstore/kotlin-jvm-spring-2-webclient/src/main/kotlin/org/openapitools/client/apis/PetApi.kt @@ -59,7 +59,7 @@ open class PetApi(client: WebClient) : ApiClient(client) { @Throws(WebClientResponseException::class) fun addPetWithHttpInfo(pet: Pet): Mono> { val localVariableConfig = addPetRequestConfig(pet = pet) - return request( + return this.request( localVariableConfig ) } @@ -72,13 +72,13 @@ open class PetApi(client: WebClient) : ApiClient(client) { localVariableHeaders["Content-Type"] = "application/xml" localVariableHeaders["Accept"] = "application/xml, application/json" - val params = mutableMapOf( + val localVariableParams = mutableMapOf( ) return RequestConfig( method = RequestMethod.POST, path = "/pet", - params = params, + params = localVariableParams, query = localVariableQuery, headers = localVariableHeaders, requiresAuthentication = true, @@ -96,7 +96,7 @@ open class PetApi(client: WebClient) : ApiClient(client) { @Throws(WebClientResponseException::class) fun deletePetWithHttpInfo(petId: kotlin.Long, apiKey: kotlin.String? = null): Mono> { val localVariableConfig = deletePetRequestConfig(petId = petId, apiKey = apiKey) - return request( + return this.request( localVariableConfig ) } @@ -108,14 +108,14 @@ open class PetApi(client: WebClient) : ApiClient(client) { apiKey?.apply { localVariableHeaders["api_key"] = this.toString() } - val params = mutableMapOf( + val localVariableParams = mutableMapOf( "petId" to petId, ) return RequestConfig( method = RequestMethod.DELETE, path = "/pet/{petId}", - params = params, + params = localVariableParams, query = localVariableQuery, headers = localVariableHeaders, requiresAuthentication = true, @@ -142,7 +142,7 @@ open class PetApi(client: WebClient) : ApiClient(client) { @Throws(WebClientResponseException::class) fun findPetsByStatusWithHttpInfo(status: kotlin.collections.List): Mono>> { val localVariableConfig = findPetsByStatusRequestConfig(status = status) - return request>( + return this.request>( localVariableConfig ) } @@ -156,13 +156,13 @@ open class PetApi(client: WebClient) : ApiClient(client) { val localVariableHeaders: MutableMap = mutableMapOf() localVariableHeaders["Accept"] = "application/xml, application/json" - val params = mutableMapOf( + val localVariableParams = mutableMapOf( ) return RequestConfig( method = RequestMethod.GET, path = "/pet/findByStatus", - params = params, + params = localVariableParams, query = localVariableQuery, headers = localVariableHeaders, requiresAuthentication = true, @@ -182,7 +182,7 @@ open class PetApi(client: WebClient) : ApiClient(client) { @Deprecated(message = "This operation is deprecated.") fun findPetsByTagsWithHttpInfo(tags: kotlin.collections.List): Mono>> { val localVariableConfig = findPetsByTagsRequestConfig(tags = tags) - return request>( + return this.request>( localVariableConfig ) } @@ -197,13 +197,13 @@ open class PetApi(client: WebClient) : ApiClient(client) { val localVariableHeaders: MutableMap = mutableMapOf() localVariableHeaders["Accept"] = "application/xml, application/json" - val params = mutableMapOf( + val localVariableParams = mutableMapOf( ) return RequestConfig( method = RequestMethod.GET, path = "/pet/findByTags", - params = params, + params = localVariableParams, query = localVariableQuery, headers = localVariableHeaders, requiresAuthentication = true, @@ -221,7 +221,7 @@ open class PetApi(client: WebClient) : ApiClient(client) { @Throws(WebClientResponseException::class) fun getPetByIdWithHttpInfo(petId: kotlin.Long): Mono> { val localVariableConfig = getPetByIdRequestConfig(petId = petId) - return request( + return this.request( localVariableConfig ) } @@ -232,14 +232,14 @@ open class PetApi(client: WebClient) : ApiClient(client) { val localVariableHeaders: MutableMap = mutableMapOf() localVariableHeaders["Accept"] = "application/xml, application/json" - val params = mutableMapOf( + val localVariableParams = mutableMapOf( "petId" to petId, ) return RequestConfig( method = RequestMethod.GET, path = "/pet/{petId}", - params = params, + params = localVariableParams, query = localVariableQuery, headers = localVariableHeaders, requiresAuthentication = true, @@ -257,7 +257,7 @@ open class PetApi(client: WebClient) : ApiClient(client) { @Throws(WebClientResponseException::class) fun updatePetWithHttpInfo(pet: Pet): Mono> { val localVariableConfig = updatePetRequestConfig(pet = pet) - return request( + return this.request( localVariableConfig ) } @@ -270,13 +270,13 @@ open class PetApi(client: WebClient) : ApiClient(client) { localVariableHeaders["Content-Type"] = "application/xml" localVariableHeaders["Accept"] = "application/xml, application/json" - val params = mutableMapOf( + val localVariableParams = mutableMapOf( ) return RequestConfig( method = RequestMethod.PUT, path = "/pet", - params = params, + params = localVariableParams, query = localVariableQuery, headers = localVariableHeaders, requiresAuthentication = true, @@ -294,7 +294,7 @@ open class PetApi(client: WebClient) : ApiClient(client) { @Throws(WebClientResponseException::class) fun updatePetWithFormWithHttpInfo(petId: kotlin.Long, name: kotlin.String? = null, status: kotlin.String? = null): Mono> { val localVariableConfig = updatePetWithFormRequestConfig(petId = petId, name = name, status = status) - return request>, Unit>( + return this.request>, Unit>( localVariableConfig ) } @@ -307,14 +307,14 @@ open class PetApi(client: WebClient) : ApiClient(client) { val localVariableHeaders: MutableMap = mutableMapOf("Content-Type" to "application/x-www-form-urlencoded") - val params = mutableMapOf( + val localVariableParams = mutableMapOf( "petId" to petId, ) return RequestConfig( method = RequestMethod.POST, path = "/pet/{petId}", - params = params, + params = localVariableParams, query = localVariableQuery, headers = localVariableHeaders, requiresAuthentication = true, @@ -332,7 +332,7 @@ open class PetApi(client: WebClient) : ApiClient(client) { @Throws(WebClientResponseException::class) fun uploadFileWithHttpInfo(petId: kotlin.Long, additionalMetadata: kotlin.String? = null, file: java.io.File? = null): Mono> { val localVariableConfig = uploadFileRequestConfig(petId = petId, additionalMetadata = additionalMetadata, file = file) - return request>, ModelApiResponse>( + return this.request>, ModelApiResponse>( localVariableConfig ) } @@ -345,14 +345,14 @@ open class PetApi(client: WebClient) : ApiClient(client) { val localVariableHeaders: MutableMap = mutableMapOf("Content-Type" to "multipart/form-data") localVariableHeaders["Accept"] = "application/json" - val params = mutableMapOf( + val localVariableParams = mutableMapOf( "petId" to petId, ) return RequestConfig( method = RequestMethod.POST, path = "/pet/{petId}/uploadImage", - params = params, + params = localVariableParams, query = localVariableQuery, headers = localVariableHeaders, requiresAuthentication = true, diff --git a/samples/client/petstore/kotlin-jvm-spring-2-webclient/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt b/samples/client/petstore/kotlin-jvm-spring-2-webclient/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt index d5c24e250543..72e5a653fcaa 100644 --- a/samples/client/petstore/kotlin-jvm-spring-2-webclient/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt +++ b/samples/client/petstore/kotlin-jvm-spring-2-webclient/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt @@ -58,7 +58,7 @@ open class StoreApi(client: WebClient) : ApiClient(client) { @Throws(WebClientResponseException::class) fun deleteOrderWithHttpInfo(orderId: kotlin.String): Mono> { val localVariableConfig = deleteOrderRequestConfig(orderId = orderId) - return request( + return this.request( localVariableConfig ) } @@ -69,14 +69,14 @@ open class StoreApi(client: WebClient) : ApiClient(client) { val localVariableHeaders: MutableMap = mutableMapOf() - val params = mutableMapOf( + val localVariableParams = mutableMapOf( "orderId" to orderId, ) return RequestConfig( method = RequestMethod.DELETE, path = "/store/order/{orderId}", - params = params, + params = localVariableParams, query = localVariableQuery, headers = localVariableHeaders, requiresAuthentication = false, @@ -94,7 +94,7 @@ open class StoreApi(client: WebClient) : ApiClient(client) { @Throws(WebClientResponseException::class) fun getInventoryWithHttpInfo(): Mono>> { val localVariableConfig = getInventoryRequestConfig() - return request>( + return this.request>( localVariableConfig ) } @@ -105,13 +105,13 @@ open class StoreApi(client: WebClient) : ApiClient(client) { val localVariableHeaders: MutableMap = mutableMapOf() localVariableHeaders["Accept"] = "application/json" - val params = mutableMapOf( + val localVariableParams = mutableMapOf( ) return RequestConfig( method = RequestMethod.GET, path = "/store/inventory", - params = params, + params = localVariableParams, query = localVariableQuery, headers = localVariableHeaders, requiresAuthentication = true, @@ -129,7 +129,7 @@ open class StoreApi(client: WebClient) : ApiClient(client) { @Throws(WebClientResponseException::class) fun getOrderByIdWithHttpInfo(orderId: kotlin.Long): Mono> { val localVariableConfig = getOrderByIdRequestConfig(orderId = orderId) - return request( + return this.request( localVariableConfig ) } @@ -140,14 +140,14 @@ open class StoreApi(client: WebClient) : ApiClient(client) { val localVariableHeaders: MutableMap = mutableMapOf() localVariableHeaders["Accept"] = "application/xml, application/json" - val params = mutableMapOf( + val localVariableParams = mutableMapOf( "orderId" to orderId, ) return RequestConfig( method = RequestMethod.GET, path = "/store/order/{orderId}", - params = params, + params = localVariableParams, query = localVariableQuery, headers = localVariableHeaders, requiresAuthentication = false, @@ -165,7 +165,7 @@ open class StoreApi(client: WebClient) : ApiClient(client) { @Throws(WebClientResponseException::class) fun placeOrderWithHttpInfo(order: Order): Mono> { val localVariableConfig = placeOrderRequestConfig(order = order) - return request( + return this.request( localVariableConfig ) } @@ -177,13 +177,13 @@ open class StoreApi(client: WebClient) : ApiClient(client) { localVariableHeaders["Content-Type"] = "application/json" localVariableHeaders["Accept"] = "application/xml, application/json" - val params = mutableMapOf( + val localVariableParams = mutableMapOf( ) return RequestConfig( method = RequestMethod.POST, path = "/store/order", - params = params, + params = localVariableParams, query = localVariableQuery, headers = localVariableHeaders, requiresAuthentication = false, diff --git a/samples/client/petstore/kotlin-jvm-spring-2-webclient/src/main/kotlin/org/openapitools/client/apis/UserApi.kt b/samples/client/petstore/kotlin-jvm-spring-2-webclient/src/main/kotlin/org/openapitools/client/apis/UserApi.kt index a39aa5c68743..5b7018e372c4 100644 --- a/samples/client/petstore/kotlin-jvm-spring-2-webclient/src/main/kotlin/org/openapitools/client/apis/UserApi.kt +++ b/samples/client/petstore/kotlin-jvm-spring-2-webclient/src/main/kotlin/org/openapitools/client/apis/UserApi.kt @@ -58,7 +58,7 @@ open class UserApi(client: WebClient) : ApiClient(client) { @Throws(WebClientResponseException::class) fun createUserWithHttpInfo(user: User): Mono> { val localVariableConfig = createUserRequestConfig(user = user) - return request( + return this.request( localVariableConfig ) } @@ -70,13 +70,13 @@ open class UserApi(client: WebClient) : ApiClient(client) { localVariableHeaders["Content-Type"] = "application/json" - val params = mutableMapOf( + val localVariableParams = mutableMapOf( ) return RequestConfig( method = RequestMethod.POST, path = "/user", - params = params, + params = localVariableParams, query = localVariableQuery, headers = localVariableHeaders, requiresAuthentication = true, @@ -94,7 +94,7 @@ open class UserApi(client: WebClient) : ApiClient(client) { @Throws(WebClientResponseException::class) fun createUsersWithArrayInputWithHttpInfo(user: kotlin.collections.List): Mono> { val localVariableConfig = createUsersWithArrayInputRequestConfig(user = user) - return request, Unit>( + return this.request, Unit>( localVariableConfig ) } @@ -106,13 +106,13 @@ open class UserApi(client: WebClient) : ApiClient(client) { localVariableHeaders["Content-Type"] = "application/json" - val params = mutableMapOf( + val localVariableParams = mutableMapOf( ) return RequestConfig( method = RequestMethod.POST, path = "/user/createWithArray", - params = params, + params = localVariableParams, query = localVariableQuery, headers = localVariableHeaders, requiresAuthentication = true, @@ -130,7 +130,7 @@ open class UserApi(client: WebClient) : ApiClient(client) { @Throws(WebClientResponseException::class) fun createUsersWithListInputWithHttpInfo(user: kotlin.collections.List): Mono> { val localVariableConfig = createUsersWithListInputRequestConfig(user = user) - return request, Unit>( + return this.request, Unit>( localVariableConfig ) } @@ -142,13 +142,13 @@ open class UserApi(client: WebClient) : ApiClient(client) { localVariableHeaders["Content-Type"] = "application/json" - val params = mutableMapOf( + val localVariableParams = mutableMapOf( ) return RequestConfig( method = RequestMethod.POST, path = "/user/createWithList", - params = params, + params = localVariableParams, query = localVariableQuery, headers = localVariableHeaders, requiresAuthentication = true, @@ -166,7 +166,7 @@ open class UserApi(client: WebClient) : ApiClient(client) { @Throws(WebClientResponseException::class) fun deleteUserWithHttpInfo(username: kotlin.String): Mono> { val localVariableConfig = deleteUserRequestConfig(username = username) - return request( + return this.request( localVariableConfig ) } @@ -177,14 +177,14 @@ open class UserApi(client: WebClient) : ApiClient(client) { val localVariableHeaders: MutableMap = mutableMapOf() - val params = mutableMapOf( + val localVariableParams = mutableMapOf( "username" to username, ) return RequestConfig( method = RequestMethod.DELETE, path = "/user/{username}", - params = params, + params = localVariableParams, query = localVariableQuery, headers = localVariableHeaders, requiresAuthentication = true, @@ -202,7 +202,7 @@ open class UserApi(client: WebClient) : ApiClient(client) { @Throws(WebClientResponseException::class) fun getUserByNameWithHttpInfo(username: kotlin.String): Mono> { val localVariableConfig = getUserByNameRequestConfig(username = username) - return request( + return this.request( localVariableConfig ) } @@ -213,14 +213,14 @@ open class UserApi(client: WebClient) : ApiClient(client) { val localVariableHeaders: MutableMap = mutableMapOf() localVariableHeaders["Accept"] = "application/xml, application/json" - val params = mutableMapOf( + val localVariableParams = mutableMapOf( "username" to username, ) return RequestConfig( method = RequestMethod.GET, path = "/user/{username}", - params = params, + params = localVariableParams, query = localVariableQuery, headers = localVariableHeaders, requiresAuthentication = false, @@ -238,7 +238,7 @@ open class UserApi(client: WebClient) : ApiClient(client) { @Throws(WebClientResponseException::class) fun loginUserWithHttpInfo(username: kotlin.String, password: kotlin.String): Mono> { val localVariableConfig = loginUserRequestConfig(username = username, password = password) - return request( + return this.request( localVariableConfig ) } @@ -253,13 +253,13 @@ open class UserApi(client: WebClient) : ApiClient(client) { val localVariableHeaders: MutableMap = mutableMapOf() localVariableHeaders["Accept"] = "application/xml, application/json" - val params = mutableMapOf( + val localVariableParams = mutableMapOf( ) return RequestConfig( method = RequestMethod.GET, path = "/user/login", - params = params, + params = localVariableParams, query = localVariableQuery, headers = localVariableHeaders, requiresAuthentication = false, @@ -277,7 +277,7 @@ open class UserApi(client: WebClient) : ApiClient(client) { @Throws(WebClientResponseException::class) fun logoutUserWithHttpInfo(): Mono> { val localVariableConfig = logoutUserRequestConfig() - return request( + return this.request( localVariableConfig ) } @@ -288,13 +288,13 @@ open class UserApi(client: WebClient) : ApiClient(client) { val localVariableHeaders: MutableMap = mutableMapOf() - val params = mutableMapOf( + val localVariableParams = mutableMapOf( ) return RequestConfig( method = RequestMethod.GET, path = "/user/logout", - params = params, + params = localVariableParams, query = localVariableQuery, headers = localVariableHeaders, requiresAuthentication = true, @@ -312,7 +312,7 @@ open class UserApi(client: WebClient) : ApiClient(client) { @Throws(WebClientResponseException::class) fun updateUserWithHttpInfo(username: kotlin.String, user: User): Mono> { val localVariableConfig = updateUserRequestConfig(username = username, user = user) - return request( + return this.request( localVariableConfig ) } @@ -324,14 +324,14 @@ open class UserApi(client: WebClient) : ApiClient(client) { localVariableHeaders["Content-Type"] = "application/json" - val params = mutableMapOf( + val localVariableParams = mutableMapOf( "username" to username, ) return RequestConfig( method = RequestMethod.PUT, path = "/user/{username}", - params = params, + params = localVariableParams, query = localVariableQuery, headers = localVariableHeaders, requiresAuthentication = true, diff --git a/samples/client/petstore/kotlin-jvm-spring-3-restclient/src/main/kotlin/org/openapitools/client/apis/PetApi.kt b/samples/client/petstore/kotlin-jvm-spring-3-restclient/src/main/kotlin/org/openapitools/client/apis/PetApi.kt index 14b76e6cb842..4ec2ddde66c4 100644 --- a/samples/client/petstore/kotlin-jvm-spring-3-restclient/src/main/kotlin/org/openapitools/client/apis/PetApi.kt +++ b/samples/client/petstore/kotlin-jvm-spring-3-restclient/src/main/kotlin/org/openapitools/client/apis/PetApi.kt @@ -48,14 +48,14 @@ open class PetApi(client: RestClient) : ApiClient(client) { @Throws(RestClientResponseException::class) fun addPet(pet: Pet): Pet { - val result = addPetWithHttpInfo(pet = pet) - return result.body!! + val localVariableResult = addPetWithHttpInfo(pet = pet) + return localVariableResult.body!! } @Throws(RestClientResponseException::class) fun addPetWithHttpInfo(pet: Pet): ResponseEntity { val localVariableConfig = addPetRequestConfig(pet = pet) - return request( + return this.request( localVariableConfig ) } @@ -68,13 +68,13 @@ open class PetApi(client: RestClient) : ApiClient(client) { localVariableHeaders["Content-Type"] = "application/xml" localVariableHeaders["Accept"] = "application/xml, application/json" - val params = mutableMapOf( + val localVariableParams = mutableMapOf( ) return RequestConfig( method = RequestMethod.POST, path = "/pet", - params = params, + params = localVariableParams, query = localVariableQuery, headers = localVariableHeaders, requiresAuthentication = true, @@ -91,7 +91,7 @@ open class PetApi(client: RestClient) : ApiClient(client) { @Throws(RestClientResponseException::class) fun deletePetWithHttpInfo(petId: kotlin.Long, apiKey: kotlin.String? = null): ResponseEntity { val localVariableConfig = deletePetRequestConfig(petId = petId, apiKey = apiKey) - return request( + return this.request( localVariableConfig ) } @@ -103,14 +103,14 @@ open class PetApi(client: RestClient) : ApiClient(client) { apiKey?.apply { localVariableHeaders["api_key"] = this.toString() } - val params = mutableMapOf( + val localVariableParams = mutableMapOf( "petId" to petId, ) return RequestConfig( method = RequestMethod.DELETE, path = "/pet/{petId}", - params = params, + params = localVariableParams, query = localVariableQuery, headers = localVariableHeaders, requiresAuthentication = true, @@ -130,14 +130,14 @@ open class PetApi(client: RestClient) : ApiClient(client) { @Throws(RestClientResponseException::class) fun findPetsByStatus(status: kotlin.collections.List): kotlin.collections.List { - val result = findPetsByStatusWithHttpInfo(status = status) - return result.body!! + val localVariableResult = findPetsByStatusWithHttpInfo(status = status) + return localVariableResult.body!! } @Throws(RestClientResponseException::class) fun findPetsByStatusWithHttpInfo(status: kotlin.collections.List): ResponseEntity> { val localVariableConfig = findPetsByStatusRequestConfig(status = status) - return request>( + return this.request>( localVariableConfig ) } @@ -151,13 +151,13 @@ open class PetApi(client: RestClient) : ApiClient(client) { val localVariableHeaders: MutableMap = mutableMapOf() localVariableHeaders["Accept"] = "application/xml, application/json" - val params = mutableMapOf( + val localVariableParams = mutableMapOf( ) return RequestConfig( method = RequestMethod.GET, path = "/pet/findByStatus", - params = params, + params = localVariableParams, query = localVariableQuery, headers = localVariableHeaders, requiresAuthentication = true, @@ -169,15 +169,15 @@ open class PetApi(client: RestClient) : ApiClient(client) { @Throws(RestClientResponseException::class) @Deprecated(message = "This operation is deprecated.") fun findPetsByTags(tags: kotlin.collections.List): kotlin.collections.List { - val result = findPetsByTagsWithHttpInfo(tags = tags) - return result.body!! + val localVariableResult = findPetsByTagsWithHttpInfo(tags = tags) + return localVariableResult.body!! } @Throws(RestClientResponseException::class) @Deprecated(message = "This operation is deprecated.") fun findPetsByTagsWithHttpInfo(tags: kotlin.collections.List): ResponseEntity> { val localVariableConfig = findPetsByTagsRequestConfig(tags = tags) - return request>( + return this.request>( localVariableConfig ) } @@ -192,13 +192,13 @@ open class PetApi(client: RestClient) : ApiClient(client) { val localVariableHeaders: MutableMap = mutableMapOf() localVariableHeaders["Accept"] = "application/xml, application/json" - val params = mutableMapOf( + val localVariableParams = mutableMapOf( ) return RequestConfig( method = RequestMethod.GET, path = "/pet/findByTags", - params = params, + params = localVariableParams, query = localVariableQuery, headers = localVariableHeaders, requiresAuthentication = true, @@ -209,14 +209,14 @@ open class PetApi(client: RestClient) : ApiClient(client) { @Throws(RestClientResponseException::class) fun getPetById(petId: kotlin.Long): Pet { - val result = getPetByIdWithHttpInfo(petId = petId) - return result.body!! + val localVariableResult = getPetByIdWithHttpInfo(petId = petId) + return localVariableResult.body!! } @Throws(RestClientResponseException::class) fun getPetByIdWithHttpInfo(petId: kotlin.Long): ResponseEntity { val localVariableConfig = getPetByIdRequestConfig(petId = petId) - return request( + return this.request( localVariableConfig ) } @@ -227,14 +227,14 @@ open class PetApi(client: RestClient) : ApiClient(client) { val localVariableHeaders: MutableMap = mutableMapOf() localVariableHeaders["Accept"] = "application/xml, application/json" - val params = mutableMapOf( + val localVariableParams = mutableMapOf( "petId" to petId, ) return RequestConfig( method = RequestMethod.GET, path = "/pet/{petId}", - params = params, + params = localVariableParams, query = localVariableQuery, headers = localVariableHeaders, requiresAuthentication = true, @@ -245,14 +245,14 @@ open class PetApi(client: RestClient) : ApiClient(client) { @Throws(RestClientResponseException::class) fun updatePet(pet: Pet): Pet { - val result = updatePetWithHttpInfo(pet = pet) - return result.body!! + val localVariableResult = updatePetWithHttpInfo(pet = pet) + return localVariableResult.body!! } @Throws(RestClientResponseException::class) fun updatePetWithHttpInfo(pet: Pet): ResponseEntity { val localVariableConfig = updatePetRequestConfig(pet = pet) - return request( + return this.request( localVariableConfig ) } @@ -265,13 +265,13 @@ open class PetApi(client: RestClient) : ApiClient(client) { localVariableHeaders["Content-Type"] = "application/xml" localVariableHeaders["Accept"] = "application/xml, application/json" - val params = mutableMapOf( + val localVariableParams = mutableMapOf( ) return RequestConfig( method = RequestMethod.PUT, path = "/pet", - params = params, + params = localVariableParams, query = localVariableQuery, headers = localVariableHeaders, requiresAuthentication = true, @@ -288,7 +288,7 @@ open class PetApi(client: RestClient) : ApiClient(client) { @Throws(RestClientResponseException::class) fun updatePetWithFormWithHttpInfo(petId: kotlin.Long, name: kotlin.String? = null, status: kotlin.String? = null): ResponseEntity { val localVariableConfig = updatePetWithFormRequestConfig(petId = petId, name = name, status = status) - return request>, Unit>( + return this.request>, Unit>( localVariableConfig ) } @@ -301,14 +301,14 @@ open class PetApi(client: RestClient) : ApiClient(client) { val localVariableHeaders: MutableMap = mutableMapOf("Content-Type" to "application/x-www-form-urlencoded") - val params = mutableMapOf( + val localVariableParams = mutableMapOf( "petId" to petId, ) return RequestConfig( method = RequestMethod.POST, path = "/pet/{petId}", - params = params, + params = localVariableParams, query = localVariableQuery, headers = localVariableHeaders, requiresAuthentication = true, @@ -319,14 +319,14 @@ open class PetApi(client: RestClient) : ApiClient(client) { @Throws(RestClientResponseException::class) fun uploadFile(petId: kotlin.Long, additionalMetadata: kotlin.String? = null, file: java.io.File? = null): ModelApiResponse { - val result = uploadFileWithHttpInfo(petId = petId, additionalMetadata = additionalMetadata, file = file) - return result.body!! + val localVariableResult = uploadFileWithHttpInfo(petId = petId, additionalMetadata = additionalMetadata, file = file) + return localVariableResult.body!! } @Throws(RestClientResponseException::class) fun uploadFileWithHttpInfo(petId: kotlin.Long, additionalMetadata: kotlin.String? = null, file: java.io.File? = null): ResponseEntity { val localVariableConfig = uploadFileRequestConfig(petId = petId, additionalMetadata = additionalMetadata, file = file) - return request>, ModelApiResponse>( + return this.request>, ModelApiResponse>( localVariableConfig ) } @@ -339,14 +339,14 @@ open class PetApi(client: RestClient) : ApiClient(client) { val localVariableHeaders: MutableMap = mutableMapOf("Content-Type" to "multipart/form-data") localVariableHeaders["Accept"] = "application/json" - val params = mutableMapOf( + val localVariableParams = mutableMapOf( "petId" to petId, ) return RequestConfig( method = RequestMethod.POST, path = "/pet/{petId}/uploadImage", - params = params, + params = localVariableParams, query = localVariableQuery, headers = localVariableHeaders, requiresAuthentication = true, diff --git a/samples/client/petstore/kotlin-jvm-spring-3-restclient/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt b/samples/client/petstore/kotlin-jvm-spring-3-restclient/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt index 834b30f20526..f388470be236 100644 --- a/samples/client/petstore/kotlin-jvm-spring-3-restclient/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt +++ b/samples/client/petstore/kotlin-jvm-spring-3-restclient/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt @@ -53,7 +53,7 @@ open class StoreApi(client: RestClient) : ApiClient(client) { @Throws(RestClientResponseException::class) fun deleteOrderWithHttpInfo(orderId: kotlin.String): ResponseEntity { val localVariableConfig = deleteOrderRequestConfig(orderId = orderId) - return request( + return this.request( localVariableConfig ) } @@ -64,14 +64,14 @@ open class StoreApi(client: RestClient) : ApiClient(client) { val localVariableHeaders: MutableMap = mutableMapOf() - val params = mutableMapOf( + val localVariableParams = mutableMapOf( "orderId" to orderId, ) return RequestConfig( method = RequestMethod.DELETE, path = "/store/order/{orderId}", - params = params, + params = localVariableParams, query = localVariableQuery, headers = localVariableHeaders, requiresAuthentication = false, @@ -82,14 +82,14 @@ open class StoreApi(client: RestClient) : ApiClient(client) { @Throws(RestClientResponseException::class) fun getInventory(): kotlin.collections.Map { - val result = getInventoryWithHttpInfo() - return result.body!! + val localVariableResult = getInventoryWithHttpInfo() + return localVariableResult.body!! } @Throws(RestClientResponseException::class) fun getInventoryWithHttpInfo(): ResponseEntity> { val localVariableConfig = getInventoryRequestConfig() - return request>( + return this.request>( localVariableConfig ) } @@ -100,13 +100,13 @@ open class StoreApi(client: RestClient) : ApiClient(client) { val localVariableHeaders: MutableMap = mutableMapOf() localVariableHeaders["Accept"] = "application/json" - val params = mutableMapOf( + val localVariableParams = mutableMapOf( ) return RequestConfig( method = RequestMethod.GET, path = "/store/inventory", - params = params, + params = localVariableParams, query = localVariableQuery, headers = localVariableHeaders, requiresAuthentication = true, @@ -117,14 +117,14 @@ open class StoreApi(client: RestClient) : ApiClient(client) { @Throws(RestClientResponseException::class) fun getOrderById(orderId: kotlin.Long): Order { - val result = getOrderByIdWithHttpInfo(orderId = orderId) - return result.body!! + val localVariableResult = getOrderByIdWithHttpInfo(orderId = orderId) + return localVariableResult.body!! } @Throws(RestClientResponseException::class) fun getOrderByIdWithHttpInfo(orderId: kotlin.Long): ResponseEntity { val localVariableConfig = getOrderByIdRequestConfig(orderId = orderId) - return request( + return this.request( localVariableConfig ) } @@ -135,14 +135,14 @@ open class StoreApi(client: RestClient) : ApiClient(client) { val localVariableHeaders: MutableMap = mutableMapOf() localVariableHeaders["Accept"] = "application/xml, application/json" - val params = mutableMapOf( + val localVariableParams = mutableMapOf( "orderId" to orderId, ) return RequestConfig( method = RequestMethod.GET, path = "/store/order/{orderId}", - params = params, + params = localVariableParams, query = localVariableQuery, headers = localVariableHeaders, requiresAuthentication = false, @@ -153,14 +153,14 @@ open class StoreApi(client: RestClient) : ApiClient(client) { @Throws(RestClientResponseException::class) fun placeOrder(order: Order): Order { - val result = placeOrderWithHttpInfo(order = order) - return result.body!! + val localVariableResult = placeOrderWithHttpInfo(order = order) + return localVariableResult.body!! } @Throws(RestClientResponseException::class) fun placeOrderWithHttpInfo(order: Order): ResponseEntity { val localVariableConfig = placeOrderRequestConfig(order = order) - return request( + return this.request( localVariableConfig ) } @@ -172,13 +172,13 @@ open class StoreApi(client: RestClient) : ApiClient(client) { localVariableHeaders["Content-Type"] = "application/json" localVariableHeaders["Accept"] = "application/xml, application/json" - val params = mutableMapOf( + val localVariableParams = mutableMapOf( ) return RequestConfig( method = RequestMethod.POST, path = "/store/order", - params = params, + params = localVariableParams, query = localVariableQuery, headers = localVariableHeaders, requiresAuthentication = false, diff --git a/samples/client/petstore/kotlin-jvm-spring-3-restclient/src/main/kotlin/org/openapitools/client/apis/UserApi.kt b/samples/client/petstore/kotlin-jvm-spring-3-restclient/src/main/kotlin/org/openapitools/client/apis/UserApi.kt index 189b95211824..1d9d7c14daef 100644 --- a/samples/client/petstore/kotlin-jvm-spring-3-restclient/src/main/kotlin/org/openapitools/client/apis/UserApi.kt +++ b/samples/client/petstore/kotlin-jvm-spring-3-restclient/src/main/kotlin/org/openapitools/client/apis/UserApi.kt @@ -53,7 +53,7 @@ open class UserApi(client: RestClient) : ApiClient(client) { @Throws(RestClientResponseException::class) fun createUserWithHttpInfo(user: User): ResponseEntity { val localVariableConfig = createUserRequestConfig(user = user) - return request( + return this.request( localVariableConfig ) } @@ -65,13 +65,13 @@ open class UserApi(client: RestClient) : ApiClient(client) { localVariableHeaders["Content-Type"] = "application/json" - val params = mutableMapOf( + val localVariableParams = mutableMapOf( ) return RequestConfig( method = RequestMethod.POST, path = "/user", - params = params, + params = localVariableParams, query = localVariableQuery, headers = localVariableHeaders, requiresAuthentication = true, @@ -88,7 +88,7 @@ open class UserApi(client: RestClient) : ApiClient(client) { @Throws(RestClientResponseException::class) fun createUsersWithArrayInputWithHttpInfo(user: kotlin.collections.List): ResponseEntity { val localVariableConfig = createUsersWithArrayInputRequestConfig(user = user) - return request, Unit>( + return this.request, Unit>( localVariableConfig ) } @@ -100,13 +100,13 @@ open class UserApi(client: RestClient) : ApiClient(client) { localVariableHeaders["Content-Type"] = "application/json" - val params = mutableMapOf( + val localVariableParams = mutableMapOf( ) return RequestConfig( method = RequestMethod.POST, path = "/user/createWithArray", - params = params, + params = localVariableParams, query = localVariableQuery, headers = localVariableHeaders, requiresAuthentication = true, @@ -123,7 +123,7 @@ open class UserApi(client: RestClient) : ApiClient(client) { @Throws(RestClientResponseException::class) fun createUsersWithListInputWithHttpInfo(user: kotlin.collections.List): ResponseEntity { val localVariableConfig = createUsersWithListInputRequestConfig(user = user) - return request, Unit>( + return this.request, Unit>( localVariableConfig ) } @@ -135,13 +135,13 @@ open class UserApi(client: RestClient) : ApiClient(client) { localVariableHeaders["Content-Type"] = "application/json" - val params = mutableMapOf( + val localVariableParams = mutableMapOf( ) return RequestConfig( method = RequestMethod.POST, path = "/user/createWithList", - params = params, + params = localVariableParams, query = localVariableQuery, headers = localVariableHeaders, requiresAuthentication = true, @@ -158,7 +158,7 @@ open class UserApi(client: RestClient) : ApiClient(client) { @Throws(RestClientResponseException::class) fun deleteUserWithHttpInfo(username: kotlin.String): ResponseEntity { val localVariableConfig = deleteUserRequestConfig(username = username) - return request( + return this.request( localVariableConfig ) } @@ -169,14 +169,14 @@ open class UserApi(client: RestClient) : ApiClient(client) { val localVariableHeaders: MutableMap = mutableMapOf() - val params = mutableMapOf( + val localVariableParams = mutableMapOf( "username" to username, ) return RequestConfig( method = RequestMethod.DELETE, path = "/user/{username}", - params = params, + params = localVariableParams, query = localVariableQuery, headers = localVariableHeaders, requiresAuthentication = true, @@ -187,14 +187,14 @@ open class UserApi(client: RestClient) : ApiClient(client) { @Throws(RestClientResponseException::class) fun getUserByName(username: kotlin.String): User { - val result = getUserByNameWithHttpInfo(username = username) - return result.body!! + val localVariableResult = getUserByNameWithHttpInfo(username = username) + return localVariableResult.body!! } @Throws(RestClientResponseException::class) fun getUserByNameWithHttpInfo(username: kotlin.String): ResponseEntity { val localVariableConfig = getUserByNameRequestConfig(username = username) - return request( + return this.request( localVariableConfig ) } @@ -205,14 +205,14 @@ open class UserApi(client: RestClient) : ApiClient(client) { val localVariableHeaders: MutableMap = mutableMapOf() localVariableHeaders["Accept"] = "application/xml, application/json" - val params = mutableMapOf( + val localVariableParams = mutableMapOf( "username" to username, ) return RequestConfig( method = RequestMethod.GET, path = "/user/{username}", - params = params, + params = localVariableParams, query = localVariableQuery, headers = localVariableHeaders, requiresAuthentication = false, @@ -223,14 +223,14 @@ open class UserApi(client: RestClient) : ApiClient(client) { @Throws(RestClientResponseException::class) fun loginUser(username: kotlin.String, password: kotlin.String): kotlin.String { - val result = loginUserWithHttpInfo(username = username, password = password) - return result.body!! + val localVariableResult = loginUserWithHttpInfo(username = username, password = password) + return localVariableResult.body!! } @Throws(RestClientResponseException::class) fun loginUserWithHttpInfo(username: kotlin.String, password: kotlin.String): ResponseEntity { val localVariableConfig = loginUserRequestConfig(username = username, password = password) - return request( + return this.request( localVariableConfig ) } @@ -245,13 +245,13 @@ open class UserApi(client: RestClient) : ApiClient(client) { val localVariableHeaders: MutableMap = mutableMapOf() localVariableHeaders["Accept"] = "application/xml, application/json" - val params = mutableMapOf( + val localVariableParams = mutableMapOf( ) return RequestConfig( method = RequestMethod.GET, path = "/user/login", - params = params, + params = localVariableParams, query = localVariableQuery, headers = localVariableHeaders, requiresAuthentication = false, @@ -268,7 +268,7 @@ open class UserApi(client: RestClient) : ApiClient(client) { @Throws(RestClientResponseException::class) fun logoutUserWithHttpInfo(): ResponseEntity { val localVariableConfig = logoutUserRequestConfig() - return request( + return this.request( localVariableConfig ) } @@ -279,13 +279,13 @@ open class UserApi(client: RestClient) : ApiClient(client) { val localVariableHeaders: MutableMap = mutableMapOf() - val params = mutableMapOf( + val localVariableParams = mutableMapOf( ) return RequestConfig( method = RequestMethod.GET, path = "/user/logout", - params = params, + params = localVariableParams, query = localVariableQuery, headers = localVariableHeaders, requiresAuthentication = true, @@ -302,7 +302,7 @@ open class UserApi(client: RestClient) : ApiClient(client) { @Throws(RestClientResponseException::class) fun updateUserWithHttpInfo(username: kotlin.String, user: User): ResponseEntity { val localVariableConfig = updateUserRequestConfig(username = username, user = user) - return request( + return this.request( localVariableConfig ) } @@ -314,14 +314,14 @@ open class UserApi(client: RestClient) : ApiClient(client) { localVariableHeaders["Content-Type"] = "application/json" - val params = mutableMapOf( + val localVariableParams = mutableMapOf( "username" to username, ) return RequestConfig( method = RequestMethod.PUT, path = "/user/{username}", - params = params, + params = localVariableParams, query = localVariableQuery, headers = localVariableHeaders, requiresAuthentication = true, diff --git a/samples/client/petstore/kotlin-jvm-spring-3-webclient/src/main/kotlin/org/openapitools/client/apis/PetApi.kt b/samples/client/petstore/kotlin-jvm-spring-3-webclient/src/main/kotlin/org/openapitools/client/apis/PetApi.kt index 0f50e55c233b..e628f38f89c6 100644 --- a/samples/client/petstore/kotlin-jvm-spring-3-webclient/src/main/kotlin/org/openapitools/client/apis/PetApi.kt +++ b/samples/client/petstore/kotlin-jvm-spring-3-webclient/src/main/kotlin/org/openapitools/client/apis/PetApi.kt @@ -59,7 +59,7 @@ open class PetApi(client: WebClient) : ApiClient(client) { @Throws(WebClientResponseException::class) fun addPetWithHttpInfo(pet: Pet): Mono> { val localVariableConfig = addPetRequestConfig(pet = pet) - return request( + return this.request( localVariableConfig ) } @@ -72,13 +72,13 @@ open class PetApi(client: WebClient) : ApiClient(client) { localVariableHeaders["Content-Type"] = "application/xml" localVariableHeaders["Accept"] = "application/xml, application/json" - val params = mutableMapOf( + val localVariableParams = mutableMapOf( ) return RequestConfig( method = RequestMethod.POST, path = "/pet", - params = params, + params = localVariableParams, query = localVariableQuery, headers = localVariableHeaders, requiresAuthentication = true, @@ -96,7 +96,7 @@ open class PetApi(client: WebClient) : ApiClient(client) { @Throws(WebClientResponseException::class) fun deletePetWithHttpInfo(petId: kotlin.Long, apiKey: kotlin.String? = null): Mono> { val localVariableConfig = deletePetRequestConfig(petId = petId, apiKey = apiKey) - return request( + return this.request( localVariableConfig ) } @@ -108,14 +108,14 @@ open class PetApi(client: WebClient) : ApiClient(client) { apiKey?.apply { localVariableHeaders["api_key"] = this.toString() } - val params = mutableMapOf( + val localVariableParams = mutableMapOf( "petId" to petId, ) return RequestConfig( method = RequestMethod.DELETE, path = "/pet/{petId}", - params = params, + params = localVariableParams, query = localVariableQuery, headers = localVariableHeaders, requiresAuthentication = true, @@ -142,7 +142,7 @@ open class PetApi(client: WebClient) : ApiClient(client) { @Throws(WebClientResponseException::class) fun findPetsByStatusWithHttpInfo(status: kotlin.collections.List): Mono>> { val localVariableConfig = findPetsByStatusRequestConfig(status = status) - return request>( + return this.request>( localVariableConfig ) } @@ -156,13 +156,13 @@ open class PetApi(client: WebClient) : ApiClient(client) { val localVariableHeaders: MutableMap = mutableMapOf() localVariableHeaders["Accept"] = "application/xml, application/json" - val params = mutableMapOf( + val localVariableParams = mutableMapOf( ) return RequestConfig( method = RequestMethod.GET, path = "/pet/findByStatus", - params = params, + params = localVariableParams, query = localVariableQuery, headers = localVariableHeaders, requiresAuthentication = true, @@ -182,7 +182,7 @@ open class PetApi(client: WebClient) : ApiClient(client) { @Deprecated(message = "This operation is deprecated.") fun findPetsByTagsWithHttpInfo(tags: kotlin.collections.List): Mono>> { val localVariableConfig = findPetsByTagsRequestConfig(tags = tags) - return request>( + return this.request>( localVariableConfig ) } @@ -197,13 +197,13 @@ open class PetApi(client: WebClient) : ApiClient(client) { val localVariableHeaders: MutableMap = mutableMapOf() localVariableHeaders["Accept"] = "application/xml, application/json" - val params = mutableMapOf( + val localVariableParams = mutableMapOf( ) return RequestConfig( method = RequestMethod.GET, path = "/pet/findByTags", - params = params, + params = localVariableParams, query = localVariableQuery, headers = localVariableHeaders, requiresAuthentication = true, @@ -221,7 +221,7 @@ open class PetApi(client: WebClient) : ApiClient(client) { @Throws(WebClientResponseException::class) fun getPetByIdWithHttpInfo(petId: kotlin.Long): Mono> { val localVariableConfig = getPetByIdRequestConfig(petId = petId) - return request( + return this.request( localVariableConfig ) } @@ -232,14 +232,14 @@ open class PetApi(client: WebClient) : ApiClient(client) { val localVariableHeaders: MutableMap = mutableMapOf() localVariableHeaders["Accept"] = "application/xml, application/json" - val params = mutableMapOf( + val localVariableParams = mutableMapOf( "petId" to petId, ) return RequestConfig( method = RequestMethod.GET, path = "/pet/{petId}", - params = params, + params = localVariableParams, query = localVariableQuery, headers = localVariableHeaders, requiresAuthentication = true, @@ -257,7 +257,7 @@ open class PetApi(client: WebClient) : ApiClient(client) { @Throws(WebClientResponseException::class) fun updatePetWithHttpInfo(pet: Pet): Mono> { val localVariableConfig = updatePetRequestConfig(pet = pet) - return request( + return this.request( localVariableConfig ) } @@ -270,13 +270,13 @@ open class PetApi(client: WebClient) : ApiClient(client) { localVariableHeaders["Content-Type"] = "application/xml" localVariableHeaders["Accept"] = "application/xml, application/json" - val params = mutableMapOf( + val localVariableParams = mutableMapOf( ) return RequestConfig( method = RequestMethod.PUT, path = "/pet", - params = params, + params = localVariableParams, query = localVariableQuery, headers = localVariableHeaders, requiresAuthentication = true, @@ -294,7 +294,7 @@ open class PetApi(client: WebClient) : ApiClient(client) { @Throws(WebClientResponseException::class) fun updatePetWithFormWithHttpInfo(petId: kotlin.Long, name: kotlin.String? = null, status: kotlin.String? = null): Mono> { val localVariableConfig = updatePetWithFormRequestConfig(petId = petId, name = name, status = status) - return request>, Unit>( + return this.request>, Unit>( localVariableConfig ) } @@ -307,14 +307,14 @@ open class PetApi(client: WebClient) : ApiClient(client) { val localVariableHeaders: MutableMap = mutableMapOf("Content-Type" to "application/x-www-form-urlencoded") - val params = mutableMapOf( + val localVariableParams = mutableMapOf( "petId" to petId, ) return RequestConfig( method = RequestMethod.POST, path = "/pet/{petId}", - params = params, + params = localVariableParams, query = localVariableQuery, headers = localVariableHeaders, requiresAuthentication = true, @@ -332,7 +332,7 @@ open class PetApi(client: WebClient) : ApiClient(client) { @Throws(WebClientResponseException::class) fun uploadFileWithHttpInfo(petId: kotlin.Long, additionalMetadata: kotlin.String? = null, file: java.io.File? = null): Mono> { val localVariableConfig = uploadFileRequestConfig(petId = petId, additionalMetadata = additionalMetadata, file = file) - return request>, ModelApiResponse>( + return this.request>, ModelApiResponse>( localVariableConfig ) } @@ -345,14 +345,14 @@ open class PetApi(client: WebClient) : ApiClient(client) { val localVariableHeaders: MutableMap = mutableMapOf("Content-Type" to "multipart/form-data") localVariableHeaders["Accept"] = "application/json" - val params = mutableMapOf( + val localVariableParams = mutableMapOf( "petId" to petId, ) return RequestConfig( method = RequestMethod.POST, path = "/pet/{petId}/uploadImage", - params = params, + params = localVariableParams, query = localVariableQuery, headers = localVariableHeaders, requiresAuthentication = true, diff --git a/samples/client/petstore/kotlin-jvm-spring-3-webclient/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt b/samples/client/petstore/kotlin-jvm-spring-3-webclient/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt index d5c24e250543..72e5a653fcaa 100644 --- a/samples/client/petstore/kotlin-jvm-spring-3-webclient/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt +++ b/samples/client/petstore/kotlin-jvm-spring-3-webclient/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt @@ -58,7 +58,7 @@ open class StoreApi(client: WebClient) : ApiClient(client) { @Throws(WebClientResponseException::class) fun deleteOrderWithHttpInfo(orderId: kotlin.String): Mono> { val localVariableConfig = deleteOrderRequestConfig(orderId = orderId) - return request( + return this.request( localVariableConfig ) } @@ -69,14 +69,14 @@ open class StoreApi(client: WebClient) : ApiClient(client) { val localVariableHeaders: MutableMap = mutableMapOf() - val params = mutableMapOf( + val localVariableParams = mutableMapOf( "orderId" to orderId, ) return RequestConfig( method = RequestMethod.DELETE, path = "/store/order/{orderId}", - params = params, + params = localVariableParams, query = localVariableQuery, headers = localVariableHeaders, requiresAuthentication = false, @@ -94,7 +94,7 @@ open class StoreApi(client: WebClient) : ApiClient(client) { @Throws(WebClientResponseException::class) fun getInventoryWithHttpInfo(): Mono>> { val localVariableConfig = getInventoryRequestConfig() - return request>( + return this.request>( localVariableConfig ) } @@ -105,13 +105,13 @@ open class StoreApi(client: WebClient) : ApiClient(client) { val localVariableHeaders: MutableMap = mutableMapOf() localVariableHeaders["Accept"] = "application/json" - val params = mutableMapOf( + val localVariableParams = mutableMapOf( ) return RequestConfig( method = RequestMethod.GET, path = "/store/inventory", - params = params, + params = localVariableParams, query = localVariableQuery, headers = localVariableHeaders, requiresAuthentication = true, @@ -129,7 +129,7 @@ open class StoreApi(client: WebClient) : ApiClient(client) { @Throws(WebClientResponseException::class) fun getOrderByIdWithHttpInfo(orderId: kotlin.Long): Mono> { val localVariableConfig = getOrderByIdRequestConfig(orderId = orderId) - return request( + return this.request( localVariableConfig ) } @@ -140,14 +140,14 @@ open class StoreApi(client: WebClient) : ApiClient(client) { val localVariableHeaders: MutableMap = mutableMapOf() localVariableHeaders["Accept"] = "application/xml, application/json" - val params = mutableMapOf( + val localVariableParams = mutableMapOf( "orderId" to orderId, ) return RequestConfig( method = RequestMethod.GET, path = "/store/order/{orderId}", - params = params, + params = localVariableParams, query = localVariableQuery, headers = localVariableHeaders, requiresAuthentication = false, @@ -165,7 +165,7 @@ open class StoreApi(client: WebClient) : ApiClient(client) { @Throws(WebClientResponseException::class) fun placeOrderWithHttpInfo(order: Order): Mono> { val localVariableConfig = placeOrderRequestConfig(order = order) - return request( + return this.request( localVariableConfig ) } @@ -177,13 +177,13 @@ open class StoreApi(client: WebClient) : ApiClient(client) { localVariableHeaders["Content-Type"] = "application/json" localVariableHeaders["Accept"] = "application/xml, application/json" - val params = mutableMapOf( + val localVariableParams = mutableMapOf( ) return RequestConfig( method = RequestMethod.POST, path = "/store/order", - params = params, + params = localVariableParams, query = localVariableQuery, headers = localVariableHeaders, requiresAuthentication = false, diff --git a/samples/client/petstore/kotlin-jvm-spring-3-webclient/src/main/kotlin/org/openapitools/client/apis/UserApi.kt b/samples/client/petstore/kotlin-jvm-spring-3-webclient/src/main/kotlin/org/openapitools/client/apis/UserApi.kt index a39aa5c68743..5b7018e372c4 100644 --- a/samples/client/petstore/kotlin-jvm-spring-3-webclient/src/main/kotlin/org/openapitools/client/apis/UserApi.kt +++ b/samples/client/petstore/kotlin-jvm-spring-3-webclient/src/main/kotlin/org/openapitools/client/apis/UserApi.kt @@ -58,7 +58,7 @@ open class UserApi(client: WebClient) : ApiClient(client) { @Throws(WebClientResponseException::class) fun createUserWithHttpInfo(user: User): Mono> { val localVariableConfig = createUserRequestConfig(user = user) - return request( + return this.request( localVariableConfig ) } @@ -70,13 +70,13 @@ open class UserApi(client: WebClient) : ApiClient(client) { localVariableHeaders["Content-Type"] = "application/json" - val params = mutableMapOf( + val localVariableParams = mutableMapOf( ) return RequestConfig( method = RequestMethod.POST, path = "/user", - params = params, + params = localVariableParams, query = localVariableQuery, headers = localVariableHeaders, requiresAuthentication = true, @@ -94,7 +94,7 @@ open class UserApi(client: WebClient) : ApiClient(client) { @Throws(WebClientResponseException::class) fun createUsersWithArrayInputWithHttpInfo(user: kotlin.collections.List): Mono> { val localVariableConfig = createUsersWithArrayInputRequestConfig(user = user) - return request, Unit>( + return this.request, Unit>( localVariableConfig ) } @@ -106,13 +106,13 @@ open class UserApi(client: WebClient) : ApiClient(client) { localVariableHeaders["Content-Type"] = "application/json" - val params = mutableMapOf( + val localVariableParams = mutableMapOf( ) return RequestConfig( method = RequestMethod.POST, path = "/user/createWithArray", - params = params, + params = localVariableParams, query = localVariableQuery, headers = localVariableHeaders, requiresAuthentication = true, @@ -130,7 +130,7 @@ open class UserApi(client: WebClient) : ApiClient(client) { @Throws(WebClientResponseException::class) fun createUsersWithListInputWithHttpInfo(user: kotlin.collections.List): Mono> { val localVariableConfig = createUsersWithListInputRequestConfig(user = user) - return request, Unit>( + return this.request, Unit>( localVariableConfig ) } @@ -142,13 +142,13 @@ open class UserApi(client: WebClient) : ApiClient(client) { localVariableHeaders["Content-Type"] = "application/json" - val params = mutableMapOf( + val localVariableParams = mutableMapOf( ) return RequestConfig( method = RequestMethod.POST, path = "/user/createWithList", - params = params, + params = localVariableParams, query = localVariableQuery, headers = localVariableHeaders, requiresAuthentication = true, @@ -166,7 +166,7 @@ open class UserApi(client: WebClient) : ApiClient(client) { @Throws(WebClientResponseException::class) fun deleteUserWithHttpInfo(username: kotlin.String): Mono> { val localVariableConfig = deleteUserRequestConfig(username = username) - return request( + return this.request( localVariableConfig ) } @@ -177,14 +177,14 @@ open class UserApi(client: WebClient) : ApiClient(client) { val localVariableHeaders: MutableMap = mutableMapOf() - val params = mutableMapOf( + val localVariableParams = mutableMapOf( "username" to username, ) return RequestConfig( method = RequestMethod.DELETE, path = "/user/{username}", - params = params, + params = localVariableParams, query = localVariableQuery, headers = localVariableHeaders, requiresAuthentication = true, @@ -202,7 +202,7 @@ open class UserApi(client: WebClient) : ApiClient(client) { @Throws(WebClientResponseException::class) fun getUserByNameWithHttpInfo(username: kotlin.String): Mono> { val localVariableConfig = getUserByNameRequestConfig(username = username) - return request( + return this.request( localVariableConfig ) } @@ -213,14 +213,14 @@ open class UserApi(client: WebClient) : ApiClient(client) { val localVariableHeaders: MutableMap = mutableMapOf() localVariableHeaders["Accept"] = "application/xml, application/json" - val params = mutableMapOf( + val localVariableParams = mutableMapOf( "username" to username, ) return RequestConfig( method = RequestMethod.GET, path = "/user/{username}", - params = params, + params = localVariableParams, query = localVariableQuery, headers = localVariableHeaders, requiresAuthentication = false, @@ -238,7 +238,7 @@ open class UserApi(client: WebClient) : ApiClient(client) { @Throws(WebClientResponseException::class) fun loginUserWithHttpInfo(username: kotlin.String, password: kotlin.String): Mono> { val localVariableConfig = loginUserRequestConfig(username = username, password = password) - return request( + return this.request( localVariableConfig ) } @@ -253,13 +253,13 @@ open class UserApi(client: WebClient) : ApiClient(client) { val localVariableHeaders: MutableMap = mutableMapOf() localVariableHeaders["Accept"] = "application/xml, application/json" - val params = mutableMapOf( + val localVariableParams = mutableMapOf( ) return RequestConfig( method = RequestMethod.GET, path = "/user/login", - params = params, + params = localVariableParams, query = localVariableQuery, headers = localVariableHeaders, requiresAuthentication = false, @@ -277,7 +277,7 @@ open class UserApi(client: WebClient) : ApiClient(client) { @Throws(WebClientResponseException::class) fun logoutUserWithHttpInfo(): Mono> { val localVariableConfig = logoutUserRequestConfig() - return request( + return this.request( localVariableConfig ) } @@ -288,13 +288,13 @@ open class UserApi(client: WebClient) : ApiClient(client) { val localVariableHeaders: MutableMap = mutableMapOf() - val params = mutableMapOf( + val localVariableParams = mutableMapOf( ) return RequestConfig( method = RequestMethod.GET, path = "/user/logout", - params = params, + params = localVariableParams, query = localVariableQuery, headers = localVariableHeaders, requiresAuthentication = true, @@ -312,7 +312,7 @@ open class UserApi(client: WebClient) : ApiClient(client) { @Throws(WebClientResponseException::class) fun updateUserWithHttpInfo(username: kotlin.String, user: User): Mono> { val localVariableConfig = updateUserRequestConfig(username = username, user = user) - return request( + return this.request( localVariableConfig ) } @@ -324,14 +324,14 @@ open class UserApi(client: WebClient) : ApiClient(client) { localVariableHeaders["Content-Type"] = "application/json" - val params = mutableMapOf( + val localVariableParams = mutableMapOf( "username" to username, ) return RequestConfig( method = RequestMethod.PUT, path = "/user/{username}", - params = params, + params = localVariableParams, query = localVariableQuery, headers = localVariableHeaders, requiresAuthentication = true, diff --git a/samples/client/petstore/kotlin-jvm-spring-4-restclient-jackson3/src/main/kotlin/org/openapitools/client/apis/PetApi.kt b/samples/client/petstore/kotlin-jvm-spring-4-restclient-jackson3/src/main/kotlin/org/openapitools/client/apis/PetApi.kt index b67a736839bc..db37f2bed5fb 100644 --- a/samples/client/petstore/kotlin-jvm-spring-4-restclient-jackson3/src/main/kotlin/org/openapitools/client/apis/PetApi.kt +++ b/samples/client/petstore/kotlin-jvm-spring-4-restclient-jackson3/src/main/kotlin/org/openapitools/client/apis/PetApi.kt @@ -49,14 +49,14 @@ open class PetApi(client: RestClient) : ApiClient(client) { @Throws(RestClientResponseException::class) fun addPet(pet: Pet): Pet { - val result = addPetWithHttpInfo(pet = pet) - return result.body!! + val localVariableResult = addPetWithHttpInfo(pet = pet) + return localVariableResult.body!! } @Throws(RestClientResponseException::class) fun addPetWithHttpInfo(pet: Pet): ResponseEntity { val localVariableConfig = addPetRequestConfig(pet = pet) - return request( + return this.request( localVariableConfig ) } @@ -69,13 +69,13 @@ open class PetApi(client: RestClient) : ApiClient(client) { localVariableHeaders["Content-Type"] = "application/xml" localVariableHeaders["Accept"] = "application/xml, application/json" - val params = mutableMapOf( + val localVariableParams = mutableMapOf( ) return RequestConfig( method = RequestMethod.POST, path = "/pet", - params = params, + params = localVariableParams, query = localVariableQuery, headers = localVariableHeaders, requiresAuthentication = true, @@ -92,7 +92,7 @@ open class PetApi(client: RestClient) : ApiClient(client) { @Throws(RestClientResponseException::class) fun deletePetWithHttpInfo(petId: kotlin.Long, apiKey: kotlin.String? = null): ResponseEntity { val localVariableConfig = deletePetRequestConfig(petId = petId, apiKey = apiKey) - return request( + return this.request( localVariableConfig ) } @@ -104,14 +104,14 @@ open class PetApi(client: RestClient) : ApiClient(client) { apiKey?.apply { localVariableHeaders["api_key"] = this.toString() } - val params = mutableMapOf( + val localVariableParams = mutableMapOf( "petId" to petId, ) return RequestConfig( method = RequestMethod.DELETE, path = "/pet/{petId}", - params = params, + params = localVariableParams, query = localVariableQuery, headers = localVariableHeaders, requiresAuthentication = true, @@ -131,14 +131,14 @@ open class PetApi(client: RestClient) : ApiClient(client) { @Throws(RestClientResponseException::class) fun findPetsByStatus(status: kotlin.collections.List): kotlin.collections.List { - val result = findPetsByStatusWithHttpInfo(status = status) - return result.body!! + val localVariableResult = findPetsByStatusWithHttpInfo(status = status) + return localVariableResult.body!! } @Throws(RestClientResponseException::class) fun findPetsByStatusWithHttpInfo(status: kotlin.collections.List): ResponseEntity> { val localVariableConfig = findPetsByStatusRequestConfig(status = status) - return request>( + return this.request>( localVariableConfig ) } @@ -152,13 +152,13 @@ open class PetApi(client: RestClient) : ApiClient(client) { val localVariableHeaders: MutableMap = mutableMapOf() localVariableHeaders["Accept"] = "application/xml, application/json" - val params = mutableMapOf( + val localVariableParams = mutableMapOf( ) return RequestConfig( method = RequestMethod.GET, path = "/pet/findByStatus", - params = params, + params = localVariableParams, query = localVariableQuery, headers = localVariableHeaders, requiresAuthentication = true, @@ -170,15 +170,15 @@ open class PetApi(client: RestClient) : ApiClient(client) { @Throws(RestClientResponseException::class) @Deprecated(message = "This operation is deprecated.") fun findPetsByTags(tags: kotlin.collections.List): kotlin.collections.List { - val result = findPetsByTagsWithHttpInfo(tags = tags) - return result.body!! + val localVariableResult = findPetsByTagsWithHttpInfo(tags = tags) + return localVariableResult.body!! } @Throws(RestClientResponseException::class) @Deprecated(message = "This operation is deprecated.") fun findPetsByTagsWithHttpInfo(tags: kotlin.collections.List): ResponseEntity> { val localVariableConfig = findPetsByTagsRequestConfig(tags = tags) - return request>( + return this.request>( localVariableConfig ) } @@ -193,13 +193,13 @@ open class PetApi(client: RestClient) : ApiClient(client) { val localVariableHeaders: MutableMap = mutableMapOf() localVariableHeaders["Accept"] = "application/xml, application/json" - val params = mutableMapOf( + val localVariableParams = mutableMapOf( ) return RequestConfig( method = RequestMethod.GET, path = "/pet/findByTags", - params = params, + params = localVariableParams, query = localVariableQuery, headers = localVariableHeaders, requiresAuthentication = true, @@ -210,14 +210,14 @@ open class PetApi(client: RestClient) : ApiClient(client) { @Throws(RestClientResponseException::class) fun getPetById(petId: kotlin.Long): Pet { - val result = getPetByIdWithHttpInfo(petId = petId) - return result.body!! + val localVariableResult = getPetByIdWithHttpInfo(petId = petId) + return localVariableResult.body!! } @Throws(RestClientResponseException::class) fun getPetByIdWithHttpInfo(petId: kotlin.Long): ResponseEntity { val localVariableConfig = getPetByIdRequestConfig(petId = petId) - return request( + return this.request( localVariableConfig ) } @@ -228,14 +228,14 @@ open class PetApi(client: RestClient) : ApiClient(client) { val localVariableHeaders: MutableMap = mutableMapOf() localVariableHeaders["Accept"] = "application/xml, application/json" - val params = mutableMapOf( + val localVariableParams = mutableMapOf( "petId" to petId, ) return RequestConfig( method = RequestMethod.GET, path = "/pet/{petId}", - params = params, + params = localVariableParams, query = localVariableQuery, headers = localVariableHeaders, requiresAuthentication = true, @@ -246,14 +246,14 @@ open class PetApi(client: RestClient) : ApiClient(client) { @Throws(RestClientResponseException::class) fun updatePet(pet: Pet): Pet { - val result = updatePetWithHttpInfo(pet = pet) - return result.body!! + val localVariableResult = updatePetWithHttpInfo(pet = pet) + return localVariableResult.body!! } @Throws(RestClientResponseException::class) fun updatePetWithHttpInfo(pet: Pet): ResponseEntity { val localVariableConfig = updatePetRequestConfig(pet = pet) - return request( + return this.request( localVariableConfig ) } @@ -266,13 +266,13 @@ open class PetApi(client: RestClient) : ApiClient(client) { localVariableHeaders["Content-Type"] = "application/xml" localVariableHeaders["Accept"] = "application/xml, application/json" - val params = mutableMapOf( + val localVariableParams = mutableMapOf( ) return RequestConfig( method = RequestMethod.PUT, path = "/pet", - params = params, + params = localVariableParams, query = localVariableQuery, headers = localVariableHeaders, requiresAuthentication = true, @@ -289,7 +289,7 @@ open class PetApi(client: RestClient) : ApiClient(client) { @Throws(RestClientResponseException::class) fun updatePetWithFormWithHttpInfo(petId: kotlin.Long, name: kotlin.String? = null, status: kotlin.String? = null): ResponseEntity { val localVariableConfig = updatePetWithFormRequestConfig(petId = petId, name = name, status = status) - return request>, Unit>( + return this.request>, Unit>( localVariableConfig ) } @@ -302,14 +302,14 @@ open class PetApi(client: RestClient) : ApiClient(client) { val localVariableHeaders: MutableMap = mutableMapOf("Content-Type" to "application/x-www-form-urlencoded") - val params = mutableMapOf( + val localVariableParams = mutableMapOf( "petId" to petId, ) return RequestConfig( method = RequestMethod.POST, path = "/pet/{petId}", - params = params, + params = localVariableParams, query = localVariableQuery, headers = localVariableHeaders, requiresAuthentication = true, @@ -320,14 +320,14 @@ open class PetApi(client: RestClient) : ApiClient(client) { @Throws(RestClientResponseException::class) fun uploadFile(petId: kotlin.Long, additionalMetadata: kotlin.String? = null, file: java.io.File? = null): ModelApiResponse { - val result = uploadFileWithHttpInfo(petId = petId, additionalMetadata = additionalMetadata, file = file) - return result.body!! + val localVariableResult = uploadFileWithHttpInfo(petId = petId, additionalMetadata = additionalMetadata, file = file) + return localVariableResult.body!! } @Throws(RestClientResponseException::class) fun uploadFileWithHttpInfo(petId: kotlin.Long, additionalMetadata: kotlin.String? = null, file: java.io.File? = null): ResponseEntity { val localVariableConfig = uploadFileRequestConfig(petId = petId, additionalMetadata = additionalMetadata, file = file) - return request>, ModelApiResponse>( + return this.request>, ModelApiResponse>( localVariableConfig ) } @@ -340,14 +340,14 @@ open class PetApi(client: RestClient) : ApiClient(client) { val localVariableHeaders: MutableMap = mutableMapOf("Content-Type" to "multipart/form-data") localVariableHeaders["Accept"] = "application/json" - val params = mutableMapOf( + val localVariableParams = mutableMapOf( "petId" to petId, ) return RequestConfig( method = RequestMethod.POST, path = "/pet/{petId}/uploadImage", - params = params, + params = localVariableParams, query = localVariableQuery, headers = localVariableHeaders, requiresAuthentication = true, diff --git a/samples/client/petstore/kotlin-jvm-spring-4-restclient-jackson3/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt b/samples/client/petstore/kotlin-jvm-spring-4-restclient-jackson3/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt index 5d66640ea62e..31ebf3289d6f 100644 --- a/samples/client/petstore/kotlin-jvm-spring-4-restclient-jackson3/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt +++ b/samples/client/petstore/kotlin-jvm-spring-4-restclient-jackson3/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt @@ -54,7 +54,7 @@ open class StoreApi(client: RestClient) : ApiClient(client) { @Throws(RestClientResponseException::class) fun deleteOrderWithHttpInfo(orderId: kotlin.String): ResponseEntity { val localVariableConfig = deleteOrderRequestConfig(orderId = orderId) - return request( + return this.request( localVariableConfig ) } @@ -65,14 +65,14 @@ open class StoreApi(client: RestClient) : ApiClient(client) { val localVariableHeaders: MutableMap = mutableMapOf() - val params = mutableMapOf( + val localVariableParams = mutableMapOf( "orderId" to orderId, ) return RequestConfig( method = RequestMethod.DELETE, path = "/store/order/{orderId}", - params = params, + params = localVariableParams, query = localVariableQuery, headers = localVariableHeaders, requiresAuthentication = false, @@ -83,14 +83,14 @@ open class StoreApi(client: RestClient) : ApiClient(client) { @Throws(RestClientResponseException::class) fun getInventory(): kotlin.collections.Map { - val result = getInventoryWithHttpInfo() - return result.body!! + val localVariableResult = getInventoryWithHttpInfo() + return localVariableResult.body!! } @Throws(RestClientResponseException::class) fun getInventoryWithHttpInfo(): ResponseEntity> { val localVariableConfig = getInventoryRequestConfig() - return request>( + return this.request>( localVariableConfig ) } @@ -101,13 +101,13 @@ open class StoreApi(client: RestClient) : ApiClient(client) { val localVariableHeaders: MutableMap = mutableMapOf() localVariableHeaders["Accept"] = "application/json" - val params = mutableMapOf( + val localVariableParams = mutableMapOf( ) return RequestConfig( method = RequestMethod.GET, path = "/store/inventory", - params = params, + params = localVariableParams, query = localVariableQuery, headers = localVariableHeaders, requiresAuthentication = true, @@ -118,14 +118,14 @@ open class StoreApi(client: RestClient) : ApiClient(client) { @Throws(RestClientResponseException::class) fun getOrderById(orderId: kotlin.Long): Order { - val result = getOrderByIdWithHttpInfo(orderId = orderId) - return result.body!! + val localVariableResult = getOrderByIdWithHttpInfo(orderId = orderId) + return localVariableResult.body!! } @Throws(RestClientResponseException::class) fun getOrderByIdWithHttpInfo(orderId: kotlin.Long): ResponseEntity { val localVariableConfig = getOrderByIdRequestConfig(orderId = orderId) - return request( + return this.request( localVariableConfig ) } @@ -136,14 +136,14 @@ open class StoreApi(client: RestClient) : ApiClient(client) { val localVariableHeaders: MutableMap = mutableMapOf() localVariableHeaders["Accept"] = "application/xml, application/json" - val params = mutableMapOf( + val localVariableParams = mutableMapOf( "orderId" to orderId, ) return RequestConfig( method = RequestMethod.GET, path = "/store/order/{orderId}", - params = params, + params = localVariableParams, query = localVariableQuery, headers = localVariableHeaders, requiresAuthentication = false, @@ -154,14 +154,14 @@ open class StoreApi(client: RestClient) : ApiClient(client) { @Throws(RestClientResponseException::class) fun placeOrder(order: Order): Order { - val result = placeOrderWithHttpInfo(order = order) - return result.body!! + val localVariableResult = placeOrderWithHttpInfo(order = order) + return localVariableResult.body!! } @Throws(RestClientResponseException::class) fun placeOrderWithHttpInfo(order: Order): ResponseEntity { val localVariableConfig = placeOrderRequestConfig(order = order) - return request( + return this.request( localVariableConfig ) } @@ -173,13 +173,13 @@ open class StoreApi(client: RestClient) : ApiClient(client) { localVariableHeaders["Content-Type"] = "application/json" localVariableHeaders["Accept"] = "application/xml, application/json" - val params = mutableMapOf( + val localVariableParams = mutableMapOf( ) return RequestConfig( method = RequestMethod.POST, path = "/store/order", - params = params, + params = localVariableParams, query = localVariableQuery, headers = localVariableHeaders, requiresAuthentication = false, diff --git a/samples/client/petstore/kotlin-jvm-spring-4-restclient-jackson3/src/main/kotlin/org/openapitools/client/apis/UserApi.kt b/samples/client/petstore/kotlin-jvm-spring-4-restclient-jackson3/src/main/kotlin/org/openapitools/client/apis/UserApi.kt index bdf8a51c19b8..c5fefd4b8a0a 100644 --- a/samples/client/petstore/kotlin-jvm-spring-4-restclient-jackson3/src/main/kotlin/org/openapitools/client/apis/UserApi.kt +++ b/samples/client/petstore/kotlin-jvm-spring-4-restclient-jackson3/src/main/kotlin/org/openapitools/client/apis/UserApi.kt @@ -54,7 +54,7 @@ open class UserApi(client: RestClient) : ApiClient(client) { @Throws(RestClientResponseException::class) fun createUserWithHttpInfo(user: User): ResponseEntity { val localVariableConfig = createUserRequestConfig(user = user) - return request( + return this.request( localVariableConfig ) } @@ -66,13 +66,13 @@ open class UserApi(client: RestClient) : ApiClient(client) { localVariableHeaders["Content-Type"] = "application/json" - val params = mutableMapOf( + val localVariableParams = mutableMapOf( ) return RequestConfig( method = RequestMethod.POST, path = "/user", - params = params, + params = localVariableParams, query = localVariableQuery, headers = localVariableHeaders, requiresAuthentication = true, @@ -89,7 +89,7 @@ open class UserApi(client: RestClient) : ApiClient(client) { @Throws(RestClientResponseException::class) fun createUsersWithArrayInputWithHttpInfo(user: kotlin.collections.List): ResponseEntity { val localVariableConfig = createUsersWithArrayInputRequestConfig(user = user) - return request, Unit>( + return this.request, Unit>( localVariableConfig ) } @@ -101,13 +101,13 @@ open class UserApi(client: RestClient) : ApiClient(client) { localVariableHeaders["Content-Type"] = "application/json" - val params = mutableMapOf( + val localVariableParams = mutableMapOf( ) return RequestConfig( method = RequestMethod.POST, path = "/user/createWithArray", - params = params, + params = localVariableParams, query = localVariableQuery, headers = localVariableHeaders, requiresAuthentication = true, @@ -124,7 +124,7 @@ open class UserApi(client: RestClient) : ApiClient(client) { @Throws(RestClientResponseException::class) fun createUsersWithListInputWithHttpInfo(user: kotlin.collections.List): ResponseEntity { val localVariableConfig = createUsersWithListInputRequestConfig(user = user) - return request, Unit>( + return this.request, Unit>( localVariableConfig ) } @@ -136,13 +136,13 @@ open class UserApi(client: RestClient) : ApiClient(client) { localVariableHeaders["Content-Type"] = "application/json" - val params = mutableMapOf( + val localVariableParams = mutableMapOf( ) return RequestConfig( method = RequestMethod.POST, path = "/user/createWithList", - params = params, + params = localVariableParams, query = localVariableQuery, headers = localVariableHeaders, requiresAuthentication = true, @@ -159,7 +159,7 @@ open class UserApi(client: RestClient) : ApiClient(client) { @Throws(RestClientResponseException::class) fun deleteUserWithHttpInfo(username: kotlin.String): ResponseEntity { val localVariableConfig = deleteUserRequestConfig(username = username) - return request( + return this.request( localVariableConfig ) } @@ -170,14 +170,14 @@ open class UserApi(client: RestClient) : ApiClient(client) { val localVariableHeaders: MutableMap = mutableMapOf() - val params = mutableMapOf( + val localVariableParams = mutableMapOf( "username" to username, ) return RequestConfig( method = RequestMethod.DELETE, path = "/user/{username}", - params = params, + params = localVariableParams, query = localVariableQuery, headers = localVariableHeaders, requiresAuthentication = true, @@ -188,14 +188,14 @@ open class UserApi(client: RestClient) : ApiClient(client) { @Throws(RestClientResponseException::class) fun getUserByName(username: kotlin.String): User { - val result = getUserByNameWithHttpInfo(username = username) - return result.body!! + val localVariableResult = getUserByNameWithHttpInfo(username = username) + return localVariableResult.body!! } @Throws(RestClientResponseException::class) fun getUserByNameWithHttpInfo(username: kotlin.String): ResponseEntity { val localVariableConfig = getUserByNameRequestConfig(username = username) - return request( + return this.request( localVariableConfig ) } @@ -206,14 +206,14 @@ open class UserApi(client: RestClient) : ApiClient(client) { val localVariableHeaders: MutableMap = mutableMapOf() localVariableHeaders["Accept"] = "application/xml, application/json" - val params = mutableMapOf( + val localVariableParams = mutableMapOf( "username" to username, ) return RequestConfig( method = RequestMethod.GET, path = "/user/{username}", - params = params, + params = localVariableParams, query = localVariableQuery, headers = localVariableHeaders, requiresAuthentication = false, @@ -224,14 +224,14 @@ open class UserApi(client: RestClient) : ApiClient(client) { @Throws(RestClientResponseException::class) fun loginUser(username: kotlin.String, password: kotlin.String): kotlin.String { - val result = loginUserWithHttpInfo(username = username, password = password) - return result.body!! + val localVariableResult = loginUserWithHttpInfo(username = username, password = password) + return localVariableResult.body!! } @Throws(RestClientResponseException::class) fun loginUserWithHttpInfo(username: kotlin.String, password: kotlin.String): ResponseEntity { val localVariableConfig = loginUserRequestConfig(username = username, password = password) - return request( + return this.request( localVariableConfig ) } @@ -246,13 +246,13 @@ open class UserApi(client: RestClient) : ApiClient(client) { val localVariableHeaders: MutableMap = mutableMapOf() localVariableHeaders["Accept"] = "application/xml, application/json" - val params = mutableMapOf( + val localVariableParams = mutableMapOf( ) return RequestConfig( method = RequestMethod.GET, path = "/user/login", - params = params, + params = localVariableParams, query = localVariableQuery, headers = localVariableHeaders, requiresAuthentication = false, @@ -269,7 +269,7 @@ open class UserApi(client: RestClient) : ApiClient(client) { @Throws(RestClientResponseException::class) fun logoutUserWithHttpInfo(): ResponseEntity { val localVariableConfig = logoutUserRequestConfig() - return request( + return this.request( localVariableConfig ) } @@ -280,13 +280,13 @@ open class UserApi(client: RestClient) : ApiClient(client) { val localVariableHeaders: MutableMap = mutableMapOf() - val params = mutableMapOf( + val localVariableParams = mutableMapOf( ) return RequestConfig( method = RequestMethod.GET, path = "/user/logout", - params = params, + params = localVariableParams, query = localVariableQuery, headers = localVariableHeaders, requiresAuthentication = true, @@ -303,7 +303,7 @@ open class UserApi(client: RestClient) : ApiClient(client) { @Throws(RestClientResponseException::class) fun updateUserWithHttpInfo(username: kotlin.String, user: User): ResponseEntity { val localVariableConfig = updateUserRequestConfig(username = username, user = user) - return request( + return this.request( localVariableConfig ) } @@ -315,14 +315,14 @@ open class UserApi(client: RestClient) : ApiClient(client) { localVariableHeaders["Content-Type"] = "application/json" - val params = mutableMapOf( + val localVariableParams = mutableMapOf( "username" to username, ) return RequestConfig( method = RequestMethod.PUT, path = "/user/{username}", - params = params, + params = localVariableParams, query = localVariableQuery, headers = localVariableHeaders, requiresAuthentication = true, diff --git a/samples/client/petstore/kotlin-jvm-vertx-gson/src/main/kotlin/org/openapitools/client/apis/PetApi.kt b/samples/client/petstore/kotlin-jvm-vertx-gson/src/main/kotlin/org/openapitools/client/apis/PetApi.kt index e6543e48bfc8..62456f269dd8 100644 --- a/samples/client/petstore/kotlin-jvm-vertx-gson/src/main/kotlin/org/openapitools/client/apis/PetApi.kt +++ b/samples/client/petstore/kotlin-jvm-vertx-gson/src/main/kotlin/org/openapitools/client/apis/PetApi.kt @@ -59,18 +59,18 @@ open class PetApi(basePath: kotlin.String = ApiClient.defaultBasePath, accessTok @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun addPet(pet: Pet) : Future { - return addPetWithHttpInfo(pet = pet).map { localVarResponse -> - when (localVarResponse.responseType) { - ResponseType.Success -> (localVarResponse as Success<*>).data as Pet + return addPetWithHttpInfo(pet = pet).map { localVariableResponse -> + when (localVariableResponse.responseType) { + ResponseType.Success -> (localVariableResponse as Success<*>).data as Pet 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) + val localVariableError = localVariableResponse as ClientError<*> + throw ClientException("Client error : ${localVariableError.statusCode} ${localVariableError.message.orEmpty()}", localVariableError.statusCode, localVariableResponse) } ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) + val localVariableError = localVariableResponse as ServerError<*> + throw ServerException("Server error : ${localVariableError.statusCode} ${localVariableError.message.orEmpty()}", localVariableError.statusCode, localVariableResponse) } } } @@ -88,28 +88,28 @@ open class PetApi(basePath: kotlin.String = ApiClient.defaultBasePath, accessTok @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class) fun addPetWithHttpInfo(pet: Pet) : Future> { - val vertxClient = WebClient.create(vertx) - val request = vertxClient.requestAbs(HttpMethod.POST, UriTemplate.of("$basePath/pet")) + val localVariableClient = WebClient.create(this.vertx) + val localVariableRequest = localVariableClient.requestAbs(HttpMethod.POST, UriTemplate.of("${this.basePath}/pet")) - request.putHeader("Content-Type", "application/json") - request.putHeader("Content-Type", "application/xml") + localVariableRequest.putHeader("Content-Type", "application/json") + localVariableRequest.putHeader("Content-Type", "application/xml") - request.putHeader("Accept", "application/xml, application/json") + localVariableRequest.putHeader("Accept", "application/xml, application/json") - accessToken?.let { accessToken -> - request.bearerTokenAuthentication(accessToken) + this.accessToken?.let { accessToken -> + localVariableRequest.bearerTokenAuthentication(accessToken) } - return request - .sendBuffer(responseBody(pet)) + return localVariableRequest + .sendBuffer(this.responseBody(pet)) .map { - val apiResponse: ApiResponse = handleResponse(it) - apiResponse + val localVariableApiResponse: ApiResponse = this.handleResponse(it) + localVariableApiResponse } } @@ -128,18 +128,18 @@ open class PetApi(basePath: kotlin.String = ApiClient.defaultBasePath, accessTok */ @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun deletePet(petId: kotlin.Long, apiKey: kotlin.String? = null) : Future { - return deletePetWithHttpInfo(petId = petId, apiKey = apiKey).map { localVarResponse -> - when (localVarResponse.responseType) { + return deletePetWithHttpInfo(petId = petId, apiKey = apiKey).map { localVariableResponse -> + when (localVariableResponse.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) + val localVariableError = localVariableResponse as ClientError<*> + throw ClientException("Client error : ${localVariableError.statusCode} ${localVariableError.message.orEmpty()}", localVariableError.statusCode, localVariableResponse) } ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) + val localVariableError = localVariableResponse as ServerError<*> + throw ServerException("Server error : ${localVariableError.statusCode} ${localVariableError.message.orEmpty()}", localVariableError.statusCode, localVariableResponse) } } } @@ -157,25 +157,25 @@ open class PetApi(basePath: kotlin.String = ApiClient.defaultBasePath, accessTok */ @Throws(IllegalStateException::class, IOException::class) fun deletePetWithHttpInfo(petId: kotlin.Long, apiKey: kotlin.String?) : Future> { - val vertxClient = WebClient.create(vertx) - val request = vertxClient.requestAbs(HttpMethod.DELETE, UriTemplate.of("$basePath/pet/{petId}".replace("{"+"petId"+"}", encodeURIComponent(petId.toString())))) + val localVariableClient = WebClient.create(this.vertx) + val localVariableRequest = localVariableClient.requestAbs(HttpMethod.DELETE, UriTemplate.of("${this.basePath}/pet/{petId}".replace("{"+"petId"+"}", this.encodeURIComponent(petId.toString())))) - apiKey?.apply { request.putHeader("api_key", this.toString())} + apiKey?.apply { localVariableRequest.putHeader("api_key", this.toString())} - accessToken?.let { accessToken -> - request.bearerTokenAuthentication(accessToken) + this.accessToken?.let { accessToken -> + localVariableRequest.bearerTokenAuthentication(accessToken) } - return request + return localVariableRequest .send() .map { - val apiResponse: ApiResponse = handleResponse(it) - apiResponse + val localVariableApiResponse: ApiResponse = this.handleResponse(it) + localVariableApiResponse } } @@ -203,18 +203,18 @@ open class PetApi(basePath: kotlin.String = ApiClient.defaultBasePath, accessTok @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun findPetsByStatus(status: kotlin.collections.List) : Future> { - return findPetsByStatusWithHttpInfo(status = status).map { localVarResponse -> - when (localVarResponse.responseType) { - ResponseType.Success -> (localVarResponse as Success<*>).data as kotlin.collections.List + return findPetsByStatusWithHttpInfo(status = status).map { localVariableResponse -> + when (localVariableResponse.responseType) { + ResponseType.Success -> (localVariableResponse as Success<*>).data as kotlin.collections.List 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) + val localVariableError = localVariableResponse as ClientError<*> + throw ClientException("Client error : ${localVariableError.statusCode} ${localVariableError.message.orEmpty()}", localVariableError.statusCode, localVariableResponse) } ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) + val localVariableError = localVariableResponse as ServerError<*> + throw ServerException("Server error : ${localVariableError.statusCode} ${localVariableError.message.orEmpty()}", localVariableError.statusCode, localVariableResponse) } } } @@ -232,26 +232,26 @@ open class PetApi(basePath: kotlin.String = ApiClient.defaultBasePath, accessTok @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class) fun findPetsByStatusWithHttpInfo(status: kotlin.collections.List) : Future?>> { - val vertxClient = WebClient.create(vertx) - val request = vertxClient.requestAbs(HttpMethod.GET, UriTemplate.of("$basePath/pet/findByStatus")) + val localVariableClient = WebClient.create(this.vertx) + val localVariableRequest = localVariableClient.requestAbs(HttpMethod.GET, UriTemplate.of("${this.basePath}/pet/findByStatus")) - request.putHeader("Accept", "application/xml, application/json") + localVariableRequest.putHeader("Accept", "application/xml, application/json") - status.let { request.queryParams().add("status", toMultiValue(it.toList(), "csv")) } + status.let { localVariableRequest.queryParams().add("status", toMultiValue(it.toList(), "csv")) } - accessToken?.let { accessToken -> - request.bearerTokenAuthentication(accessToken) + this.accessToken?.let { accessToken -> + localVariableRequest.bearerTokenAuthentication(accessToken) } - return request + return localVariableRequest .send() .map { - val apiResponse: ApiResponse?> = handleResponse(it) - apiResponse + val localVariableApiResponse: ApiResponse?> = this.handleResponse(it) + localVariableApiResponse } } @@ -271,18 +271,18 @@ open class PetApi(basePath: kotlin.String = ApiClient.defaultBasePath, accessTok @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) @Deprecated(message = "This operation is deprecated.") fun findPetsByTags(tags: kotlin.collections.List) : Future> { - return findPetsByTagsWithHttpInfo(tags = tags).map { localVarResponse -> - when (localVarResponse.responseType) { - ResponseType.Success -> (localVarResponse as Success<*>).data as kotlin.collections.List + return findPetsByTagsWithHttpInfo(tags = tags).map { localVariableResponse -> + when (localVariableResponse.responseType) { + ResponseType.Success -> (localVariableResponse as Success<*>).data as kotlin.collections.List 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) + val localVariableError = localVariableResponse as ClientError<*> + throw ClientException("Client error : ${localVariableError.statusCode} ${localVariableError.message.orEmpty()}", localVariableError.statusCode, localVariableResponse) } ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) + val localVariableError = localVariableResponse as ServerError<*> + throw ServerException("Server error : ${localVariableError.statusCode} ${localVariableError.message.orEmpty()}", localVariableError.statusCode, localVariableResponse) } } } @@ -301,26 +301,26 @@ open class PetApi(basePath: kotlin.String = ApiClient.defaultBasePath, accessTok @Throws(IllegalStateException::class, IOException::class) @Deprecated(message = "This operation is deprecated.") fun findPetsByTagsWithHttpInfo(tags: kotlin.collections.List) : Future?>> { - val vertxClient = WebClient.create(vertx) - val request = vertxClient.requestAbs(HttpMethod.GET, UriTemplate.of("$basePath/pet/findByTags")) + val localVariableClient = WebClient.create(this.vertx) + val localVariableRequest = localVariableClient.requestAbs(HttpMethod.GET, UriTemplate.of("${this.basePath}/pet/findByTags")) - request.putHeader("Accept", "application/xml, application/json") + localVariableRequest.putHeader("Accept", "application/xml, application/json") - tags.let { request.queryParams().add("tags", toMultiValue(it.toList(), "csv")) } + tags.let { localVariableRequest.queryParams().add("tags", toMultiValue(it.toList(), "csv")) } - accessToken?.let { accessToken -> - request.bearerTokenAuthentication(accessToken) + this.accessToken?.let { accessToken -> + localVariableRequest.bearerTokenAuthentication(accessToken) } - return request + return localVariableRequest .send() .map { - val apiResponse: ApiResponse?> = handleResponse(it) - apiResponse + val localVariableApiResponse: ApiResponse?> = this.handleResponse(it) + localVariableApiResponse } } @@ -339,18 +339,18 @@ open class PetApi(basePath: kotlin.String = ApiClient.defaultBasePath, accessTok @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun getPetById(petId: kotlin.Long) : Future { - return getPetByIdWithHttpInfo(petId = petId).map { localVarResponse -> - when (localVarResponse.responseType) { - ResponseType.Success -> (localVarResponse as Success<*>).data as Pet + return getPetByIdWithHttpInfo(petId = petId).map { localVariableResponse -> + when (localVariableResponse.responseType) { + ResponseType.Success -> (localVariableResponse as Success<*>).data as Pet 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) + val localVariableError = localVariableResponse as ClientError<*> + throw ClientException("Client error : ${localVariableError.statusCode} ${localVariableError.message.orEmpty()}", localVariableError.statusCode, localVariableResponse) } ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) + val localVariableError = localVariableResponse as ServerError<*> + throw ServerException("Server error : ${localVariableError.statusCode} ${localVariableError.message.orEmpty()}", localVariableError.statusCode, localVariableResponse) } } } @@ -368,29 +368,29 @@ open class PetApi(basePath: kotlin.String = ApiClient.defaultBasePath, accessTok @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class) fun getPetByIdWithHttpInfo(petId: kotlin.Long) : Future> { - val vertxClient = WebClient.create(vertx) - val request = vertxClient.requestAbs(HttpMethod.GET, UriTemplate.of("$basePath/pet/{petId}".replace("{"+"petId"+"}", encodeURIComponent(petId.toString())))) + val localVariableClient = WebClient.create(this.vertx) + val localVariableRequest = localVariableClient.requestAbs(HttpMethod.GET, UriTemplate.of("${this.basePath}/pet/{petId}".replace("{"+"petId"+"}", this.encodeURIComponent(petId.toString())))) - request.putHeader("Accept", "application/xml, application/json") + localVariableRequest.putHeader("Accept", "application/xml, application/json") - if (apiKey["api_key"] != null) { - if (apiKeyPrefix["api_key"] != null) { - request.putHeader("api_key", apiKeyPrefix["api_key"]!! + " " + apiKey["api_key"]!!) + if (this.apiKey["api_key"] != null) { + if (this.apiKeyPrefix["api_key"] != null) { + localVariableRequest.putHeader("api_key", this.apiKeyPrefix["api_key"]!! + " " + this.apiKey["api_key"]!!) } else { - request.putHeader("api_key", apiKey["api_key"]!!) + localVariableRequest.putHeader("api_key", this.apiKey["api_key"]!!) } } - return request + return localVariableRequest .send() .map { - val apiResponse: ApiResponse = handleResponse(it) - apiResponse + val localVariableApiResponse: ApiResponse = this.handleResponse(it) + localVariableApiResponse } } @@ -409,18 +409,18 @@ open class PetApi(basePath: kotlin.String = ApiClient.defaultBasePath, accessTok @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun updatePet(pet: Pet) : Future { - return updatePetWithHttpInfo(pet = pet).map { localVarResponse -> - when (localVarResponse.responseType) { - ResponseType.Success -> (localVarResponse as Success<*>).data as Pet + return updatePetWithHttpInfo(pet = pet).map { localVariableResponse -> + when (localVariableResponse.responseType) { + ResponseType.Success -> (localVariableResponse as Success<*>).data as Pet 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) + val localVariableError = localVariableResponse as ClientError<*> + throw ClientException("Client error : ${localVariableError.statusCode} ${localVariableError.message.orEmpty()}", localVariableError.statusCode, localVariableResponse) } ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) + val localVariableError = localVariableResponse as ServerError<*> + throw ServerException("Server error : ${localVariableError.statusCode} ${localVariableError.message.orEmpty()}", localVariableError.statusCode, localVariableResponse) } } } @@ -438,28 +438,28 @@ open class PetApi(basePath: kotlin.String = ApiClient.defaultBasePath, accessTok @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class) fun updatePetWithHttpInfo(pet: Pet) : Future> { - val vertxClient = WebClient.create(vertx) - val request = vertxClient.requestAbs(HttpMethod.PUT, UriTemplate.of("$basePath/pet")) + val localVariableClient = WebClient.create(this.vertx) + val localVariableRequest = localVariableClient.requestAbs(HttpMethod.PUT, UriTemplate.of("${this.basePath}/pet")) - request.putHeader("Content-Type", "application/json") - request.putHeader("Content-Type", "application/xml") + localVariableRequest.putHeader("Content-Type", "application/json") + localVariableRequest.putHeader("Content-Type", "application/xml") - request.putHeader("Accept", "application/xml, application/json") + localVariableRequest.putHeader("Accept", "application/xml, application/json") - accessToken?.let { accessToken -> - request.bearerTokenAuthentication(accessToken) + this.accessToken?.let { accessToken -> + localVariableRequest.bearerTokenAuthentication(accessToken) } - return request - .sendBuffer(responseBody(pet)) + return localVariableRequest + .sendBuffer(this.responseBody(pet)) .map { - val apiResponse: ApiResponse = handleResponse(it) - apiResponse + val localVariableApiResponse: ApiResponse = this.handleResponse(it) + localVariableApiResponse } } @@ -479,18 +479,18 @@ open class PetApi(basePath: kotlin.String = ApiClient.defaultBasePath, accessTok */ @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun updatePetWithForm(petId: kotlin.Long, name: kotlin.String? = null, status: kotlin.String? = null) : Future { - return updatePetWithFormWithHttpInfo(petId = petId, name = name, status = status).map { localVarResponse -> - when (localVarResponse.responseType) { + return updatePetWithFormWithHttpInfo(petId = petId, name = name, status = status).map { localVariableResponse -> + when (localVariableResponse.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) + val localVariableError = localVariableResponse as ClientError<*> + throw ClientException("Client error : ${localVariableError.statusCode} ${localVariableError.message.orEmpty()}", localVariableError.statusCode, localVariableResponse) } ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) + val localVariableError = localVariableResponse as ServerError<*> + throw ServerException("Server error : ${localVariableError.statusCode} ${localVariableError.message.orEmpty()}", localVariableError.statusCode, localVariableResponse) } } } @@ -509,28 +509,28 @@ open class PetApi(basePath: kotlin.String = ApiClient.defaultBasePath, accessTok */ @Throws(IllegalStateException::class, IOException::class) fun updatePetWithFormWithHttpInfo(petId: kotlin.Long, name: kotlin.String?, status: kotlin.String?) : Future> { - val vertxClient = WebClient.create(vertx) - val request = vertxClient.requestAbs(HttpMethod.POST, UriTemplate.of("$basePath/pet/{petId}".replace("{"+"petId"+"}", encodeURIComponent(petId.toString())))) + val localVariableClient = WebClient.create(this.vertx) + val localVariableRequest = localVariableClient.requestAbs(HttpMethod.POST, UriTemplate.of("${this.basePath}/pet/{petId}".replace("{"+"petId"+"}", this.encodeURIComponent(petId.toString())))) - request.putHeader("Content-Type", "application/x-www-form-urlencoded") + localVariableRequest.putHeader("Content-Type", "application/x-www-form-urlencoded") - val form = io.vertx.core.MultiMap.caseInsensitiveMultiMap(); - name?.let { form.add("name", name) } - status?.let { form.add("status", status) } + val localVariableForm = io.vertx.core.MultiMap.caseInsensitiveMultiMap(); + name?.let { localVariableForm.add("name", name) } + status?.let { localVariableForm.add("status", status) } - accessToken?.let { accessToken -> - request.bearerTokenAuthentication(accessToken) + this.accessToken?.let { accessToken -> + localVariableRequest.bearerTokenAuthentication(accessToken) } - return request + return localVariableRequest .send() .map { - val apiResponse: ApiResponse = handleResponse(it) - apiResponse + val localVariableApiResponse: ApiResponse = this.handleResponse(it) + localVariableApiResponse } } @@ -551,18 +551,18 @@ open class PetApi(basePath: kotlin.String = ApiClient.defaultBasePath, accessTok @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) : Future { - return uploadFileWithHttpInfo(petId = petId, additionalMetadata = additionalMetadata, file = file).map { localVarResponse -> - when (localVarResponse.responseType) { - ResponseType.Success -> (localVarResponse as Success<*>).data as ModelApiResponse + return uploadFileWithHttpInfo(petId = petId, additionalMetadata = additionalMetadata, file = file).map { localVariableResponse -> + when (localVariableResponse.responseType) { + ResponseType.Success -> (localVariableResponse 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 -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) + val localVariableError = localVariableResponse as ClientError<*> + throw ClientException("Client error : ${localVariableError.statusCode} ${localVariableError.message.orEmpty()}", localVariableError.statusCode, localVariableResponse) } ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) + val localVariableError = localVariableResponse as ServerError<*> + throw ServerException("Server error : ${localVariableError.statusCode} ${localVariableError.message.orEmpty()}", localVariableError.statusCode, localVariableResponse) } } } @@ -582,28 +582,28 @@ open class PetApi(basePath: kotlin.String = ApiClient.defaultBasePath, accessTok @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class) fun uploadFileWithHttpInfo(petId: kotlin.Long, additionalMetadata: kotlin.String?, file: java.io.File?) : Future> { - val vertxClient = WebClient.create(vertx) - val request = vertxClient.requestAbs(HttpMethod.POST, UriTemplate.of("$basePath/pet/{petId}/uploadImage".replace("{"+"petId"+"}", encodeURIComponent(petId.toString())))) + val localVariableClient = WebClient.create(this.vertx) + val localVariableRequest = localVariableClient.requestAbs(HttpMethod.POST, UriTemplate.of("${this.basePath}/pet/{petId}/uploadImage".replace("{"+"petId"+"}", this.encodeURIComponent(petId.toString())))) - request.putHeader("Content-Type", "multipart/form-data") + localVariableRequest.putHeader("Content-Type", "multipart/form-data") - request.putHeader("Accept", "application/json") + localVariableRequest.putHeader("Accept", "application/json") - val form = io.vertx.core.MultiMap.caseInsensitiveMultiMap(); - additionalMetadata?.let { form.add("additionalMetadata", additionalMetadata) } - file?.let { form.add("file", file.toString()) } + val localVariableForm = io.vertx.core.MultiMap.caseInsensitiveMultiMap(); + additionalMetadata?.let { localVariableForm.add("additionalMetadata", additionalMetadata) } + file?.let { localVariableForm.add("file", file.toString()) } - accessToken?.let { accessToken -> - request.bearerTokenAuthentication(accessToken) + this.accessToken?.let { accessToken -> + localVariableRequest.bearerTokenAuthentication(accessToken) } - return request + return localVariableRequest .send() .map { - val apiResponse: ApiResponse = handleResponse(it) - apiResponse + val localVariableApiResponse: ApiResponse = this.handleResponse(it) + localVariableApiResponse } } diff --git a/samples/client/petstore/kotlin-jvm-vertx-gson/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt b/samples/client/petstore/kotlin-jvm-vertx-gson/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt index 98148cc12e8b..45fe841f1d7e 100644 --- a/samples/client/petstore/kotlin-jvm-vertx-gson/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt +++ b/samples/client/petstore/kotlin-jvm-vertx-gson/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt @@ -57,18 +57,18 @@ open class StoreApi(basePath: kotlin.String = ApiClient.defaultBasePath, accessT */ @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun deleteOrder(orderId: kotlin.String) : Future { - return deleteOrderWithHttpInfo(orderId = orderId).map { localVarResponse -> - when (localVarResponse.responseType) { + return deleteOrderWithHttpInfo(orderId = orderId).map { localVariableResponse -> + when (localVariableResponse.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) + val localVariableError = localVariableResponse as ClientError<*> + throw ClientException("Client error : ${localVariableError.statusCode} ${localVariableError.message.orEmpty()}", localVariableError.statusCode, localVariableResponse) } ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) + val localVariableError = localVariableResponse as ServerError<*> + throw ServerException("Server error : ${localVariableError.statusCode} ${localVariableError.message.orEmpty()}", localVariableError.statusCode, localVariableResponse) } } } @@ -85,8 +85,8 @@ open class StoreApi(basePath: kotlin.String = ApiClient.defaultBasePath, accessT */ @Throws(IllegalStateException::class, IOException::class) fun deleteOrderWithHttpInfo(orderId: kotlin.String) : Future> { - val vertxClient = WebClient.create(vertx) - val request = vertxClient.requestAbs(HttpMethod.DELETE, UriTemplate.of("$basePath/store/order/{orderId}".replace("{"+"orderId"+"}", encodeURIComponent(orderId.toString())))) + val localVariableClient = WebClient.create(this.vertx) + val localVariableRequest = localVariableClient.requestAbs(HttpMethod.DELETE, UriTemplate.of("${this.basePath}/store/order/{orderId}".replace("{"+"orderId"+"}", this.encodeURIComponent(orderId.toString())))) @@ -96,11 +96,11 @@ open class StoreApi(basePath: kotlin.String = ApiClient.defaultBasePath, accessT - return request + return localVariableRequest .send() .map { - val apiResponse: ApiResponse = handleResponse(it) - apiResponse + val localVariableApiResponse: ApiResponse = this.handleResponse(it) + localVariableApiResponse } } @@ -118,18 +118,18 @@ open class StoreApi(basePath: kotlin.String = ApiClient.defaultBasePath, accessT @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun getInventory() : Future> { - return getInventoryWithHttpInfo().map { localVarResponse -> - when (localVarResponse.responseType) { - ResponseType.Success -> (localVarResponse as Success<*>).data as kotlin.collections.Map + return getInventoryWithHttpInfo().map { localVariableResponse -> + when (localVariableResponse.responseType) { + ResponseType.Success -> (localVariableResponse as Success<*>).data as kotlin.collections.Map 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) + val localVariableError = localVariableResponse as ClientError<*> + throw ClientException("Client error : ${localVariableError.statusCode} ${localVariableError.message.orEmpty()}", localVariableError.statusCode, localVariableResponse) } ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) + val localVariableError = localVariableResponse as ServerError<*> + throw ServerException("Server error : ${localVariableError.statusCode} ${localVariableError.message.orEmpty()}", localVariableError.statusCode, localVariableResponse) } } } @@ -146,29 +146,29 @@ open class StoreApi(basePath: kotlin.String = ApiClient.defaultBasePath, accessT @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class) fun getInventoryWithHttpInfo() : Future?>> { - val vertxClient = WebClient.create(vertx) - val request = vertxClient.requestAbs(HttpMethod.GET, UriTemplate.of("$basePath/store/inventory")) + val localVariableClient = WebClient.create(this.vertx) + val localVariableRequest = localVariableClient.requestAbs(HttpMethod.GET, UriTemplate.of("${this.basePath}/store/inventory")) - request.putHeader("Accept", "application/json") + localVariableRequest.putHeader("Accept", "application/json") - if (apiKey["api_key"] != null) { - if (apiKeyPrefix["api_key"] != null) { - request.putHeader("api_key", apiKeyPrefix["api_key"]!! + " " + apiKey["api_key"]!!) + if (this.apiKey["api_key"] != null) { + if (this.apiKeyPrefix["api_key"] != null) { + localVariableRequest.putHeader("api_key", this.apiKeyPrefix["api_key"]!! + " " + this.apiKey["api_key"]!!) } else { - request.putHeader("api_key", apiKey["api_key"]!!) + localVariableRequest.putHeader("api_key", this.apiKey["api_key"]!!) } } - return request + return localVariableRequest .send() .map { - val apiResponse: ApiResponse?> = handleResponse(it) - apiResponse + val localVariableApiResponse: ApiResponse?> = this.handleResponse(it) + localVariableApiResponse } } @@ -187,18 +187,18 @@ open class StoreApi(basePath: kotlin.String = ApiClient.defaultBasePath, accessT @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun getOrderById(orderId: kotlin.Long) : Future { - return getOrderByIdWithHttpInfo(orderId = orderId).map { localVarResponse -> - when (localVarResponse.responseType) { - ResponseType.Success -> (localVarResponse as Success<*>).data as Order + return getOrderByIdWithHttpInfo(orderId = orderId).map { localVariableResponse -> + when (localVariableResponse.responseType) { + ResponseType.Success -> (localVariableResponse as Success<*>).data as Order 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) + val localVariableError = localVariableResponse as ClientError<*> + throw ClientException("Client error : ${localVariableError.statusCode} ${localVariableError.message.orEmpty()}", localVariableError.statusCode, localVariableResponse) } ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) + val localVariableError = localVariableResponse as ServerError<*> + throw ServerException("Server error : ${localVariableError.statusCode} ${localVariableError.message.orEmpty()}", localVariableError.statusCode, localVariableResponse) } } } @@ -216,22 +216,22 @@ open class StoreApi(basePath: kotlin.String = ApiClient.defaultBasePath, accessT @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class) fun getOrderByIdWithHttpInfo(orderId: kotlin.Long) : Future> { - val vertxClient = WebClient.create(vertx) - val request = vertxClient.requestAbs(HttpMethod.GET, UriTemplate.of("$basePath/store/order/{orderId}".replace("{"+"orderId"+"}", encodeURIComponent(orderId.toString())))) + val localVariableClient = WebClient.create(this.vertx) + val localVariableRequest = localVariableClient.requestAbs(HttpMethod.GET, UriTemplate.of("${this.basePath}/store/order/{orderId}".replace("{"+"orderId"+"}", this.encodeURIComponent(orderId.toString())))) - request.putHeader("Accept", "application/xml, application/json") + localVariableRequest.putHeader("Accept", "application/xml, application/json") - return request + return localVariableRequest .send() .map { - val apiResponse: ApiResponse = handleResponse(it) - apiResponse + val localVariableApiResponse: ApiResponse = this.handleResponse(it) + localVariableApiResponse } } @@ -250,18 +250,18 @@ open class StoreApi(basePath: kotlin.String = ApiClient.defaultBasePath, accessT @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun placeOrder(order: Order) : Future { - return placeOrderWithHttpInfo(order = order).map { localVarResponse -> - when (localVarResponse.responseType) { - ResponseType.Success -> (localVarResponse as Success<*>).data as Order + return placeOrderWithHttpInfo(order = order).map { localVariableResponse -> + when (localVariableResponse.responseType) { + ResponseType.Success -> (localVariableResponse as Success<*>).data as Order 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) + val localVariableError = localVariableResponse as ClientError<*> + throw ClientException("Client error : ${localVariableError.statusCode} ${localVariableError.message.orEmpty()}", localVariableError.statusCode, localVariableResponse) } ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) + val localVariableError = localVariableResponse as ServerError<*> + throw ServerException("Server error : ${localVariableError.statusCode} ${localVariableError.message.orEmpty()}", localVariableError.statusCode, localVariableResponse) } } } @@ -279,24 +279,24 @@ open class StoreApi(basePath: kotlin.String = ApiClient.defaultBasePath, accessT @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class) fun placeOrderWithHttpInfo(order: Order) : Future> { - val vertxClient = WebClient.create(vertx) - val request = vertxClient.requestAbs(HttpMethod.POST, UriTemplate.of("$basePath/store/order")) + val localVariableClient = WebClient.create(this.vertx) + val localVariableRequest = localVariableClient.requestAbs(HttpMethod.POST, UriTemplate.of("${this.basePath}/store/order")) - request.putHeader("Content-Type", "application/json") + localVariableRequest.putHeader("Content-Type", "application/json") - request.putHeader("Accept", "application/xml, application/json") + localVariableRequest.putHeader("Accept", "application/xml, application/json") - return request - .sendBuffer(responseBody(order)) + return localVariableRequest + .sendBuffer(this.responseBody(order)) .map { - val apiResponse: ApiResponse = handleResponse(it) - apiResponse + val localVariableApiResponse: ApiResponse = this.handleResponse(it) + localVariableApiResponse } } diff --git a/samples/client/petstore/kotlin-jvm-vertx-gson/src/main/kotlin/org/openapitools/client/apis/UserApi.kt b/samples/client/petstore/kotlin-jvm-vertx-gson/src/main/kotlin/org/openapitools/client/apis/UserApi.kt index b81f95fd1627..fb200e314151 100644 --- a/samples/client/petstore/kotlin-jvm-vertx-gson/src/main/kotlin/org/openapitools/client/apis/UserApi.kt +++ b/samples/client/petstore/kotlin-jvm-vertx-gson/src/main/kotlin/org/openapitools/client/apis/UserApi.kt @@ -57,18 +57,18 @@ open class UserApi(basePath: kotlin.String = ApiClient.defaultBasePath, accessTo */ @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun createUser(user: User) : Future { - return createUserWithHttpInfo(user = user).map { localVarResponse -> - when (localVarResponse.responseType) { + return createUserWithHttpInfo(user = user).map { localVariableResponse -> + when (localVariableResponse.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) + val localVariableError = localVariableResponse as ClientError<*> + throw ClientException("Client error : ${localVariableError.statusCode} ${localVariableError.message.orEmpty()}", localVariableError.statusCode, localVariableResponse) } ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) + val localVariableError = localVariableResponse as ServerError<*> + throw ServerException("Server error : ${localVariableError.statusCode} ${localVariableError.message.orEmpty()}", localVariableError.statusCode, localVariableResponse) } } } @@ -85,31 +85,31 @@ open class UserApi(basePath: kotlin.String = ApiClient.defaultBasePath, accessTo */ @Throws(IllegalStateException::class, IOException::class) fun createUserWithHttpInfo(user: User) : Future> { - val vertxClient = WebClient.create(vertx) - val request = vertxClient.requestAbs(HttpMethod.POST, UriTemplate.of("$basePath/user")) + val localVariableClient = WebClient.create(this.vertx) + val localVariableRequest = localVariableClient.requestAbs(HttpMethod.POST, UriTemplate.of("${this.basePath}/user")) - request.putHeader("Content-Type", "application/json") + localVariableRequest.putHeader("Content-Type", "application/json") - if (apiKey["api_key"] != null) { - if (apiKeyPrefix["api_key"] != null) { - request.putHeader("api_key", apiKeyPrefix["api_key"]!! + " " + apiKey["api_key"]!!) + if (this.apiKey["api_key"] != null) { + if (this.apiKeyPrefix["api_key"] != null) { + localVariableRequest.putHeader("api_key", this.apiKeyPrefix["api_key"]!! + " " + this.apiKey["api_key"]!!) } else { - request.putHeader("api_key", apiKey["api_key"]!!) + localVariableRequest.putHeader("api_key", this.apiKey["api_key"]!!) } } - return request - .sendBuffer(responseBody(user)) + return localVariableRequest + .sendBuffer(this.responseBody(user)) .map { - val apiResponse: ApiResponse = handleResponse(it) - apiResponse + val localVariableApiResponse: ApiResponse = this.handleResponse(it) + localVariableApiResponse } } @@ -127,18 +127,18 @@ open class UserApi(basePath: kotlin.String = ApiClient.defaultBasePath, accessTo */ @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun createUsersWithArrayInput(user: kotlin.collections.List) : Future { - return createUsersWithArrayInputWithHttpInfo(user = user).map { localVarResponse -> - when (localVarResponse.responseType) { + return createUsersWithArrayInputWithHttpInfo(user = user).map { localVariableResponse -> + when (localVariableResponse.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) + val localVariableError = localVariableResponse as ClientError<*> + throw ClientException("Client error : ${localVariableError.statusCode} ${localVariableError.message.orEmpty()}", localVariableError.statusCode, localVariableResponse) } ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) + val localVariableError = localVariableResponse as ServerError<*> + throw ServerException("Server error : ${localVariableError.statusCode} ${localVariableError.message.orEmpty()}", localVariableError.statusCode, localVariableResponse) } } } @@ -155,31 +155,31 @@ open class UserApi(basePath: kotlin.String = ApiClient.defaultBasePath, accessTo */ @Throws(IllegalStateException::class, IOException::class) fun createUsersWithArrayInputWithHttpInfo(user: kotlin.collections.List) : Future> { - val vertxClient = WebClient.create(vertx) - val request = vertxClient.requestAbs(HttpMethod.POST, UriTemplate.of("$basePath/user/createWithArray")) + val localVariableClient = WebClient.create(this.vertx) + val localVariableRequest = localVariableClient.requestAbs(HttpMethod.POST, UriTemplate.of("${this.basePath}/user/createWithArray")) - request.putHeader("Content-Type", "application/json") + localVariableRequest.putHeader("Content-Type", "application/json") - if (apiKey["api_key"] != null) { - if (apiKeyPrefix["api_key"] != null) { - request.putHeader("api_key", apiKeyPrefix["api_key"]!! + " " + apiKey["api_key"]!!) + if (this.apiKey["api_key"] != null) { + if (this.apiKeyPrefix["api_key"] != null) { + localVariableRequest.putHeader("api_key", this.apiKeyPrefix["api_key"]!! + " " + this.apiKey["api_key"]!!) } else { - request.putHeader("api_key", apiKey["api_key"]!!) + localVariableRequest.putHeader("api_key", this.apiKey["api_key"]!!) } } - return request - .sendBuffer(responseBody(user)) + return localVariableRequest + .sendBuffer(this.responseBody(user)) .map { - val apiResponse: ApiResponse = handleResponse(it) - apiResponse + val localVariableApiResponse: ApiResponse = this.handleResponse(it) + localVariableApiResponse } } @@ -197,18 +197,18 @@ open class UserApi(basePath: kotlin.String = ApiClient.defaultBasePath, accessTo */ @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun createUsersWithListInput(user: kotlin.collections.List) : Future { - return createUsersWithListInputWithHttpInfo(user = user).map { localVarResponse -> - when (localVarResponse.responseType) { + return createUsersWithListInputWithHttpInfo(user = user).map { localVariableResponse -> + when (localVariableResponse.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) + val localVariableError = localVariableResponse as ClientError<*> + throw ClientException("Client error : ${localVariableError.statusCode} ${localVariableError.message.orEmpty()}", localVariableError.statusCode, localVariableResponse) } ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) + val localVariableError = localVariableResponse as ServerError<*> + throw ServerException("Server error : ${localVariableError.statusCode} ${localVariableError.message.orEmpty()}", localVariableError.statusCode, localVariableResponse) } } } @@ -225,31 +225,31 @@ open class UserApi(basePath: kotlin.String = ApiClient.defaultBasePath, accessTo */ @Throws(IllegalStateException::class, IOException::class) fun createUsersWithListInputWithHttpInfo(user: kotlin.collections.List) : Future> { - val vertxClient = WebClient.create(vertx) - val request = vertxClient.requestAbs(HttpMethod.POST, UriTemplate.of("$basePath/user/createWithList")) + val localVariableClient = WebClient.create(this.vertx) + val localVariableRequest = localVariableClient.requestAbs(HttpMethod.POST, UriTemplate.of("${this.basePath}/user/createWithList")) - request.putHeader("Content-Type", "application/json") + localVariableRequest.putHeader("Content-Type", "application/json") - if (apiKey["api_key"] != null) { - if (apiKeyPrefix["api_key"] != null) { - request.putHeader("api_key", apiKeyPrefix["api_key"]!! + " " + apiKey["api_key"]!!) + if (this.apiKey["api_key"] != null) { + if (this.apiKeyPrefix["api_key"] != null) { + localVariableRequest.putHeader("api_key", this.apiKeyPrefix["api_key"]!! + " " + this.apiKey["api_key"]!!) } else { - request.putHeader("api_key", apiKey["api_key"]!!) + localVariableRequest.putHeader("api_key", this.apiKey["api_key"]!!) } } - return request - .sendBuffer(responseBody(user)) + return localVariableRequest + .sendBuffer(this.responseBody(user)) .map { - val apiResponse: ApiResponse = handleResponse(it) - apiResponse + val localVariableApiResponse: ApiResponse = this.handleResponse(it) + localVariableApiResponse } } @@ -267,18 +267,18 @@ open class UserApi(basePath: kotlin.String = ApiClient.defaultBasePath, accessTo */ @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun deleteUser(username: kotlin.String) : Future { - return deleteUserWithHttpInfo(username = username).map { localVarResponse -> - when (localVarResponse.responseType) { + return deleteUserWithHttpInfo(username = username).map { localVariableResponse -> + when (localVariableResponse.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) + val localVariableError = localVariableResponse as ClientError<*> + throw ClientException("Client error : ${localVariableError.statusCode} ${localVariableError.message.orEmpty()}", localVariableError.statusCode, localVariableResponse) } ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) + val localVariableError = localVariableResponse as ServerError<*> + throw ServerException("Server error : ${localVariableError.statusCode} ${localVariableError.message.orEmpty()}", localVariableError.statusCode, localVariableResponse) } } } @@ -295,8 +295,8 @@ open class UserApi(basePath: kotlin.String = ApiClient.defaultBasePath, accessTo */ @Throws(IllegalStateException::class, IOException::class) fun deleteUserWithHttpInfo(username: kotlin.String) : Future> { - val vertxClient = WebClient.create(vertx) - val request = vertxClient.requestAbs(HttpMethod.DELETE, UriTemplate.of("$basePath/user/{username}".replace("{"+"username"+"}", encodeURIComponent(username.toString())))) + val localVariableClient = WebClient.create(this.vertx) + val localVariableRequest = localVariableClient.requestAbs(HttpMethod.DELETE, UriTemplate.of("${this.basePath}/user/{username}".replace("{"+"username"+"}", this.encodeURIComponent(username.toString())))) @@ -305,19 +305,19 @@ open class UserApi(basePath: kotlin.String = ApiClient.defaultBasePath, accessTo - if (apiKey["api_key"] != null) { - if (apiKeyPrefix["api_key"] != null) { - request.putHeader("api_key", apiKeyPrefix["api_key"]!! + " " + apiKey["api_key"]!!) + if (this.apiKey["api_key"] != null) { + if (this.apiKeyPrefix["api_key"] != null) { + localVariableRequest.putHeader("api_key", this.apiKeyPrefix["api_key"]!! + " " + this.apiKey["api_key"]!!) } else { - request.putHeader("api_key", apiKey["api_key"]!!) + localVariableRequest.putHeader("api_key", this.apiKey["api_key"]!!) } } - return request + return localVariableRequest .send() .map { - val apiResponse: ApiResponse = handleResponse(it) - apiResponse + val localVariableApiResponse: ApiResponse = this.handleResponse(it) + localVariableApiResponse } } @@ -336,18 +336,18 @@ open class UserApi(basePath: kotlin.String = ApiClient.defaultBasePath, accessTo @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun getUserByName(username: kotlin.String) : Future { - return getUserByNameWithHttpInfo(username = username).map { localVarResponse -> - when (localVarResponse.responseType) { - ResponseType.Success -> (localVarResponse as Success<*>).data as User + return getUserByNameWithHttpInfo(username = username).map { localVariableResponse -> + when (localVariableResponse.responseType) { + ResponseType.Success -> (localVariableResponse as Success<*>).data as User 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) + val localVariableError = localVariableResponse as ClientError<*> + throw ClientException("Client error : ${localVariableError.statusCode} ${localVariableError.message.orEmpty()}", localVariableError.statusCode, localVariableResponse) } ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) + val localVariableError = localVariableResponse as ServerError<*> + throw ServerException("Server error : ${localVariableError.statusCode} ${localVariableError.message.orEmpty()}", localVariableError.statusCode, localVariableResponse) } } } @@ -365,22 +365,22 @@ open class UserApi(basePath: kotlin.String = ApiClient.defaultBasePath, accessTo @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class) fun getUserByNameWithHttpInfo(username: kotlin.String) : Future> { - val vertxClient = WebClient.create(vertx) - val request = vertxClient.requestAbs(HttpMethod.GET, UriTemplate.of("$basePath/user/{username}".replace("{"+"username"+"}", encodeURIComponent(username.toString())))) + val localVariableClient = WebClient.create(this.vertx) + val localVariableRequest = localVariableClient.requestAbs(HttpMethod.GET, UriTemplate.of("${this.basePath}/user/{username}".replace("{"+"username"+"}", this.encodeURIComponent(username.toString())))) - request.putHeader("Accept", "application/xml, application/json") + localVariableRequest.putHeader("Accept", "application/xml, application/json") - return request + return localVariableRequest .send() .map { - val apiResponse: ApiResponse = handleResponse(it) - apiResponse + val localVariableApiResponse: ApiResponse = this.handleResponse(it) + localVariableApiResponse } } @@ -400,18 +400,18 @@ open class UserApi(basePath: kotlin.String = ApiClient.defaultBasePath, accessTo @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun loginUser(username: kotlin.String, password: kotlin.String) : Future { - return loginUserWithHttpInfo(username = username, password = password).map { localVarResponse -> - when (localVarResponse.responseType) { - ResponseType.Success -> (localVarResponse as Success<*>).data as kotlin.String + return loginUserWithHttpInfo(username = username, password = password).map { localVariableResponse -> + when (localVariableResponse.responseType) { + ResponseType.Success -> (localVariableResponse 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) + val localVariableError = localVariableResponse as ClientError<*> + throw ClientException("Client error : ${localVariableError.statusCode} ${localVariableError.message.orEmpty()}", localVariableError.statusCode, localVariableResponse) } ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) + val localVariableError = localVariableResponse as ServerError<*> + throw ServerException("Server error : ${localVariableError.statusCode} ${localVariableError.message.orEmpty()}", localVariableError.statusCode, localVariableResponse) } } } @@ -430,24 +430,24 @@ open class UserApi(basePath: kotlin.String = ApiClient.defaultBasePath, accessTo @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class) fun loginUserWithHttpInfo(username: kotlin.String, password: kotlin.String) : Future> { - val vertxClient = WebClient.create(vertx) - val request = vertxClient.requestAbs(HttpMethod.GET, UriTemplate.of("$basePath/user/login")) + val localVariableClient = WebClient.create(this.vertx) + val localVariableRequest = localVariableClient.requestAbs(HttpMethod.GET, UriTemplate.of("${this.basePath}/user/login")) - request.putHeader("Accept", "application/xml, application/json") + localVariableRequest.putHeader("Accept", "application/xml, application/json") - username.let { request.queryParams().add("username", listOf(it.toString())) } - password.let { request.queryParams().add("password", listOf(it.toString())) } + username.let { localVariableRequest.queryParams().add("username", listOf(it.toString())) } + password.let { localVariableRequest.queryParams().add("password", listOf(it.toString())) } - return request + return localVariableRequest .send() .map { - val apiResponse: ApiResponse = handleResponse(it) - apiResponse + val localVariableApiResponse: ApiResponse = this.handleResponse(it) + localVariableApiResponse } } @@ -464,18 +464,18 @@ open class UserApi(basePath: kotlin.String = ApiClient.defaultBasePath, accessTo */ @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun logoutUser() : Future { - return logoutUserWithHttpInfo().map { localVarResponse -> - when (localVarResponse.responseType) { + return logoutUserWithHttpInfo().map { localVariableResponse -> + when (localVariableResponse.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) + val localVariableError = localVariableResponse as ClientError<*> + throw ClientException("Client error : ${localVariableError.statusCode} ${localVariableError.message.orEmpty()}", localVariableError.statusCode, localVariableResponse) } ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) + val localVariableError = localVariableResponse as ServerError<*> + throw ServerException("Server error : ${localVariableError.statusCode} ${localVariableError.message.orEmpty()}", localVariableError.statusCode, localVariableResponse) } } } @@ -491,8 +491,8 @@ open class UserApi(basePath: kotlin.String = ApiClient.defaultBasePath, accessTo */ @Throws(IllegalStateException::class, IOException::class) fun logoutUserWithHttpInfo() : Future> { - val vertxClient = WebClient.create(vertx) - val request = vertxClient.requestAbs(HttpMethod.GET, UriTemplate.of("$basePath/user/logout")) + val localVariableClient = WebClient.create(this.vertx) + val localVariableRequest = localVariableClient.requestAbs(HttpMethod.GET, UriTemplate.of("${this.basePath}/user/logout")) @@ -501,19 +501,19 @@ open class UserApi(basePath: kotlin.String = ApiClient.defaultBasePath, accessTo - if (apiKey["api_key"] != null) { - if (apiKeyPrefix["api_key"] != null) { - request.putHeader("api_key", apiKeyPrefix["api_key"]!! + " " + apiKey["api_key"]!!) + if (this.apiKey["api_key"] != null) { + if (this.apiKeyPrefix["api_key"] != null) { + localVariableRequest.putHeader("api_key", this.apiKeyPrefix["api_key"]!! + " " + this.apiKey["api_key"]!!) } else { - request.putHeader("api_key", apiKey["api_key"]!!) + localVariableRequest.putHeader("api_key", this.apiKey["api_key"]!!) } } - return request + return localVariableRequest .send() .map { - val apiResponse: ApiResponse = handleResponse(it) - apiResponse + val localVariableApiResponse: ApiResponse = this.handleResponse(it) + localVariableApiResponse } } @@ -532,18 +532,18 @@ open class UserApi(basePath: kotlin.String = ApiClient.defaultBasePath, accessTo */ @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun updateUser(username: kotlin.String, user: User) : Future { - return updateUserWithHttpInfo(username = username, user = user).map { localVarResponse -> - when (localVarResponse.responseType) { + return updateUserWithHttpInfo(username = username, user = user).map { localVariableResponse -> + when (localVariableResponse.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) + val localVariableError = localVariableResponse as ClientError<*> + throw ClientException("Client error : ${localVariableError.statusCode} ${localVariableError.message.orEmpty()}", localVariableError.statusCode, localVariableResponse) } ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) + val localVariableError = localVariableResponse as ServerError<*> + throw ServerException("Server error : ${localVariableError.statusCode} ${localVariableError.message.orEmpty()}", localVariableError.statusCode, localVariableResponse) } } } @@ -561,31 +561,31 @@ open class UserApi(basePath: kotlin.String = ApiClient.defaultBasePath, accessTo */ @Throws(IllegalStateException::class, IOException::class) fun updateUserWithHttpInfo(username: kotlin.String, user: User) : Future> { - val vertxClient = WebClient.create(vertx) - val request = vertxClient.requestAbs(HttpMethod.PUT, UriTemplate.of("$basePath/user/{username}".replace("{"+"username"+"}", encodeURIComponent(username.toString())))) + val localVariableClient = WebClient.create(this.vertx) + val localVariableRequest = localVariableClient.requestAbs(HttpMethod.PUT, UriTemplate.of("${this.basePath}/user/{username}".replace("{"+"username"+"}", this.encodeURIComponent(username.toString())))) - request.putHeader("Content-Type", "application/json") + localVariableRequest.putHeader("Content-Type", "application/json") - if (apiKey["api_key"] != null) { - if (apiKeyPrefix["api_key"] != null) { - request.putHeader("api_key", apiKeyPrefix["api_key"]!! + " " + apiKey["api_key"]!!) + if (this.apiKey["api_key"] != null) { + if (this.apiKeyPrefix["api_key"] != null) { + localVariableRequest.putHeader("api_key", this.apiKeyPrefix["api_key"]!! + " " + this.apiKey["api_key"]!!) } else { - request.putHeader("api_key", apiKey["api_key"]!!) + localVariableRequest.putHeader("api_key", this.apiKey["api_key"]!!) } } - return request - .sendBuffer(responseBody(user)) + return localVariableRequest + .sendBuffer(this.responseBody(user)) .map { - val apiResponse: ApiResponse = handleResponse(it) - apiResponse + val localVariableApiResponse: ApiResponse = this.handleResponse(it) + localVariableApiResponse } } diff --git a/samples/client/petstore/kotlin-jvm-vertx-jackson-coroutines/src/main/kotlin/org/openapitools/client/apis/PetApi.kt b/samples/client/petstore/kotlin-jvm-vertx-jackson-coroutines/src/main/kotlin/org/openapitools/client/apis/PetApi.kt index 2c350b74a549..69518f9f0043 100644 --- a/samples/client/petstore/kotlin-jvm-vertx-jackson-coroutines/src/main/kotlin/org/openapitools/client/apis/PetApi.kt +++ b/samples/client/petstore/kotlin-jvm-vertx-jackson-coroutines/src/main/kotlin/org/openapitools/client/apis/PetApi.kt @@ -63,18 +63,18 @@ open class PetApi(basePath: kotlin.String = ApiClient.defaultBasePath, accessTok @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) suspend fun addPet(pet: Pet) : Pet { - return addPetWithHttpInfo(pet = pet).map { localVarResponse -> - when (localVarResponse.responseType) { - ResponseType.Success -> (localVarResponse as Success<*>).data as Pet + return addPetWithHttpInfo(pet = pet).map { localVariableResponse -> + when (localVariableResponse.responseType) { + ResponseType.Success -> (localVariableResponse as Success<*>).data as Pet 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) + val localVariableError = localVariableResponse as ClientError<*> + throw ClientException("Client error : ${localVariableError.statusCode} ${localVariableError.message.orEmpty()}", localVariableError.statusCode, localVariableResponse) } ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) + val localVariableError = localVariableResponse as ServerError<*> + throw ServerException("Server error : ${localVariableError.statusCode} ${localVariableError.message.orEmpty()}", localVariableError.statusCode, localVariableResponse) } } }.coAwait() @@ -92,28 +92,28 @@ open class PetApi(basePath: kotlin.String = ApiClient.defaultBasePath, accessTok @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class) fun addPetWithHttpInfo(pet: Pet) : Future> { - val vertxClient = WebClient.create(vertx) - val request = vertxClient.requestAbs(HttpMethod.POST, UriTemplate.of("$basePath/pet")) + val localVariableClient = WebClient.create(this.vertx) + val localVariableRequest = localVariableClient.requestAbs(HttpMethod.POST, UriTemplate.of("${this.basePath}/pet")) - request.putHeader("Content-Type", "application/json") - request.putHeader("Content-Type", "application/xml") + localVariableRequest.putHeader("Content-Type", "application/json") + localVariableRequest.putHeader("Content-Type", "application/xml") - request.putHeader("Accept", "application/xml, application/json") + localVariableRequest.putHeader("Accept", "application/xml, application/json") - accessToken?.let { accessToken -> - request.bearerTokenAuthentication(accessToken) + this.accessToken?.let { accessToken -> + localVariableRequest.bearerTokenAuthentication(accessToken) } - return request - .sendBuffer(responseBody(pet)) + return localVariableRequest + .sendBuffer(this.responseBody(pet)) .map { - val apiResponse: ApiResponse = handleResponse(it) - apiResponse + val localVariableApiResponse: ApiResponse = this.handleResponse(it) + localVariableApiResponse } } @@ -132,18 +132,18 @@ open class PetApi(basePath: kotlin.String = ApiClient.defaultBasePath, accessTok */ @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) suspend fun deletePet(petId: kotlin.Long, apiKey: kotlin.String? = null) : Unit { - return deletePetWithHttpInfo(petId = petId, apiKey = apiKey).map { localVarResponse -> - when (localVarResponse.responseType) { + return deletePetWithHttpInfo(petId = petId, apiKey = apiKey).map { localVariableResponse -> + when (localVariableResponse.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) + val localVariableError = localVariableResponse as ClientError<*> + throw ClientException("Client error : ${localVariableError.statusCode} ${localVariableError.message.orEmpty()}", localVariableError.statusCode, localVariableResponse) } ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) + val localVariableError = localVariableResponse as ServerError<*> + throw ServerException("Server error : ${localVariableError.statusCode} ${localVariableError.message.orEmpty()}", localVariableError.statusCode, localVariableResponse) } } }.coAwait() @@ -161,25 +161,25 @@ open class PetApi(basePath: kotlin.String = ApiClient.defaultBasePath, accessTok */ @Throws(IllegalStateException::class, IOException::class) fun deletePetWithHttpInfo(petId: kotlin.Long, apiKey: kotlin.String?) : Future> { - val vertxClient = WebClient.create(vertx) - val request = vertxClient.requestAbs(HttpMethod.DELETE, UriTemplate.of("$basePath/pet/{petId}".replace("{"+"petId"+"}", encodeURIComponent(petId.toString())))) + val localVariableClient = WebClient.create(this.vertx) + val localVariableRequest = localVariableClient.requestAbs(HttpMethod.DELETE, UriTemplate.of("${this.basePath}/pet/{petId}".replace("{"+"petId"+"}", this.encodeURIComponent(petId.toString())))) - apiKey?.apply { request.putHeader("api_key", this.toString())} + apiKey?.apply { localVariableRequest.putHeader("api_key", this.toString())} - accessToken?.let { accessToken -> - request.bearerTokenAuthentication(accessToken) + this.accessToken?.let { accessToken -> + localVariableRequest.bearerTokenAuthentication(accessToken) } - return request + return localVariableRequest .send() .map { - val apiResponse: ApiResponse = handleResponse(it) - apiResponse + val localVariableApiResponse: ApiResponse = this.handleResponse(it) + localVariableApiResponse } } @@ -207,18 +207,18 @@ open class PetApi(basePath: kotlin.String = ApiClient.defaultBasePath, accessTok @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) suspend fun findPetsByStatus(status: kotlin.collections.List) : kotlin.collections.List { - return findPetsByStatusWithHttpInfo(status = status).map { localVarResponse -> - when (localVarResponse.responseType) { - ResponseType.Success -> (localVarResponse as Success<*>).data as kotlin.collections.List + return findPetsByStatusWithHttpInfo(status = status).map { localVariableResponse -> + when (localVariableResponse.responseType) { + ResponseType.Success -> (localVariableResponse as Success<*>).data as kotlin.collections.List 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) + val localVariableError = localVariableResponse as ClientError<*> + throw ClientException("Client error : ${localVariableError.statusCode} ${localVariableError.message.orEmpty()}", localVariableError.statusCode, localVariableResponse) } ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) + val localVariableError = localVariableResponse as ServerError<*> + throw ServerException("Server error : ${localVariableError.statusCode} ${localVariableError.message.orEmpty()}", localVariableError.statusCode, localVariableResponse) } } }.coAwait() @@ -236,26 +236,26 @@ open class PetApi(basePath: kotlin.String = ApiClient.defaultBasePath, accessTok @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class) fun findPetsByStatusWithHttpInfo(status: kotlin.collections.List) : Future?>> { - val vertxClient = WebClient.create(vertx) - val request = vertxClient.requestAbs(HttpMethod.GET, UriTemplate.of("$basePath/pet/findByStatus")) + val localVariableClient = WebClient.create(this.vertx) + val localVariableRequest = localVariableClient.requestAbs(HttpMethod.GET, UriTemplate.of("${this.basePath}/pet/findByStatus")) - request.putHeader("Accept", "application/xml, application/json") + localVariableRequest.putHeader("Accept", "application/xml, application/json") - status.let { request.queryParams().add("status", toMultiValue(it.toList(), "csv")) } + status.let { localVariableRequest.queryParams().add("status", toMultiValue(it.toList(), "csv")) } - accessToken?.let { accessToken -> - request.bearerTokenAuthentication(accessToken) + this.accessToken?.let { accessToken -> + localVariableRequest.bearerTokenAuthentication(accessToken) } - return request + return localVariableRequest .send() .map { - val apiResponse: ApiResponse?> = handleResponse(it) - apiResponse + val localVariableApiResponse: ApiResponse?> = this.handleResponse(it) + localVariableApiResponse } } @@ -275,18 +275,18 @@ open class PetApi(basePath: kotlin.String = ApiClient.defaultBasePath, accessTok @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) @Deprecated(message = "This operation is deprecated.") suspend fun findPetsByTags(tags: kotlin.collections.List) : kotlin.collections.List { - return findPetsByTagsWithHttpInfo(tags = tags).map { localVarResponse -> - when (localVarResponse.responseType) { - ResponseType.Success -> (localVarResponse as Success<*>).data as kotlin.collections.List + return findPetsByTagsWithHttpInfo(tags = tags).map { localVariableResponse -> + when (localVariableResponse.responseType) { + ResponseType.Success -> (localVariableResponse as Success<*>).data as kotlin.collections.List 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) + val localVariableError = localVariableResponse as ClientError<*> + throw ClientException("Client error : ${localVariableError.statusCode} ${localVariableError.message.orEmpty()}", localVariableError.statusCode, localVariableResponse) } ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) + val localVariableError = localVariableResponse as ServerError<*> + throw ServerException("Server error : ${localVariableError.statusCode} ${localVariableError.message.orEmpty()}", localVariableError.statusCode, localVariableResponse) } } }.coAwait() @@ -305,26 +305,26 @@ open class PetApi(basePath: kotlin.String = ApiClient.defaultBasePath, accessTok @Throws(IllegalStateException::class, IOException::class) @Deprecated(message = "This operation is deprecated.") fun findPetsByTagsWithHttpInfo(tags: kotlin.collections.List) : Future?>> { - val vertxClient = WebClient.create(vertx) - val request = vertxClient.requestAbs(HttpMethod.GET, UriTemplate.of("$basePath/pet/findByTags")) + val localVariableClient = WebClient.create(this.vertx) + val localVariableRequest = localVariableClient.requestAbs(HttpMethod.GET, UriTemplate.of("${this.basePath}/pet/findByTags")) - request.putHeader("Accept", "application/xml, application/json") + localVariableRequest.putHeader("Accept", "application/xml, application/json") - tags.let { request.queryParams().add("tags", toMultiValue(it.toList(), "csv")) } + tags.let { localVariableRequest.queryParams().add("tags", toMultiValue(it.toList(), "csv")) } - accessToken?.let { accessToken -> - request.bearerTokenAuthentication(accessToken) + this.accessToken?.let { accessToken -> + localVariableRequest.bearerTokenAuthentication(accessToken) } - return request + return localVariableRequest .send() .map { - val apiResponse: ApiResponse?> = handleResponse(it) - apiResponse + val localVariableApiResponse: ApiResponse?> = this.handleResponse(it) + localVariableApiResponse } } @@ -343,18 +343,18 @@ open class PetApi(basePath: kotlin.String = ApiClient.defaultBasePath, accessTok @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) suspend fun getPetById(petId: kotlin.Long) : Pet { - return getPetByIdWithHttpInfo(petId = petId).map { localVarResponse -> - when (localVarResponse.responseType) { - ResponseType.Success -> (localVarResponse as Success<*>).data as Pet + return getPetByIdWithHttpInfo(petId = petId).map { localVariableResponse -> + when (localVariableResponse.responseType) { + ResponseType.Success -> (localVariableResponse as Success<*>).data as Pet 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) + val localVariableError = localVariableResponse as ClientError<*> + throw ClientException("Client error : ${localVariableError.statusCode} ${localVariableError.message.orEmpty()}", localVariableError.statusCode, localVariableResponse) } ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) + val localVariableError = localVariableResponse as ServerError<*> + throw ServerException("Server error : ${localVariableError.statusCode} ${localVariableError.message.orEmpty()}", localVariableError.statusCode, localVariableResponse) } } }.coAwait() @@ -372,29 +372,29 @@ open class PetApi(basePath: kotlin.String = ApiClient.defaultBasePath, accessTok @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class) fun getPetByIdWithHttpInfo(petId: kotlin.Long) : Future> { - val vertxClient = WebClient.create(vertx) - val request = vertxClient.requestAbs(HttpMethod.GET, UriTemplate.of("$basePath/pet/{petId}".replace("{"+"petId"+"}", encodeURIComponent(petId.toString())))) + val localVariableClient = WebClient.create(this.vertx) + val localVariableRequest = localVariableClient.requestAbs(HttpMethod.GET, UriTemplate.of("${this.basePath}/pet/{petId}".replace("{"+"petId"+"}", this.encodeURIComponent(petId.toString())))) - request.putHeader("Accept", "application/xml, application/json") + localVariableRequest.putHeader("Accept", "application/xml, application/json") - if (apiKey["api_key"] != null) { - if (apiKeyPrefix["api_key"] != null) { - request.putHeader("api_key", apiKeyPrefix["api_key"]!! + " " + apiKey["api_key"]!!) + if (this.apiKey["api_key"] != null) { + if (this.apiKeyPrefix["api_key"] != null) { + localVariableRequest.putHeader("api_key", this.apiKeyPrefix["api_key"]!! + " " + this.apiKey["api_key"]!!) } else { - request.putHeader("api_key", apiKey["api_key"]!!) + localVariableRequest.putHeader("api_key", this.apiKey["api_key"]!!) } } - return request + return localVariableRequest .send() .map { - val apiResponse: ApiResponse = handleResponse(it) - apiResponse + val localVariableApiResponse: ApiResponse = this.handleResponse(it) + localVariableApiResponse } } @@ -413,18 +413,18 @@ open class PetApi(basePath: kotlin.String = ApiClient.defaultBasePath, accessTok @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) suspend fun updatePet(pet: Pet) : Pet { - return updatePetWithHttpInfo(pet = pet).map { localVarResponse -> - when (localVarResponse.responseType) { - ResponseType.Success -> (localVarResponse as Success<*>).data as Pet + return updatePetWithHttpInfo(pet = pet).map { localVariableResponse -> + when (localVariableResponse.responseType) { + ResponseType.Success -> (localVariableResponse as Success<*>).data as Pet 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) + val localVariableError = localVariableResponse as ClientError<*> + throw ClientException("Client error : ${localVariableError.statusCode} ${localVariableError.message.orEmpty()}", localVariableError.statusCode, localVariableResponse) } ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) + val localVariableError = localVariableResponse as ServerError<*> + throw ServerException("Server error : ${localVariableError.statusCode} ${localVariableError.message.orEmpty()}", localVariableError.statusCode, localVariableResponse) } } }.coAwait() @@ -442,28 +442,28 @@ open class PetApi(basePath: kotlin.String = ApiClient.defaultBasePath, accessTok @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class) fun updatePetWithHttpInfo(pet: Pet) : Future> { - val vertxClient = WebClient.create(vertx) - val request = vertxClient.requestAbs(HttpMethod.PUT, UriTemplate.of("$basePath/pet")) + val localVariableClient = WebClient.create(this.vertx) + val localVariableRequest = localVariableClient.requestAbs(HttpMethod.PUT, UriTemplate.of("${this.basePath}/pet")) - request.putHeader("Content-Type", "application/json") - request.putHeader("Content-Type", "application/xml") + localVariableRequest.putHeader("Content-Type", "application/json") + localVariableRequest.putHeader("Content-Type", "application/xml") - request.putHeader("Accept", "application/xml, application/json") + localVariableRequest.putHeader("Accept", "application/xml, application/json") - accessToken?.let { accessToken -> - request.bearerTokenAuthentication(accessToken) + this.accessToken?.let { accessToken -> + localVariableRequest.bearerTokenAuthentication(accessToken) } - return request - .sendBuffer(responseBody(pet)) + return localVariableRequest + .sendBuffer(this.responseBody(pet)) .map { - val apiResponse: ApiResponse = handleResponse(it) - apiResponse + val localVariableApiResponse: ApiResponse = this.handleResponse(it) + localVariableApiResponse } } @@ -483,18 +483,18 @@ open class PetApi(basePath: kotlin.String = ApiClient.defaultBasePath, accessTok */ @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) suspend fun updatePetWithForm(petId: kotlin.Long, name: kotlin.String? = null, status: kotlin.String? = null) : Unit { - return updatePetWithFormWithHttpInfo(petId = petId, name = name, status = status).map { localVarResponse -> - when (localVarResponse.responseType) { + return updatePetWithFormWithHttpInfo(petId = petId, name = name, status = status).map { localVariableResponse -> + when (localVariableResponse.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) + val localVariableError = localVariableResponse as ClientError<*> + throw ClientException("Client error : ${localVariableError.statusCode} ${localVariableError.message.orEmpty()}", localVariableError.statusCode, localVariableResponse) } ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) + val localVariableError = localVariableResponse as ServerError<*> + throw ServerException("Server error : ${localVariableError.statusCode} ${localVariableError.message.orEmpty()}", localVariableError.statusCode, localVariableResponse) } } }.coAwait() @@ -513,28 +513,28 @@ open class PetApi(basePath: kotlin.String = ApiClient.defaultBasePath, accessTok */ @Throws(IllegalStateException::class, IOException::class) fun updatePetWithFormWithHttpInfo(petId: kotlin.Long, name: kotlin.String?, status: kotlin.String?) : Future> { - val vertxClient = WebClient.create(vertx) - val request = vertxClient.requestAbs(HttpMethod.POST, UriTemplate.of("$basePath/pet/{petId}".replace("{"+"petId"+"}", encodeURIComponent(petId.toString())))) + val localVariableClient = WebClient.create(this.vertx) + val localVariableRequest = localVariableClient.requestAbs(HttpMethod.POST, UriTemplate.of("${this.basePath}/pet/{petId}".replace("{"+"petId"+"}", this.encodeURIComponent(petId.toString())))) - request.putHeader("Content-Type", "application/x-www-form-urlencoded") + localVariableRequest.putHeader("Content-Type", "application/x-www-form-urlencoded") - val form = io.vertx.core.MultiMap.caseInsensitiveMultiMap(); - name?.let { form.add("name", name) } - status?.let { form.add("status", status) } + val localVariableForm = io.vertx.core.MultiMap.caseInsensitiveMultiMap(); + name?.let { localVariableForm.add("name", name) } + status?.let { localVariableForm.add("status", status) } - accessToken?.let { accessToken -> - request.bearerTokenAuthentication(accessToken) + this.accessToken?.let { accessToken -> + localVariableRequest.bearerTokenAuthentication(accessToken) } - return request + return localVariableRequest .send() .map { - val apiResponse: ApiResponse = handleResponse(it) - apiResponse + val localVariableApiResponse: ApiResponse = this.handleResponse(it) + localVariableApiResponse } } @@ -555,18 +555,18 @@ open class PetApi(basePath: kotlin.String = ApiClient.defaultBasePath, accessTok @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) suspend fun uploadFile(petId: kotlin.Long, additionalMetadata: kotlin.String? = null, file: java.io.File? = null) : ModelApiResponse { - return uploadFileWithHttpInfo(petId = petId, additionalMetadata = additionalMetadata, file = file).map { localVarResponse -> - when (localVarResponse.responseType) { - ResponseType.Success -> (localVarResponse as Success<*>).data as ModelApiResponse + return uploadFileWithHttpInfo(petId = petId, additionalMetadata = additionalMetadata, file = file).map { localVariableResponse -> + when (localVariableResponse.responseType) { + ResponseType.Success -> (localVariableResponse 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 -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) + val localVariableError = localVariableResponse as ClientError<*> + throw ClientException("Client error : ${localVariableError.statusCode} ${localVariableError.message.orEmpty()}", localVariableError.statusCode, localVariableResponse) } ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) + val localVariableError = localVariableResponse as ServerError<*> + throw ServerException("Server error : ${localVariableError.statusCode} ${localVariableError.message.orEmpty()}", localVariableError.statusCode, localVariableResponse) } } }.coAwait() @@ -586,28 +586,28 @@ open class PetApi(basePath: kotlin.String = ApiClient.defaultBasePath, accessTok @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class) fun uploadFileWithHttpInfo(petId: kotlin.Long, additionalMetadata: kotlin.String?, file: java.io.File?) : Future> { - val vertxClient = WebClient.create(vertx) - val request = vertxClient.requestAbs(HttpMethod.POST, UriTemplate.of("$basePath/pet/{petId}/uploadImage".replace("{"+"petId"+"}", encodeURIComponent(petId.toString())))) + val localVariableClient = WebClient.create(this.vertx) + val localVariableRequest = localVariableClient.requestAbs(HttpMethod.POST, UriTemplate.of("${this.basePath}/pet/{petId}/uploadImage".replace("{"+"petId"+"}", this.encodeURIComponent(petId.toString())))) - request.putHeader("Content-Type", "multipart/form-data") + localVariableRequest.putHeader("Content-Type", "multipart/form-data") - request.putHeader("Accept", "application/json") + localVariableRequest.putHeader("Accept", "application/json") - val form = io.vertx.core.MultiMap.caseInsensitiveMultiMap(); - additionalMetadata?.let { form.add("additionalMetadata", additionalMetadata) } - file?.let { form.add("file", file.toString()) } + val localVariableForm = io.vertx.core.MultiMap.caseInsensitiveMultiMap(); + additionalMetadata?.let { localVariableForm.add("additionalMetadata", additionalMetadata) } + file?.let { localVariableForm.add("file", file.toString()) } - accessToken?.let { accessToken -> - request.bearerTokenAuthentication(accessToken) + this.accessToken?.let { accessToken -> + localVariableRequest.bearerTokenAuthentication(accessToken) } - return request + return localVariableRequest .send() .map { - val apiResponse: ApiResponse = handleResponse(it) - apiResponse + val localVariableApiResponse: ApiResponse = this.handleResponse(it) + localVariableApiResponse } } diff --git a/samples/client/petstore/kotlin-jvm-vertx-jackson-coroutines/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt b/samples/client/petstore/kotlin-jvm-vertx-jackson-coroutines/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt index fc2519cdabac..9a8be0845ad9 100644 --- a/samples/client/petstore/kotlin-jvm-vertx-jackson-coroutines/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt +++ b/samples/client/petstore/kotlin-jvm-vertx-jackson-coroutines/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt @@ -61,18 +61,18 @@ open class StoreApi(basePath: kotlin.String = ApiClient.defaultBasePath, accessT */ @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) suspend fun deleteOrder(orderId: kotlin.String) : Unit { - return deleteOrderWithHttpInfo(orderId = orderId).map { localVarResponse -> - when (localVarResponse.responseType) { + return deleteOrderWithHttpInfo(orderId = orderId).map { localVariableResponse -> + when (localVariableResponse.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) + val localVariableError = localVariableResponse as ClientError<*> + throw ClientException("Client error : ${localVariableError.statusCode} ${localVariableError.message.orEmpty()}", localVariableError.statusCode, localVariableResponse) } ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) + val localVariableError = localVariableResponse as ServerError<*> + throw ServerException("Server error : ${localVariableError.statusCode} ${localVariableError.message.orEmpty()}", localVariableError.statusCode, localVariableResponse) } } }.coAwait() @@ -89,8 +89,8 @@ open class StoreApi(basePath: kotlin.String = ApiClient.defaultBasePath, accessT */ @Throws(IllegalStateException::class, IOException::class) fun deleteOrderWithHttpInfo(orderId: kotlin.String) : Future> { - val vertxClient = WebClient.create(vertx) - val request = vertxClient.requestAbs(HttpMethod.DELETE, UriTemplate.of("$basePath/store/order/{orderId}".replace("{"+"orderId"+"}", encodeURIComponent(orderId.toString())))) + val localVariableClient = WebClient.create(this.vertx) + val localVariableRequest = localVariableClient.requestAbs(HttpMethod.DELETE, UriTemplate.of("${this.basePath}/store/order/{orderId}".replace("{"+"orderId"+"}", this.encodeURIComponent(orderId.toString())))) @@ -100,11 +100,11 @@ open class StoreApi(basePath: kotlin.String = ApiClient.defaultBasePath, accessT - return request + return localVariableRequest .send() .map { - val apiResponse: ApiResponse = handleResponse(it) - apiResponse + val localVariableApiResponse: ApiResponse = this.handleResponse(it) + localVariableApiResponse } } @@ -122,18 +122,18 @@ open class StoreApi(basePath: kotlin.String = ApiClient.defaultBasePath, accessT @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) suspend fun getInventory() : kotlin.collections.Map { - return getInventoryWithHttpInfo().map { localVarResponse -> - when (localVarResponse.responseType) { - ResponseType.Success -> (localVarResponse as Success<*>).data as kotlin.collections.Map + return getInventoryWithHttpInfo().map { localVariableResponse -> + when (localVariableResponse.responseType) { + ResponseType.Success -> (localVariableResponse as Success<*>).data as kotlin.collections.Map 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) + val localVariableError = localVariableResponse as ClientError<*> + throw ClientException("Client error : ${localVariableError.statusCode} ${localVariableError.message.orEmpty()}", localVariableError.statusCode, localVariableResponse) } ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) + val localVariableError = localVariableResponse as ServerError<*> + throw ServerException("Server error : ${localVariableError.statusCode} ${localVariableError.message.orEmpty()}", localVariableError.statusCode, localVariableResponse) } } }.coAwait() @@ -150,29 +150,29 @@ open class StoreApi(basePath: kotlin.String = ApiClient.defaultBasePath, accessT @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class) fun getInventoryWithHttpInfo() : Future?>> { - val vertxClient = WebClient.create(vertx) - val request = vertxClient.requestAbs(HttpMethod.GET, UriTemplate.of("$basePath/store/inventory")) + val localVariableClient = WebClient.create(this.vertx) + val localVariableRequest = localVariableClient.requestAbs(HttpMethod.GET, UriTemplate.of("${this.basePath}/store/inventory")) - request.putHeader("Accept", "application/json") + localVariableRequest.putHeader("Accept", "application/json") - if (apiKey["api_key"] != null) { - if (apiKeyPrefix["api_key"] != null) { - request.putHeader("api_key", apiKeyPrefix["api_key"]!! + " " + apiKey["api_key"]!!) + if (this.apiKey["api_key"] != null) { + if (this.apiKeyPrefix["api_key"] != null) { + localVariableRequest.putHeader("api_key", this.apiKeyPrefix["api_key"]!! + " " + this.apiKey["api_key"]!!) } else { - request.putHeader("api_key", apiKey["api_key"]!!) + localVariableRequest.putHeader("api_key", this.apiKey["api_key"]!!) } } - return request + return localVariableRequest .send() .map { - val apiResponse: ApiResponse?> = handleResponse(it) - apiResponse + val localVariableApiResponse: ApiResponse?> = this.handleResponse(it) + localVariableApiResponse } } @@ -191,18 +191,18 @@ open class StoreApi(basePath: kotlin.String = ApiClient.defaultBasePath, accessT @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) suspend fun getOrderById(orderId: kotlin.Long) : Order { - return getOrderByIdWithHttpInfo(orderId = orderId).map { localVarResponse -> - when (localVarResponse.responseType) { - ResponseType.Success -> (localVarResponse as Success<*>).data as Order + return getOrderByIdWithHttpInfo(orderId = orderId).map { localVariableResponse -> + when (localVariableResponse.responseType) { + ResponseType.Success -> (localVariableResponse as Success<*>).data as Order 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) + val localVariableError = localVariableResponse as ClientError<*> + throw ClientException("Client error : ${localVariableError.statusCode} ${localVariableError.message.orEmpty()}", localVariableError.statusCode, localVariableResponse) } ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) + val localVariableError = localVariableResponse as ServerError<*> + throw ServerException("Server error : ${localVariableError.statusCode} ${localVariableError.message.orEmpty()}", localVariableError.statusCode, localVariableResponse) } } }.coAwait() @@ -220,22 +220,22 @@ open class StoreApi(basePath: kotlin.String = ApiClient.defaultBasePath, accessT @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class) fun getOrderByIdWithHttpInfo(orderId: kotlin.Long) : Future> { - val vertxClient = WebClient.create(vertx) - val request = vertxClient.requestAbs(HttpMethod.GET, UriTemplate.of("$basePath/store/order/{orderId}".replace("{"+"orderId"+"}", encodeURIComponent(orderId.toString())))) + val localVariableClient = WebClient.create(this.vertx) + val localVariableRequest = localVariableClient.requestAbs(HttpMethod.GET, UriTemplate.of("${this.basePath}/store/order/{orderId}".replace("{"+"orderId"+"}", this.encodeURIComponent(orderId.toString())))) - request.putHeader("Accept", "application/xml, application/json") + localVariableRequest.putHeader("Accept", "application/xml, application/json") - return request + return localVariableRequest .send() .map { - val apiResponse: ApiResponse = handleResponse(it) - apiResponse + val localVariableApiResponse: ApiResponse = this.handleResponse(it) + localVariableApiResponse } } @@ -254,18 +254,18 @@ open class StoreApi(basePath: kotlin.String = ApiClient.defaultBasePath, accessT @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) suspend fun placeOrder(order: Order) : Order { - return placeOrderWithHttpInfo(order = order).map { localVarResponse -> - when (localVarResponse.responseType) { - ResponseType.Success -> (localVarResponse as Success<*>).data as Order + return placeOrderWithHttpInfo(order = order).map { localVariableResponse -> + when (localVariableResponse.responseType) { + ResponseType.Success -> (localVariableResponse as Success<*>).data as Order 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) + val localVariableError = localVariableResponse as ClientError<*> + throw ClientException("Client error : ${localVariableError.statusCode} ${localVariableError.message.orEmpty()}", localVariableError.statusCode, localVariableResponse) } ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) + val localVariableError = localVariableResponse as ServerError<*> + throw ServerException("Server error : ${localVariableError.statusCode} ${localVariableError.message.orEmpty()}", localVariableError.statusCode, localVariableResponse) } } }.coAwait() @@ -283,24 +283,24 @@ open class StoreApi(basePath: kotlin.String = ApiClient.defaultBasePath, accessT @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class) fun placeOrderWithHttpInfo(order: Order) : Future> { - val vertxClient = WebClient.create(vertx) - val request = vertxClient.requestAbs(HttpMethod.POST, UriTemplate.of("$basePath/store/order")) + val localVariableClient = WebClient.create(this.vertx) + val localVariableRequest = localVariableClient.requestAbs(HttpMethod.POST, UriTemplate.of("${this.basePath}/store/order")) - request.putHeader("Content-Type", "application/json") + localVariableRequest.putHeader("Content-Type", "application/json") - request.putHeader("Accept", "application/xml, application/json") + localVariableRequest.putHeader("Accept", "application/xml, application/json") - return request - .sendBuffer(responseBody(order)) + return localVariableRequest + .sendBuffer(this.responseBody(order)) .map { - val apiResponse: ApiResponse = handleResponse(it) - apiResponse + val localVariableApiResponse: ApiResponse = this.handleResponse(it) + localVariableApiResponse } } diff --git a/samples/client/petstore/kotlin-jvm-vertx-jackson-coroutines/src/main/kotlin/org/openapitools/client/apis/UserApi.kt b/samples/client/petstore/kotlin-jvm-vertx-jackson-coroutines/src/main/kotlin/org/openapitools/client/apis/UserApi.kt index c4f0d6f0f01a..50401d300e6a 100644 --- a/samples/client/petstore/kotlin-jvm-vertx-jackson-coroutines/src/main/kotlin/org/openapitools/client/apis/UserApi.kt +++ b/samples/client/petstore/kotlin-jvm-vertx-jackson-coroutines/src/main/kotlin/org/openapitools/client/apis/UserApi.kt @@ -61,18 +61,18 @@ open class UserApi(basePath: kotlin.String = ApiClient.defaultBasePath, accessTo */ @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) suspend fun createUser(user: User) : Unit { - return createUserWithHttpInfo(user = user).map { localVarResponse -> - when (localVarResponse.responseType) { + return createUserWithHttpInfo(user = user).map { localVariableResponse -> + when (localVariableResponse.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) + val localVariableError = localVariableResponse as ClientError<*> + throw ClientException("Client error : ${localVariableError.statusCode} ${localVariableError.message.orEmpty()}", localVariableError.statusCode, localVariableResponse) } ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) + val localVariableError = localVariableResponse as ServerError<*> + throw ServerException("Server error : ${localVariableError.statusCode} ${localVariableError.message.orEmpty()}", localVariableError.statusCode, localVariableResponse) } } }.coAwait() @@ -89,31 +89,31 @@ open class UserApi(basePath: kotlin.String = ApiClient.defaultBasePath, accessTo */ @Throws(IllegalStateException::class, IOException::class) fun createUserWithHttpInfo(user: User) : Future> { - val vertxClient = WebClient.create(vertx) - val request = vertxClient.requestAbs(HttpMethod.POST, UriTemplate.of("$basePath/user")) + val localVariableClient = WebClient.create(this.vertx) + val localVariableRequest = localVariableClient.requestAbs(HttpMethod.POST, UriTemplate.of("${this.basePath}/user")) - request.putHeader("Content-Type", "application/json") + localVariableRequest.putHeader("Content-Type", "application/json") - if (apiKey["api_key"] != null) { - if (apiKeyPrefix["api_key"] != null) { - request.putHeader("api_key", apiKeyPrefix["api_key"]!! + " " + apiKey["api_key"]!!) + if (this.apiKey["api_key"] != null) { + if (this.apiKeyPrefix["api_key"] != null) { + localVariableRequest.putHeader("api_key", this.apiKeyPrefix["api_key"]!! + " " + this.apiKey["api_key"]!!) } else { - request.putHeader("api_key", apiKey["api_key"]!!) + localVariableRequest.putHeader("api_key", this.apiKey["api_key"]!!) } } - return request - .sendBuffer(responseBody(user)) + return localVariableRequest + .sendBuffer(this.responseBody(user)) .map { - val apiResponse: ApiResponse = handleResponse(it) - apiResponse + val localVariableApiResponse: ApiResponse = this.handleResponse(it) + localVariableApiResponse } } @@ -131,18 +131,18 @@ open class UserApi(basePath: kotlin.String = ApiClient.defaultBasePath, accessTo */ @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) suspend fun createUsersWithArrayInput(user: kotlin.collections.List) : Unit { - return createUsersWithArrayInputWithHttpInfo(user = user).map { localVarResponse -> - when (localVarResponse.responseType) { + return createUsersWithArrayInputWithHttpInfo(user = user).map { localVariableResponse -> + when (localVariableResponse.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) + val localVariableError = localVariableResponse as ClientError<*> + throw ClientException("Client error : ${localVariableError.statusCode} ${localVariableError.message.orEmpty()}", localVariableError.statusCode, localVariableResponse) } ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) + val localVariableError = localVariableResponse as ServerError<*> + throw ServerException("Server error : ${localVariableError.statusCode} ${localVariableError.message.orEmpty()}", localVariableError.statusCode, localVariableResponse) } } }.coAwait() @@ -159,31 +159,31 @@ open class UserApi(basePath: kotlin.String = ApiClient.defaultBasePath, accessTo */ @Throws(IllegalStateException::class, IOException::class) fun createUsersWithArrayInputWithHttpInfo(user: kotlin.collections.List) : Future> { - val vertxClient = WebClient.create(vertx) - val request = vertxClient.requestAbs(HttpMethod.POST, UriTemplate.of("$basePath/user/createWithArray")) + val localVariableClient = WebClient.create(this.vertx) + val localVariableRequest = localVariableClient.requestAbs(HttpMethod.POST, UriTemplate.of("${this.basePath}/user/createWithArray")) - request.putHeader("Content-Type", "application/json") + localVariableRequest.putHeader("Content-Type", "application/json") - if (apiKey["api_key"] != null) { - if (apiKeyPrefix["api_key"] != null) { - request.putHeader("api_key", apiKeyPrefix["api_key"]!! + " " + apiKey["api_key"]!!) + if (this.apiKey["api_key"] != null) { + if (this.apiKeyPrefix["api_key"] != null) { + localVariableRequest.putHeader("api_key", this.apiKeyPrefix["api_key"]!! + " " + this.apiKey["api_key"]!!) } else { - request.putHeader("api_key", apiKey["api_key"]!!) + localVariableRequest.putHeader("api_key", this.apiKey["api_key"]!!) } } - return request - .sendBuffer(responseBody(user)) + return localVariableRequest + .sendBuffer(this.responseBody(user)) .map { - val apiResponse: ApiResponse = handleResponse(it) - apiResponse + val localVariableApiResponse: ApiResponse = this.handleResponse(it) + localVariableApiResponse } } @@ -201,18 +201,18 @@ open class UserApi(basePath: kotlin.String = ApiClient.defaultBasePath, accessTo */ @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) suspend fun createUsersWithListInput(user: kotlin.collections.List) : Unit { - return createUsersWithListInputWithHttpInfo(user = user).map { localVarResponse -> - when (localVarResponse.responseType) { + return createUsersWithListInputWithHttpInfo(user = user).map { localVariableResponse -> + when (localVariableResponse.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) + val localVariableError = localVariableResponse as ClientError<*> + throw ClientException("Client error : ${localVariableError.statusCode} ${localVariableError.message.orEmpty()}", localVariableError.statusCode, localVariableResponse) } ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) + val localVariableError = localVariableResponse as ServerError<*> + throw ServerException("Server error : ${localVariableError.statusCode} ${localVariableError.message.orEmpty()}", localVariableError.statusCode, localVariableResponse) } } }.coAwait() @@ -229,31 +229,31 @@ open class UserApi(basePath: kotlin.String = ApiClient.defaultBasePath, accessTo */ @Throws(IllegalStateException::class, IOException::class) fun createUsersWithListInputWithHttpInfo(user: kotlin.collections.List) : Future> { - val vertxClient = WebClient.create(vertx) - val request = vertxClient.requestAbs(HttpMethod.POST, UriTemplate.of("$basePath/user/createWithList")) + val localVariableClient = WebClient.create(this.vertx) + val localVariableRequest = localVariableClient.requestAbs(HttpMethod.POST, UriTemplate.of("${this.basePath}/user/createWithList")) - request.putHeader("Content-Type", "application/json") + localVariableRequest.putHeader("Content-Type", "application/json") - if (apiKey["api_key"] != null) { - if (apiKeyPrefix["api_key"] != null) { - request.putHeader("api_key", apiKeyPrefix["api_key"]!! + " " + apiKey["api_key"]!!) + if (this.apiKey["api_key"] != null) { + if (this.apiKeyPrefix["api_key"] != null) { + localVariableRequest.putHeader("api_key", this.apiKeyPrefix["api_key"]!! + " " + this.apiKey["api_key"]!!) } else { - request.putHeader("api_key", apiKey["api_key"]!!) + localVariableRequest.putHeader("api_key", this.apiKey["api_key"]!!) } } - return request - .sendBuffer(responseBody(user)) + return localVariableRequest + .sendBuffer(this.responseBody(user)) .map { - val apiResponse: ApiResponse = handleResponse(it) - apiResponse + val localVariableApiResponse: ApiResponse = this.handleResponse(it) + localVariableApiResponse } } @@ -271,18 +271,18 @@ open class UserApi(basePath: kotlin.String = ApiClient.defaultBasePath, accessTo */ @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) suspend fun deleteUser(username: kotlin.String) : Unit { - return deleteUserWithHttpInfo(username = username).map { localVarResponse -> - when (localVarResponse.responseType) { + return deleteUserWithHttpInfo(username = username).map { localVariableResponse -> + when (localVariableResponse.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) + val localVariableError = localVariableResponse as ClientError<*> + throw ClientException("Client error : ${localVariableError.statusCode} ${localVariableError.message.orEmpty()}", localVariableError.statusCode, localVariableResponse) } ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) + val localVariableError = localVariableResponse as ServerError<*> + throw ServerException("Server error : ${localVariableError.statusCode} ${localVariableError.message.orEmpty()}", localVariableError.statusCode, localVariableResponse) } } }.coAwait() @@ -299,8 +299,8 @@ open class UserApi(basePath: kotlin.String = ApiClient.defaultBasePath, accessTo */ @Throws(IllegalStateException::class, IOException::class) fun deleteUserWithHttpInfo(username: kotlin.String) : Future> { - val vertxClient = WebClient.create(vertx) - val request = vertxClient.requestAbs(HttpMethod.DELETE, UriTemplate.of("$basePath/user/{username}".replace("{"+"username"+"}", encodeURIComponent(username.toString())))) + val localVariableClient = WebClient.create(this.vertx) + val localVariableRequest = localVariableClient.requestAbs(HttpMethod.DELETE, UriTemplate.of("${this.basePath}/user/{username}".replace("{"+"username"+"}", this.encodeURIComponent(username.toString())))) @@ -309,19 +309,19 @@ open class UserApi(basePath: kotlin.String = ApiClient.defaultBasePath, accessTo - if (apiKey["api_key"] != null) { - if (apiKeyPrefix["api_key"] != null) { - request.putHeader("api_key", apiKeyPrefix["api_key"]!! + " " + apiKey["api_key"]!!) + if (this.apiKey["api_key"] != null) { + if (this.apiKeyPrefix["api_key"] != null) { + localVariableRequest.putHeader("api_key", this.apiKeyPrefix["api_key"]!! + " " + this.apiKey["api_key"]!!) } else { - request.putHeader("api_key", apiKey["api_key"]!!) + localVariableRequest.putHeader("api_key", this.apiKey["api_key"]!!) } } - return request + return localVariableRequest .send() .map { - val apiResponse: ApiResponse = handleResponse(it) - apiResponse + val localVariableApiResponse: ApiResponse = this.handleResponse(it) + localVariableApiResponse } } @@ -340,18 +340,18 @@ open class UserApi(basePath: kotlin.String = ApiClient.defaultBasePath, accessTo @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) suspend fun getUserByName(username: kotlin.String) : User { - return getUserByNameWithHttpInfo(username = username).map { localVarResponse -> - when (localVarResponse.responseType) { - ResponseType.Success -> (localVarResponse as Success<*>).data as User + return getUserByNameWithHttpInfo(username = username).map { localVariableResponse -> + when (localVariableResponse.responseType) { + ResponseType.Success -> (localVariableResponse as Success<*>).data as User 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) + val localVariableError = localVariableResponse as ClientError<*> + throw ClientException("Client error : ${localVariableError.statusCode} ${localVariableError.message.orEmpty()}", localVariableError.statusCode, localVariableResponse) } ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) + val localVariableError = localVariableResponse as ServerError<*> + throw ServerException("Server error : ${localVariableError.statusCode} ${localVariableError.message.orEmpty()}", localVariableError.statusCode, localVariableResponse) } } }.coAwait() @@ -369,22 +369,22 @@ open class UserApi(basePath: kotlin.String = ApiClient.defaultBasePath, accessTo @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class) fun getUserByNameWithHttpInfo(username: kotlin.String) : Future> { - val vertxClient = WebClient.create(vertx) - val request = vertxClient.requestAbs(HttpMethod.GET, UriTemplate.of("$basePath/user/{username}".replace("{"+"username"+"}", encodeURIComponent(username.toString())))) + val localVariableClient = WebClient.create(this.vertx) + val localVariableRequest = localVariableClient.requestAbs(HttpMethod.GET, UriTemplate.of("${this.basePath}/user/{username}".replace("{"+"username"+"}", this.encodeURIComponent(username.toString())))) - request.putHeader("Accept", "application/xml, application/json") + localVariableRequest.putHeader("Accept", "application/xml, application/json") - return request + return localVariableRequest .send() .map { - val apiResponse: ApiResponse = handleResponse(it) - apiResponse + val localVariableApiResponse: ApiResponse = this.handleResponse(it) + localVariableApiResponse } } @@ -404,18 +404,18 @@ open class UserApi(basePath: kotlin.String = ApiClient.defaultBasePath, accessTo @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) suspend fun loginUser(username: kotlin.String, password: kotlin.String) : kotlin.String { - return loginUserWithHttpInfo(username = username, password = password).map { localVarResponse -> - when (localVarResponse.responseType) { - ResponseType.Success -> (localVarResponse as Success<*>).data as kotlin.String + return loginUserWithHttpInfo(username = username, password = password).map { localVariableResponse -> + when (localVariableResponse.responseType) { + ResponseType.Success -> (localVariableResponse 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) + val localVariableError = localVariableResponse as ClientError<*> + throw ClientException("Client error : ${localVariableError.statusCode} ${localVariableError.message.orEmpty()}", localVariableError.statusCode, localVariableResponse) } ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) + val localVariableError = localVariableResponse as ServerError<*> + throw ServerException("Server error : ${localVariableError.statusCode} ${localVariableError.message.orEmpty()}", localVariableError.statusCode, localVariableResponse) } } }.coAwait() @@ -434,24 +434,24 @@ open class UserApi(basePath: kotlin.String = ApiClient.defaultBasePath, accessTo @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class) fun loginUserWithHttpInfo(username: kotlin.String, password: kotlin.String) : Future> { - val vertxClient = WebClient.create(vertx) - val request = vertxClient.requestAbs(HttpMethod.GET, UriTemplate.of("$basePath/user/login")) + val localVariableClient = WebClient.create(this.vertx) + val localVariableRequest = localVariableClient.requestAbs(HttpMethod.GET, UriTemplate.of("${this.basePath}/user/login")) - request.putHeader("Accept", "application/xml, application/json") + localVariableRequest.putHeader("Accept", "application/xml, application/json") - username.let { request.queryParams().add("username", listOf(it.toString())) } - password.let { request.queryParams().add("password", listOf(it.toString())) } + username.let { localVariableRequest.queryParams().add("username", listOf(it.toString())) } + password.let { localVariableRequest.queryParams().add("password", listOf(it.toString())) } - return request + return localVariableRequest .send() .map { - val apiResponse: ApiResponse = handleResponse(it) - apiResponse + val localVariableApiResponse: ApiResponse = this.handleResponse(it) + localVariableApiResponse } } @@ -468,18 +468,18 @@ open class UserApi(basePath: kotlin.String = ApiClient.defaultBasePath, accessTo */ @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) suspend fun logoutUser() : Unit { - return logoutUserWithHttpInfo().map { localVarResponse -> - when (localVarResponse.responseType) { + return logoutUserWithHttpInfo().map { localVariableResponse -> + when (localVariableResponse.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) + val localVariableError = localVariableResponse as ClientError<*> + throw ClientException("Client error : ${localVariableError.statusCode} ${localVariableError.message.orEmpty()}", localVariableError.statusCode, localVariableResponse) } ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) + val localVariableError = localVariableResponse as ServerError<*> + throw ServerException("Server error : ${localVariableError.statusCode} ${localVariableError.message.orEmpty()}", localVariableError.statusCode, localVariableResponse) } } }.coAwait() @@ -495,8 +495,8 @@ open class UserApi(basePath: kotlin.String = ApiClient.defaultBasePath, accessTo */ @Throws(IllegalStateException::class, IOException::class) fun logoutUserWithHttpInfo() : Future> { - val vertxClient = WebClient.create(vertx) - val request = vertxClient.requestAbs(HttpMethod.GET, UriTemplate.of("$basePath/user/logout")) + val localVariableClient = WebClient.create(this.vertx) + val localVariableRequest = localVariableClient.requestAbs(HttpMethod.GET, UriTemplate.of("${this.basePath}/user/logout")) @@ -505,19 +505,19 @@ open class UserApi(basePath: kotlin.String = ApiClient.defaultBasePath, accessTo - if (apiKey["api_key"] != null) { - if (apiKeyPrefix["api_key"] != null) { - request.putHeader("api_key", apiKeyPrefix["api_key"]!! + " " + apiKey["api_key"]!!) + if (this.apiKey["api_key"] != null) { + if (this.apiKeyPrefix["api_key"] != null) { + localVariableRequest.putHeader("api_key", this.apiKeyPrefix["api_key"]!! + " " + this.apiKey["api_key"]!!) } else { - request.putHeader("api_key", apiKey["api_key"]!!) + localVariableRequest.putHeader("api_key", this.apiKey["api_key"]!!) } } - return request + return localVariableRequest .send() .map { - val apiResponse: ApiResponse = handleResponse(it) - apiResponse + val localVariableApiResponse: ApiResponse = this.handleResponse(it) + localVariableApiResponse } } @@ -536,18 +536,18 @@ open class UserApi(basePath: kotlin.String = ApiClient.defaultBasePath, accessTo */ @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) suspend fun updateUser(username: kotlin.String, user: User) : Unit { - return updateUserWithHttpInfo(username = username, user = user).map { localVarResponse -> - when (localVarResponse.responseType) { + return updateUserWithHttpInfo(username = username, user = user).map { localVariableResponse -> + when (localVariableResponse.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) + val localVariableError = localVariableResponse as ClientError<*> + throw ClientException("Client error : ${localVariableError.statusCode} ${localVariableError.message.orEmpty()}", localVariableError.statusCode, localVariableResponse) } ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) + val localVariableError = localVariableResponse as ServerError<*> + throw ServerException("Server error : ${localVariableError.statusCode} ${localVariableError.message.orEmpty()}", localVariableError.statusCode, localVariableResponse) } } }.coAwait() @@ -565,31 +565,31 @@ open class UserApi(basePath: kotlin.String = ApiClient.defaultBasePath, accessTo */ @Throws(IllegalStateException::class, IOException::class) fun updateUserWithHttpInfo(username: kotlin.String, user: User) : Future> { - val vertxClient = WebClient.create(vertx) - val request = vertxClient.requestAbs(HttpMethod.PUT, UriTemplate.of("$basePath/user/{username}".replace("{"+"username"+"}", encodeURIComponent(username.toString())))) + val localVariableClient = WebClient.create(this.vertx) + val localVariableRequest = localVariableClient.requestAbs(HttpMethod.PUT, UriTemplate.of("${this.basePath}/user/{username}".replace("{"+"username"+"}", this.encodeURIComponent(username.toString())))) - request.putHeader("Content-Type", "application/json") + localVariableRequest.putHeader("Content-Type", "application/json") - if (apiKey["api_key"] != null) { - if (apiKeyPrefix["api_key"] != null) { - request.putHeader("api_key", apiKeyPrefix["api_key"]!! + " " + apiKey["api_key"]!!) + if (this.apiKey["api_key"] != null) { + if (this.apiKeyPrefix["api_key"] != null) { + localVariableRequest.putHeader("api_key", this.apiKeyPrefix["api_key"]!! + " " + this.apiKey["api_key"]!!) } else { - request.putHeader("api_key", apiKey["api_key"]!!) + localVariableRequest.putHeader("api_key", this.apiKey["api_key"]!!) } } - return request - .sendBuffer(responseBody(user)) + return localVariableRequest + .sendBuffer(this.responseBody(user)) .map { - val apiResponse: ApiResponse = handleResponse(it) - apiResponse + val localVariableApiResponse: ApiResponse = this.handleResponse(it) + localVariableApiResponse } } diff --git a/samples/client/petstore/kotlin-jvm-vertx-jackson/src/main/kotlin/org/openapitools/client/apis/PetApi.kt b/samples/client/petstore/kotlin-jvm-vertx-jackson/src/main/kotlin/org/openapitools/client/apis/PetApi.kt index b2fc02ddc166..73ae32775cb9 100644 --- a/samples/client/petstore/kotlin-jvm-vertx-jackson/src/main/kotlin/org/openapitools/client/apis/PetApi.kt +++ b/samples/client/petstore/kotlin-jvm-vertx-jackson/src/main/kotlin/org/openapitools/client/apis/PetApi.kt @@ -59,18 +59,18 @@ open class PetApi(basePath: kotlin.String = ApiClient.defaultBasePath, accessTok @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun addPet(pet: Pet) : Future { - return addPetWithHttpInfo(pet = pet).map { localVarResponse -> - when (localVarResponse.responseType) { - ResponseType.Success -> (localVarResponse as Success<*>).data as Pet + return addPetWithHttpInfo(pet = pet).map { localVariableResponse -> + when (localVariableResponse.responseType) { + ResponseType.Success -> (localVariableResponse as Success<*>).data as Pet 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) + val localVariableError = localVariableResponse as ClientError<*> + throw ClientException("Client error : ${localVariableError.statusCode} ${localVariableError.message.orEmpty()}", localVariableError.statusCode, localVariableResponse) } ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) + val localVariableError = localVariableResponse as ServerError<*> + throw ServerException("Server error : ${localVariableError.statusCode} ${localVariableError.message.orEmpty()}", localVariableError.statusCode, localVariableResponse) } } } @@ -88,28 +88,28 @@ open class PetApi(basePath: kotlin.String = ApiClient.defaultBasePath, accessTok @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class) fun addPetWithHttpInfo(pet: Pet) : Future> { - val vertxClient = WebClient.create(vertx) - val request = vertxClient.requestAbs(HttpMethod.POST, UriTemplate.of("$basePath/pet")) + val localVariableClient = WebClient.create(this.vertx) + val localVariableRequest = localVariableClient.requestAbs(HttpMethod.POST, UriTemplate.of("${this.basePath}/pet")) - request.putHeader("Content-Type", "application/json") - request.putHeader("Content-Type", "application/xml") + localVariableRequest.putHeader("Content-Type", "application/json") + localVariableRequest.putHeader("Content-Type", "application/xml") - request.putHeader("Accept", "application/xml, application/json") + localVariableRequest.putHeader("Accept", "application/xml, application/json") - accessToken?.let { accessToken -> - request.bearerTokenAuthentication(accessToken) + this.accessToken?.let { accessToken -> + localVariableRequest.bearerTokenAuthentication(accessToken) } - return request - .sendBuffer(responseBody(pet)) + return localVariableRequest + .sendBuffer(this.responseBody(pet)) .map { - val apiResponse: ApiResponse = handleResponse(it) - apiResponse + val localVariableApiResponse: ApiResponse = this.handleResponse(it) + localVariableApiResponse } } @@ -128,18 +128,18 @@ open class PetApi(basePath: kotlin.String = ApiClient.defaultBasePath, accessTok */ @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun deletePet(petId: kotlin.Long, apiKey: kotlin.String? = null) : Future { - return deletePetWithHttpInfo(petId = petId, apiKey = apiKey).map { localVarResponse -> - when (localVarResponse.responseType) { + return deletePetWithHttpInfo(petId = petId, apiKey = apiKey).map { localVariableResponse -> + when (localVariableResponse.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) + val localVariableError = localVariableResponse as ClientError<*> + throw ClientException("Client error : ${localVariableError.statusCode} ${localVariableError.message.orEmpty()}", localVariableError.statusCode, localVariableResponse) } ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) + val localVariableError = localVariableResponse as ServerError<*> + throw ServerException("Server error : ${localVariableError.statusCode} ${localVariableError.message.orEmpty()}", localVariableError.statusCode, localVariableResponse) } } } @@ -157,25 +157,25 @@ open class PetApi(basePath: kotlin.String = ApiClient.defaultBasePath, accessTok */ @Throws(IllegalStateException::class, IOException::class) fun deletePetWithHttpInfo(petId: kotlin.Long, apiKey: kotlin.String?) : Future> { - val vertxClient = WebClient.create(vertx) - val request = vertxClient.requestAbs(HttpMethod.DELETE, UriTemplate.of("$basePath/pet/{petId}".replace("{"+"petId"+"}", encodeURIComponent(petId.toString())))) + val localVariableClient = WebClient.create(this.vertx) + val localVariableRequest = localVariableClient.requestAbs(HttpMethod.DELETE, UriTemplate.of("${this.basePath}/pet/{petId}".replace("{"+"petId"+"}", this.encodeURIComponent(petId.toString())))) - apiKey?.apply { request.putHeader("api_key", this.toString())} + apiKey?.apply { localVariableRequest.putHeader("api_key", this.toString())} - accessToken?.let { accessToken -> - request.bearerTokenAuthentication(accessToken) + this.accessToken?.let { accessToken -> + localVariableRequest.bearerTokenAuthentication(accessToken) } - return request + return localVariableRequest .send() .map { - val apiResponse: ApiResponse = handleResponse(it) - apiResponse + val localVariableApiResponse: ApiResponse = this.handleResponse(it) + localVariableApiResponse } } @@ -203,18 +203,18 @@ open class PetApi(basePath: kotlin.String = ApiClient.defaultBasePath, accessTok @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun findPetsByStatus(status: kotlin.collections.List) : Future> { - return findPetsByStatusWithHttpInfo(status = status).map { localVarResponse -> - when (localVarResponse.responseType) { - ResponseType.Success -> (localVarResponse as Success<*>).data as kotlin.collections.List + return findPetsByStatusWithHttpInfo(status = status).map { localVariableResponse -> + when (localVariableResponse.responseType) { + ResponseType.Success -> (localVariableResponse as Success<*>).data as kotlin.collections.List 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) + val localVariableError = localVariableResponse as ClientError<*> + throw ClientException("Client error : ${localVariableError.statusCode} ${localVariableError.message.orEmpty()}", localVariableError.statusCode, localVariableResponse) } ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) + val localVariableError = localVariableResponse as ServerError<*> + throw ServerException("Server error : ${localVariableError.statusCode} ${localVariableError.message.orEmpty()}", localVariableError.statusCode, localVariableResponse) } } } @@ -232,26 +232,26 @@ open class PetApi(basePath: kotlin.String = ApiClient.defaultBasePath, accessTok @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class) fun findPetsByStatusWithHttpInfo(status: kotlin.collections.List) : Future?>> { - val vertxClient = WebClient.create(vertx) - val request = vertxClient.requestAbs(HttpMethod.GET, UriTemplate.of("$basePath/pet/findByStatus")) + val localVariableClient = WebClient.create(this.vertx) + val localVariableRequest = localVariableClient.requestAbs(HttpMethod.GET, UriTemplate.of("${this.basePath}/pet/findByStatus")) - request.putHeader("Accept", "application/xml, application/json") + localVariableRequest.putHeader("Accept", "application/xml, application/json") - status.let { request.queryParams().add("status", toMultiValue(it.toList(), "csv")) } + status.let { localVariableRequest.queryParams().add("status", toMultiValue(it.toList(), "csv")) } - accessToken?.let { accessToken -> - request.bearerTokenAuthentication(accessToken) + this.accessToken?.let { accessToken -> + localVariableRequest.bearerTokenAuthentication(accessToken) } - return request + return localVariableRequest .send() .map { - val apiResponse: ApiResponse?> = handleResponse(it) - apiResponse + val localVariableApiResponse: ApiResponse?> = this.handleResponse(it) + localVariableApiResponse } } @@ -271,18 +271,18 @@ open class PetApi(basePath: kotlin.String = ApiClient.defaultBasePath, accessTok @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) @Deprecated(message = "This operation is deprecated.") fun findPetsByTags(tags: kotlin.collections.List) : Future> { - return findPetsByTagsWithHttpInfo(tags = tags).map { localVarResponse -> - when (localVarResponse.responseType) { - ResponseType.Success -> (localVarResponse as Success<*>).data as kotlin.collections.List + return findPetsByTagsWithHttpInfo(tags = tags).map { localVariableResponse -> + when (localVariableResponse.responseType) { + ResponseType.Success -> (localVariableResponse as Success<*>).data as kotlin.collections.List 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) + val localVariableError = localVariableResponse as ClientError<*> + throw ClientException("Client error : ${localVariableError.statusCode} ${localVariableError.message.orEmpty()}", localVariableError.statusCode, localVariableResponse) } ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) + val localVariableError = localVariableResponse as ServerError<*> + throw ServerException("Server error : ${localVariableError.statusCode} ${localVariableError.message.orEmpty()}", localVariableError.statusCode, localVariableResponse) } } } @@ -301,26 +301,26 @@ open class PetApi(basePath: kotlin.String = ApiClient.defaultBasePath, accessTok @Throws(IllegalStateException::class, IOException::class) @Deprecated(message = "This operation is deprecated.") fun findPetsByTagsWithHttpInfo(tags: kotlin.collections.List) : Future?>> { - val vertxClient = WebClient.create(vertx) - val request = vertxClient.requestAbs(HttpMethod.GET, UriTemplate.of("$basePath/pet/findByTags")) + val localVariableClient = WebClient.create(this.vertx) + val localVariableRequest = localVariableClient.requestAbs(HttpMethod.GET, UriTemplate.of("${this.basePath}/pet/findByTags")) - request.putHeader("Accept", "application/xml, application/json") + localVariableRequest.putHeader("Accept", "application/xml, application/json") - tags.let { request.queryParams().add("tags", toMultiValue(it.toList(), "csv")) } + tags.let { localVariableRequest.queryParams().add("tags", toMultiValue(it.toList(), "csv")) } - accessToken?.let { accessToken -> - request.bearerTokenAuthentication(accessToken) + this.accessToken?.let { accessToken -> + localVariableRequest.bearerTokenAuthentication(accessToken) } - return request + return localVariableRequest .send() .map { - val apiResponse: ApiResponse?> = handleResponse(it) - apiResponse + val localVariableApiResponse: ApiResponse?> = this.handleResponse(it) + localVariableApiResponse } } @@ -339,18 +339,18 @@ open class PetApi(basePath: kotlin.String = ApiClient.defaultBasePath, accessTok @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun getPetById(petId: kotlin.Long) : Future { - return getPetByIdWithHttpInfo(petId = petId).map { localVarResponse -> - when (localVarResponse.responseType) { - ResponseType.Success -> (localVarResponse as Success<*>).data as Pet + return getPetByIdWithHttpInfo(petId = petId).map { localVariableResponse -> + when (localVariableResponse.responseType) { + ResponseType.Success -> (localVariableResponse as Success<*>).data as Pet 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) + val localVariableError = localVariableResponse as ClientError<*> + throw ClientException("Client error : ${localVariableError.statusCode} ${localVariableError.message.orEmpty()}", localVariableError.statusCode, localVariableResponse) } ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) + val localVariableError = localVariableResponse as ServerError<*> + throw ServerException("Server error : ${localVariableError.statusCode} ${localVariableError.message.orEmpty()}", localVariableError.statusCode, localVariableResponse) } } } @@ -368,29 +368,29 @@ open class PetApi(basePath: kotlin.String = ApiClient.defaultBasePath, accessTok @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class) fun getPetByIdWithHttpInfo(petId: kotlin.Long) : Future> { - val vertxClient = WebClient.create(vertx) - val request = vertxClient.requestAbs(HttpMethod.GET, UriTemplate.of("$basePath/pet/{petId}".replace("{"+"petId"+"}", encodeURIComponent(petId.toString())))) + val localVariableClient = WebClient.create(this.vertx) + val localVariableRequest = localVariableClient.requestAbs(HttpMethod.GET, UriTemplate.of("${this.basePath}/pet/{petId}".replace("{"+"petId"+"}", this.encodeURIComponent(petId.toString())))) - request.putHeader("Accept", "application/xml, application/json") + localVariableRequest.putHeader("Accept", "application/xml, application/json") - if (apiKey["api_key"] != null) { - if (apiKeyPrefix["api_key"] != null) { - request.putHeader("api_key", apiKeyPrefix["api_key"]!! + " " + apiKey["api_key"]!!) + if (this.apiKey["api_key"] != null) { + if (this.apiKeyPrefix["api_key"] != null) { + localVariableRequest.putHeader("api_key", this.apiKeyPrefix["api_key"]!! + " " + this.apiKey["api_key"]!!) } else { - request.putHeader("api_key", apiKey["api_key"]!!) + localVariableRequest.putHeader("api_key", this.apiKey["api_key"]!!) } } - return request + return localVariableRequest .send() .map { - val apiResponse: ApiResponse = handleResponse(it) - apiResponse + val localVariableApiResponse: ApiResponse = this.handleResponse(it) + localVariableApiResponse } } @@ -409,18 +409,18 @@ open class PetApi(basePath: kotlin.String = ApiClient.defaultBasePath, accessTok @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun updatePet(pet: Pet) : Future { - return updatePetWithHttpInfo(pet = pet).map { localVarResponse -> - when (localVarResponse.responseType) { - ResponseType.Success -> (localVarResponse as Success<*>).data as Pet + return updatePetWithHttpInfo(pet = pet).map { localVariableResponse -> + when (localVariableResponse.responseType) { + ResponseType.Success -> (localVariableResponse as Success<*>).data as Pet 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) + val localVariableError = localVariableResponse as ClientError<*> + throw ClientException("Client error : ${localVariableError.statusCode} ${localVariableError.message.orEmpty()}", localVariableError.statusCode, localVariableResponse) } ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) + val localVariableError = localVariableResponse as ServerError<*> + throw ServerException("Server error : ${localVariableError.statusCode} ${localVariableError.message.orEmpty()}", localVariableError.statusCode, localVariableResponse) } } } @@ -438,28 +438,28 @@ open class PetApi(basePath: kotlin.String = ApiClient.defaultBasePath, accessTok @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class) fun updatePetWithHttpInfo(pet: Pet) : Future> { - val vertxClient = WebClient.create(vertx) - val request = vertxClient.requestAbs(HttpMethod.PUT, UriTemplate.of("$basePath/pet")) + val localVariableClient = WebClient.create(this.vertx) + val localVariableRequest = localVariableClient.requestAbs(HttpMethod.PUT, UriTemplate.of("${this.basePath}/pet")) - request.putHeader("Content-Type", "application/json") - request.putHeader("Content-Type", "application/xml") + localVariableRequest.putHeader("Content-Type", "application/json") + localVariableRequest.putHeader("Content-Type", "application/xml") - request.putHeader("Accept", "application/xml, application/json") + localVariableRequest.putHeader("Accept", "application/xml, application/json") - accessToken?.let { accessToken -> - request.bearerTokenAuthentication(accessToken) + this.accessToken?.let { accessToken -> + localVariableRequest.bearerTokenAuthentication(accessToken) } - return request - .sendBuffer(responseBody(pet)) + return localVariableRequest + .sendBuffer(this.responseBody(pet)) .map { - val apiResponse: ApiResponse = handleResponse(it) - apiResponse + val localVariableApiResponse: ApiResponse = this.handleResponse(it) + localVariableApiResponse } } @@ -479,18 +479,18 @@ open class PetApi(basePath: kotlin.String = ApiClient.defaultBasePath, accessTok */ @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun updatePetWithForm(petId: kotlin.Long, name: kotlin.String? = null, status: kotlin.String? = null) : Future { - return updatePetWithFormWithHttpInfo(petId = petId, name = name, status = status).map { localVarResponse -> - when (localVarResponse.responseType) { + return updatePetWithFormWithHttpInfo(petId = petId, name = name, status = status).map { localVariableResponse -> + when (localVariableResponse.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) + val localVariableError = localVariableResponse as ClientError<*> + throw ClientException("Client error : ${localVariableError.statusCode} ${localVariableError.message.orEmpty()}", localVariableError.statusCode, localVariableResponse) } ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) + val localVariableError = localVariableResponse as ServerError<*> + throw ServerException("Server error : ${localVariableError.statusCode} ${localVariableError.message.orEmpty()}", localVariableError.statusCode, localVariableResponse) } } } @@ -509,28 +509,28 @@ open class PetApi(basePath: kotlin.String = ApiClient.defaultBasePath, accessTok */ @Throws(IllegalStateException::class, IOException::class) fun updatePetWithFormWithHttpInfo(petId: kotlin.Long, name: kotlin.String?, status: kotlin.String?) : Future> { - val vertxClient = WebClient.create(vertx) - val request = vertxClient.requestAbs(HttpMethod.POST, UriTemplate.of("$basePath/pet/{petId}".replace("{"+"petId"+"}", encodeURIComponent(petId.toString())))) + val localVariableClient = WebClient.create(this.vertx) + val localVariableRequest = localVariableClient.requestAbs(HttpMethod.POST, UriTemplate.of("${this.basePath}/pet/{petId}".replace("{"+"petId"+"}", this.encodeURIComponent(petId.toString())))) - request.putHeader("Content-Type", "application/x-www-form-urlencoded") + localVariableRequest.putHeader("Content-Type", "application/x-www-form-urlencoded") - val form = io.vertx.core.MultiMap.caseInsensitiveMultiMap(); - name?.let { form.add("name", name) } - status?.let { form.add("status", status) } + val localVariableForm = io.vertx.core.MultiMap.caseInsensitiveMultiMap(); + name?.let { localVariableForm.add("name", name) } + status?.let { localVariableForm.add("status", status) } - accessToken?.let { accessToken -> - request.bearerTokenAuthentication(accessToken) + this.accessToken?.let { accessToken -> + localVariableRequest.bearerTokenAuthentication(accessToken) } - return request + return localVariableRequest .send() .map { - val apiResponse: ApiResponse = handleResponse(it) - apiResponse + val localVariableApiResponse: ApiResponse = this.handleResponse(it) + localVariableApiResponse } } @@ -551,18 +551,18 @@ open class PetApi(basePath: kotlin.String = ApiClient.defaultBasePath, accessTok @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) : Future { - return uploadFileWithHttpInfo(petId = petId, additionalMetadata = additionalMetadata, file = file).map { localVarResponse -> - when (localVarResponse.responseType) { - ResponseType.Success -> (localVarResponse as Success<*>).data as ModelApiResponse + return uploadFileWithHttpInfo(petId = petId, additionalMetadata = additionalMetadata, file = file).map { localVariableResponse -> + when (localVariableResponse.responseType) { + ResponseType.Success -> (localVariableResponse 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 -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) + val localVariableError = localVariableResponse as ClientError<*> + throw ClientException("Client error : ${localVariableError.statusCode} ${localVariableError.message.orEmpty()}", localVariableError.statusCode, localVariableResponse) } ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) + val localVariableError = localVariableResponse as ServerError<*> + throw ServerException("Server error : ${localVariableError.statusCode} ${localVariableError.message.orEmpty()}", localVariableError.statusCode, localVariableResponse) } } } @@ -582,28 +582,28 @@ open class PetApi(basePath: kotlin.String = ApiClient.defaultBasePath, accessTok @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class) fun uploadFileWithHttpInfo(petId: kotlin.Long, additionalMetadata: kotlin.String?, file: java.io.File?) : Future> { - val vertxClient = WebClient.create(vertx) - val request = vertxClient.requestAbs(HttpMethod.POST, UriTemplate.of("$basePath/pet/{petId}/uploadImage".replace("{"+"petId"+"}", encodeURIComponent(petId.toString())))) + val localVariableClient = WebClient.create(this.vertx) + val localVariableRequest = localVariableClient.requestAbs(HttpMethod.POST, UriTemplate.of("${this.basePath}/pet/{petId}/uploadImage".replace("{"+"petId"+"}", this.encodeURIComponent(petId.toString())))) - request.putHeader("Content-Type", "multipart/form-data") + localVariableRequest.putHeader("Content-Type", "multipart/form-data") - request.putHeader("Accept", "application/json") + localVariableRequest.putHeader("Accept", "application/json") - val form = io.vertx.core.MultiMap.caseInsensitiveMultiMap(); - additionalMetadata?.let { form.add("additionalMetadata", additionalMetadata) } - file?.let { form.add("file", file.toString()) } + val localVariableForm = io.vertx.core.MultiMap.caseInsensitiveMultiMap(); + additionalMetadata?.let { localVariableForm.add("additionalMetadata", additionalMetadata) } + file?.let { localVariableForm.add("file", file.toString()) } - accessToken?.let { accessToken -> - request.bearerTokenAuthentication(accessToken) + this.accessToken?.let { accessToken -> + localVariableRequest.bearerTokenAuthentication(accessToken) } - return request + return localVariableRequest .send() .map { - val apiResponse: ApiResponse = handleResponse(it) - apiResponse + val localVariableApiResponse: ApiResponse = this.handleResponse(it) + localVariableApiResponse } } diff --git a/samples/client/petstore/kotlin-jvm-vertx-jackson/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt b/samples/client/petstore/kotlin-jvm-vertx-jackson/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt index c6944c70d770..096c1e0f485f 100644 --- a/samples/client/petstore/kotlin-jvm-vertx-jackson/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt +++ b/samples/client/petstore/kotlin-jvm-vertx-jackson/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt @@ -57,18 +57,18 @@ open class StoreApi(basePath: kotlin.String = ApiClient.defaultBasePath, accessT */ @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun deleteOrder(orderId: kotlin.String) : Future { - return deleteOrderWithHttpInfo(orderId = orderId).map { localVarResponse -> - when (localVarResponse.responseType) { + return deleteOrderWithHttpInfo(orderId = orderId).map { localVariableResponse -> + when (localVariableResponse.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) + val localVariableError = localVariableResponse as ClientError<*> + throw ClientException("Client error : ${localVariableError.statusCode} ${localVariableError.message.orEmpty()}", localVariableError.statusCode, localVariableResponse) } ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) + val localVariableError = localVariableResponse as ServerError<*> + throw ServerException("Server error : ${localVariableError.statusCode} ${localVariableError.message.orEmpty()}", localVariableError.statusCode, localVariableResponse) } } } @@ -85,8 +85,8 @@ open class StoreApi(basePath: kotlin.String = ApiClient.defaultBasePath, accessT */ @Throws(IllegalStateException::class, IOException::class) fun deleteOrderWithHttpInfo(orderId: kotlin.String) : Future> { - val vertxClient = WebClient.create(vertx) - val request = vertxClient.requestAbs(HttpMethod.DELETE, UriTemplate.of("$basePath/store/order/{orderId}".replace("{"+"orderId"+"}", encodeURIComponent(orderId.toString())))) + val localVariableClient = WebClient.create(this.vertx) + val localVariableRequest = localVariableClient.requestAbs(HttpMethod.DELETE, UriTemplate.of("${this.basePath}/store/order/{orderId}".replace("{"+"orderId"+"}", this.encodeURIComponent(orderId.toString())))) @@ -96,11 +96,11 @@ open class StoreApi(basePath: kotlin.String = ApiClient.defaultBasePath, accessT - return request + return localVariableRequest .send() .map { - val apiResponse: ApiResponse = handleResponse(it) - apiResponse + val localVariableApiResponse: ApiResponse = this.handleResponse(it) + localVariableApiResponse } } @@ -118,18 +118,18 @@ open class StoreApi(basePath: kotlin.String = ApiClient.defaultBasePath, accessT @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun getInventory() : Future> { - return getInventoryWithHttpInfo().map { localVarResponse -> - when (localVarResponse.responseType) { - ResponseType.Success -> (localVarResponse as Success<*>).data as kotlin.collections.Map + return getInventoryWithHttpInfo().map { localVariableResponse -> + when (localVariableResponse.responseType) { + ResponseType.Success -> (localVariableResponse as Success<*>).data as kotlin.collections.Map 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) + val localVariableError = localVariableResponse as ClientError<*> + throw ClientException("Client error : ${localVariableError.statusCode} ${localVariableError.message.orEmpty()}", localVariableError.statusCode, localVariableResponse) } ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) + val localVariableError = localVariableResponse as ServerError<*> + throw ServerException("Server error : ${localVariableError.statusCode} ${localVariableError.message.orEmpty()}", localVariableError.statusCode, localVariableResponse) } } } @@ -146,29 +146,29 @@ open class StoreApi(basePath: kotlin.String = ApiClient.defaultBasePath, accessT @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class) fun getInventoryWithHttpInfo() : Future?>> { - val vertxClient = WebClient.create(vertx) - val request = vertxClient.requestAbs(HttpMethod.GET, UriTemplate.of("$basePath/store/inventory")) + val localVariableClient = WebClient.create(this.vertx) + val localVariableRequest = localVariableClient.requestAbs(HttpMethod.GET, UriTemplate.of("${this.basePath}/store/inventory")) - request.putHeader("Accept", "application/json") + localVariableRequest.putHeader("Accept", "application/json") - if (apiKey["api_key"] != null) { - if (apiKeyPrefix["api_key"] != null) { - request.putHeader("api_key", apiKeyPrefix["api_key"]!! + " " + apiKey["api_key"]!!) + if (this.apiKey["api_key"] != null) { + if (this.apiKeyPrefix["api_key"] != null) { + localVariableRequest.putHeader("api_key", this.apiKeyPrefix["api_key"]!! + " " + this.apiKey["api_key"]!!) } else { - request.putHeader("api_key", apiKey["api_key"]!!) + localVariableRequest.putHeader("api_key", this.apiKey["api_key"]!!) } } - return request + return localVariableRequest .send() .map { - val apiResponse: ApiResponse?> = handleResponse(it) - apiResponse + val localVariableApiResponse: ApiResponse?> = this.handleResponse(it) + localVariableApiResponse } } @@ -187,18 +187,18 @@ open class StoreApi(basePath: kotlin.String = ApiClient.defaultBasePath, accessT @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun getOrderById(orderId: kotlin.Long) : Future { - return getOrderByIdWithHttpInfo(orderId = orderId).map { localVarResponse -> - when (localVarResponse.responseType) { - ResponseType.Success -> (localVarResponse as Success<*>).data as Order + return getOrderByIdWithHttpInfo(orderId = orderId).map { localVariableResponse -> + when (localVariableResponse.responseType) { + ResponseType.Success -> (localVariableResponse as Success<*>).data as Order 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) + val localVariableError = localVariableResponse as ClientError<*> + throw ClientException("Client error : ${localVariableError.statusCode} ${localVariableError.message.orEmpty()}", localVariableError.statusCode, localVariableResponse) } ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) + val localVariableError = localVariableResponse as ServerError<*> + throw ServerException("Server error : ${localVariableError.statusCode} ${localVariableError.message.orEmpty()}", localVariableError.statusCode, localVariableResponse) } } } @@ -216,22 +216,22 @@ open class StoreApi(basePath: kotlin.String = ApiClient.defaultBasePath, accessT @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class) fun getOrderByIdWithHttpInfo(orderId: kotlin.Long) : Future> { - val vertxClient = WebClient.create(vertx) - val request = vertxClient.requestAbs(HttpMethod.GET, UriTemplate.of("$basePath/store/order/{orderId}".replace("{"+"orderId"+"}", encodeURIComponent(orderId.toString())))) + val localVariableClient = WebClient.create(this.vertx) + val localVariableRequest = localVariableClient.requestAbs(HttpMethod.GET, UriTemplate.of("${this.basePath}/store/order/{orderId}".replace("{"+"orderId"+"}", this.encodeURIComponent(orderId.toString())))) - request.putHeader("Accept", "application/xml, application/json") + localVariableRequest.putHeader("Accept", "application/xml, application/json") - return request + return localVariableRequest .send() .map { - val apiResponse: ApiResponse = handleResponse(it) - apiResponse + val localVariableApiResponse: ApiResponse = this.handleResponse(it) + localVariableApiResponse } } @@ -250,18 +250,18 @@ open class StoreApi(basePath: kotlin.String = ApiClient.defaultBasePath, accessT @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun placeOrder(order: Order) : Future { - return placeOrderWithHttpInfo(order = order).map { localVarResponse -> - when (localVarResponse.responseType) { - ResponseType.Success -> (localVarResponse as Success<*>).data as Order + return placeOrderWithHttpInfo(order = order).map { localVariableResponse -> + when (localVariableResponse.responseType) { + ResponseType.Success -> (localVariableResponse as Success<*>).data as Order 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) + val localVariableError = localVariableResponse as ClientError<*> + throw ClientException("Client error : ${localVariableError.statusCode} ${localVariableError.message.orEmpty()}", localVariableError.statusCode, localVariableResponse) } ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) + val localVariableError = localVariableResponse as ServerError<*> + throw ServerException("Server error : ${localVariableError.statusCode} ${localVariableError.message.orEmpty()}", localVariableError.statusCode, localVariableResponse) } } } @@ -279,24 +279,24 @@ open class StoreApi(basePath: kotlin.String = ApiClient.defaultBasePath, accessT @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class) fun placeOrderWithHttpInfo(order: Order) : Future> { - val vertxClient = WebClient.create(vertx) - val request = vertxClient.requestAbs(HttpMethod.POST, UriTemplate.of("$basePath/store/order")) + val localVariableClient = WebClient.create(this.vertx) + val localVariableRequest = localVariableClient.requestAbs(HttpMethod.POST, UriTemplate.of("${this.basePath}/store/order")) - request.putHeader("Content-Type", "application/json") + localVariableRequest.putHeader("Content-Type", "application/json") - request.putHeader("Accept", "application/xml, application/json") + localVariableRequest.putHeader("Accept", "application/xml, application/json") - return request - .sendBuffer(responseBody(order)) + return localVariableRequest + .sendBuffer(this.responseBody(order)) .map { - val apiResponse: ApiResponse = handleResponse(it) - apiResponse + val localVariableApiResponse: ApiResponse = this.handleResponse(it) + localVariableApiResponse } } diff --git a/samples/client/petstore/kotlin-jvm-vertx-jackson/src/main/kotlin/org/openapitools/client/apis/UserApi.kt b/samples/client/petstore/kotlin-jvm-vertx-jackson/src/main/kotlin/org/openapitools/client/apis/UserApi.kt index 41dc5b9db38a..34fa0c4325d0 100644 --- a/samples/client/petstore/kotlin-jvm-vertx-jackson/src/main/kotlin/org/openapitools/client/apis/UserApi.kt +++ b/samples/client/petstore/kotlin-jvm-vertx-jackson/src/main/kotlin/org/openapitools/client/apis/UserApi.kt @@ -57,18 +57,18 @@ open class UserApi(basePath: kotlin.String = ApiClient.defaultBasePath, accessTo */ @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun createUser(user: User) : Future { - return createUserWithHttpInfo(user = user).map { localVarResponse -> - when (localVarResponse.responseType) { + return createUserWithHttpInfo(user = user).map { localVariableResponse -> + when (localVariableResponse.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) + val localVariableError = localVariableResponse as ClientError<*> + throw ClientException("Client error : ${localVariableError.statusCode} ${localVariableError.message.orEmpty()}", localVariableError.statusCode, localVariableResponse) } ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) + val localVariableError = localVariableResponse as ServerError<*> + throw ServerException("Server error : ${localVariableError.statusCode} ${localVariableError.message.orEmpty()}", localVariableError.statusCode, localVariableResponse) } } } @@ -85,31 +85,31 @@ open class UserApi(basePath: kotlin.String = ApiClient.defaultBasePath, accessTo */ @Throws(IllegalStateException::class, IOException::class) fun createUserWithHttpInfo(user: User) : Future> { - val vertxClient = WebClient.create(vertx) - val request = vertxClient.requestAbs(HttpMethod.POST, UriTemplate.of("$basePath/user")) + val localVariableClient = WebClient.create(this.vertx) + val localVariableRequest = localVariableClient.requestAbs(HttpMethod.POST, UriTemplate.of("${this.basePath}/user")) - request.putHeader("Content-Type", "application/json") + localVariableRequest.putHeader("Content-Type", "application/json") - if (apiKey["api_key"] != null) { - if (apiKeyPrefix["api_key"] != null) { - request.putHeader("api_key", apiKeyPrefix["api_key"]!! + " " + apiKey["api_key"]!!) + if (this.apiKey["api_key"] != null) { + if (this.apiKeyPrefix["api_key"] != null) { + localVariableRequest.putHeader("api_key", this.apiKeyPrefix["api_key"]!! + " " + this.apiKey["api_key"]!!) } else { - request.putHeader("api_key", apiKey["api_key"]!!) + localVariableRequest.putHeader("api_key", this.apiKey["api_key"]!!) } } - return request - .sendBuffer(responseBody(user)) + return localVariableRequest + .sendBuffer(this.responseBody(user)) .map { - val apiResponse: ApiResponse = handleResponse(it) - apiResponse + val localVariableApiResponse: ApiResponse = this.handleResponse(it) + localVariableApiResponse } } @@ -127,18 +127,18 @@ open class UserApi(basePath: kotlin.String = ApiClient.defaultBasePath, accessTo */ @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun createUsersWithArrayInput(user: kotlin.collections.List) : Future { - return createUsersWithArrayInputWithHttpInfo(user = user).map { localVarResponse -> - when (localVarResponse.responseType) { + return createUsersWithArrayInputWithHttpInfo(user = user).map { localVariableResponse -> + when (localVariableResponse.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) + val localVariableError = localVariableResponse as ClientError<*> + throw ClientException("Client error : ${localVariableError.statusCode} ${localVariableError.message.orEmpty()}", localVariableError.statusCode, localVariableResponse) } ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) + val localVariableError = localVariableResponse as ServerError<*> + throw ServerException("Server error : ${localVariableError.statusCode} ${localVariableError.message.orEmpty()}", localVariableError.statusCode, localVariableResponse) } } } @@ -155,31 +155,31 @@ open class UserApi(basePath: kotlin.String = ApiClient.defaultBasePath, accessTo */ @Throws(IllegalStateException::class, IOException::class) fun createUsersWithArrayInputWithHttpInfo(user: kotlin.collections.List) : Future> { - val vertxClient = WebClient.create(vertx) - val request = vertxClient.requestAbs(HttpMethod.POST, UriTemplate.of("$basePath/user/createWithArray")) + val localVariableClient = WebClient.create(this.vertx) + val localVariableRequest = localVariableClient.requestAbs(HttpMethod.POST, UriTemplate.of("${this.basePath}/user/createWithArray")) - request.putHeader("Content-Type", "application/json") + localVariableRequest.putHeader("Content-Type", "application/json") - if (apiKey["api_key"] != null) { - if (apiKeyPrefix["api_key"] != null) { - request.putHeader("api_key", apiKeyPrefix["api_key"]!! + " " + apiKey["api_key"]!!) + if (this.apiKey["api_key"] != null) { + if (this.apiKeyPrefix["api_key"] != null) { + localVariableRequest.putHeader("api_key", this.apiKeyPrefix["api_key"]!! + " " + this.apiKey["api_key"]!!) } else { - request.putHeader("api_key", apiKey["api_key"]!!) + localVariableRequest.putHeader("api_key", this.apiKey["api_key"]!!) } } - return request - .sendBuffer(responseBody(user)) + return localVariableRequest + .sendBuffer(this.responseBody(user)) .map { - val apiResponse: ApiResponse = handleResponse(it) - apiResponse + val localVariableApiResponse: ApiResponse = this.handleResponse(it) + localVariableApiResponse } } @@ -197,18 +197,18 @@ open class UserApi(basePath: kotlin.String = ApiClient.defaultBasePath, accessTo */ @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun createUsersWithListInput(user: kotlin.collections.List) : Future { - return createUsersWithListInputWithHttpInfo(user = user).map { localVarResponse -> - when (localVarResponse.responseType) { + return createUsersWithListInputWithHttpInfo(user = user).map { localVariableResponse -> + when (localVariableResponse.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) + val localVariableError = localVariableResponse as ClientError<*> + throw ClientException("Client error : ${localVariableError.statusCode} ${localVariableError.message.orEmpty()}", localVariableError.statusCode, localVariableResponse) } ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) + val localVariableError = localVariableResponse as ServerError<*> + throw ServerException("Server error : ${localVariableError.statusCode} ${localVariableError.message.orEmpty()}", localVariableError.statusCode, localVariableResponse) } } } @@ -225,31 +225,31 @@ open class UserApi(basePath: kotlin.String = ApiClient.defaultBasePath, accessTo */ @Throws(IllegalStateException::class, IOException::class) fun createUsersWithListInputWithHttpInfo(user: kotlin.collections.List) : Future> { - val vertxClient = WebClient.create(vertx) - val request = vertxClient.requestAbs(HttpMethod.POST, UriTemplate.of("$basePath/user/createWithList")) + val localVariableClient = WebClient.create(this.vertx) + val localVariableRequest = localVariableClient.requestAbs(HttpMethod.POST, UriTemplate.of("${this.basePath}/user/createWithList")) - request.putHeader("Content-Type", "application/json") + localVariableRequest.putHeader("Content-Type", "application/json") - if (apiKey["api_key"] != null) { - if (apiKeyPrefix["api_key"] != null) { - request.putHeader("api_key", apiKeyPrefix["api_key"]!! + " " + apiKey["api_key"]!!) + if (this.apiKey["api_key"] != null) { + if (this.apiKeyPrefix["api_key"] != null) { + localVariableRequest.putHeader("api_key", this.apiKeyPrefix["api_key"]!! + " " + this.apiKey["api_key"]!!) } else { - request.putHeader("api_key", apiKey["api_key"]!!) + localVariableRequest.putHeader("api_key", this.apiKey["api_key"]!!) } } - return request - .sendBuffer(responseBody(user)) + return localVariableRequest + .sendBuffer(this.responseBody(user)) .map { - val apiResponse: ApiResponse = handleResponse(it) - apiResponse + val localVariableApiResponse: ApiResponse = this.handleResponse(it) + localVariableApiResponse } } @@ -267,18 +267,18 @@ open class UserApi(basePath: kotlin.String = ApiClient.defaultBasePath, accessTo */ @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun deleteUser(username: kotlin.String) : Future { - return deleteUserWithHttpInfo(username = username).map { localVarResponse -> - when (localVarResponse.responseType) { + return deleteUserWithHttpInfo(username = username).map { localVariableResponse -> + when (localVariableResponse.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) + val localVariableError = localVariableResponse as ClientError<*> + throw ClientException("Client error : ${localVariableError.statusCode} ${localVariableError.message.orEmpty()}", localVariableError.statusCode, localVariableResponse) } ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) + val localVariableError = localVariableResponse as ServerError<*> + throw ServerException("Server error : ${localVariableError.statusCode} ${localVariableError.message.orEmpty()}", localVariableError.statusCode, localVariableResponse) } } } @@ -295,8 +295,8 @@ open class UserApi(basePath: kotlin.String = ApiClient.defaultBasePath, accessTo */ @Throws(IllegalStateException::class, IOException::class) fun deleteUserWithHttpInfo(username: kotlin.String) : Future> { - val vertxClient = WebClient.create(vertx) - val request = vertxClient.requestAbs(HttpMethod.DELETE, UriTemplate.of("$basePath/user/{username}".replace("{"+"username"+"}", encodeURIComponent(username.toString())))) + val localVariableClient = WebClient.create(this.vertx) + val localVariableRequest = localVariableClient.requestAbs(HttpMethod.DELETE, UriTemplate.of("${this.basePath}/user/{username}".replace("{"+"username"+"}", this.encodeURIComponent(username.toString())))) @@ -305,19 +305,19 @@ open class UserApi(basePath: kotlin.String = ApiClient.defaultBasePath, accessTo - if (apiKey["api_key"] != null) { - if (apiKeyPrefix["api_key"] != null) { - request.putHeader("api_key", apiKeyPrefix["api_key"]!! + " " + apiKey["api_key"]!!) + if (this.apiKey["api_key"] != null) { + if (this.apiKeyPrefix["api_key"] != null) { + localVariableRequest.putHeader("api_key", this.apiKeyPrefix["api_key"]!! + " " + this.apiKey["api_key"]!!) } else { - request.putHeader("api_key", apiKey["api_key"]!!) + localVariableRequest.putHeader("api_key", this.apiKey["api_key"]!!) } } - return request + return localVariableRequest .send() .map { - val apiResponse: ApiResponse = handleResponse(it) - apiResponse + val localVariableApiResponse: ApiResponse = this.handleResponse(it) + localVariableApiResponse } } @@ -336,18 +336,18 @@ open class UserApi(basePath: kotlin.String = ApiClient.defaultBasePath, accessTo @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun getUserByName(username: kotlin.String) : Future { - return getUserByNameWithHttpInfo(username = username).map { localVarResponse -> - when (localVarResponse.responseType) { - ResponseType.Success -> (localVarResponse as Success<*>).data as User + return getUserByNameWithHttpInfo(username = username).map { localVariableResponse -> + when (localVariableResponse.responseType) { + ResponseType.Success -> (localVariableResponse as Success<*>).data as User 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) + val localVariableError = localVariableResponse as ClientError<*> + throw ClientException("Client error : ${localVariableError.statusCode} ${localVariableError.message.orEmpty()}", localVariableError.statusCode, localVariableResponse) } ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) + val localVariableError = localVariableResponse as ServerError<*> + throw ServerException("Server error : ${localVariableError.statusCode} ${localVariableError.message.orEmpty()}", localVariableError.statusCode, localVariableResponse) } } } @@ -365,22 +365,22 @@ open class UserApi(basePath: kotlin.String = ApiClient.defaultBasePath, accessTo @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class) fun getUserByNameWithHttpInfo(username: kotlin.String) : Future> { - val vertxClient = WebClient.create(vertx) - val request = vertxClient.requestAbs(HttpMethod.GET, UriTemplate.of("$basePath/user/{username}".replace("{"+"username"+"}", encodeURIComponent(username.toString())))) + val localVariableClient = WebClient.create(this.vertx) + val localVariableRequest = localVariableClient.requestAbs(HttpMethod.GET, UriTemplate.of("${this.basePath}/user/{username}".replace("{"+"username"+"}", this.encodeURIComponent(username.toString())))) - request.putHeader("Accept", "application/xml, application/json") + localVariableRequest.putHeader("Accept", "application/xml, application/json") - return request + return localVariableRequest .send() .map { - val apiResponse: ApiResponse = handleResponse(it) - apiResponse + val localVariableApiResponse: ApiResponse = this.handleResponse(it) + localVariableApiResponse } } @@ -400,18 +400,18 @@ open class UserApi(basePath: kotlin.String = ApiClient.defaultBasePath, accessTo @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun loginUser(username: kotlin.String, password: kotlin.String) : Future { - return loginUserWithHttpInfo(username = username, password = password).map { localVarResponse -> - when (localVarResponse.responseType) { - ResponseType.Success -> (localVarResponse as Success<*>).data as kotlin.String + return loginUserWithHttpInfo(username = username, password = password).map { localVariableResponse -> + when (localVariableResponse.responseType) { + ResponseType.Success -> (localVariableResponse 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) + val localVariableError = localVariableResponse as ClientError<*> + throw ClientException("Client error : ${localVariableError.statusCode} ${localVariableError.message.orEmpty()}", localVariableError.statusCode, localVariableResponse) } ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) + val localVariableError = localVariableResponse as ServerError<*> + throw ServerException("Server error : ${localVariableError.statusCode} ${localVariableError.message.orEmpty()}", localVariableError.statusCode, localVariableResponse) } } } @@ -430,24 +430,24 @@ open class UserApi(basePath: kotlin.String = ApiClient.defaultBasePath, accessTo @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class) fun loginUserWithHttpInfo(username: kotlin.String, password: kotlin.String) : Future> { - val vertxClient = WebClient.create(vertx) - val request = vertxClient.requestAbs(HttpMethod.GET, UriTemplate.of("$basePath/user/login")) + val localVariableClient = WebClient.create(this.vertx) + val localVariableRequest = localVariableClient.requestAbs(HttpMethod.GET, UriTemplate.of("${this.basePath}/user/login")) - request.putHeader("Accept", "application/xml, application/json") + localVariableRequest.putHeader("Accept", "application/xml, application/json") - username.let { request.queryParams().add("username", listOf(it.toString())) } - password.let { request.queryParams().add("password", listOf(it.toString())) } + username.let { localVariableRequest.queryParams().add("username", listOf(it.toString())) } + password.let { localVariableRequest.queryParams().add("password", listOf(it.toString())) } - return request + return localVariableRequest .send() .map { - val apiResponse: ApiResponse = handleResponse(it) - apiResponse + val localVariableApiResponse: ApiResponse = this.handleResponse(it) + localVariableApiResponse } } @@ -464,18 +464,18 @@ open class UserApi(basePath: kotlin.String = ApiClient.defaultBasePath, accessTo */ @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun logoutUser() : Future { - return logoutUserWithHttpInfo().map { localVarResponse -> - when (localVarResponse.responseType) { + return logoutUserWithHttpInfo().map { localVariableResponse -> + when (localVariableResponse.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) + val localVariableError = localVariableResponse as ClientError<*> + throw ClientException("Client error : ${localVariableError.statusCode} ${localVariableError.message.orEmpty()}", localVariableError.statusCode, localVariableResponse) } ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) + val localVariableError = localVariableResponse as ServerError<*> + throw ServerException("Server error : ${localVariableError.statusCode} ${localVariableError.message.orEmpty()}", localVariableError.statusCode, localVariableResponse) } } } @@ -491,8 +491,8 @@ open class UserApi(basePath: kotlin.String = ApiClient.defaultBasePath, accessTo */ @Throws(IllegalStateException::class, IOException::class) fun logoutUserWithHttpInfo() : Future> { - val vertxClient = WebClient.create(vertx) - val request = vertxClient.requestAbs(HttpMethod.GET, UriTemplate.of("$basePath/user/logout")) + val localVariableClient = WebClient.create(this.vertx) + val localVariableRequest = localVariableClient.requestAbs(HttpMethod.GET, UriTemplate.of("${this.basePath}/user/logout")) @@ -501,19 +501,19 @@ open class UserApi(basePath: kotlin.String = ApiClient.defaultBasePath, accessTo - if (apiKey["api_key"] != null) { - if (apiKeyPrefix["api_key"] != null) { - request.putHeader("api_key", apiKeyPrefix["api_key"]!! + " " + apiKey["api_key"]!!) + if (this.apiKey["api_key"] != null) { + if (this.apiKeyPrefix["api_key"] != null) { + localVariableRequest.putHeader("api_key", this.apiKeyPrefix["api_key"]!! + " " + this.apiKey["api_key"]!!) } else { - request.putHeader("api_key", apiKey["api_key"]!!) + localVariableRequest.putHeader("api_key", this.apiKey["api_key"]!!) } } - return request + return localVariableRequest .send() .map { - val apiResponse: ApiResponse = handleResponse(it) - apiResponse + val localVariableApiResponse: ApiResponse = this.handleResponse(it) + localVariableApiResponse } } @@ -532,18 +532,18 @@ open class UserApi(basePath: kotlin.String = ApiClient.defaultBasePath, accessTo */ @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun updateUser(username: kotlin.String, user: User) : Future { - return updateUserWithHttpInfo(username = username, user = user).map { localVarResponse -> - when (localVarResponse.responseType) { + return updateUserWithHttpInfo(username = username, user = user).map { localVariableResponse -> + when (localVariableResponse.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) + val localVariableError = localVariableResponse as ClientError<*> + throw ClientException("Client error : ${localVariableError.statusCode} ${localVariableError.message.orEmpty()}", localVariableError.statusCode, localVariableResponse) } ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) + val localVariableError = localVariableResponse as ServerError<*> + throw ServerException("Server error : ${localVariableError.statusCode} ${localVariableError.message.orEmpty()}", localVariableError.statusCode, localVariableResponse) } } } @@ -561,31 +561,31 @@ open class UserApi(basePath: kotlin.String = ApiClient.defaultBasePath, accessTo */ @Throws(IllegalStateException::class, IOException::class) fun updateUserWithHttpInfo(username: kotlin.String, user: User) : Future> { - val vertxClient = WebClient.create(vertx) - val request = vertxClient.requestAbs(HttpMethod.PUT, UriTemplate.of("$basePath/user/{username}".replace("{"+"username"+"}", encodeURIComponent(username.toString())))) + val localVariableClient = WebClient.create(this.vertx) + val localVariableRequest = localVariableClient.requestAbs(HttpMethod.PUT, UriTemplate.of("${this.basePath}/user/{username}".replace("{"+"username"+"}", this.encodeURIComponent(username.toString())))) - request.putHeader("Content-Type", "application/json") + localVariableRequest.putHeader("Content-Type", "application/json") - if (apiKey["api_key"] != null) { - if (apiKeyPrefix["api_key"] != null) { - request.putHeader("api_key", apiKeyPrefix["api_key"]!! + " " + apiKey["api_key"]!!) + if (this.apiKey["api_key"] != null) { + if (this.apiKeyPrefix["api_key"] != null) { + localVariableRequest.putHeader("api_key", this.apiKeyPrefix["api_key"]!! + " " + this.apiKey["api_key"]!!) } else { - request.putHeader("api_key", apiKey["api_key"]!!) + localVariableRequest.putHeader("api_key", this.apiKey["api_key"]!!) } } - return request - .sendBuffer(responseBody(user)) + return localVariableRequest + .sendBuffer(this.responseBody(user)) .map { - val apiResponse: ApiResponse = handleResponse(it) - apiResponse + val localVariableApiResponse: ApiResponse = this.handleResponse(it) + localVariableApiResponse } } diff --git a/samples/client/petstore/kotlin-jvm-vertx-moshi/src/main/kotlin/org/openapitools/client/apis/PetApi.kt b/samples/client/petstore/kotlin-jvm-vertx-moshi/src/main/kotlin/org/openapitools/client/apis/PetApi.kt index 594ef079252d..1014a512d606 100644 --- a/samples/client/petstore/kotlin-jvm-vertx-moshi/src/main/kotlin/org/openapitools/client/apis/PetApi.kt +++ b/samples/client/petstore/kotlin-jvm-vertx-moshi/src/main/kotlin/org/openapitools/client/apis/PetApi.kt @@ -58,18 +58,18 @@ open class PetApi(basePath: kotlin.String = ApiClient.defaultBasePath, accessTok @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun addPet(pet: Pet) : Future { - return addPetWithHttpInfo(pet = pet).map { localVarResponse -> - when (localVarResponse.responseType) { - ResponseType.Success -> (localVarResponse as Success<*>).data as Pet + return addPetWithHttpInfo(pet = pet).map { localVariableResponse -> + when (localVariableResponse.responseType) { + ResponseType.Success -> (localVariableResponse as Success<*>).data as Pet 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) + val localVariableError = localVariableResponse as ClientError<*> + throw ClientException("Client error : ${localVariableError.statusCode} ${localVariableError.message.orEmpty()}", localVariableError.statusCode, localVariableResponse) } ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) + val localVariableError = localVariableResponse as ServerError<*> + throw ServerException("Server error : ${localVariableError.statusCode} ${localVariableError.message.orEmpty()}", localVariableError.statusCode, localVariableResponse) } } } @@ -87,28 +87,28 @@ open class PetApi(basePath: kotlin.String = ApiClient.defaultBasePath, accessTok @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class) fun addPetWithHttpInfo(pet: Pet) : Future> { - val vertxClient = WebClient.create(vertx) - val request = vertxClient.requestAbs(HttpMethod.POST, UriTemplate.of("$basePath/pet")) + val localVariableClient = WebClient.create(this.vertx) + val localVariableRequest = localVariableClient.requestAbs(HttpMethod.POST, UriTemplate.of("${this.basePath}/pet")) - request.putHeader("Content-Type", "application/json") - request.putHeader("Content-Type", "application/xml") + localVariableRequest.putHeader("Content-Type", "application/json") + localVariableRequest.putHeader("Content-Type", "application/xml") - request.putHeader("Accept", "application/xml, application/json") + localVariableRequest.putHeader("Accept", "application/xml, application/json") - accessToken?.let { accessToken -> - request.bearerTokenAuthentication(accessToken) + this.accessToken?.let { accessToken -> + localVariableRequest.bearerTokenAuthentication(accessToken) } - return request - .sendBuffer(responseBody(pet)) + return localVariableRequest + .sendBuffer(this.responseBody(pet)) .map { - val apiResponse: ApiResponse = handleResponse(it) - apiResponse + val localVariableApiResponse: ApiResponse = this.handleResponse(it) + localVariableApiResponse } } @@ -127,18 +127,18 @@ open class PetApi(basePath: kotlin.String = ApiClient.defaultBasePath, accessTok */ @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun deletePet(petId: kotlin.Long, apiKey: kotlin.String? = null) : Future { - return deletePetWithHttpInfo(petId = petId, apiKey = apiKey).map { localVarResponse -> - when (localVarResponse.responseType) { + return deletePetWithHttpInfo(petId = petId, apiKey = apiKey).map { localVariableResponse -> + when (localVariableResponse.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) + val localVariableError = localVariableResponse as ClientError<*> + throw ClientException("Client error : ${localVariableError.statusCode} ${localVariableError.message.orEmpty()}", localVariableError.statusCode, localVariableResponse) } ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) + val localVariableError = localVariableResponse as ServerError<*> + throw ServerException("Server error : ${localVariableError.statusCode} ${localVariableError.message.orEmpty()}", localVariableError.statusCode, localVariableResponse) } } } @@ -156,25 +156,25 @@ open class PetApi(basePath: kotlin.String = ApiClient.defaultBasePath, accessTok */ @Throws(IllegalStateException::class, IOException::class) fun deletePetWithHttpInfo(petId: kotlin.Long, apiKey: kotlin.String?) : Future> { - val vertxClient = WebClient.create(vertx) - val request = vertxClient.requestAbs(HttpMethod.DELETE, UriTemplate.of("$basePath/pet/{petId}".replace("{"+"petId"+"}", encodeURIComponent(petId.toString())))) + val localVariableClient = WebClient.create(this.vertx) + val localVariableRequest = localVariableClient.requestAbs(HttpMethod.DELETE, UriTemplate.of("${this.basePath}/pet/{petId}".replace("{"+"petId"+"}", this.encodeURIComponent(petId.toString())))) - apiKey?.apply { request.putHeader("api_key", this.toString())} + apiKey?.apply { localVariableRequest.putHeader("api_key", this.toString())} - accessToken?.let { accessToken -> - request.bearerTokenAuthentication(accessToken) + this.accessToken?.let { accessToken -> + localVariableRequest.bearerTokenAuthentication(accessToken) } - return request + return localVariableRequest .send() .map { - val apiResponse: ApiResponse = handleResponse(it) - apiResponse + val localVariableApiResponse: ApiResponse = this.handleResponse(it) + localVariableApiResponse } } @@ -202,18 +202,18 @@ open class PetApi(basePath: kotlin.String = ApiClient.defaultBasePath, accessTok @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun findPetsByStatus(status: kotlin.collections.List) : Future> { - return findPetsByStatusWithHttpInfo(status = status).map { localVarResponse -> - when (localVarResponse.responseType) { - ResponseType.Success -> (localVarResponse as Success<*>).data as kotlin.collections.List + return findPetsByStatusWithHttpInfo(status = status).map { localVariableResponse -> + when (localVariableResponse.responseType) { + ResponseType.Success -> (localVariableResponse as Success<*>).data as kotlin.collections.List 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) + val localVariableError = localVariableResponse as ClientError<*> + throw ClientException("Client error : ${localVariableError.statusCode} ${localVariableError.message.orEmpty()}", localVariableError.statusCode, localVariableResponse) } ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) + val localVariableError = localVariableResponse as ServerError<*> + throw ServerException("Server error : ${localVariableError.statusCode} ${localVariableError.message.orEmpty()}", localVariableError.statusCode, localVariableResponse) } } } @@ -231,26 +231,26 @@ open class PetApi(basePath: kotlin.String = ApiClient.defaultBasePath, accessTok @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class) fun findPetsByStatusWithHttpInfo(status: kotlin.collections.List) : Future?>> { - val vertxClient = WebClient.create(vertx) - val request = vertxClient.requestAbs(HttpMethod.GET, UriTemplate.of("$basePath/pet/findByStatus")) + val localVariableClient = WebClient.create(this.vertx) + val localVariableRequest = localVariableClient.requestAbs(HttpMethod.GET, UriTemplate.of("${this.basePath}/pet/findByStatus")) - request.putHeader("Accept", "application/xml, application/json") + localVariableRequest.putHeader("Accept", "application/xml, application/json") - status.let { request.queryParams().add("status", toMultiValue(it.toList(), "csv")) } + status.let { localVariableRequest.queryParams().add("status", toMultiValue(it.toList(), "csv")) } - accessToken?.let { accessToken -> - request.bearerTokenAuthentication(accessToken) + this.accessToken?.let { accessToken -> + localVariableRequest.bearerTokenAuthentication(accessToken) } - return request + return localVariableRequest .send() .map { - val apiResponse: ApiResponse?> = handleResponse(it) - apiResponse + val localVariableApiResponse: ApiResponse?> = this.handleResponse(it) + localVariableApiResponse } } @@ -270,18 +270,18 @@ open class PetApi(basePath: kotlin.String = ApiClient.defaultBasePath, accessTok @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) @Deprecated(message = "This operation is deprecated.") fun findPetsByTags(tags: kotlin.collections.List) : Future> { - return findPetsByTagsWithHttpInfo(tags = tags).map { localVarResponse -> - when (localVarResponse.responseType) { - ResponseType.Success -> (localVarResponse as Success<*>).data as kotlin.collections.List + return findPetsByTagsWithHttpInfo(tags = tags).map { localVariableResponse -> + when (localVariableResponse.responseType) { + ResponseType.Success -> (localVariableResponse as Success<*>).data as kotlin.collections.List 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) + val localVariableError = localVariableResponse as ClientError<*> + throw ClientException("Client error : ${localVariableError.statusCode} ${localVariableError.message.orEmpty()}", localVariableError.statusCode, localVariableResponse) } ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) + val localVariableError = localVariableResponse as ServerError<*> + throw ServerException("Server error : ${localVariableError.statusCode} ${localVariableError.message.orEmpty()}", localVariableError.statusCode, localVariableResponse) } } } @@ -300,26 +300,26 @@ open class PetApi(basePath: kotlin.String = ApiClient.defaultBasePath, accessTok @Throws(IllegalStateException::class, IOException::class) @Deprecated(message = "This operation is deprecated.") fun findPetsByTagsWithHttpInfo(tags: kotlin.collections.List) : Future?>> { - val vertxClient = WebClient.create(vertx) - val request = vertxClient.requestAbs(HttpMethod.GET, UriTemplate.of("$basePath/pet/findByTags")) + val localVariableClient = WebClient.create(this.vertx) + val localVariableRequest = localVariableClient.requestAbs(HttpMethod.GET, UriTemplate.of("${this.basePath}/pet/findByTags")) - request.putHeader("Accept", "application/xml, application/json") + localVariableRequest.putHeader("Accept", "application/xml, application/json") - tags.let { request.queryParams().add("tags", toMultiValue(it.toList(), "csv")) } + tags.let { localVariableRequest.queryParams().add("tags", toMultiValue(it.toList(), "csv")) } - accessToken?.let { accessToken -> - request.bearerTokenAuthentication(accessToken) + this.accessToken?.let { accessToken -> + localVariableRequest.bearerTokenAuthentication(accessToken) } - return request + return localVariableRequest .send() .map { - val apiResponse: ApiResponse?> = handleResponse(it) - apiResponse + val localVariableApiResponse: ApiResponse?> = this.handleResponse(it) + localVariableApiResponse } } @@ -338,18 +338,18 @@ open class PetApi(basePath: kotlin.String = ApiClient.defaultBasePath, accessTok @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun getPetById(petId: kotlin.Long) : Future { - return getPetByIdWithHttpInfo(petId = petId).map { localVarResponse -> - when (localVarResponse.responseType) { - ResponseType.Success -> (localVarResponse as Success<*>).data as Pet + return getPetByIdWithHttpInfo(petId = petId).map { localVariableResponse -> + when (localVariableResponse.responseType) { + ResponseType.Success -> (localVariableResponse as Success<*>).data as Pet 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) + val localVariableError = localVariableResponse as ClientError<*> + throw ClientException("Client error : ${localVariableError.statusCode} ${localVariableError.message.orEmpty()}", localVariableError.statusCode, localVariableResponse) } ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) + val localVariableError = localVariableResponse as ServerError<*> + throw ServerException("Server error : ${localVariableError.statusCode} ${localVariableError.message.orEmpty()}", localVariableError.statusCode, localVariableResponse) } } } @@ -367,29 +367,29 @@ open class PetApi(basePath: kotlin.String = ApiClient.defaultBasePath, accessTok @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class) fun getPetByIdWithHttpInfo(petId: kotlin.Long) : Future> { - val vertxClient = WebClient.create(vertx) - val request = vertxClient.requestAbs(HttpMethod.GET, UriTemplate.of("$basePath/pet/{petId}".replace("{"+"petId"+"}", encodeURIComponent(petId.toString())))) + val localVariableClient = WebClient.create(this.vertx) + val localVariableRequest = localVariableClient.requestAbs(HttpMethod.GET, UriTemplate.of("${this.basePath}/pet/{petId}".replace("{"+"petId"+"}", this.encodeURIComponent(petId.toString())))) - request.putHeader("Accept", "application/xml, application/json") + localVariableRequest.putHeader("Accept", "application/xml, application/json") - if (apiKey["api_key"] != null) { - if (apiKeyPrefix["api_key"] != null) { - request.putHeader("api_key", apiKeyPrefix["api_key"]!! + " " + apiKey["api_key"]!!) + if (this.apiKey["api_key"] != null) { + if (this.apiKeyPrefix["api_key"] != null) { + localVariableRequest.putHeader("api_key", this.apiKeyPrefix["api_key"]!! + " " + this.apiKey["api_key"]!!) } else { - request.putHeader("api_key", apiKey["api_key"]!!) + localVariableRequest.putHeader("api_key", this.apiKey["api_key"]!!) } } - return request + return localVariableRequest .send() .map { - val apiResponse: ApiResponse = handleResponse(it) - apiResponse + val localVariableApiResponse: ApiResponse = this.handleResponse(it) + localVariableApiResponse } } @@ -408,18 +408,18 @@ open class PetApi(basePath: kotlin.String = ApiClient.defaultBasePath, accessTok @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun updatePet(pet: Pet) : Future { - return updatePetWithHttpInfo(pet = pet).map { localVarResponse -> - when (localVarResponse.responseType) { - ResponseType.Success -> (localVarResponse as Success<*>).data as Pet + return updatePetWithHttpInfo(pet = pet).map { localVariableResponse -> + when (localVariableResponse.responseType) { + ResponseType.Success -> (localVariableResponse as Success<*>).data as Pet 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) + val localVariableError = localVariableResponse as ClientError<*> + throw ClientException("Client error : ${localVariableError.statusCode} ${localVariableError.message.orEmpty()}", localVariableError.statusCode, localVariableResponse) } ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) + val localVariableError = localVariableResponse as ServerError<*> + throw ServerException("Server error : ${localVariableError.statusCode} ${localVariableError.message.orEmpty()}", localVariableError.statusCode, localVariableResponse) } } } @@ -437,28 +437,28 @@ open class PetApi(basePath: kotlin.String = ApiClient.defaultBasePath, accessTok @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class) fun updatePetWithHttpInfo(pet: Pet) : Future> { - val vertxClient = WebClient.create(vertx) - val request = vertxClient.requestAbs(HttpMethod.PUT, UriTemplate.of("$basePath/pet")) + val localVariableClient = WebClient.create(this.vertx) + val localVariableRequest = localVariableClient.requestAbs(HttpMethod.PUT, UriTemplate.of("${this.basePath}/pet")) - request.putHeader("Content-Type", "application/json") - request.putHeader("Content-Type", "application/xml") + localVariableRequest.putHeader("Content-Type", "application/json") + localVariableRequest.putHeader("Content-Type", "application/xml") - request.putHeader("Accept", "application/xml, application/json") + localVariableRequest.putHeader("Accept", "application/xml, application/json") - accessToken?.let { accessToken -> - request.bearerTokenAuthentication(accessToken) + this.accessToken?.let { accessToken -> + localVariableRequest.bearerTokenAuthentication(accessToken) } - return request - .sendBuffer(responseBody(pet)) + return localVariableRequest + .sendBuffer(this.responseBody(pet)) .map { - val apiResponse: ApiResponse = handleResponse(it) - apiResponse + val localVariableApiResponse: ApiResponse = this.handleResponse(it) + localVariableApiResponse } } @@ -478,18 +478,18 @@ open class PetApi(basePath: kotlin.String = ApiClient.defaultBasePath, accessTok */ @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun updatePetWithForm(petId: kotlin.Long, name: kotlin.String? = null, status: kotlin.String? = null) : Future { - return updatePetWithFormWithHttpInfo(petId = petId, name = name, status = status).map { localVarResponse -> - when (localVarResponse.responseType) { + return updatePetWithFormWithHttpInfo(petId = petId, name = name, status = status).map { localVariableResponse -> + when (localVariableResponse.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) + val localVariableError = localVariableResponse as ClientError<*> + throw ClientException("Client error : ${localVariableError.statusCode} ${localVariableError.message.orEmpty()}", localVariableError.statusCode, localVariableResponse) } ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) + val localVariableError = localVariableResponse as ServerError<*> + throw ServerException("Server error : ${localVariableError.statusCode} ${localVariableError.message.orEmpty()}", localVariableError.statusCode, localVariableResponse) } } } @@ -508,28 +508,28 @@ open class PetApi(basePath: kotlin.String = ApiClient.defaultBasePath, accessTok */ @Throws(IllegalStateException::class, IOException::class) fun updatePetWithFormWithHttpInfo(petId: kotlin.Long, name: kotlin.String?, status: kotlin.String?) : Future> { - val vertxClient = WebClient.create(vertx) - val request = vertxClient.requestAbs(HttpMethod.POST, UriTemplate.of("$basePath/pet/{petId}".replace("{"+"petId"+"}", encodeURIComponent(petId.toString())))) + val localVariableClient = WebClient.create(this.vertx) + val localVariableRequest = localVariableClient.requestAbs(HttpMethod.POST, UriTemplate.of("${this.basePath}/pet/{petId}".replace("{"+"petId"+"}", this.encodeURIComponent(petId.toString())))) - request.putHeader("Content-Type", "application/x-www-form-urlencoded") + localVariableRequest.putHeader("Content-Type", "application/x-www-form-urlencoded") - val form = io.vertx.core.MultiMap.caseInsensitiveMultiMap(); - name?.let { form.add("name", name) } - status?.let { form.add("status", status) } + val localVariableForm = io.vertx.core.MultiMap.caseInsensitiveMultiMap(); + name?.let { localVariableForm.add("name", name) } + status?.let { localVariableForm.add("status", status) } - accessToken?.let { accessToken -> - request.bearerTokenAuthentication(accessToken) + this.accessToken?.let { accessToken -> + localVariableRequest.bearerTokenAuthentication(accessToken) } - return request + return localVariableRequest .send() .map { - val apiResponse: ApiResponse = handleResponse(it) - apiResponse + val localVariableApiResponse: ApiResponse = this.handleResponse(it) + localVariableApiResponse } } @@ -550,18 +550,18 @@ open class PetApi(basePath: kotlin.String = ApiClient.defaultBasePath, accessTok @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) : Future { - return uploadFileWithHttpInfo(petId = petId, additionalMetadata = additionalMetadata, file = file).map { localVarResponse -> - when (localVarResponse.responseType) { - ResponseType.Success -> (localVarResponse as Success<*>).data as ModelApiResponse + return uploadFileWithHttpInfo(petId = petId, additionalMetadata = additionalMetadata, file = file).map { localVariableResponse -> + when (localVariableResponse.responseType) { + ResponseType.Success -> (localVariableResponse 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 -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) + val localVariableError = localVariableResponse as ClientError<*> + throw ClientException("Client error : ${localVariableError.statusCode} ${localVariableError.message.orEmpty()}", localVariableError.statusCode, localVariableResponse) } ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) + val localVariableError = localVariableResponse as ServerError<*> + throw ServerException("Server error : ${localVariableError.statusCode} ${localVariableError.message.orEmpty()}", localVariableError.statusCode, localVariableResponse) } } } @@ -581,28 +581,28 @@ open class PetApi(basePath: kotlin.String = ApiClient.defaultBasePath, accessTok @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class) fun uploadFileWithHttpInfo(petId: kotlin.Long, additionalMetadata: kotlin.String?, file: java.io.File?) : Future> { - val vertxClient = WebClient.create(vertx) - val request = vertxClient.requestAbs(HttpMethod.POST, UriTemplate.of("$basePath/pet/{petId}/uploadImage".replace("{"+"petId"+"}", encodeURIComponent(petId.toString())))) + val localVariableClient = WebClient.create(this.vertx) + val localVariableRequest = localVariableClient.requestAbs(HttpMethod.POST, UriTemplate.of("${this.basePath}/pet/{petId}/uploadImage".replace("{"+"petId"+"}", this.encodeURIComponent(petId.toString())))) - request.putHeader("Content-Type", "multipart/form-data") + localVariableRequest.putHeader("Content-Type", "multipart/form-data") - request.putHeader("Accept", "application/json") + localVariableRequest.putHeader("Accept", "application/json") - val form = io.vertx.core.MultiMap.caseInsensitiveMultiMap(); - additionalMetadata?.let { form.add("additionalMetadata", additionalMetadata) } - file?.let { form.add("file", file.toString()) } + val localVariableForm = io.vertx.core.MultiMap.caseInsensitiveMultiMap(); + additionalMetadata?.let { localVariableForm.add("additionalMetadata", additionalMetadata) } + file?.let { localVariableForm.add("file", file.toString()) } - accessToken?.let { accessToken -> - request.bearerTokenAuthentication(accessToken) + this.accessToken?.let { accessToken -> + localVariableRequest.bearerTokenAuthentication(accessToken) } - return request + return localVariableRequest .send() .map { - val apiResponse: ApiResponse = handleResponse(it) - apiResponse + val localVariableApiResponse: ApiResponse = this.handleResponse(it) + localVariableApiResponse } } diff --git a/samples/client/petstore/kotlin-jvm-vertx-moshi/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt b/samples/client/petstore/kotlin-jvm-vertx-moshi/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt index 6ad8031b4870..54b1fd11f557 100644 --- a/samples/client/petstore/kotlin-jvm-vertx-moshi/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt +++ b/samples/client/petstore/kotlin-jvm-vertx-moshi/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt @@ -56,18 +56,18 @@ open class StoreApi(basePath: kotlin.String = ApiClient.defaultBasePath, accessT */ @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun deleteOrder(orderId: kotlin.String) : Future { - return deleteOrderWithHttpInfo(orderId = orderId).map { localVarResponse -> - when (localVarResponse.responseType) { + return deleteOrderWithHttpInfo(orderId = orderId).map { localVariableResponse -> + when (localVariableResponse.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) + val localVariableError = localVariableResponse as ClientError<*> + throw ClientException("Client error : ${localVariableError.statusCode} ${localVariableError.message.orEmpty()}", localVariableError.statusCode, localVariableResponse) } ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) + val localVariableError = localVariableResponse as ServerError<*> + throw ServerException("Server error : ${localVariableError.statusCode} ${localVariableError.message.orEmpty()}", localVariableError.statusCode, localVariableResponse) } } } @@ -84,8 +84,8 @@ open class StoreApi(basePath: kotlin.String = ApiClient.defaultBasePath, accessT */ @Throws(IllegalStateException::class, IOException::class) fun deleteOrderWithHttpInfo(orderId: kotlin.String) : Future> { - val vertxClient = WebClient.create(vertx) - val request = vertxClient.requestAbs(HttpMethod.DELETE, UriTemplate.of("$basePath/store/order/{orderId}".replace("{"+"orderId"+"}", encodeURIComponent(orderId.toString())))) + val localVariableClient = WebClient.create(this.vertx) + val localVariableRequest = localVariableClient.requestAbs(HttpMethod.DELETE, UriTemplate.of("${this.basePath}/store/order/{orderId}".replace("{"+"orderId"+"}", this.encodeURIComponent(orderId.toString())))) @@ -95,11 +95,11 @@ open class StoreApi(basePath: kotlin.String = ApiClient.defaultBasePath, accessT - return request + return localVariableRequest .send() .map { - val apiResponse: ApiResponse = handleResponse(it) - apiResponse + val localVariableApiResponse: ApiResponse = this.handleResponse(it) + localVariableApiResponse } } @@ -117,18 +117,18 @@ open class StoreApi(basePath: kotlin.String = ApiClient.defaultBasePath, accessT @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun getInventory() : Future> { - return getInventoryWithHttpInfo().map { localVarResponse -> - when (localVarResponse.responseType) { - ResponseType.Success -> (localVarResponse as Success<*>).data as kotlin.collections.Map + return getInventoryWithHttpInfo().map { localVariableResponse -> + when (localVariableResponse.responseType) { + ResponseType.Success -> (localVariableResponse as Success<*>).data as kotlin.collections.Map 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) + val localVariableError = localVariableResponse as ClientError<*> + throw ClientException("Client error : ${localVariableError.statusCode} ${localVariableError.message.orEmpty()}", localVariableError.statusCode, localVariableResponse) } ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) + val localVariableError = localVariableResponse as ServerError<*> + throw ServerException("Server error : ${localVariableError.statusCode} ${localVariableError.message.orEmpty()}", localVariableError.statusCode, localVariableResponse) } } } @@ -145,29 +145,29 @@ open class StoreApi(basePath: kotlin.String = ApiClient.defaultBasePath, accessT @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class) fun getInventoryWithHttpInfo() : Future?>> { - val vertxClient = WebClient.create(vertx) - val request = vertxClient.requestAbs(HttpMethod.GET, UriTemplate.of("$basePath/store/inventory")) + val localVariableClient = WebClient.create(this.vertx) + val localVariableRequest = localVariableClient.requestAbs(HttpMethod.GET, UriTemplate.of("${this.basePath}/store/inventory")) - request.putHeader("Accept", "application/json") + localVariableRequest.putHeader("Accept", "application/json") - if (apiKey["api_key"] != null) { - if (apiKeyPrefix["api_key"] != null) { - request.putHeader("api_key", apiKeyPrefix["api_key"]!! + " " + apiKey["api_key"]!!) + if (this.apiKey["api_key"] != null) { + if (this.apiKeyPrefix["api_key"] != null) { + localVariableRequest.putHeader("api_key", this.apiKeyPrefix["api_key"]!! + " " + this.apiKey["api_key"]!!) } else { - request.putHeader("api_key", apiKey["api_key"]!!) + localVariableRequest.putHeader("api_key", this.apiKey["api_key"]!!) } } - return request + return localVariableRequest .send() .map { - val apiResponse: ApiResponse?> = handleResponse(it) - apiResponse + val localVariableApiResponse: ApiResponse?> = this.handleResponse(it) + localVariableApiResponse } } @@ -186,18 +186,18 @@ open class StoreApi(basePath: kotlin.String = ApiClient.defaultBasePath, accessT @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun getOrderById(orderId: kotlin.Long) : Future { - return getOrderByIdWithHttpInfo(orderId = orderId).map { localVarResponse -> - when (localVarResponse.responseType) { - ResponseType.Success -> (localVarResponse as Success<*>).data as Order + return getOrderByIdWithHttpInfo(orderId = orderId).map { localVariableResponse -> + when (localVariableResponse.responseType) { + ResponseType.Success -> (localVariableResponse as Success<*>).data as Order 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) + val localVariableError = localVariableResponse as ClientError<*> + throw ClientException("Client error : ${localVariableError.statusCode} ${localVariableError.message.orEmpty()}", localVariableError.statusCode, localVariableResponse) } ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) + val localVariableError = localVariableResponse as ServerError<*> + throw ServerException("Server error : ${localVariableError.statusCode} ${localVariableError.message.orEmpty()}", localVariableError.statusCode, localVariableResponse) } } } @@ -215,22 +215,22 @@ open class StoreApi(basePath: kotlin.String = ApiClient.defaultBasePath, accessT @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class) fun getOrderByIdWithHttpInfo(orderId: kotlin.Long) : Future> { - val vertxClient = WebClient.create(vertx) - val request = vertxClient.requestAbs(HttpMethod.GET, UriTemplate.of("$basePath/store/order/{orderId}".replace("{"+"orderId"+"}", encodeURIComponent(orderId.toString())))) + val localVariableClient = WebClient.create(this.vertx) + val localVariableRequest = localVariableClient.requestAbs(HttpMethod.GET, UriTemplate.of("${this.basePath}/store/order/{orderId}".replace("{"+"orderId"+"}", this.encodeURIComponent(orderId.toString())))) - request.putHeader("Accept", "application/xml, application/json") + localVariableRequest.putHeader("Accept", "application/xml, application/json") - return request + return localVariableRequest .send() .map { - val apiResponse: ApiResponse = handleResponse(it) - apiResponse + val localVariableApiResponse: ApiResponse = this.handleResponse(it) + localVariableApiResponse } } @@ -249,18 +249,18 @@ open class StoreApi(basePath: kotlin.String = ApiClient.defaultBasePath, accessT @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun placeOrder(order: Order) : Future { - return placeOrderWithHttpInfo(order = order).map { localVarResponse -> - when (localVarResponse.responseType) { - ResponseType.Success -> (localVarResponse as Success<*>).data as Order + return placeOrderWithHttpInfo(order = order).map { localVariableResponse -> + when (localVariableResponse.responseType) { + ResponseType.Success -> (localVariableResponse as Success<*>).data as Order 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) + val localVariableError = localVariableResponse as ClientError<*> + throw ClientException("Client error : ${localVariableError.statusCode} ${localVariableError.message.orEmpty()}", localVariableError.statusCode, localVariableResponse) } ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) + val localVariableError = localVariableResponse as ServerError<*> + throw ServerException("Server error : ${localVariableError.statusCode} ${localVariableError.message.orEmpty()}", localVariableError.statusCode, localVariableResponse) } } } @@ -278,24 +278,24 @@ open class StoreApi(basePath: kotlin.String = ApiClient.defaultBasePath, accessT @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class) fun placeOrderWithHttpInfo(order: Order) : Future> { - val vertxClient = WebClient.create(vertx) - val request = vertxClient.requestAbs(HttpMethod.POST, UriTemplate.of("$basePath/store/order")) + val localVariableClient = WebClient.create(this.vertx) + val localVariableRequest = localVariableClient.requestAbs(HttpMethod.POST, UriTemplate.of("${this.basePath}/store/order")) - request.putHeader("Content-Type", "application/json") + localVariableRequest.putHeader("Content-Type", "application/json") - request.putHeader("Accept", "application/xml, application/json") + localVariableRequest.putHeader("Accept", "application/xml, application/json") - return request - .sendBuffer(responseBody(order)) + return localVariableRequest + .sendBuffer(this.responseBody(order)) .map { - val apiResponse: ApiResponse = handleResponse(it) - apiResponse + val localVariableApiResponse: ApiResponse = this.handleResponse(it) + localVariableApiResponse } } diff --git a/samples/client/petstore/kotlin-jvm-vertx-moshi/src/main/kotlin/org/openapitools/client/apis/UserApi.kt b/samples/client/petstore/kotlin-jvm-vertx-moshi/src/main/kotlin/org/openapitools/client/apis/UserApi.kt index 1ef61610a54e..836dfd73ecbc 100644 --- a/samples/client/petstore/kotlin-jvm-vertx-moshi/src/main/kotlin/org/openapitools/client/apis/UserApi.kt +++ b/samples/client/petstore/kotlin-jvm-vertx-moshi/src/main/kotlin/org/openapitools/client/apis/UserApi.kt @@ -56,18 +56,18 @@ open class UserApi(basePath: kotlin.String = ApiClient.defaultBasePath, accessTo */ @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun createUser(user: User) : Future { - return createUserWithHttpInfo(user = user).map { localVarResponse -> - when (localVarResponse.responseType) { + return createUserWithHttpInfo(user = user).map { localVariableResponse -> + when (localVariableResponse.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) + val localVariableError = localVariableResponse as ClientError<*> + throw ClientException("Client error : ${localVariableError.statusCode} ${localVariableError.message.orEmpty()}", localVariableError.statusCode, localVariableResponse) } ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) + val localVariableError = localVariableResponse as ServerError<*> + throw ServerException("Server error : ${localVariableError.statusCode} ${localVariableError.message.orEmpty()}", localVariableError.statusCode, localVariableResponse) } } } @@ -84,31 +84,31 @@ open class UserApi(basePath: kotlin.String = ApiClient.defaultBasePath, accessTo */ @Throws(IllegalStateException::class, IOException::class) fun createUserWithHttpInfo(user: User) : Future> { - val vertxClient = WebClient.create(vertx) - val request = vertxClient.requestAbs(HttpMethod.POST, UriTemplate.of("$basePath/user")) + val localVariableClient = WebClient.create(this.vertx) + val localVariableRequest = localVariableClient.requestAbs(HttpMethod.POST, UriTemplate.of("${this.basePath}/user")) - request.putHeader("Content-Type", "application/json") + localVariableRequest.putHeader("Content-Type", "application/json") - if (apiKey["api_key"] != null) { - if (apiKeyPrefix["api_key"] != null) { - request.putHeader("api_key", apiKeyPrefix["api_key"]!! + " " + apiKey["api_key"]!!) + if (this.apiKey["api_key"] != null) { + if (this.apiKeyPrefix["api_key"] != null) { + localVariableRequest.putHeader("api_key", this.apiKeyPrefix["api_key"]!! + " " + this.apiKey["api_key"]!!) } else { - request.putHeader("api_key", apiKey["api_key"]!!) + localVariableRequest.putHeader("api_key", this.apiKey["api_key"]!!) } } - return request - .sendBuffer(responseBody(user)) + return localVariableRequest + .sendBuffer(this.responseBody(user)) .map { - val apiResponse: ApiResponse = handleResponse(it) - apiResponse + val localVariableApiResponse: ApiResponse = this.handleResponse(it) + localVariableApiResponse } } @@ -126,18 +126,18 @@ open class UserApi(basePath: kotlin.String = ApiClient.defaultBasePath, accessTo */ @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun createUsersWithArrayInput(user: kotlin.collections.List) : Future { - return createUsersWithArrayInputWithHttpInfo(user = user).map { localVarResponse -> - when (localVarResponse.responseType) { + return createUsersWithArrayInputWithHttpInfo(user = user).map { localVariableResponse -> + when (localVariableResponse.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) + val localVariableError = localVariableResponse as ClientError<*> + throw ClientException("Client error : ${localVariableError.statusCode} ${localVariableError.message.orEmpty()}", localVariableError.statusCode, localVariableResponse) } ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) + val localVariableError = localVariableResponse as ServerError<*> + throw ServerException("Server error : ${localVariableError.statusCode} ${localVariableError.message.orEmpty()}", localVariableError.statusCode, localVariableResponse) } } } @@ -154,31 +154,31 @@ open class UserApi(basePath: kotlin.String = ApiClient.defaultBasePath, accessTo */ @Throws(IllegalStateException::class, IOException::class) fun createUsersWithArrayInputWithHttpInfo(user: kotlin.collections.List) : Future> { - val vertxClient = WebClient.create(vertx) - val request = vertxClient.requestAbs(HttpMethod.POST, UriTemplate.of("$basePath/user/createWithArray")) + val localVariableClient = WebClient.create(this.vertx) + val localVariableRequest = localVariableClient.requestAbs(HttpMethod.POST, UriTemplate.of("${this.basePath}/user/createWithArray")) - request.putHeader("Content-Type", "application/json") + localVariableRequest.putHeader("Content-Type", "application/json") - if (apiKey["api_key"] != null) { - if (apiKeyPrefix["api_key"] != null) { - request.putHeader("api_key", apiKeyPrefix["api_key"]!! + " " + apiKey["api_key"]!!) + if (this.apiKey["api_key"] != null) { + if (this.apiKeyPrefix["api_key"] != null) { + localVariableRequest.putHeader("api_key", this.apiKeyPrefix["api_key"]!! + " " + this.apiKey["api_key"]!!) } else { - request.putHeader("api_key", apiKey["api_key"]!!) + localVariableRequest.putHeader("api_key", this.apiKey["api_key"]!!) } } - return request - .sendBuffer(responseBody(user)) + return localVariableRequest + .sendBuffer(this.responseBody(user)) .map { - val apiResponse: ApiResponse = handleResponse(it) - apiResponse + val localVariableApiResponse: ApiResponse = this.handleResponse(it) + localVariableApiResponse } } @@ -196,18 +196,18 @@ open class UserApi(basePath: kotlin.String = ApiClient.defaultBasePath, accessTo */ @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun createUsersWithListInput(user: kotlin.collections.List) : Future { - return createUsersWithListInputWithHttpInfo(user = user).map { localVarResponse -> - when (localVarResponse.responseType) { + return createUsersWithListInputWithHttpInfo(user = user).map { localVariableResponse -> + when (localVariableResponse.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) + val localVariableError = localVariableResponse as ClientError<*> + throw ClientException("Client error : ${localVariableError.statusCode} ${localVariableError.message.orEmpty()}", localVariableError.statusCode, localVariableResponse) } ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) + val localVariableError = localVariableResponse as ServerError<*> + throw ServerException("Server error : ${localVariableError.statusCode} ${localVariableError.message.orEmpty()}", localVariableError.statusCode, localVariableResponse) } } } @@ -224,31 +224,31 @@ open class UserApi(basePath: kotlin.String = ApiClient.defaultBasePath, accessTo */ @Throws(IllegalStateException::class, IOException::class) fun createUsersWithListInputWithHttpInfo(user: kotlin.collections.List) : Future> { - val vertxClient = WebClient.create(vertx) - val request = vertxClient.requestAbs(HttpMethod.POST, UriTemplate.of("$basePath/user/createWithList")) + val localVariableClient = WebClient.create(this.vertx) + val localVariableRequest = localVariableClient.requestAbs(HttpMethod.POST, UriTemplate.of("${this.basePath}/user/createWithList")) - request.putHeader("Content-Type", "application/json") + localVariableRequest.putHeader("Content-Type", "application/json") - if (apiKey["api_key"] != null) { - if (apiKeyPrefix["api_key"] != null) { - request.putHeader("api_key", apiKeyPrefix["api_key"]!! + " " + apiKey["api_key"]!!) + if (this.apiKey["api_key"] != null) { + if (this.apiKeyPrefix["api_key"] != null) { + localVariableRequest.putHeader("api_key", this.apiKeyPrefix["api_key"]!! + " " + this.apiKey["api_key"]!!) } else { - request.putHeader("api_key", apiKey["api_key"]!!) + localVariableRequest.putHeader("api_key", this.apiKey["api_key"]!!) } } - return request - .sendBuffer(responseBody(user)) + return localVariableRequest + .sendBuffer(this.responseBody(user)) .map { - val apiResponse: ApiResponse = handleResponse(it) - apiResponse + val localVariableApiResponse: ApiResponse = this.handleResponse(it) + localVariableApiResponse } } @@ -266,18 +266,18 @@ open class UserApi(basePath: kotlin.String = ApiClient.defaultBasePath, accessTo */ @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun deleteUser(username: kotlin.String) : Future { - return deleteUserWithHttpInfo(username = username).map { localVarResponse -> - when (localVarResponse.responseType) { + return deleteUserWithHttpInfo(username = username).map { localVariableResponse -> + when (localVariableResponse.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) + val localVariableError = localVariableResponse as ClientError<*> + throw ClientException("Client error : ${localVariableError.statusCode} ${localVariableError.message.orEmpty()}", localVariableError.statusCode, localVariableResponse) } ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) + val localVariableError = localVariableResponse as ServerError<*> + throw ServerException("Server error : ${localVariableError.statusCode} ${localVariableError.message.orEmpty()}", localVariableError.statusCode, localVariableResponse) } } } @@ -294,8 +294,8 @@ open class UserApi(basePath: kotlin.String = ApiClient.defaultBasePath, accessTo */ @Throws(IllegalStateException::class, IOException::class) fun deleteUserWithHttpInfo(username: kotlin.String) : Future> { - val vertxClient = WebClient.create(vertx) - val request = vertxClient.requestAbs(HttpMethod.DELETE, UriTemplate.of("$basePath/user/{username}".replace("{"+"username"+"}", encodeURIComponent(username.toString())))) + val localVariableClient = WebClient.create(this.vertx) + val localVariableRequest = localVariableClient.requestAbs(HttpMethod.DELETE, UriTemplate.of("${this.basePath}/user/{username}".replace("{"+"username"+"}", this.encodeURIComponent(username.toString())))) @@ -304,19 +304,19 @@ open class UserApi(basePath: kotlin.String = ApiClient.defaultBasePath, accessTo - if (apiKey["api_key"] != null) { - if (apiKeyPrefix["api_key"] != null) { - request.putHeader("api_key", apiKeyPrefix["api_key"]!! + " " + apiKey["api_key"]!!) + if (this.apiKey["api_key"] != null) { + if (this.apiKeyPrefix["api_key"] != null) { + localVariableRequest.putHeader("api_key", this.apiKeyPrefix["api_key"]!! + " " + this.apiKey["api_key"]!!) } else { - request.putHeader("api_key", apiKey["api_key"]!!) + localVariableRequest.putHeader("api_key", this.apiKey["api_key"]!!) } } - return request + return localVariableRequest .send() .map { - val apiResponse: ApiResponse = handleResponse(it) - apiResponse + val localVariableApiResponse: ApiResponse = this.handleResponse(it) + localVariableApiResponse } } @@ -335,18 +335,18 @@ open class UserApi(basePath: kotlin.String = ApiClient.defaultBasePath, accessTo @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun getUserByName(username: kotlin.String) : Future { - return getUserByNameWithHttpInfo(username = username).map { localVarResponse -> - when (localVarResponse.responseType) { - ResponseType.Success -> (localVarResponse as Success<*>).data as User + return getUserByNameWithHttpInfo(username = username).map { localVariableResponse -> + when (localVariableResponse.responseType) { + ResponseType.Success -> (localVariableResponse as Success<*>).data as User 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) + val localVariableError = localVariableResponse as ClientError<*> + throw ClientException("Client error : ${localVariableError.statusCode} ${localVariableError.message.orEmpty()}", localVariableError.statusCode, localVariableResponse) } ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) + val localVariableError = localVariableResponse as ServerError<*> + throw ServerException("Server error : ${localVariableError.statusCode} ${localVariableError.message.orEmpty()}", localVariableError.statusCode, localVariableResponse) } } } @@ -364,22 +364,22 @@ open class UserApi(basePath: kotlin.String = ApiClient.defaultBasePath, accessTo @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class) fun getUserByNameWithHttpInfo(username: kotlin.String) : Future> { - val vertxClient = WebClient.create(vertx) - val request = vertxClient.requestAbs(HttpMethod.GET, UriTemplate.of("$basePath/user/{username}".replace("{"+"username"+"}", encodeURIComponent(username.toString())))) + val localVariableClient = WebClient.create(this.vertx) + val localVariableRequest = localVariableClient.requestAbs(HttpMethod.GET, UriTemplate.of("${this.basePath}/user/{username}".replace("{"+"username"+"}", this.encodeURIComponent(username.toString())))) - request.putHeader("Accept", "application/xml, application/json") + localVariableRequest.putHeader("Accept", "application/xml, application/json") - return request + return localVariableRequest .send() .map { - val apiResponse: ApiResponse = handleResponse(it) - apiResponse + val localVariableApiResponse: ApiResponse = this.handleResponse(it) + localVariableApiResponse } } @@ -399,18 +399,18 @@ open class UserApi(basePath: kotlin.String = ApiClient.defaultBasePath, accessTo @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun loginUser(username: kotlin.String, password: kotlin.String) : Future { - return loginUserWithHttpInfo(username = username, password = password).map { localVarResponse -> - when (localVarResponse.responseType) { - ResponseType.Success -> (localVarResponse as Success<*>).data as kotlin.String + return loginUserWithHttpInfo(username = username, password = password).map { localVariableResponse -> + when (localVariableResponse.responseType) { + ResponseType.Success -> (localVariableResponse 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) + val localVariableError = localVariableResponse as ClientError<*> + throw ClientException("Client error : ${localVariableError.statusCode} ${localVariableError.message.orEmpty()}", localVariableError.statusCode, localVariableResponse) } ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) + val localVariableError = localVariableResponse as ServerError<*> + throw ServerException("Server error : ${localVariableError.statusCode} ${localVariableError.message.orEmpty()}", localVariableError.statusCode, localVariableResponse) } } } @@ -429,24 +429,24 @@ open class UserApi(basePath: kotlin.String = ApiClient.defaultBasePath, accessTo @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class) fun loginUserWithHttpInfo(username: kotlin.String, password: kotlin.String) : Future> { - val vertxClient = WebClient.create(vertx) - val request = vertxClient.requestAbs(HttpMethod.GET, UriTemplate.of("$basePath/user/login")) + val localVariableClient = WebClient.create(this.vertx) + val localVariableRequest = localVariableClient.requestAbs(HttpMethod.GET, UriTemplate.of("${this.basePath}/user/login")) - request.putHeader("Accept", "application/xml, application/json") + localVariableRequest.putHeader("Accept", "application/xml, application/json") - username.let { request.queryParams().add("username", listOf(it.toString())) } - password.let { request.queryParams().add("password", listOf(it.toString())) } + username.let { localVariableRequest.queryParams().add("username", listOf(it.toString())) } + password.let { localVariableRequest.queryParams().add("password", listOf(it.toString())) } - return request + return localVariableRequest .send() .map { - val apiResponse: ApiResponse = handleResponse(it) - apiResponse + val localVariableApiResponse: ApiResponse = this.handleResponse(it) + localVariableApiResponse } } @@ -463,18 +463,18 @@ open class UserApi(basePath: kotlin.String = ApiClient.defaultBasePath, accessTo */ @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun logoutUser() : Future { - return logoutUserWithHttpInfo().map { localVarResponse -> - when (localVarResponse.responseType) { + return logoutUserWithHttpInfo().map { localVariableResponse -> + when (localVariableResponse.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) + val localVariableError = localVariableResponse as ClientError<*> + throw ClientException("Client error : ${localVariableError.statusCode} ${localVariableError.message.orEmpty()}", localVariableError.statusCode, localVariableResponse) } ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) + val localVariableError = localVariableResponse as ServerError<*> + throw ServerException("Server error : ${localVariableError.statusCode} ${localVariableError.message.orEmpty()}", localVariableError.statusCode, localVariableResponse) } } } @@ -490,8 +490,8 @@ open class UserApi(basePath: kotlin.String = ApiClient.defaultBasePath, accessTo */ @Throws(IllegalStateException::class, IOException::class) fun logoutUserWithHttpInfo() : Future> { - val vertxClient = WebClient.create(vertx) - val request = vertxClient.requestAbs(HttpMethod.GET, UriTemplate.of("$basePath/user/logout")) + val localVariableClient = WebClient.create(this.vertx) + val localVariableRequest = localVariableClient.requestAbs(HttpMethod.GET, UriTemplate.of("${this.basePath}/user/logout")) @@ -500,19 +500,19 @@ open class UserApi(basePath: kotlin.String = ApiClient.defaultBasePath, accessTo - if (apiKey["api_key"] != null) { - if (apiKeyPrefix["api_key"] != null) { - request.putHeader("api_key", apiKeyPrefix["api_key"]!! + " " + apiKey["api_key"]!!) + if (this.apiKey["api_key"] != null) { + if (this.apiKeyPrefix["api_key"] != null) { + localVariableRequest.putHeader("api_key", this.apiKeyPrefix["api_key"]!! + " " + this.apiKey["api_key"]!!) } else { - request.putHeader("api_key", apiKey["api_key"]!!) + localVariableRequest.putHeader("api_key", this.apiKey["api_key"]!!) } } - return request + return localVariableRequest .send() .map { - val apiResponse: ApiResponse = handleResponse(it) - apiResponse + val localVariableApiResponse: ApiResponse = this.handleResponse(it) + localVariableApiResponse } } @@ -531,18 +531,18 @@ open class UserApi(basePath: kotlin.String = ApiClient.defaultBasePath, accessTo */ @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun updateUser(username: kotlin.String, user: User) : Future { - return updateUserWithHttpInfo(username = username, user = user).map { localVarResponse -> - when (localVarResponse.responseType) { + return updateUserWithHttpInfo(username = username, user = user).map { localVariableResponse -> + when (localVariableResponse.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) + val localVariableError = localVariableResponse as ClientError<*> + throw ClientException("Client error : ${localVariableError.statusCode} ${localVariableError.message.orEmpty()}", localVariableError.statusCode, localVariableResponse) } ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) + val localVariableError = localVariableResponse as ServerError<*> + throw ServerException("Server error : ${localVariableError.statusCode} ${localVariableError.message.orEmpty()}", localVariableError.statusCode, localVariableResponse) } } } @@ -560,31 +560,31 @@ open class UserApi(basePath: kotlin.String = ApiClient.defaultBasePath, accessTo */ @Throws(IllegalStateException::class, IOException::class) fun updateUserWithHttpInfo(username: kotlin.String, user: User) : Future> { - val vertxClient = WebClient.create(vertx) - val request = vertxClient.requestAbs(HttpMethod.PUT, UriTemplate.of("$basePath/user/{username}".replace("{"+"username"+"}", encodeURIComponent(username.toString())))) + val localVariableClient = WebClient.create(this.vertx) + val localVariableRequest = localVariableClient.requestAbs(HttpMethod.PUT, UriTemplate.of("${this.basePath}/user/{username}".replace("{"+"username"+"}", this.encodeURIComponent(username.toString())))) - request.putHeader("Content-Type", "application/json") + localVariableRequest.putHeader("Content-Type", "application/json") - if (apiKey["api_key"] != null) { - if (apiKeyPrefix["api_key"] != null) { - request.putHeader("api_key", apiKeyPrefix["api_key"]!! + " " + apiKey["api_key"]!!) + if (this.apiKey["api_key"] != null) { + if (this.apiKeyPrefix["api_key"] != null) { + localVariableRequest.putHeader("api_key", this.apiKeyPrefix["api_key"]!! + " " + this.apiKey["api_key"]!!) } else { - request.putHeader("api_key", apiKey["api_key"]!!) + localVariableRequest.putHeader("api_key", this.apiKey["api_key"]!!) } } - return request - .sendBuffer(responseBody(user)) + return localVariableRequest + .sendBuffer(this.responseBody(user)) .map { - val apiResponse: ApiResponse = handleResponse(it) - apiResponse + val localVariableApiResponse: ApiResponse = this.handleResponse(it) + localVariableApiResponse } } diff --git a/samples/client/petstore/kotlin-kotlinx-datetime/src/main/kotlin/org/openapitools/client/apis/PetApi.kt b/samples/client/petstore/kotlin-kotlinx-datetime/src/main/kotlin/org/openapitools/client/apis/PetApi.kt index 6cfa0c37c266..29bf13a5131c 100644 --- a/samples/client/petstore/kotlin-kotlinx-datetime/src/main/kotlin/org/openapitools/client/apis/PetApi.kt +++ b/samples/client/petstore/kotlin-kotlinx-datetime/src/main/kotlin/org/openapitools/client/apis/PetApi.kt @@ -193,7 +193,7 @@ open class PetApi(basePath: kotlin.String = defaultBasePath, client: Call.Factor return RequestConfig( method = RequestMethod.DELETE, - path = "/pet/{petId}".replace("{"+"petId"+"}", encodeURIComponent(petId.toString())), + path = "/pet/{petId}".replace("{"+"petId"+"}", this@PetApi.encodeURIComponent(petId.toString())), query = localVariableQuery, headers = localVariableHeaders, requiresAuthentication = true, @@ -441,7 +441,7 @@ open class PetApi(basePath: kotlin.String = defaultBasePath, client: Call.Factor return RequestConfig( method = RequestMethod.GET, - path = "/pet/{petId}".replace("{"+"petId"+"}", encodeURIComponent(petId.toString())), + path = "/pet/{petId}".replace("{"+"petId"+"}", this@PetApi.encodeURIComponent(petId.toString())), query = localVariableQuery, headers = localVariableHeaders, requiresAuthentication = true, @@ -592,7 +592,7 @@ open class PetApi(basePath: kotlin.String = defaultBasePath, client: Call.Factor return RequestConfig( method = RequestMethod.POST, - path = "/pet/{petId}".replace("{"+"petId"+"}", encodeURIComponent(petId.toString())), + path = "/pet/{petId}".replace("{"+"petId"+"}", this@PetApi.encodeURIComponent(petId.toString())), query = localVariableQuery, headers = localVariableHeaders, requiresAuthentication = true, @@ -673,7 +673,7 @@ open class PetApi(basePath: kotlin.String = defaultBasePath, client: Call.Factor return RequestConfig( method = RequestMethod.POST, - path = "/pet/{petId}/uploadImage".replace("{"+"petId"+"}", encodeURIComponent(petId.toString())), + path = "/pet/{petId}/uploadImage".replace("{"+"petId"+"}", this@PetApi.encodeURIComponent(petId.toString())), query = localVariableQuery, headers = localVariableHeaders, requiresAuthentication = true, diff --git a/samples/client/petstore/kotlin-kotlinx-datetime/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt b/samples/client/petstore/kotlin-kotlinx-datetime/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt index 1b6de3f183e1..f07ff0845a5f 100644 --- a/samples/client/petstore/kotlin-kotlinx-datetime/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt +++ b/samples/client/petstore/kotlin-kotlinx-datetime/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt @@ -116,7 +116,7 @@ open class StoreApi(basePath: kotlin.String = defaultBasePath, client: Call.Fact return RequestConfig( method = RequestMethod.DELETE, - path = "/store/order/{orderId}".replace("{"+"orderId"+"}", encodeURIComponent(orderId.toString())), + path = "/store/order/{orderId}".replace("{"+"orderId"+"}", this@StoreApi.encodeURIComponent(orderId.toString())), query = localVariableQuery, headers = localVariableHeaders, requiresAuthentication = false, @@ -259,7 +259,7 @@ open class StoreApi(basePath: kotlin.String = defaultBasePath, client: Call.Fact return RequestConfig( method = RequestMethod.GET, - path = "/store/order/{orderId}".replace("{"+"orderId"+"}", encodeURIComponent(orderId.toString())), + path = "/store/order/{orderId}".replace("{"+"orderId"+"}", this@StoreApi.encodeURIComponent(orderId.toString())), query = localVariableQuery, headers = localVariableHeaders, requiresAuthentication = false, diff --git a/samples/client/petstore/kotlin-kotlinx-datetime/src/main/kotlin/org/openapitools/client/apis/UserApi.kt b/samples/client/petstore/kotlin-kotlinx-datetime/src/main/kotlin/org/openapitools/client/apis/UserApi.kt index 4e2b9587c8d4..a19e9660b12b 100644 --- a/samples/client/petstore/kotlin-kotlinx-datetime/src/main/kotlin/org/openapitools/client/apis/UserApi.kt +++ b/samples/client/petstore/kotlin-kotlinx-datetime/src/main/kotlin/org/openapitools/client/apis/UserApi.kt @@ -329,7 +329,7 @@ open class UserApi(basePath: kotlin.String = defaultBasePath, client: Call.Facto return RequestConfig( method = RequestMethod.DELETE, - path = "/user/{username}".replace("{"+"username"+"}", encodeURIComponent(username.toString())), + path = "/user/{username}".replace("{"+"username"+"}", this@UserApi.encodeURIComponent(username.toString())), query = localVariableQuery, headers = localVariableHeaders, requiresAuthentication = false, @@ -402,7 +402,7 @@ open class UserApi(basePath: kotlin.String = defaultBasePath, client: Call.Facto return RequestConfig( method = RequestMethod.GET, - path = "/user/{username}".replace("{"+"username"+"}", encodeURIComponent(username.toString())), + path = "/user/{username}".replace("{"+"username"+"}", this@UserApi.encodeURIComponent(username.toString())), query = localVariableQuery, headers = localVariableHeaders, requiresAuthentication = false, @@ -624,7 +624,7 @@ open class UserApi(basePath: kotlin.String = defaultBasePath, client: Call.Facto return RequestConfig( method = RequestMethod.PUT, - path = "/user/{username}".replace("{"+"username"+"}", encodeURIComponent(username.toString())), + path = "/user/{username}".replace("{"+"username"+"}", this@UserApi.encodeURIComponent(username.toString())), query = localVariableQuery, headers = localVariableHeaders, requiresAuthentication = false, diff --git a/samples/client/petstore/kotlin-modelMutable/src/main/kotlin/org/openapitools/client/apis/PetApi.kt b/samples/client/petstore/kotlin-modelMutable/src/main/kotlin/org/openapitools/client/apis/PetApi.kt index dca9fe018530..bc7153cb349a 100644 --- a/samples/client/petstore/kotlin-modelMutable/src/main/kotlin/org/openapitools/client/apis/PetApi.kt +++ b/samples/client/petstore/kotlin-modelMutable/src/main/kotlin/org/openapitools/client/apis/PetApi.kt @@ -193,7 +193,7 @@ open class PetApi(basePath: kotlin.String = defaultBasePath, client: Call.Factor return RequestConfig( method = RequestMethod.DELETE, - path = "/pet/{petId}".replace("{"+"petId"+"}", encodeURIComponent(petId.toString())), + path = "/pet/{petId}".replace("{"+"petId"+"}", this@PetApi.encodeURIComponent(petId.toString())), query = localVariableQuery, headers = localVariableHeaders, requiresAuthentication = true, @@ -441,7 +441,7 @@ open class PetApi(basePath: kotlin.String = defaultBasePath, client: Call.Factor return RequestConfig( method = RequestMethod.GET, - path = "/pet/{petId}".replace("{"+"petId"+"}", encodeURIComponent(petId.toString())), + path = "/pet/{petId}".replace("{"+"petId"+"}", this@PetApi.encodeURIComponent(petId.toString())), query = localVariableQuery, headers = localVariableHeaders, requiresAuthentication = true, @@ -592,7 +592,7 @@ open class PetApi(basePath: kotlin.String = defaultBasePath, client: Call.Factor return RequestConfig( method = RequestMethod.POST, - path = "/pet/{petId}".replace("{"+"petId"+"}", encodeURIComponent(petId.toString())), + path = "/pet/{petId}".replace("{"+"petId"+"}", this@PetApi.encodeURIComponent(petId.toString())), query = localVariableQuery, headers = localVariableHeaders, requiresAuthentication = true, @@ -673,7 +673,7 @@ open class PetApi(basePath: kotlin.String = defaultBasePath, client: Call.Factor return RequestConfig( method = RequestMethod.POST, - path = "/pet/{petId}/uploadImage".replace("{"+"petId"+"}", encodeURIComponent(petId.toString())), + path = "/pet/{petId}/uploadImage".replace("{"+"petId"+"}", this@PetApi.encodeURIComponent(petId.toString())), query = localVariableQuery, headers = localVariableHeaders, requiresAuthentication = true, diff --git a/samples/client/petstore/kotlin-modelMutable/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt b/samples/client/petstore/kotlin-modelMutable/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt index c116d324fccf..a973f246e7fe 100644 --- a/samples/client/petstore/kotlin-modelMutable/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt +++ b/samples/client/petstore/kotlin-modelMutable/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt @@ -116,7 +116,7 @@ open class StoreApi(basePath: kotlin.String = defaultBasePath, client: Call.Fact return RequestConfig( method = RequestMethod.DELETE, - path = "/store/order/{orderId}".replace("{"+"orderId"+"}", encodeURIComponent(orderId.toString())), + path = "/store/order/{orderId}".replace("{"+"orderId"+"}", this@StoreApi.encodeURIComponent(orderId.toString())), query = localVariableQuery, headers = localVariableHeaders, requiresAuthentication = false, @@ -259,7 +259,7 @@ open class StoreApi(basePath: kotlin.String = defaultBasePath, client: Call.Fact return RequestConfig( method = RequestMethod.GET, - path = "/store/order/{orderId}".replace("{"+"orderId"+"}", encodeURIComponent(orderId.toString())), + path = "/store/order/{orderId}".replace("{"+"orderId"+"}", this@StoreApi.encodeURIComponent(orderId.toString())), query = localVariableQuery, headers = localVariableHeaders, requiresAuthentication = false, diff --git a/samples/client/petstore/kotlin-modelMutable/src/main/kotlin/org/openapitools/client/apis/UserApi.kt b/samples/client/petstore/kotlin-modelMutable/src/main/kotlin/org/openapitools/client/apis/UserApi.kt index 51354195973c..55ac7b2451ba 100644 --- a/samples/client/petstore/kotlin-modelMutable/src/main/kotlin/org/openapitools/client/apis/UserApi.kt +++ b/samples/client/petstore/kotlin-modelMutable/src/main/kotlin/org/openapitools/client/apis/UserApi.kt @@ -329,7 +329,7 @@ open class UserApi(basePath: kotlin.String = defaultBasePath, client: Call.Facto return RequestConfig( method = RequestMethod.DELETE, - path = "/user/{username}".replace("{"+"username"+"}", encodeURIComponent(username.toString())), + path = "/user/{username}".replace("{"+"username"+"}", this@UserApi.encodeURIComponent(username.toString())), query = localVariableQuery, headers = localVariableHeaders, requiresAuthentication = false, @@ -402,7 +402,7 @@ open class UserApi(basePath: kotlin.String = defaultBasePath, client: Call.Facto return RequestConfig( method = RequestMethod.GET, - path = "/user/{username}".replace("{"+"username"+"}", encodeURIComponent(username.toString())), + path = "/user/{username}".replace("{"+"username"+"}", this@UserApi.encodeURIComponent(username.toString())), query = localVariableQuery, headers = localVariableHeaders, requiresAuthentication = false, @@ -624,7 +624,7 @@ open class UserApi(basePath: kotlin.String = defaultBasePath, client: Call.Facto return RequestConfig( method = RequestMethod.PUT, - path = "/user/{username}".replace("{"+"username"+"}", encodeURIComponent(username.toString())), + path = "/user/{username}".replace("{"+"username"+"}", this@UserApi.encodeURIComponent(username.toString())), query = localVariableQuery, headers = localVariableHeaders, requiresAuthentication = false, diff --git a/samples/client/petstore/kotlin-moshi-codegen/src/main/kotlin/org/openapitools/client/apis/PetApi.kt b/samples/client/petstore/kotlin-moshi-codegen/src/main/kotlin/org/openapitools/client/apis/PetApi.kt index 6cfa0c37c266..29bf13a5131c 100644 --- a/samples/client/petstore/kotlin-moshi-codegen/src/main/kotlin/org/openapitools/client/apis/PetApi.kt +++ b/samples/client/petstore/kotlin-moshi-codegen/src/main/kotlin/org/openapitools/client/apis/PetApi.kt @@ -193,7 +193,7 @@ open class PetApi(basePath: kotlin.String = defaultBasePath, client: Call.Factor return RequestConfig( method = RequestMethod.DELETE, - path = "/pet/{petId}".replace("{"+"petId"+"}", encodeURIComponent(petId.toString())), + path = "/pet/{petId}".replace("{"+"petId"+"}", this@PetApi.encodeURIComponent(petId.toString())), query = localVariableQuery, headers = localVariableHeaders, requiresAuthentication = true, @@ -441,7 +441,7 @@ open class PetApi(basePath: kotlin.String = defaultBasePath, client: Call.Factor return RequestConfig( method = RequestMethod.GET, - path = "/pet/{petId}".replace("{"+"petId"+"}", encodeURIComponent(petId.toString())), + path = "/pet/{petId}".replace("{"+"petId"+"}", this@PetApi.encodeURIComponent(petId.toString())), query = localVariableQuery, headers = localVariableHeaders, requiresAuthentication = true, @@ -592,7 +592,7 @@ open class PetApi(basePath: kotlin.String = defaultBasePath, client: Call.Factor return RequestConfig( method = RequestMethod.POST, - path = "/pet/{petId}".replace("{"+"petId"+"}", encodeURIComponent(petId.toString())), + path = "/pet/{petId}".replace("{"+"petId"+"}", this@PetApi.encodeURIComponent(petId.toString())), query = localVariableQuery, headers = localVariableHeaders, requiresAuthentication = true, @@ -673,7 +673,7 @@ open class PetApi(basePath: kotlin.String = defaultBasePath, client: Call.Factor return RequestConfig( method = RequestMethod.POST, - path = "/pet/{petId}/uploadImage".replace("{"+"petId"+"}", encodeURIComponent(petId.toString())), + path = "/pet/{petId}/uploadImage".replace("{"+"petId"+"}", this@PetApi.encodeURIComponent(petId.toString())), query = localVariableQuery, headers = localVariableHeaders, requiresAuthentication = true, diff --git a/samples/client/petstore/kotlin-moshi-codegen/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt b/samples/client/petstore/kotlin-moshi-codegen/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt index 1b6de3f183e1..f07ff0845a5f 100644 --- a/samples/client/petstore/kotlin-moshi-codegen/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt +++ b/samples/client/petstore/kotlin-moshi-codegen/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt @@ -116,7 +116,7 @@ open class StoreApi(basePath: kotlin.String = defaultBasePath, client: Call.Fact return RequestConfig( method = RequestMethod.DELETE, - path = "/store/order/{orderId}".replace("{"+"orderId"+"}", encodeURIComponent(orderId.toString())), + path = "/store/order/{orderId}".replace("{"+"orderId"+"}", this@StoreApi.encodeURIComponent(orderId.toString())), query = localVariableQuery, headers = localVariableHeaders, requiresAuthentication = false, @@ -259,7 +259,7 @@ open class StoreApi(basePath: kotlin.String = defaultBasePath, client: Call.Fact return RequestConfig( method = RequestMethod.GET, - path = "/store/order/{orderId}".replace("{"+"orderId"+"}", encodeURIComponent(orderId.toString())), + path = "/store/order/{orderId}".replace("{"+"orderId"+"}", this@StoreApi.encodeURIComponent(orderId.toString())), query = localVariableQuery, headers = localVariableHeaders, requiresAuthentication = false, diff --git a/samples/client/petstore/kotlin-moshi-codegen/src/main/kotlin/org/openapitools/client/apis/UserApi.kt b/samples/client/petstore/kotlin-moshi-codegen/src/main/kotlin/org/openapitools/client/apis/UserApi.kt index 4e2b9587c8d4..a19e9660b12b 100644 --- a/samples/client/petstore/kotlin-moshi-codegen/src/main/kotlin/org/openapitools/client/apis/UserApi.kt +++ b/samples/client/petstore/kotlin-moshi-codegen/src/main/kotlin/org/openapitools/client/apis/UserApi.kt @@ -329,7 +329,7 @@ open class UserApi(basePath: kotlin.String = defaultBasePath, client: Call.Facto return RequestConfig( method = RequestMethod.DELETE, - path = "/user/{username}".replace("{"+"username"+"}", encodeURIComponent(username.toString())), + path = "/user/{username}".replace("{"+"username"+"}", this@UserApi.encodeURIComponent(username.toString())), query = localVariableQuery, headers = localVariableHeaders, requiresAuthentication = false, @@ -402,7 +402,7 @@ open class UserApi(basePath: kotlin.String = defaultBasePath, client: Call.Facto return RequestConfig( method = RequestMethod.GET, - path = "/user/{username}".replace("{"+"username"+"}", encodeURIComponent(username.toString())), + path = "/user/{username}".replace("{"+"username"+"}", this@UserApi.encodeURIComponent(username.toString())), query = localVariableQuery, headers = localVariableHeaders, requiresAuthentication = false, @@ -624,7 +624,7 @@ open class UserApi(basePath: kotlin.String = defaultBasePath, client: Call.Facto return RequestConfig( method = RequestMethod.PUT, - path = "/user/{username}".replace("{"+"username"+"}", encodeURIComponent(username.toString())), + path = "/user/{username}".replace("{"+"username"+"}", this@UserApi.encodeURIComponent(username.toString())), query = localVariableQuery, headers = localVariableHeaders, requiresAuthentication = false, diff --git a/samples/client/petstore/kotlin-nonpublic/src/main/kotlin/org/openapitools/client/apis/PetApi.kt b/samples/client/petstore/kotlin-nonpublic/src/main/kotlin/org/openapitools/client/apis/PetApi.kt index b5416a08be00..020d5723f21e 100644 --- a/samples/client/petstore/kotlin-nonpublic/src/main/kotlin/org/openapitools/client/apis/PetApi.kt +++ b/samples/client/petstore/kotlin-nonpublic/src/main/kotlin/org/openapitools/client/apis/PetApi.kt @@ -193,7 +193,7 @@ internal class PetApi(basePath: kotlin.String = defaultBasePath, client: Call.Fa return RequestConfig( method = RequestMethod.DELETE, - path = "/pet/{petId}".replace("{"+"petId"+"}", encodeURIComponent(petId.toString())), + path = "/pet/{petId}".replace("{"+"petId"+"}", this@PetApi.encodeURIComponent(petId.toString())), query = localVariableQuery, headers = localVariableHeaders, requiresAuthentication = true, @@ -441,7 +441,7 @@ internal class PetApi(basePath: kotlin.String = defaultBasePath, client: Call.Fa return RequestConfig( method = RequestMethod.GET, - path = "/pet/{petId}".replace("{"+"petId"+"}", encodeURIComponent(petId.toString())), + path = "/pet/{petId}".replace("{"+"petId"+"}", this@PetApi.encodeURIComponent(petId.toString())), query = localVariableQuery, headers = localVariableHeaders, requiresAuthentication = true, @@ -592,7 +592,7 @@ internal class PetApi(basePath: kotlin.String = defaultBasePath, client: Call.Fa return RequestConfig( method = RequestMethod.POST, - path = "/pet/{petId}".replace("{"+"petId"+"}", encodeURIComponent(petId.toString())), + path = "/pet/{petId}".replace("{"+"petId"+"}", this@PetApi.encodeURIComponent(petId.toString())), query = localVariableQuery, headers = localVariableHeaders, requiresAuthentication = true, @@ -673,7 +673,7 @@ internal class PetApi(basePath: kotlin.String = defaultBasePath, client: Call.Fa return RequestConfig( method = RequestMethod.POST, - path = "/pet/{petId}/uploadImage".replace("{"+"petId"+"}", encodeURIComponent(petId.toString())), + path = "/pet/{petId}/uploadImage".replace("{"+"petId"+"}", this@PetApi.encodeURIComponent(petId.toString())), query = localVariableQuery, headers = localVariableHeaders, requiresAuthentication = true, diff --git a/samples/client/petstore/kotlin-nonpublic/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt b/samples/client/petstore/kotlin-nonpublic/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt index 72b51cec0fd4..7ad461930a52 100644 --- a/samples/client/petstore/kotlin-nonpublic/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt +++ b/samples/client/petstore/kotlin-nonpublic/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt @@ -116,7 +116,7 @@ internal class StoreApi(basePath: kotlin.String = defaultBasePath, client: Call. return RequestConfig( method = RequestMethod.DELETE, - path = "/store/order/{orderId}".replace("{"+"orderId"+"}", encodeURIComponent(orderId.toString())), + path = "/store/order/{orderId}".replace("{"+"orderId"+"}", this@StoreApi.encodeURIComponent(orderId.toString())), query = localVariableQuery, headers = localVariableHeaders, requiresAuthentication = false, @@ -259,7 +259,7 @@ internal class StoreApi(basePath: kotlin.String = defaultBasePath, client: Call. return RequestConfig( method = RequestMethod.GET, - path = "/store/order/{orderId}".replace("{"+"orderId"+"}", encodeURIComponent(orderId.toString())), + path = "/store/order/{orderId}".replace("{"+"orderId"+"}", this@StoreApi.encodeURIComponent(orderId.toString())), query = localVariableQuery, headers = localVariableHeaders, requiresAuthentication = false, diff --git a/samples/client/petstore/kotlin-nonpublic/src/main/kotlin/org/openapitools/client/apis/UserApi.kt b/samples/client/petstore/kotlin-nonpublic/src/main/kotlin/org/openapitools/client/apis/UserApi.kt index a80e55c7e25d..15aa22461871 100644 --- a/samples/client/petstore/kotlin-nonpublic/src/main/kotlin/org/openapitools/client/apis/UserApi.kt +++ b/samples/client/petstore/kotlin-nonpublic/src/main/kotlin/org/openapitools/client/apis/UserApi.kt @@ -329,7 +329,7 @@ internal class UserApi(basePath: kotlin.String = defaultBasePath, client: Call.F return RequestConfig( method = RequestMethod.DELETE, - path = "/user/{username}".replace("{"+"username"+"}", encodeURIComponent(username.toString())), + path = "/user/{username}".replace("{"+"username"+"}", this@UserApi.encodeURIComponent(username.toString())), query = localVariableQuery, headers = localVariableHeaders, requiresAuthentication = false, @@ -402,7 +402,7 @@ internal class UserApi(basePath: kotlin.String = defaultBasePath, client: Call.F return RequestConfig( method = RequestMethod.GET, - path = "/user/{username}".replace("{"+"username"+"}", encodeURIComponent(username.toString())), + path = "/user/{username}".replace("{"+"username"+"}", this@UserApi.encodeURIComponent(username.toString())), query = localVariableQuery, headers = localVariableHeaders, requiresAuthentication = false, @@ -624,7 +624,7 @@ internal class UserApi(basePath: kotlin.String = defaultBasePath, client: Call.F return RequestConfig( method = RequestMethod.PUT, - path = "/user/{username}".replace("{"+"username"+"}", encodeURIComponent(username.toString())), + path = "/user/{username}".replace("{"+"username"+"}", this@UserApi.encodeURIComponent(username.toString())), query = localVariableQuery, headers = localVariableHeaders, requiresAuthentication = false, diff --git a/samples/client/petstore/kotlin-nullable/src/main/kotlin/org/openapitools/client/apis/PetApi.kt b/samples/client/petstore/kotlin-nullable/src/main/kotlin/org/openapitools/client/apis/PetApi.kt index a925039769be..92d2f009e404 100644 --- a/samples/client/petstore/kotlin-nullable/src/main/kotlin/org/openapitools/client/apis/PetApi.kt +++ b/samples/client/petstore/kotlin-nullable/src/main/kotlin/org/openapitools/client/apis/PetApi.kt @@ -193,7 +193,7 @@ open class PetApi(basePath: kotlin.String = defaultBasePath, client: Call.Factor return RequestConfig( method = RequestMethod.DELETE, - path = "/pet/{petId}".replace("{"+"petId"+"}", encodeURIComponent(petId.toString())), + path = "/pet/{petId}".replace("{"+"petId"+"}", this@PetApi.encodeURIComponent(petId.toString())), query = localVariableQuery, headers = localVariableHeaders, requiresAuthentication = true, @@ -441,7 +441,7 @@ open class PetApi(basePath: kotlin.String = defaultBasePath, client: Call.Factor return RequestConfig( method = RequestMethod.GET, - path = "/pet/{petId}".replace("{"+"petId"+"}", encodeURIComponent(petId.toString())), + path = "/pet/{petId}".replace("{"+"petId"+"}", this@PetApi.encodeURIComponent(petId.toString())), query = localVariableQuery, headers = localVariableHeaders, requiresAuthentication = true, @@ -592,7 +592,7 @@ open class PetApi(basePath: kotlin.String = defaultBasePath, client: Call.Factor return RequestConfig( method = RequestMethod.POST, - path = "/pet/{petId}".replace("{"+"petId"+"}", encodeURIComponent(petId.toString())), + path = "/pet/{petId}".replace("{"+"petId"+"}", this@PetApi.encodeURIComponent(petId.toString())), query = localVariableQuery, headers = localVariableHeaders, requiresAuthentication = true, @@ -673,7 +673,7 @@ open class PetApi(basePath: kotlin.String = defaultBasePath, client: Call.Factor return RequestConfig( method = RequestMethod.POST, - path = "/pet/{petId}/uploadImage".replace("{"+"petId"+"}", encodeURIComponent(petId.toString())), + path = "/pet/{petId}/uploadImage".replace("{"+"petId"+"}", this@PetApi.encodeURIComponent(petId.toString())), query = localVariableQuery, headers = localVariableHeaders, requiresAuthentication = true, diff --git a/samples/client/petstore/kotlin-nullable/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt b/samples/client/petstore/kotlin-nullable/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt index 215f7bc1255a..d585aa7b8cf2 100644 --- a/samples/client/petstore/kotlin-nullable/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt +++ b/samples/client/petstore/kotlin-nullable/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt @@ -116,7 +116,7 @@ open class StoreApi(basePath: kotlin.String = defaultBasePath, client: Call.Fact return RequestConfig( method = RequestMethod.DELETE, - path = "/store/order/{orderId}".replace("{"+"orderId"+"}", encodeURIComponent(orderId.toString())), + path = "/store/order/{orderId}".replace("{"+"orderId"+"}", this@StoreApi.encodeURIComponent(orderId.toString())), query = localVariableQuery, headers = localVariableHeaders, requiresAuthentication = false, @@ -259,7 +259,7 @@ open class StoreApi(basePath: kotlin.String = defaultBasePath, client: Call.Fact return RequestConfig( method = RequestMethod.GET, - path = "/store/order/{orderId}".replace("{"+"orderId"+"}", encodeURIComponent(orderId.toString())), + path = "/store/order/{orderId}".replace("{"+"orderId"+"}", this@StoreApi.encodeURIComponent(orderId.toString())), query = localVariableQuery, headers = localVariableHeaders, requiresAuthentication = false, diff --git a/samples/client/petstore/kotlin-nullable/src/main/kotlin/org/openapitools/client/apis/UserApi.kt b/samples/client/petstore/kotlin-nullable/src/main/kotlin/org/openapitools/client/apis/UserApi.kt index 05b919d7a646..50bd6e3b44ce 100644 --- a/samples/client/petstore/kotlin-nullable/src/main/kotlin/org/openapitools/client/apis/UserApi.kt +++ b/samples/client/petstore/kotlin-nullable/src/main/kotlin/org/openapitools/client/apis/UserApi.kt @@ -329,7 +329,7 @@ open class UserApi(basePath: kotlin.String = defaultBasePath, client: Call.Facto return RequestConfig( method = RequestMethod.DELETE, - path = "/user/{username}".replace("{"+"username"+"}", encodeURIComponent(username.toString())), + path = "/user/{username}".replace("{"+"username"+"}", this@UserApi.encodeURIComponent(username.toString())), query = localVariableQuery, headers = localVariableHeaders, requiresAuthentication = false, @@ -402,7 +402,7 @@ open class UserApi(basePath: kotlin.String = defaultBasePath, client: Call.Facto return RequestConfig( method = RequestMethod.GET, - path = "/user/{username}".replace("{"+"username"+"}", encodeURIComponent(username.toString())), + path = "/user/{username}".replace("{"+"username"+"}", this@UserApi.encodeURIComponent(username.toString())), query = localVariableQuery, headers = localVariableHeaders, requiresAuthentication = false, @@ -624,7 +624,7 @@ open class UserApi(basePath: kotlin.String = defaultBasePath, client: Call.Facto return RequestConfig( method = RequestMethod.PUT, - path = "/user/{username}".replace("{"+"username"+"}", encodeURIComponent(username.toString())), + path = "/user/{username}".replace("{"+"username"+"}", this@UserApi.encodeURIComponent(username.toString())), query = localVariableQuery, headers = localVariableHeaders, requiresAuthentication = false, diff --git a/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/apis/PetApi.kt b/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/apis/PetApi.kt index 1e13f5d984f4..23166b8ebd84 100644 --- a/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/apis/PetApi.kt +++ b/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/apis/PetApi.kt @@ -193,7 +193,7 @@ open class PetApi(basePath: kotlin.String = defaultBasePath, client: Call.Factor return RequestConfig( method = RequestMethod.DELETE, - path = "/pet/{petId}".replace("{"+"petId"+"}", encodeURIComponent(petId.toString())), + path = "/pet/{petId}".replace("{"+"petId"+"}", this@PetApi.encodeURIComponent(petId.toString())), query = localVariableQuery, headers = localVariableHeaders, requiresAuthentication = true, @@ -441,7 +441,7 @@ open class PetApi(basePath: kotlin.String = defaultBasePath, client: Call.Factor return RequestConfig( method = RequestMethod.GET, - path = "/pet/{petId}".replace("{"+"petId"+"}", encodeURIComponent(petId.toString())), + path = "/pet/{petId}".replace("{"+"petId"+"}", this@PetApi.encodeURIComponent(petId.toString())), query = localVariableQuery, headers = localVariableHeaders, requiresAuthentication = true, @@ -592,7 +592,7 @@ open class PetApi(basePath: kotlin.String = defaultBasePath, client: Call.Factor return RequestConfig( method = RequestMethod.POST, - path = "/pet/{petId}".replace("{"+"petId"+"}", encodeURIComponent(petId.toString())), + path = "/pet/{petId}".replace("{"+"petId"+"}", this@PetApi.encodeURIComponent(petId.toString())), query = localVariableQuery, headers = localVariableHeaders, requiresAuthentication = true, @@ -673,7 +673,7 @@ open class PetApi(basePath: kotlin.String = defaultBasePath, client: Call.Factor return RequestConfig( method = RequestMethod.POST, - path = "/pet/{petId}/uploadImage".replace("{"+"petId"+"}", encodeURIComponent(petId.toString())), + path = "/pet/{petId}/uploadImage".replace("{"+"petId"+"}", this@PetApi.encodeURIComponent(petId.toString())), query = localVariableQuery, headers = localVariableHeaders, requiresAuthentication = true, diff --git a/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt b/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt index 1b6de3f183e1..f07ff0845a5f 100644 --- a/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt +++ b/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt @@ -116,7 +116,7 @@ open class StoreApi(basePath: kotlin.String = defaultBasePath, client: Call.Fact return RequestConfig( method = RequestMethod.DELETE, - path = "/store/order/{orderId}".replace("{"+"orderId"+"}", encodeURIComponent(orderId.toString())), + path = "/store/order/{orderId}".replace("{"+"orderId"+"}", this@StoreApi.encodeURIComponent(orderId.toString())), query = localVariableQuery, headers = localVariableHeaders, requiresAuthentication = false, @@ -259,7 +259,7 @@ open class StoreApi(basePath: kotlin.String = defaultBasePath, client: Call.Fact return RequestConfig( method = RequestMethod.GET, - path = "/store/order/{orderId}".replace("{"+"orderId"+"}", encodeURIComponent(orderId.toString())), + path = "/store/order/{orderId}".replace("{"+"orderId"+"}", this@StoreApi.encodeURIComponent(orderId.toString())), query = localVariableQuery, headers = localVariableHeaders, requiresAuthentication = false, diff --git a/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/apis/UserApi.kt b/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/apis/UserApi.kt index 4e2b9587c8d4..a19e9660b12b 100644 --- a/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/apis/UserApi.kt +++ b/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/apis/UserApi.kt @@ -329,7 +329,7 @@ open class UserApi(basePath: kotlin.String = defaultBasePath, client: Call.Facto return RequestConfig( method = RequestMethod.DELETE, - path = "/user/{username}".replace("{"+"username"+"}", encodeURIComponent(username.toString())), + path = "/user/{username}".replace("{"+"username"+"}", this@UserApi.encodeURIComponent(username.toString())), query = localVariableQuery, headers = localVariableHeaders, requiresAuthentication = false, @@ -402,7 +402,7 @@ open class UserApi(basePath: kotlin.String = defaultBasePath, client: Call.Facto return RequestConfig( method = RequestMethod.GET, - path = "/user/{username}".replace("{"+"username"+"}", encodeURIComponent(username.toString())), + path = "/user/{username}".replace("{"+"username"+"}", this@UserApi.encodeURIComponent(username.toString())), query = localVariableQuery, headers = localVariableHeaders, requiresAuthentication = false, @@ -624,7 +624,7 @@ open class UserApi(basePath: kotlin.String = defaultBasePath, client: Call.Facto return RequestConfig( method = RequestMethod.PUT, - path = "/user/{username}".replace("{"+"username"+"}", encodeURIComponent(username.toString())), + path = "/user/{username}".replace("{"+"username"+"}", this@UserApi.encodeURIComponent(username.toString())), query = localVariableQuery, headers = localVariableHeaders, requiresAuthentication = false, diff --git a/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/apis/PetApi.kt b/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/apis/PetApi.kt index 6cfa0c37c266..29bf13a5131c 100644 --- a/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/apis/PetApi.kt +++ b/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/apis/PetApi.kt @@ -193,7 +193,7 @@ open class PetApi(basePath: kotlin.String = defaultBasePath, client: Call.Factor return RequestConfig( method = RequestMethod.DELETE, - path = "/pet/{petId}".replace("{"+"petId"+"}", encodeURIComponent(petId.toString())), + path = "/pet/{petId}".replace("{"+"petId"+"}", this@PetApi.encodeURIComponent(petId.toString())), query = localVariableQuery, headers = localVariableHeaders, requiresAuthentication = true, @@ -441,7 +441,7 @@ open class PetApi(basePath: kotlin.String = defaultBasePath, client: Call.Factor return RequestConfig( method = RequestMethod.GET, - path = "/pet/{petId}".replace("{"+"petId"+"}", encodeURIComponent(petId.toString())), + path = "/pet/{petId}".replace("{"+"petId"+"}", this@PetApi.encodeURIComponent(petId.toString())), query = localVariableQuery, headers = localVariableHeaders, requiresAuthentication = true, @@ -592,7 +592,7 @@ open class PetApi(basePath: kotlin.String = defaultBasePath, client: Call.Factor return RequestConfig( method = RequestMethod.POST, - path = "/pet/{petId}".replace("{"+"petId"+"}", encodeURIComponent(petId.toString())), + path = "/pet/{petId}".replace("{"+"petId"+"}", this@PetApi.encodeURIComponent(petId.toString())), query = localVariableQuery, headers = localVariableHeaders, requiresAuthentication = true, @@ -673,7 +673,7 @@ open class PetApi(basePath: kotlin.String = defaultBasePath, client: Call.Factor return RequestConfig( method = RequestMethod.POST, - path = "/pet/{petId}/uploadImage".replace("{"+"petId"+"}", encodeURIComponent(petId.toString())), + path = "/pet/{petId}/uploadImage".replace("{"+"petId"+"}", this@PetApi.encodeURIComponent(petId.toString())), query = localVariableQuery, headers = localVariableHeaders, requiresAuthentication = true, diff --git a/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt b/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt index 1b6de3f183e1..f07ff0845a5f 100644 --- a/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt +++ b/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt @@ -116,7 +116,7 @@ open class StoreApi(basePath: kotlin.String = defaultBasePath, client: Call.Fact return RequestConfig( method = RequestMethod.DELETE, - path = "/store/order/{orderId}".replace("{"+"orderId"+"}", encodeURIComponent(orderId.toString())), + path = "/store/order/{orderId}".replace("{"+"orderId"+"}", this@StoreApi.encodeURIComponent(orderId.toString())), query = localVariableQuery, headers = localVariableHeaders, requiresAuthentication = false, @@ -259,7 +259,7 @@ open class StoreApi(basePath: kotlin.String = defaultBasePath, client: Call.Fact return RequestConfig( method = RequestMethod.GET, - path = "/store/order/{orderId}".replace("{"+"orderId"+"}", encodeURIComponent(orderId.toString())), + path = "/store/order/{orderId}".replace("{"+"orderId"+"}", this@StoreApi.encodeURIComponent(orderId.toString())), query = localVariableQuery, headers = localVariableHeaders, requiresAuthentication = false, diff --git a/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/apis/UserApi.kt b/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/apis/UserApi.kt index 4e2b9587c8d4..a19e9660b12b 100644 --- a/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/apis/UserApi.kt +++ b/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/apis/UserApi.kt @@ -329,7 +329,7 @@ open class UserApi(basePath: kotlin.String = defaultBasePath, client: Call.Facto return RequestConfig( method = RequestMethod.DELETE, - path = "/user/{username}".replace("{"+"username"+"}", encodeURIComponent(username.toString())), + path = "/user/{username}".replace("{"+"username"+"}", this@UserApi.encodeURIComponent(username.toString())), query = localVariableQuery, headers = localVariableHeaders, requiresAuthentication = false, @@ -402,7 +402,7 @@ open class UserApi(basePath: kotlin.String = defaultBasePath, client: Call.Facto return RequestConfig( method = RequestMethod.GET, - path = "/user/{username}".replace("{"+"username"+"}", encodeURIComponent(username.toString())), + path = "/user/{username}".replace("{"+"username"+"}", this@UserApi.encodeURIComponent(username.toString())), query = localVariableQuery, headers = localVariableHeaders, requiresAuthentication = false, @@ -624,7 +624,7 @@ open class UserApi(basePath: kotlin.String = defaultBasePath, client: Call.Facto return RequestConfig( method = RequestMethod.PUT, - path = "/user/{username}".replace("{"+"username"+"}", encodeURIComponent(username.toString())), + path = "/user/{username}".replace("{"+"username"+"}", this@UserApi.encodeURIComponent(username.toString())), query = localVariableQuery, headers = localVariableHeaders, requiresAuthentication = false, diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/apis/PetApi.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/apis/PetApi.kt index 6cfa0c37c266..29bf13a5131c 100644 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/apis/PetApi.kt +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/apis/PetApi.kt @@ -193,7 +193,7 @@ open class PetApi(basePath: kotlin.String = defaultBasePath, client: Call.Factor return RequestConfig( method = RequestMethod.DELETE, - path = "/pet/{petId}".replace("{"+"petId"+"}", encodeURIComponent(petId.toString())), + path = "/pet/{petId}".replace("{"+"petId"+"}", this@PetApi.encodeURIComponent(petId.toString())), query = localVariableQuery, headers = localVariableHeaders, requiresAuthentication = true, @@ -441,7 +441,7 @@ open class PetApi(basePath: kotlin.String = defaultBasePath, client: Call.Factor return RequestConfig( method = RequestMethod.GET, - path = "/pet/{petId}".replace("{"+"petId"+"}", encodeURIComponent(petId.toString())), + path = "/pet/{petId}".replace("{"+"petId"+"}", this@PetApi.encodeURIComponent(petId.toString())), query = localVariableQuery, headers = localVariableHeaders, requiresAuthentication = true, @@ -592,7 +592,7 @@ open class PetApi(basePath: kotlin.String = defaultBasePath, client: Call.Factor return RequestConfig( method = RequestMethod.POST, - path = "/pet/{petId}".replace("{"+"petId"+"}", encodeURIComponent(petId.toString())), + path = "/pet/{petId}".replace("{"+"petId"+"}", this@PetApi.encodeURIComponent(petId.toString())), query = localVariableQuery, headers = localVariableHeaders, requiresAuthentication = true, @@ -673,7 +673,7 @@ open class PetApi(basePath: kotlin.String = defaultBasePath, client: Call.Factor return RequestConfig( method = RequestMethod.POST, - path = "/pet/{petId}/uploadImage".replace("{"+"petId"+"}", encodeURIComponent(petId.toString())), + path = "/pet/{petId}/uploadImage".replace("{"+"petId"+"}", this@PetApi.encodeURIComponent(petId.toString())), query = localVariableQuery, headers = localVariableHeaders, requiresAuthentication = true, diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt index 1b6de3f183e1..f07ff0845a5f 100644 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt @@ -116,7 +116,7 @@ open class StoreApi(basePath: kotlin.String = defaultBasePath, client: Call.Fact return RequestConfig( method = RequestMethod.DELETE, - path = "/store/order/{orderId}".replace("{"+"orderId"+"}", encodeURIComponent(orderId.toString())), + path = "/store/order/{orderId}".replace("{"+"orderId"+"}", this@StoreApi.encodeURIComponent(orderId.toString())), query = localVariableQuery, headers = localVariableHeaders, requiresAuthentication = false, @@ -259,7 +259,7 @@ open class StoreApi(basePath: kotlin.String = defaultBasePath, client: Call.Fact return RequestConfig( method = RequestMethod.GET, - path = "/store/order/{orderId}".replace("{"+"orderId"+"}", encodeURIComponent(orderId.toString())), + path = "/store/order/{orderId}".replace("{"+"orderId"+"}", this@StoreApi.encodeURIComponent(orderId.toString())), query = localVariableQuery, headers = localVariableHeaders, requiresAuthentication = false, diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/apis/UserApi.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/apis/UserApi.kt index 4e2b9587c8d4..a19e9660b12b 100644 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/apis/UserApi.kt +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/apis/UserApi.kt @@ -329,7 +329,7 @@ open class UserApi(basePath: kotlin.String = defaultBasePath, client: Call.Facto return RequestConfig( method = RequestMethod.DELETE, - path = "/user/{username}".replace("{"+"username"+"}", encodeURIComponent(username.toString())), + path = "/user/{username}".replace("{"+"username"+"}", this@UserApi.encodeURIComponent(username.toString())), query = localVariableQuery, headers = localVariableHeaders, requiresAuthentication = false, @@ -402,7 +402,7 @@ open class UserApi(basePath: kotlin.String = defaultBasePath, client: Call.Facto return RequestConfig( method = RequestMethod.GET, - path = "/user/{username}".replace("{"+"username"+"}", encodeURIComponent(username.toString())), + path = "/user/{username}".replace("{"+"username"+"}", this@UserApi.encodeURIComponent(username.toString())), query = localVariableQuery, headers = localVariableHeaders, requiresAuthentication = false, @@ -624,7 +624,7 @@ open class UserApi(basePath: kotlin.String = defaultBasePath, client: Call.Facto return RequestConfig( method = RequestMethod.PUT, - path = "/user/{username}".replace("{"+"username"+"}", encodeURIComponent(username.toString())), + path = "/user/{username}".replace("{"+"username"+"}", this@UserApi.encodeURIComponent(username.toString())), query = localVariableQuery, headers = localVariableHeaders, requiresAuthentication = false, From 1cf67f2eadfc1dcc261b493b132e00087004f15a Mon Sep 17 00:00:00 2001 From: khayashi4337 Date: Thu, 24 Sep 2026 13:06:33 +0900 Subject: [PATCH 23/31] chore(samples): regenerate ruby/php samples for earlier template fixes The api_client.rb changes for verbatim bodies on 3.2 verbs and path-only slash collapsing (51fa9b99c00), and the psr-7 ^2.10 bump plus param_* collision renames (62a98c232ae, 9f2676e95c5), were committed without regenerating the samples. Backfill the drift so the committed samples match current templates. Generated with [Devin](https://devin.ai) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com> --- .../lib/openapi_client/api_client.rb | 9 ++-- .../lib/openapi_client/api_client.rb | 15 ++++--- .../lib/openapi_client/api_client.rb | 9 ++-- .../php/OpenAPIClient-php/composer.json | 2 +- .../php/OpenAPIClient-php/docs/Api/FakeApi.md | 8 ++-- .../php/OpenAPIClient-php/lib/Api/FakeApi.php | 36 ++++++++-------- .../petstore/php/psr-18/docs/Api/FakeApi.md | 8 ++-- .../petstore/php/psr-18/lib/Api/FakeApi.php | 42 +++++++++---------- .../ruby-autoload/lib/petstore/api_client.rb | 9 ++-- .../ruby-faraday/lib/petstore/api_client.rb | 9 ++-- .../ruby-httpx/lib/petstore/api_client.rb | 15 ++++--- .../petstore/ruby/lib/petstore/api_client.rb | 9 ++-- .../lib/x_auth_id_alias/api_client.rb | 9 ++-- .../ruby/lib/dynamic_servers/api_client.rb | 9 ++-- .../ruby-client/lib/petstore/api_client.rb | 9 ++-- 15 files changed, 116 insertions(+), 82 deletions(-) diff --git a/samples/client/echo_api/ruby-faraday/lib/openapi_client/api_client.rb b/samples/client/echo_api/ruby-faraday/lib/openapi_client/api_client.rb index d6b0329212cf..0293a21af4ee 100644 --- a/samples/client/echo_api/ruby-faraday/lib/openapi_client/api_client.rb +++ b/samples/client/echo_api/ruby-faraday/lib/openapi_client/api_client.rb @@ -342,9 +342,12 @@ def sanitize_filename(filename) end def build_request_url(path, opts = {}) - # Add leading and trailing slashes to path - path = "/#{path}".gsub(/\/+/, '/') - @config.base_url(opts[:operation]) + path + # Add leading and trailing slashes to path. An OpenAPI 3.2 + # `in: querystring` value is appended verbatim to `path`, so only the + # part before '?' may have its slashes collapsed. + path_only, sep, query = path.partition('?') + path_only = "/#{path_only}".gsub(/\/+/, '/') + @config.base_url(opts[:operation]) + path_only + sep + query end # Update header and query params based on authentication settings. diff --git a/samples/client/echo_api/ruby-httpx/lib/openapi_client/api_client.rb b/samples/client/echo_api/ruby-httpx/lib/openapi_client/api_client.rb index bdb14dc06a52..a106cf732ccf 100644 --- a/samples/client/echo_api/ruby-httpx/lib/openapi_client/api_client.rb +++ b/samples/client/echo_api/ruby-httpx/lib/openapi_client/api_client.rb @@ -101,10 +101,12 @@ def build_request(http_method, path, opts = {}) update_params_for_auth! header_params, query_params, opts[:auth_names] - if %w[POST PATCH PUT DELETE].include?(http_method) + # OpenAPI 3.2 query/additionalOperations verbs may carry a body too; for + # non-standard methods we always attempt to build one (nil when absent). + if %w[POST PATCH PUT DELETE].include?(http_method) || !STANDARD_HTTP_METHODS.include?(http_method.to_s) body_params = build_request_body(header_params, form_params, opts[:body]) if config.debugging - config.logger.debug "HTTP request body param ~BEGIN~\n#{req_body}\n~END~\n" + config.logger.debug "HTTP request body param ~BEGIN~\n#{body_params}\n~END~\n" end end req_opts = { @@ -290,9 +292,12 @@ def sanitize_filename(filename) end def build_request_url(path, opts = {}) - # Add leading and trailing slashes to path - path = "/#{path}".gsub(/\/+/, '/') - @config.base_url(opts[:operation]) + path + # Add leading and trailing slashes to path. An OpenAPI 3.2 + # `in: querystring` value is appended verbatim to `path`, so only the + # part before '?' may have its slashes collapsed. + path_only, sep, query = path.partition('?') + path_only = "/#{path_only}".gsub(/\/+/, '/') + @config.base_url(opts[:operation]) + path_only + sep + query end # Update header and query params based on authentication settings. diff --git a/samples/client/echo_api/ruby-typhoeus/lib/openapi_client/api_client.rb b/samples/client/echo_api/ruby-typhoeus/lib/openapi_client/api_client.rb index 75ecf919ae90..fcef132d2f25 100644 --- a/samples/client/echo_api/ruby-typhoeus/lib/openapi_client/api_client.rb +++ b/samples/client/echo_api/ruby-typhoeus/lib/openapi_client/api_client.rb @@ -298,9 +298,12 @@ def sanitize_filename(filename) end def build_request_url(path, opts = {}) - # Add leading and trailing slashes to path - path = "/#{path}".gsub(/\/+/, '/') - @config.base_url(opts[:operation]) + path + # Add leading and trailing slashes to path. An OpenAPI 3.2 + # `in: querystring` value is appended verbatim to `path`, so only the + # part before '?' may have its slashes collapsed. + path_only, sep, query = path.partition('?') + path_only = "/#{path_only}".gsub(/\/+/, '/') + @config.base_url(opts[:operation]) + path_only + sep + query end # Update header and query params based on authentication settings. diff --git a/samples/client/petstore/php/OpenAPIClient-php/composer.json b/samples/client/petstore/php/OpenAPIClient-php/composer.json index f700934f4012..b28da44ff373 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/composer.json +++ b/samples/client/petstore/php/OpenAPIClient-php/composer.json @@ -23,7 +23,7 @@ "ext-json": "*", "ext-mbstring": "*", "guzzlehttp/guzzle": "^7.3", - "guzzlehttp/psr7": "^1.7 || ^2.0" + "guzzlehttp/psr7": "^2.10" }, "require-dev": { "phpunit/phpunit": "^8.0 || ^9.0", diff --git a/samples/client/petstore/php/OpenAPIClient-php/docs/Api/FakeApi.md b/samples/client/petstore/php/OpenAPIClient-php/docs/Api/FakeApi.md index c0414db77f7e..c8ba09310ce8 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/docs/Api/FakeApi.md +++ b/samples/client/petstore/php/OpenAPIClient-php/docs/Api/FakeApi.md @@ -1036,7 +1036,7 @@ No authorization required ## `testBodyWithQueryParams()` ```php -testBodyWithQueryParams($query, $user) +testBodyWithQueryParams($param_query, $user) ``` @@ -1054,11 +1054,11 @@ $apiInstance = new OpenAPI\Client\Api\FakeApi( // This is optional, `GuzzleHttp\Client` will be used as default. new GuzzleHttp\Client() ); -$query = 'query_example'; // string +$param_query = 'param_query_example'; // string $user = new \OpenAPI\Client\Model\User(); // \OpenAPI\Client\Model\User try { - $apiInstance->testBodyWithQueryParams($query, $user); + $apiInstance->testBodyWithQueryParams($param_query, $user); } catch (Exception $e) { echo 'Exception when calling FakeApi->testBodyWithQueryParams: ', $e->getMessage(), PHP_EOL; } @@ -1068,7 +1068,7 @@ try { | Name | Type | Description | Notes | | ------------- | ------------- | ------------- | ------------- | -| **query** | **string**| | | +| **param_query** | **string**| | | | **user** | [**\OpenAPI\Client\Model\User**](../Model/User.md)| | | ### Return type diff --git a/samples/client/petstore/php/OpenAPIClient-php/lib/Api/FakeApi.php b/samples/client/petstore/php/OpenAPIClient-php/lib/Api/FakeApi.php index 0ea96424421f..c31a2b916b27 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/lib/Api/FakeApi.php +++ b/samples/client/petstore/php/OpenAPIClient-php/lib/Api/FakeApi.php @@ -4975,7 +4975,7 @@ public function testBodyWithFileSchemaRequest($file_schema_test_class, string $c /** * Operation testBodyWithQueryParams * - * @param string $query query (required) + * @param string $param_query param_query (required) * @param \OpenAPI\Client\Model\User $user user (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testBodyWithQueryParams'] to see the possible values for this operation * @@ -4983,15 +4983,15 @@ public function testBodyWithFileSchemaRequest($file_schema_test_class, string $c * @throws \InvalidArgumentException * @return void */ - public function testBodyWithQueryParams($query, $user, string $contentType = self::contentTypes['testBodyWithQueryParams'][0]) + public function testBodyWithQueryParams($param_query, $user, string $contentType = self::contentTypes['testBodyWithQueryParams'][0]) { - $this->testBodyWithQueryParamsWithHttpInfo($query, $user, $contentType); + $this->testBodyWithQueryParamsWithHttpInfo($param_query, $user, $contentType); } /** * Operation testBodyWithQueryParamsWithHttpInfo * - * @param string $query (required) + * @param string $param_query (required) * @param \OpenAPI\Client\Model\User $user (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testBodyWithQueryParams'] to see the possible values for this operation * @@ -4999,9 +4999,9 @@ public function testBodyWithQueryParams($query, $user, string $contentType = sel * @throws \InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function testBodyWithQueryParamsWithHttpInfo($query, $user, string $contentType = self::contentTypes['testBodyWithQueryParams'][0]) + public function testBodyWithQueryParamsWithHttpInfo($param_query, $user, string $contentType = self::contentTypes['testBodyWithQueryParams'][0]) { - $request = $this->testBodyWithQueryParamsRequest($query, $user, $contentType); + $request = $this->testBodyWithQueryParamsRequest($param_query, $user, $contentType); try { $options = $this->createHttpClientOption(); @@ -5039,16 +5039,16 @@ public function testBodyWithQueryParamsWithHttpInfo($query, $user, string $conte /** * Operation testBodyWithQueryParamsAsync * - * @param string $query (required) + * @param string $param_query (required) * @param \OpenAPI\Client\Model\User $user (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testBodyWithQueryParams'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function testBodyWithQueryParamsAsync($query, $user, string $contentType = self::contentTypes['testBodyWithQueryParams'][0]) + public function testBodyWithQueryParamsAsync($param_query, $user, string $contentType = self::contentTypes['testBodyWithQueryParams'][0]) { - return $this->testBodyWithQueryParamsAsyncWithHttpInfo($query, $user, $contentType) + return $this->testBodyWithQueryParamsAsyncWithHttpInfo($param_query, $user, $contentType) ->then( function ($response) { return $response[0]; @@ -5059,17 +5059,17 @@ function ($response) { /** * Operation testBodyWithQueryParamsAsyncWithHttpInfo * - * @param string $query (required) + * @param string $param_query (required) * @param \OpenAPI\Client\Model\User $user (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testBodyWithQueryParams'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function testBodyWithQueryParamsAsyncWithHttpInfo($query, $user, string $contentType = self::contentTypes['testBodyWithQueryParams'][0]) + public function testBodyWithQueryParamsAsyncWithHttpInfo($param_query, $user, string $contentType = self::contentTypes['testBodyWithQueryParams'][0]) { $returnType = ''; - $request = $this->testBodyWithQueryParamsRequest($query, $user, $contentType); + $request = $this->testBodyWithQueryParamsRequest($param_query, $user, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -5097,20 +5097,20 @@ function ($exception) { /** * Create request for operation 'testBodyWithQueryParams' * - * @param string $query (required) + * @param string $param_query (required) * @param \OpenAPI\Client\Model\User $user (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testBodyWithQueryParams'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function testBodyWithQueryParamsRequest($query, $user, string $contentType = self::contentTypes['testBodyWithQueryParams'][0]) + public function testBodyWithQueryParamsRequest($param_query, $user, string $contentType = self::contentTypes['testBodyWithQueryParams'][0]) { - // verify the required parameter 'query' is set - if ($query === null || (is_array($query) && count($query) === 0)) { + // verify the required parameter 'param_query' is set + if ($param_query === null || (is_array($param_query) && count($param_query) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $query when calling testBodyWithQueryParams' + 'Missing the required parameter $param_query when calling testBodyWithQueryParams' ); } @@ -5131,7 +5131,7 @@ public function testBodyWithQueryParamsRequest($query, $user, string $contentTyp // query params $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( - $query, + $param_query, 'query', // param base name 'string', // openApiType 'form', // style diff --git a/samples/client/petstore/php/psr-18/docs/Api/FakeApi.md b/samples/client/petstore/php/psr-18/docs/Api/FakeApi.md index 7fff81c2a77d..8a00b45b489e 100644 --- a/samples/client/petstore/php/psr-18/docs/Api/FakeApi.md +++ b/samples/client/petstore/php/psr-18/docs/Api/FakeApi.md @@ -1034,7 +1034,7 @@ No authorization required ## `testBodyWithQueryParams()` ```php -testBodyWithQueryParams($query, $user) +testBodyWithQueryParams($param_query, $user) ``` @@ -1052,11 +1052,11 @@ $apiInstance = new OpenAPI\Client\Api\FakeApi( // This is optional, `Psr18ClientDiscovery` will be used to find http client. For instance `GuzzleHttp\Client` implements that interface new GuzzleHttp\Client() ); -$query = 'query_example'; // string +$param_query = 'param_query_example'; // string $user = new \OpenAPI\Client\Model\User(); // \OpenAPI\Client\Model\User try { - $apiInstance->testBodyWithQueryParams($query, $user); + $apiInstance->testBodyWithQueryParams($param_query, $user); } catch (Exception $e) { echo 'Exception when calling FakeApi->testBodyWithQueryParams: ', $e->getMessage(), PHP_EOL; } @@ -1066,7 +1066,7 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **query** | **string**| | + **param_query** | **string**| | **user** | [**\OpenAPI\Client\Model\User**](../Model/User.md)| | ### Return type diff --git a/samples/client/petstore/php/psr-18/lib/Api/FakeApi.php b/samples/client/petstore/php/psr-18/lib/Api/FakeApi.php index 99696f375b4b..9cb97eaed384 100644 --- a/samples/client/petstore/php/psr-18/lib/Api/FakeApi.php +++ b/samples/client/petstore/php/psr-18/lib/Api/FakeApi.php @@ -4623,31 +4623,31 @@ public function testBodyWithFileSchemaRequest($file_schema_test_class) /** * Operation testBodyWithQueryParams * - * @param string $query query (required) + * @param string $param_query param_query (required) * @param \OpenAPI\Client\Model\User $user user (required) * * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return void */ - public function testBodyWithQueryParams($query, $user) + public function testBodyWithQueryParams($param_query, $user) { - $this->testBodyWithQueryParamsWithHttpInfo($query, $user); + $this->testBodyWithQueryParamsWithHttpInfo($param_query, $user); } /** * Operation testBodyWithQueryParamsWithHttpInfo * - * @param string $query (required) + * @param string $param_query (required) * @param \OpenAPI\Client\Model\User $user (required) * * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function testBodyWithQueryParamsWithHttpInfo($query, $user) + public function testBodyWithQueryParamsWithHttpInfo($param_query, $user) { - $request = $this->testBodyWithQueryParamsRequest($query, $user); + $request = $this->testBodyWithQueryParamsRequest($param_query, $user); try { try { @@ -4689,15 +4689,15 @@ public function testBodyWithQueryParamsWithHttpInfo($query, $user) /** * Operation testBodyWithQueryParamsAsync * - * @param string $query (required) + * @param string $param_query (required) * @param \OpenAPI\Client\Model\User $user (required) * * @throws \InvalidArgumentException * @return Promise */ - public function testBodyWithQueryParamsAsync($query, $user) + public function testBodyWithQueryParamsAsync($param_query, $user) { - return $this->testBodyWithQueryParamsAsyncWithHttpInfo($query, $user) + return $this->testBodyWithQueryParamsAsyncWithHttpInfo($param_query, $user) ->then( function ($response) { return $response[0]; @@ -4708,16 +4708,16 @@ function ($response) { /** * Operation testBodyWithQueryParamsAsyncWithHttpInfo * - * @param string $query (required) + * @param string $param_query (required) * @param \OpenAPI\Client\Model\User $user (required) * * @throws \InvalidArgumentException * @return Promise */ - public function testBodyWithQueryParamsAsyncWithHttpInfo($query, $user) + public function testBodyWithQueryParamsAsyncWithHttpInfo($param_query, $user) { $returnType = ''; - $request = $this->testBodyWithQueryParamsRequest($query, $user); + $request = $this->testBodyWithQueryParamsRequest($param_query, $user); return $this->httpAsyncClient->sendAsyncRequest($request) ->then( @@ -4744,18 +4744,18 @@ function (HttpException $exception) { /** * Create request for operation 'testBodyWithQueryParams' * - * @param string $query (required) + * @param string $param_query (required) * @param \OpenAPI\Client\Model\User $user (required) * * @throws \InvalidArgumentException * @return RequestInterface */ - public function testBodyWithQueryParamsRequest($query, $user) + public function testBodyWithQueryParamsRequest($param_query, $user) { - // verify the required parameter 'query' is set - if ($query === null || (is_array($query) && count($query) === 0)) { + // verify the required parameter 'param_query' is set + if ($param_query === null || (is_array($param_query) && count($param_query) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $query when calling testBodyWithQueryParams' + 'Missing the required parameter $param_query when calling testBodyWithQueryParams' ); } // verify the required parameter 'user' is set @@ -4773,14 +4773,14 @@ public function testBodyWithQueryParamsRequest($query, $user) $multipart = false; // query params - if ($query !== null) { - if('form' === 'form' && is_array($query)) { - foreach($query as $key => $value) { + if ($param_query !== null) { + if('form' === 'form' && is_array($param_query)) { + foreach($param_query as $key => $value) { $queryParams[$key] = $value; } } else { - $queryParams['query'] = $query; + $queryParams['query'] = $param_query; } } diff --git a/samples/client/petstore/ruby-autoload/lib/petstore/api_client.rb b/samples/client/petstore/ruby-autoload/lib/petstore/api_client.rb index 8d591ea8b4ae..3c0777c9b4e8 100644 --- a/samples/client/petstore/ruby-autoload/lib/petstore/api_client.rb +++ b/samples/client/petstore/ruby-autoload/lib/petstore/api_client.rb @@ -298,9 +298,12 @@ def sanitize_filename(filename) end def build_request_url(path, opts = {}) - # Add leading and trailing slashes to path - path = "/#{path}".gsub(/\/+/, '/') - @config.base_url(opts[:operation]) + path + # Add leading and trailing slashes to path. An OpenAPI 3.2 + # `in: querystring` value is appended verbatim to `path`, so only the + # part before '?' may have its slashes collapsed. + path_only, sep, query = path.partition('?') + path_only = "/#{path_only}".gsub(/\/+/, '/') + @config.base_url(opts[:operation]) + path_only + sep + query end # Update header and query params based on authentication settings. diff --git a/samples/client/petstore/ruby-faraday/lib/petstore/api_client.rb b/samples/client/petstore/ruby-faraday/lib/petstore/api_client.rb index 6cc2169b46da..fa79f9bb8af8 100644 --- a/samples/client/petstore/ruby-faraday/lib/petstore/api_client.rb +++ b/samples/client/petstore/ruby-faraday/lib/petstore/api_client.rb @@ -342,9 +342,12 @@ def sanitize_filename(filename) end def build_request_url(path, opts = {}) - # Add leading and trailing slashes to path - path = "/#{path}".gsub(/\/+/, '/') - @config.base_url(opts[:operation]) + path + # Add leading and trailing slashes to path. An OpenAPI 3.2 + # `in: querystring` value is appended verbatim to `path`, so only the + # part before '?' may have its slashes collapsed. + path_only, sep, query = path.partition('?') + path_only = "/#{path_only}".gsub(/\/+/, '/') + @config.base_url(opts[:operation]) + path_only + sep + query end # Update header and query params based on authentication settings. diff --git a/samples/client/petstore/ruby-httpx/lib/petstore/api_client.rb b/samples/client/petstore/ruby-httpx/lib/petstore/api_client.rb index e8637abbe5d4..364c1c04a366 100644 --- a/samples/client/petstore/ruby-httpx/lib/petstore/api_client.rb +++ b/samples/client/petstore/ruby-httpx/lib/petstore/api_client.rb @@ -101,10 +101,12 @@ def build_request(http_method, path, opts = {}) update_params_for_auth! header_params, query_params, opts[:auth_names] - if %w[POST PATCH PUT DELETE].include?(http_method) + # OpenAPI 3.2 query/additionalOperations verbs may carry a body too; for + # non-standard methods we always attempt to build one (nil when absent). + if %w[POST PATCH PUT DELETE].include?(http_method) || !STANDARD_HTTP_METHODS.include?(http_method.to_s) body_params = build_request_body(header_params, form_params, opts[:body]) if config.debugging - config.logger.debug "HTTP request body param ~BEGIN~\n#{req_body}\n~END~\n" + config.logger.debug "HTTP request body param ~BEGIN~\n#{body_params}\n~END~\n" end end req_opts = { @@ -290,9 +292,12 @@ def sanitize_filename(filename) end def build_request_url(path, opts = {}) - # Add leading and trailing slashes to path - path = "/#{path}".gsub(/\/+/, '/') - @config.base_url(opts[:operation]) + path + # Add leading and trailing slashes to path. An OpenAPI 3.2 + # `in: querystring` value is appended verbatim to `path`, so only the + # part before '?' may have its slashes collapsed. + path_only, sep, query = path.partition('?') + path_only = "/#{path_only}".gsub(/\/+/, '/') + @config.base_url(opts[:operation]) + path_only + sep + query end # Update header and query params based on authentication settings. diff --git a/samples/client/petstore/ruby/lib/petstore/api_client.rb b/samples/client/petstore/ruby/lib/petstore/api_client.rb index 8d591ea8b4ae..3c0777c9b4e8 100644 --- a/samples/client/petstore/ruby/lib/petstore/api_client.rb +++ b/samples/client/petstore/ruby/lib/petstore/api_client.rb @@ -298,9 +298,12 @@ def sanitize_filename(filename) end def build_request_url(path, opts = {}) - # Add leading and trailing slashes to path - path = "/#{path}".gsub(/\/+/, '/') - @config.base_url(opts[:operation]) + path + # Add leading and trailing slashes to path. An OpenAPI 3.2 + # `in: querystring` value is appended verbatim to `path`, so only the + # part before '?' may have its slashes collapsed. + path_only, sep, query = path.partition('?') + path_only = "/#{path_only}".gsub(/\/+/, '/') + @config.base_url(opts[:operation]) + path_only + sep + query end # Update header and query params based on authentication settings. diff --git a/samples/openapi3/client/extensions/x-auth-id-alias/ruby-client/lib/x_auth_id_alias/api_client.rb b/samples/openapi3/client/extensions/x-auth-id-alias/ruby-client/lib/x_auth_id_alias/api_client.rb index 270c7fd74c43..0f180b10837e 100644 --- a/samples/openapi3/client/extensions/x-auth-id-alias/ruby-client/lib/x_auth_id_alias/api_client.rb +++ b/samples/openapi3/client/extensions/x-auth-id-alias/ruby-client/lib/x_auth_id_alias/api_client.rb @@ -298,9 +298,12 @@ def sanitize_filename(filename) end def build_request_url(path, opts = {}) - # Add leading and trailing slashes to path - path = "/#{path}".gsub(/\/+/, '/') - @config.base_url(opts[:operation]) + path + # Add leading and trailing slashes to path. An OpenAPI 3.2 + # `in: querystring` value is appended verbatim to `path`, so only the + # part before '?' may have its slashes collapsed. + path_only, sep, query = path.partition('?') + path_only = "/#{path_only}".gsub(/\/+/, '/') + @config.base_url(opts[:operation]) + path_only + sep + query end # Update header and query params based on authentication settings. diff --git a/samples/openapi3/client/features/dynamic-servers/ruby/lib/dynamic_servers/api_client.rb b/samples/openapi3/client/features/dynamic-servers/ruby/lib/dynamic_servers/api_client.rb index 5995e7c962d3..09fa20e441b1 100644 --- a/samples/openapi3/client/features/dynamic-servers/ruby/lib/dynamic_servers/api_client.rb +++ b/samples/openapi3/client/features/dynamic-servers/ruby/lib/dynamic_servers/api_client.rb @@ -297,9 +297,12 @@ def sanitize_filename(filename) end def build_request_url(path, opts = {}) - # Add leading and trailing slashes to path - path = "/#{path}".gsub(/\/+/, '/') - @config.base_url(opts[:operation]) + path + # Add leading and trailing slashes to path. An OpenAPI 3.2 + # `in: querystring` value is appended verbatim to `path`, so only the + # part before '?' may have its slashes collapsed. + path_only, sep, query = path.partition('?') + path_only = "/#{path_only}".gsub(/\/+/, '/') + @config.base_url(opts[:operation]) + path_only + sep + query end # Update header and query params based on authentication settings. diff --git a/samples/openapi3/client/features/generate-alias-as-model/ruby-client/lib/petstore/api_client.rb b/samples/openapi3/client/features/generate-alias-as-model/ruby-client/lib/petstore/api_client.rb index 69ef563c1118..c44ea9248792 100644 --- a/samples/openapi3/client/features/generate-alias-as-model/ruby-client/lib/petstore/api_client.rb +++ b/samples/openapi3/client/features/generate-alias-as-model/ruby-client/lib/petstore/api_client.rb @@ -297,9 +297,12 @@ def sanitize_filename(filename) end def build_request_url(path, opts = {}) - # Add leading and trailing slashes to path - path = "/#{path}".gsub(/\/+/, '/') - @config.base_url(opts[:operation]) + path + # Add leading and trailing slashes to path. An OpenAPI 3.2 + # `in: querystring` value is appended verbatim to `path`, so only the + # part before '?' may have its slashes collapsed. + path_only, sep, query = path.partition('?') + path_only = "/#{path_only}".gsub(/\/+/, '/') + @config.base_url(opts[:operation]) + path_only + sep + query end # Update header and query params based on authentication settings. From 7ab9da53d49341287953d526e9f42dae7f21ac02 Mon Sep 17 00:00:00 2001 From: khayashi4337 Date: Thu, 24 Sep 2026 13:08:30 +0900 Subject: [PATCH 24/31] fix(codegen): limit form required flags to the allOf chain MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit bc20a2c12d3 regressed a case the old code avoided by accident: for a form schema carrying both `properties`/`required` and oneOf/anyOf branches, ModelUtils.isOneOf/isAnyOf returns false (they require empty properties), so every property fell into the allOf-required path — and because addProperties unions the required lists of oneOf/anyOf alternatives too, branch-only fields were wrongly forced required. Keep collecting properties via addProperties but compute the effective required set with a dedicated traversal that only follows the schema's own required list and the allOf chain (resolving $ref, and starting from the pre-unwrap schema so a single-allOf wrapper's own required is covered). oneOf/anyOf branch requireds no longer force form fields. Note for users: this intentionally changes generated form-parameter signatures — fields required only inside a oneOf/anyOf alternative are now optional, matching the schema semantics. Specs where a renamed parameter (snake_case, collision) is required via allOf keep the fix from bc20a2c12d3 and stay required. Generated with [Devin](https://devin.ai) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com> --- .../openapitools/codegen/DefaultCodegen.java | 42 +++++++++++++--- .../codegen/DefaultCodegenTest.java | 43 ++++++++++++++++ .../resources/3_0/form-allof-required.yaml | 50 +++++++++++++++++++ 3 files changed, 128 insertions(+), 7 deletions(-) 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 7e5705349789..2ac94049e024 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 @@ -4033,6 +4033,31 @@ protected void addProperties(Map properties, List requir } } + /** + * Collects {@code required} entries only along the schema's own list and + * its allOf members (a single-allOf wrapper included), resolving $ref. + * Unlike {@link #addProperties}, oneOf/anyOf branches are not traversed: + * a branch's required entries only hold if that branch is chosen, so they + * must not force fields on the enclosing shape. + */ + private void collectRequiredFromAllOfChain(Schema schema, List required, Set visitedSchemas) { + if (schema == null || !visitedSchemas.add(schema)) { + return; + } + if (StringUtils.isNotBlank(schema.get$ref())) { + collectRequiredFromAllOfChain(ModelUtils.getReferencedSchema(this.openAPI, schema), required, visitedSchemas); + return; + } + if (schema.getRequired() != null) { + required.addAll(schema.getRequired()); + } + if (schema.getAllOf() != null) { + for (Object component : schema.getAllOf()) { + collectRequiredFromAllOfChain((Schema) component, required, visitedSchemas); + } + } + } + /** * Camelize the method name of the getter and setter * @@ -7898,7 +7923,14 @@ public List fromRequestBodyToFormParameters(RequestBody body, // TODO in the future have this return one codegenParameter of type object or composed which includes all definition // that will be needed for complex composition use cases // https://github.com/OpenAPITools/openapi-generator/issues/10415 - addProperties(properties, allRequired, schema, new HashSet<>()); + addProperties(properties, new ArrayList<>(), schema, new HashSet<>()); + // addProperties unions the required list of every composed member, + // including oneOf/anyOf alternatives whose required entries only hold + // when that branch is chosen. For form parameters only the schema's own + // required list and the ones along the allOf chain are real + // requirements, so collect them separately. Starting from the original + // (pre-unwrap) schema also picks up a single-allOf wrapper's required. + collectRequiredFromAllOfChain(original != null ? original : schema, allRequired, new HashSet<>()); boolean isOneOfOrAnyOf = ModelUtils.isOneOf(schema) || ModelUtils.isAnyOf(schema); @@ -7918,12 +7950,8 @@ public List fromRequestBodyToFormParameters(RequestBody body, } else if (!codegenParameter.required) { // 'required' applies to the schema property name (baseName); comparing // against the normalized paramName would silently drop the flag for - // e.g. snake_case names or collision-renamed parameters. allRequired - // already unions the top-level and allOf-member 'required' lists, and - // 'original' covers a single-allOf wrapper's own required list. - codegenParameter.required = allRequired.contains(entry.getKey()) - || (original != null && original.getRequired() != null - && original.getRequired().contains(entry.getKey())); + // e.g. snake_case names or collision-renamed parameters. + codegenParameter.required = allRequired.contains(entry.getKey()); } parameters.add(codegenParameter); diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/DefaultCodegenTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/DefaultCodegenTest.java index a38ac6ac57cc..48187ec28298 100644 --- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/DefaultCodegenTest.java +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/DefaultCodegenTest.java @@ -433,6 +433,49 @@ public void testTopLevelRequiredDoesNotMaskAllOfMemberRequired() { "non-required member stays optional"); } + @Test + public void testOneOfBranchesDoNotForceFormRequired() { + // a schema carrying both `properties`/`required` and oneOf branches is not + // caught by ModelUtils.isOneOf (which requires empty properties); without + // care the allOf-style required union would also force branch-only fields + final OpenAPI openAPI = TestUtils.parseSpec("src/test/resources/3_0/form-allof-required.yaml"); + + final DefaultCodegen codegen = new DefaultCodegen(); + codegen.setOpenAPI(openAPI); + + RequestBody requestBody = openAPI.getPaths().get("/register-mixed").getPost().getRequestBody(); + List formParams = codegen.fromRequestBodyToFormParameters(requestBody, new HashSet<>()); + Map paramsByBaseName = formParams.stream() + .collect(Collectors.toMap(param -> param.baseName, param -> param)); + + assertTrue(paramsByBaseName.get("common").required, + "top-level required must apply"); + assertFalse(paramsByBaseName.get("a").required, + "oneOf branch required must not force the form parameter"); + assertFalse(paramsByBaseName.get("b").required, + "oneOf branch required must not force the form parameter"); + } + + @Test + public void testSingleAllOfWrapperOwnRequired() { + // the single-allOf unwrapping keeps the wrapper schema in `original`; its + // own `required` list must still apply to member properties + final OpenAPI openAPI = TestUtils.parseSpec("src/test/resources/3_0/form-allof-required.yaml"); + + final DefaultCodegen codegen = new DefaultCodegen(); + codegen.setOpenAPI(openAPI); + + RequestBody requestBody = openAPI.getPaths().get("/register-wrapper").getPost().getRequestBody(); + List formParams = codegen.fromRequestBodyToFormParameters(requestBody, new HashSet<>()); + Map paramsByBaseName = formParams.stream() + .collect(Collectors.toMap(param -> param.baseName, param -> param)); + + assertTrue(paramsByBaseName.get("wrapper_req").required, + "allOf wrapper's own required must apply"); + assertFalse(paramsByBaseName.get("wrapper_opt").required, + "non-required member stays optional"); + } + @Test public void testOriginalOpenApiDocumentVersion() { // Test with OAS 2.0 document. diff --git a/modules/openapi-generator/src/test/resources/3_0/form-allof-required.yaml b/modules/openapi-generator/src/test/resources/3_0/form-allof-required.yaml index 51e37375e6e2..a140012ff541 100644 --- a/modules/openapi-generator/src/test/resources/3_0/form-allof-required.yaml +++ b/modules/openapi-generator/src/test/resources/3_0/form-allof-required.yaml @@ -55,3 +55,53 @@ paths: responses: '200': description: ok + /register-mixed: + post: + operationId: registerMixed + requestBody: + required: true + content: + application/x-www-form-urlencoded: + schema: + type: object + required: + - common + properties: + common: + type: string + oneOf: + - type: object + required: + - a + properties: + a: + type: string + - type: object + required: + - b + properties: + b: + type: string + responses: + '200': + description: ok + /register-wrapper: + post: + operationId: registerWrapper + requestBody: + required: true + content: + application/x-www-form-urlencoded: + schema: + required: + - wrapper_req + allOf: + - type: object + properties: + wrapper_req: + type: string + wrapper_opt: + type: string + responses: + '200': + description: ok From 19694ac2267893de6ab71b1a9038c34e77ddbcd2 Mon Sep 17 00:00:00 2001 From: khayashi4337 Date: Thu, 24 Sep 2026 13:33:31 +0900 Subject: [PATCH 25/31] fix(kotlin-client): qualify inherited member refs and revert spring date-call qualification Follow-up fixes for the member-collision work: - jvm-ktor and multiplatform emitted bare calls to the inherited request()/jsonRequest()/urlEncodedFormRequest()/multipartFormRequest() ApiClient members, so a spec parameter named `request` (or matching a member) shadowed the call. Qualify them with `this.`. - jvm-vertx rebound member names in `?.let { accessToken ->` lambda bindings; rename the bindings to the localVariable prefix so a bare member name is always a real violation. - jvm-spring-restclient/webclient: revert the package-qualified {{packageName}}.infrastructure.parseDateToQueryString() back to a bare call. Kotlin resolves a call site to the function even when a value parameter shares its name, and a package-qualified call breaks when a parameter is named `org` (first segment of the default package). Regression params `parseDateToQueryString` and `org` added to the kotlin-member-collision fixture; generated spring clients compile. - Add a lint test that mechanically extracts val/var member names from each library's ApiClient constructor (volley: its own class header) and fails on any bare `name` occurrence inside api.mustache's {{#operation}} block or the operation partials, unless this./this@ qualified. Verified by mutation: a bare `basePath` reference fails. - Assert ktor/multiplatform emit this.request/this.jsonRequest/ this.urlEncodedFormRequest alongside the spec `request` parameter. - Copy spring/reactor jars into target/kotlin-capture-deps so the generated spring clients can be compiled by the external kotlinc without adding 2.x-metadata jars to the shared test classpath. - Correct the collision-guard comment in AbstractKotlinCodegen. Regenerate kotlin samples (bare spring calls restored; this.request() emitted by ktor/multiplatform; localVariable* let-bindings in vertx). Generated with [Devin](https://devin.ai) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com> --- modules/openapi-generator/pom.xml | 64 +++++ .../languages/AbstractKotlinCodegen.java | 12 +- .../libraries/jvm-ktor/api.mustache | 2 +- .../jvm-spring-restclient/api.mustache | 6 +- .../jvm-spring-webclient/api.mustache | 6 +- .../libraries/jvm-vertx/api.mustache | 14 +- .../libraries/multiplatform/api.mustache | 2 +- .../kotlin/KotlinClientCodegenApiTest.java | 254 +++++++++++++++--- .../3_0/kotlin/kotlin-member-collision.yaml | 6 + .../org/openapitools/client/apis/QueryApi.kt | 4 +- .../org/openapitools/client/apis/QueryApi.kt | 4 +- .../openapitools/client/apis/DefaultApi.kt | 2 +- .../openapitools/client/apis/DefaultApi.kt | 2 +- .../openapitools/client/apis/DefaultApi.kt | 2 +- .../openapitools/client/apis/DefaultApi.kt | 2 +- .../openapitools/client/apis/DefaultApi.kt | 2 +- .../org/openapitools/client/apis/FakeApi.kt | 4 +- .../org/openapitools/client/apis/PetApi.kt | 16 +- .../org/openapitools/client/apis/StoreApi.kt | 8 +- .../org/openapitools/client/apis/UserApi.kt | 16 +- .../org/openapitools/client/apis/PetApi.kt | 16 +- .../org/openapitools/client/apis/StoreApi.kt | 8 +- .../org/openapitools/client/apis/UserApi.kt | 16 +- .../org/openapitools/client/apis/PetApi.kt | 16 +- .../org/openapitools/client/apis/StoreApi.kt | 8 +- .../org/openapitools/client/apis/UserApi.kt | 16 +- .../org/openapitools/client/apis/PetApi.kt | 28 +- .../org/openapitools/client/apis/PetApi.kt | 28 +- .../org/openapitools/client/apis/PetApi.kt | 28 +- .../org/openapitools/client/apis/PetApi.kt | 28 +- .../org/openapitools/client/apis/BirdApi.kt | 4 +- .../org/openapitools/client/apis/BirdApi.kt | 4 +- .../org/openapitools/client/apis/PetApi.kt | 16 +- .../org/openapitools/client/apis/StoreApi.kt | 8 +- .../org/openapitools/client/apis/UserApi.kt | 16 +- .../org/openapitools/client/apis/PetApi.kt | 16 +- .../org/openapitools/client/apis/StoreApi.kt | 8 +- .../org/openapitools/client/apis/UserApi.kt | 16 +- 38 files changed, 479 insertions(+), 229 deletions(-) diff --git a/modules/openapi-generator/pom.xml b/modules/openapi-generator/pom.xml index 33c30f2b0887..2eb8a3296d06 100644 --- a/modules/openapi-generator/pom.xml +++ b/modules/openapi-generator/pom.xml @@ -140,6 +140,70 @@ moshi-adapters 1.15.2 + + + org.springframework + spring-web + 6.2.10 + + + org.springframework + spring-core + 6.2.10 + + + org.springframework + spring-jcl + 6.2.10 + + + org.springframework + spring-webflux + 6.2.10 + + + io.projectreactor + reactor-core + 3.7.10 + + + org.reactivestreams + reactive-streams + 1.0.4 + + + io.micrometer + micrometer-observation + 1.14.10 + + + io.micrometer + micrometer-commons + 1.14.10 + + + com.fasterxml.jackson.core + jackson-databind + 2.22.1 + + + com.fasterxml.jackson.core + jackson-core + 2.22.1 + + + com.fasterxml.jackson.core + jackson-annotations + 2.22 + + + com.fasterxml.jackson.module + jackson-module-kotlin + 2.21.5 + ${project.build.directory}/kotlin-capture-deps 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 70140fe42276..96521fd9c679 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 @@ -1126,11 +1126,13 @@ public String toParamName(String name) { } String paramName = toVariableName(name); - // All generated api-function locals use the `localVar`/`localVariable` - // prefix (enforced by a template lint test). Compare the *normalized* - // name against that prefix so spelling variants (local_variable_body, - // LocalVariableBody, ...) cannot slip through and collide downstream, - // and future template locals are covered without maintaining a list. + // Statement-level `val`/`var` locals declared in operation templates + // use the `localVar`/`localVariable` prefix (enforced by a template + // lint test; lambda bindings such as `it` are outside that rule). + // Compare the *normalized* name against that prefix so spelling + // variants (local_variable_body, LocalVariableBody, ...) cannot slip + // through and collide downstream, and future template locals are + // covered without maintaining a list. if (paramName.startsWith("localVar")) { return toVariableName("param_" + name); } 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 3a830ca88390..7c6b28238e37 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 @@ -182,7 +182,7 @@ import com.fasterxml.jackson.databind.ObjectMapper requiresAuthentication = {{#hasAuthMethods}}true{{/hasAuthMethods}}{{^hasAuthMethods}}false{{/hasAuthMethods}}, ) - return {{#hasBodyParam}}jsonRequest{{/hasBodyParam}}{{^hasBodyParam}}{{#hasFormParams}}{{#isMultipart}}multipartFormRequest{{/isMultipart}}{{^isMultipart}}urlEncodedFormRequest{{/isMultipart}}{{/hasFormParams}}{{^hasFormParams}}request{{/hasFormParams}}{{/hasBodyParam}}( + return {{#hasBodyParam}}this.jsonRequest{{/hasBodyParam}}{{^hasBodyParam}}{{#hasFormParams}}{{#isMultipart}}this.multipartFormRequest{{/isMultipart}}{{^isMultipart}}this.urlEncodedFormRequest{{/isMultipart}}{{/hasFormParams}}{{^hasFormParams}}this.request{{/hasFormParams}}{{/hasBodyParam}}( localVariableConfig, localVariableBody, localVariableAuthNames 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 6f2e7a5537dc..8a5ebb536dd1 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 @@ -116,17 +116,17 @@ import {{packageName}}.infrastructure.* {{#queryParams}} {{^required}} if ({{{paramName}}} != null) { - put("{{baseName}}", {{#isContainer}}toMultiValue({{{paramName}}}.toList(), "{{collectionFormat}}"){{/isContainer}}{{^isContainer}}listOf({{#isDateTime}}{{packageName}}.infrastructure.parseDateToQueryString<{{{dataType}}}>({{{paramName}}}){{/isDateTime}}{{#isDate}}{{packageName}}.infrastructure.parseDateToQueryString<{{{dataType}}}>({{{paramName}}}){{/isDate}}{{^isDateTime}}{{^isDate}}{{{paramName}}}.toString(){{/isDate}}{{/isDateTime}}){{/isContainer}}) + 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}}) } {{/required}} {{#required}} {{#isNullable}} if ({{{paramName}}} != null) { - put("{{baseName}}", {{#isContainer}}toMultiValue({{{paramName}}}.toList(), "{{collectionFormat}}"){{/isContainer}}{{^isContainer}}listOf({{#isDateTime}}{{packageName}}.infrastructure.parseDateToQueryString<{{{dataType}}}>({{{paramName}}}){{/isDateTime}}{{#isDate}}{{packageName}}.infrastructure.parseDateToQueryString<{{{dataType}}}>({{{paramName}}}){{/isDate}}{{^isDateTime}}{{^isDate}}{{{paramName}}}.toString(){{/isDate}}{{/isDateTime}}){{/isContainer}}) + 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}}) } {{/isNullable}} {{^isNullable}} - put("{{baseName}}", {{#isContainer}}toMultiValue({{{paramName}}}.toList(), "{{collectionFormat}}"){{/isContainer}}{{^isContainer}}listOf({{#isDateTime}}{{packageName}}.infrastructure.parseDateToQueryString<{{{dataType}}}>({{{paramName}}}){{/isDateTime}}{{#isDate}}{{packageName}}.infrastructure.parseDateToQueryString<{{{dataType}}}>({{{paramName}}}){{/isDate}}{{^isDateTime}}{{^isDate}}{{{paramName}}}.toString(){{/isDate}}{{/isDateTime}}){{/isContainer}}) + 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}}) {{/isNullable}} {{/required}} {{/queryParams}} 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 feafa6468c98..b9aae408a8bc 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}}{{packageName}}.infrastructure.parseDateToQueryString<{{{dataType}}}>({{{paramName}}}){{/isDateTime}}{{#isDate}}{{packageName}}.infrastructure.parseDateToQueryString<{{{dataType}}}>({{{paramName}}}){{/isDate}}{{^isDateTime}}{{^isDate}}{{{paramName}}}.toString(){{/isDate}}{{/isDateTime}}){{/isContainer}}) + 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}}) } {{/required}} {{#required}} {{#isNullable}} if ({{{paramName}}} != null) { - put("{{baseName}}", {{#isContainer}}toMultiValue({{{paramName}}}.toList(), "{{collectionFormat}}"){{/isContainer}}{{^isContainer}}listOf({{#isDateTime}}{{packageName}}.infrastructure.parseDateToQueryString<{{{dataType}}}>({{{paramName}}}){{/isDateTime}}{{#isDate}}{{packageName}}.infrastructure.parseDateToQueryString<{{{dataType}}}>({{{paramName}}}){{/isDate}}{{^isDateTime}}{{^isDate}}{{{paramName}}}.toString(){{/isDate}}{{/isDateTime}}){{/isContainer}}) + 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}}) } {{/isNullable}} {{^isNullable}} - put("{{baseName}}", {{#isContainer}}toMultiValue({{{paramName}}}.toList(), "{{collectionFormat}}"){{/isContainer}}{{^isContainer}}listOf({{#isDateTime}}{{packageName}}.infrastructure.parseDateToQueryString<{{{dataType}}}>({{{paramName}}}){{/isDateTime}}{{#isDate}}{{packageName}}.infrastructure.parseDateToQueryString<{{{dataType}}}>({{{paramName}}}){{/isDate}}{{^isDateTime}}{{^isDate}}{{{paramName}}}.toString(){{/isDate}}{{/isDateTime}}){{/isContainer}}) + 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}}) {{/isNullable}} {{/required}} {{/queryParams}} 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 db7cb1843031..418852836a8d 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 @@ -184,21 +184,21 @@ import {{packageName}}.infrastructure.* {{/isApiKey}} {{#isBasic}} {{#isBasicBasic}} - this.username?.let { username -> - this.password?.let { password -> - localVariableRequest.basicAuthentication(username, password) + this.username?.let { localVariableUsername -> + this.password?.let { localVariablePassword -> + localVariableRequest.basicAuthentication(localVariableUsername, localVariablePassword) } } {{/isBasicBasic}} {{#isBasicBearer}} - this.accessToken?.let { accessToken -> - localVariableRequest.bearerTokenAuthentication(accessToken) + this.accessToken?.let { localVariableAccessToken -> + localVariableRequest.bearerTokenAuthentication(localVariableAccessToken) } {{/isBasicBearer}} {{/isBasic}} {{#isOAuth}} - this.accessToken?.let { accessToken -> - localVariableRequest.bearerTokenAuthentication(accessToken) + this.accessToken?.let { localVariableAccessToken -> + localVariableRequest.bearerTokenAuthentication(localVariableAccessToken) } {{/isOAuth}} {{/authMethods}} 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 82f266017caf..b49ef667bef1 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 @@ -128,7 +128,7 @@ import kotlinx.serialization.encoding.* requiresAuthentication = {{#hasAuthMethods}}true{{/hasAuthMethods}}{{^hasAuthMethods}}false{{/hasAuthMethods}}, ) - return {{#hasBodyParam}}jsonRequest{{/hasBodyParam}}{{^hasBodyParam}}{{#hasFormParams}}{{#isMultipart}}multipartFormRequest{{/isMultipart}}{{^isMultipart}}urlEncodedFormRequest{{/isMultipart}}{{/hasFormParams}}{{^hasFormParams}}request{{/hasFormParams}}{{/hasBodyParam}}( + return {{#hasBodyParam}}this.jsonRequest{{/hasBodyParam}}{{^hasBodyParam}}{{#hasFormParams}}{{#isMultipart}}this.multipartFormRequest{{/isMultipart}}{{^isMultipart}}this.urlEncodedFormRequest{{/isMultipart}}{{/hasFormParams}}{{^hasFormParams}}this.request{{/hasFormParams}}{{/hasBodyParam}}( localVariableConfig, localVariableBody, localVariableAuthNames diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/kotlin/KotlinClientCodegenApiTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/kotlin/KotlinClientCodegenApiTest.java index 508db61b574e..f453a34d82b6 100644 --- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/kotlin/KotlinClientCodegenApiTest.java +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/kotlin/KotlinClientCodegenApiTest.java @@ -21,7 +21,10 @@ import java.nio.file.Paths; import java.util.ArrayList; import java.util.Arrays; +import java.util.Collections; import java.util.List; +import java.util.Set; +import java.util.TreeSet; import java.util.regex.Matcher; import java.util.regex.Pattern; import java.util.stream.Collectors; @@ -464,18 +467,14 @@ void testKotlinLibrariesAvoidTemplateLocalCollisions() throws IOException { "jvm-spring-restclient: result local must be prefixed"); Assert.assertTrue(api.contains("val localVariableParams ="), "jvm-spring-restclient: params local must be prefixed"); - // parseDateToQueryString is top-level in spring infra, so it must be - // package-qualified (not `this.`) to survive a same-named parameter - Assert.assertTrue(api.contains(".infrastructure.parseDateToQueryString(dueDate)"), - "jvm-spring-restclient: date conversion must call the top-level helper"); + assertBareDateConversion(api, "jvm-spring-restclient"); break; case "jvm-spring-webclient": Assert.assertTrue(api.contains("this.request<"), "jvm-spring-webclient: member request() must be qualified"); Assert.assertTrue(api.contains("val localVariableParams ="), "jvm-spring-webclient: params local must be prefixed"); - Assert.assertTrue(api.contains(".infrastructure.parseDateToQueryString(dueDate)"), - "jvm-spring-webclient: date conversion must call the top-level helper"); + assertBareDateConversion(api, "jvm-spring-webclient"); break; case "jvm-okhttp4": // pre-existing locals keep their localVar* spelling @@ -487,6 +486,18 @@ void testKotlinLibrariesAvoidTemplateLocalCollisions() throws IOException { Assert.assertTrue(api.contains("this@DefaultApi.encodeURIComponent(path.toString())"), "jvm-okhttp4: path encoding must reach the api class"); break; + case "jvm-ktor": + case "multiplatform": + // request()/jsonRequest()/urlEncodedFormRequest() are + // inherited ApiClient members; a spec `request` param + // must not shadow them + for (String member : new String[]{"this.request(", "this.jsonRequest(", + "this.urlEncodedFormRequest("}) { + Assert.assertTrue(api.contains(member), lib[0] + " must qualify " + member); + } + Assert.assertTrue(api.contains("request: kotlin.String?"), + lib[0] + ": spec param `request` must keep its name"); + break; default: break; } @@ -496,6 +507,22 @@ void testKotlinLibrariesAvoidTemplateLocalCollisions() throws IOException { } } + /** + * Spring's parseDateToQueryString is a top-level function, and Kotlin + * resolves a call site to the function even when a value parameter shares + * its name — so no qualification is wanted at all. A package-qualified + * call would actually break whenever a parameter is named `org` (the + * first segment of the default package), which the fixture exercises. + */ + private void assertBareDateConversion(String api, String lib) { + Assert.assertTrue(api.contains("listOf(parseDateToQueryString(dueDate))"), + lib + ": date conversion must be an unqualified call"); + Assert.assertFalse(api.contains("infrastructure.parseDateToQueryString"), + lib + ": date conversion must not be package-qualified"); + Assert.assertFalse(api.contains("this.parseDateToQueryString"), + lib + ": date conversion must not be this-qualified"); + } + /** * Lint guard for issue #15: every `val`/`var` declared at statement level in * an operation template must use the `localVar` prefix, so spec parameters @@ -524,6 +551,108 @@ void testKotlinApiTemplatesUseLocalVariablePrefix() throws IOException { "operation-scope locals must use the localVar prefix:\n" + String.join("\n", violations)); } + /** + * Lint guard (issue #15, G1): every val/var member inherited from the + * library's ApiClient must be referenced as `this.`/`this@` inside the + * operation body, otherwise a spec parameter with the same name would + * silently shadow the member. Member names are extracted mechanically + * from the ApiClient constructor (volley: the api class's own header), + * and the same set is checked against api.mustache's {{#operation}} + * block plus the partial templates spliced into it. Comments and + * mustache tags are stripped first; template lambda bindings use the + * localVariable prefix so a bare member name is always a violation. + */ + @Test + void testKotlinApiTemplatesQualifyInheritedMembers() throws IOException { + Path libs = Path.of("src/main/resources/kotlin-client/libraries"); + String[][] libraries = { + {"jvm-ktor", "infrastructure/ApiClient.kt.mustache"}, + {"jvm-okhttp", "infrastructure/ApiClient.kt.mustache"}, + {"jvm-retrofit2", "infrastructure/ApiClient.kt.mustache"}, + {"jvm-spring-restclient", "infrastructure/ApiClient.kt.mustache"}, + {"jvm-spring-webclient", "infrastructure/ApiClient.kt.mustache"}, + {"jvm-vertx", "infrastructure/ApiClient.kt.mustache"}, + {"jvm-volley", "api.mustache"}, + {"multiplatform", "infrastructure/ApiClient.kt.mustache"}, + }; + Pattern operationBlock = Pattern.compile("\\{\\{#operation\\}\\}(.*)\\{\\{/operation\\}\\}", Pattern.DOTALL); + Pattern mustacheTag = Pattern.compile("\\{\\{\\{[^}]*\\}\\}\\}|\\{\\{[^}]*\\}\\}"); + List violations = new ArrayList<>(); + for (String[] library : libraries) { + Path libDir = libs.resolve(library[0]); + Set members = constructorMemberNames(libDir.resolve(library[1])); + Assert.assertFalse(members.isEmpty(), library[0] + ": no ApiClient constructor members extracted"); + List targets = new ArrayList<>(); + try (var stream = Files.list(libDir)) { + for (Path p : stream.filter(p -> p.getFileName().toString().equals("api.mustache") + || p.getFileName().toString().matches("(queryParams|queryParam|explodedQueryParam|pathParams|headerParams|bodyParams|formParams|paramJavadoc)\\.mustache")).toList()) { + targets.add(p); + } + } + for (Path target : targets) { + String source = Files.readString(target, StandardCharsets.UTF_8); + // restrict api.mustache to the operation block; partials are + // operation-scope by construction + if (target.getFileName().toString().equals("api.mustache")) { + Matcher op = operationBlock.matcher(source); + if (!op.find()) { + violations.add(target + ": no {{#operation}} block found"); + continue; + } + source = op.group(1); + } + int lineNo = 0; + for (String line : source.split("\n", -1)) { + lineNo++; + String code = mustacheTag.matcher(line).replaceAll(""); + String trimmed = code.strip(); + if (trimmed.startsWith("*") || trimmed.startsWith("//")) { + continue; + } + for (String member : members) { + if (Pattern.compile("(? constructorMemberNames(Path template) throws IOException { + String source = Files.readString(template, StandardCharsets.UTF_8); + Matcher cls = Pattern.compile("class\\s+[^\\s(]+\\s*\\(").matcher(source); + if (!cls.find()) { + return Collections.emptySet(); + } + int depth = 1; + int end = cls.end(); + while (end < source.length() && depth > 0) { + char c = source.charAt(end); + if (c == '(') { + depth++; + } else if (c == ')') { + depth--; + } + end++; + } + String ctor = source.substring(cls.end(), end - 1) + .replaceAll("\\{\\{[^}]*\\}\\}", ""); + Set names = new TreeSet<>(); + Matcher m = Pattern.compile("\\b(?:val|var)\\s+([a-zA-Z_]\\w*)").matcher(ctor); + while (m.find()) { + names.add(m.group(1)); + } + return names; + } + @Test void testNonOkhttpLibrariesSkipOpenApi32Operations() throws IOException { Path target = Files.createTempDirectory("kotlin32-skip"); @@ -579,38 +708,8 @@ void testJvmOkhttp4SkipsInvalidMethodToken() throws IOException { */ @Test void testJvmOkhttp4GeneratedClientSendsVerbatimMethods() throws IOException, InterruptedException { - Path kotlinc = findOnPath("kotlinc"); - if (kotlinc == null) { - throw new org.testng.SkipException("kotlinc is not on PATH; skipping generated-client verification"); - } - // PATH may hold a symlink into the install; resolve it so lib/ is found correctly - kotlinc = kotlinc.toRealPath(); - // okhttp5/moshi jars are copied out-of-band by maven-dependency-plugin - // (kotlin-capture-deps): they carry Kotlin 1.8+/2.x metadata that the - // embedded 1.6 compiler in KotlinTestUtils cannot read, so they must - // never sit on the shared test classpath - Path depDir = Path.of("target/kotlin-capture-deps"); - List jars; - try (var stream = Files.list(depDir)) { - jars = stream.filter(p -> p.toString().endsWith(".jar")) - .map(p -> p.toAbsolutePath().toString()) - .collect(Collectors.toCollection(ArrayList::new)); - } catch (IOException e) { - throw new org.testng.SkipException("kotlin-capture-deps missing (dependency:copy did not run): " + e); - } - if (jars.size() < 5) { - throw new org.testng.SkipException("expected okhttp/okio/moshi jars in " + depDir + ", found " + jars); - } - // use the stdlib/reflect bundled with the detected kotlinc so versions match - // the compiler (the module's own test classpath pins an older kotlin.version) - Path kotlincLib = kotlinc.getParent().getParent().resolve("lib"); - for (String name : new String[]{"kotlin-stdlib.jar", "kotlin-reflect.jar"}) { - Path jar = kotlincLib.resolve(name); - if (!Files.exists(jar)) { - throw new org.testng.SkipException("kotlinc lib dir lacks " + name + ": " + kotlincLib); - } - jars.add(jar.toString()); - } + Path kotlinc = requireKotlinc(); + List jars = captureDepJars(kotlinc); Path target = Files.createTempDirectory("kotlin32-verify"); try { @@ -642,6 +741,85 @@ void testJvmOkhttp4GeneratedClientSendsVerbatimMethods() throws IOException, Int } } + /** + * Issue #15 regression: a spec parameter named `org` breaks a + * package-qualified parseDateToQueryString call (the qualifier resolves + * against the parameter, not the package). The call is intentionally + * unqualified — Kotlin prefers the function over a value parameter at a + * call site — and both spring libraries must compile as-is with kotlinc, + * alongside colliding parameters (`org`, `parseDateToQueryString`, + * `request`, ...). Skipped when kotlinc or the copied deps are missing. + */ + @Test + void testJvmSpringGeneratedClientsCompileWithCollidingParams() throws IOException, InterruptedException { + Path kotlinc = requireKotlinc(); + List jars = captureDepJars(kotlinc); + String classPath = String.join(File.pathSeparator, jars); + + String[][] libraries = { + {"jvm-spring-restclient", "serializationLibrary=jackson", "useSpringBoot3=true"}, + {"jvm-spring-webclient", "serializationLibrary=jackson", "useSpringBoot3=true"}, + }; + for (String[] lib : libraries) { + Path target = Files.createTempDirectory("kotlin-spring-compile-" + lib[0]); + try { + generate(lib[0], "src/test/resources/3_0/kotlin/kotlin-member-collision.yaml", + target, Arrays.copyOfRange(lib, 1, lib.length)); + List sources = Files.walk(target.resolve("src/main/kotlin")) + .filter(p -> p.toString().endsWith(".kt")) + .map(Path::toString) + .collect(Collectors.toList()); + Assert.assertFalse(sources.isEmpty(), lib[0] + " produced no kotlin sources"); + List compile = new ArrayList<>(List.of( + kotlinc.toString(), "-cp", classPath, "-d", + target.resolve("classes").toString(), "-jvm-target", "17")); + compile.addAll(sources); + runProcess(target, "kotlinc.log", 300, compile.toArray(new String[0])); + } finally { + deleteRecursively(target); + } + } + } + + private static Path requireKotlinc() throws IOException { + Path kotlinc = findOnPath("kotlinc"); + if (kotlinc == null) { + throw new org.testng.SkipException("kotlinc is not on PATH; skipping generated-client verification"); + } + // PATH may hold a symlink into the install; resolve it so lib/ is found correctly + return kotlinc.toRealPath(); + } + + private static List captureDepJars(Path kotlinc) { + // okhttp5/moshi/spring jars are copied out-of-band by + // maven-dependency-plugin (kotlin-capture-deps): they carry Kotlin + // 1.8+/2.x metadata that the embedded 1.6 compiler in KotlinTestUtils + // cannot read, so they must never sit on the shared test classpath + Path depDir = Path.of("target/kotlin-capture-deps"); + List jars; + try (var stream = Files.list(depDir)) { + jars = stream.filter(p -> p.toString().endsWith(".jar")) + .map(p -> p.toAbsolutePath().toString()) + .collect(Collectors.toCollection(ArrayList::new)); + } catch (IOException e) { + throw new org.testng.SkipException("kotlin-capture-deps missing (dependency:copy did not run): " + e); + } + if (jars.size() < 5) { + throw new org.testng.SkipException("expected okhttp/okio/moshi/spring jars in " + depDir + ", found " + jars); + } + // use the stdlib/reflect bundled with the detected kotlinc so versions match + // the compiler (the module's own test classpath pins an older kotlin.version) + Path kotlincLib = kotlinc.getParent().getParent().resolve("lib"); + for (String name : new String[]{"kotlin-stdlib.jar", "kotlin-reflect.jar"}) { + Path jar = kotlincLib.resolve(name); + if (!Files.exists(jar)) { + throw new org.testng.SkipException("kotlinc lib dir lacks " + name + ": " + kotlincLib); + } + jars.add(jar.toString()); + } + return jars; + } + private static void generate(String library, String spec, Path outputDir, String... additionalProperties) { final CodegenConfigurator configurator = new CodegenConfigurator() .setGeneratorName("kotlin") diff --git a/modules/openapi-generator/src/test/resources/3_0/kotlin/kotlin-member-collision.yaml b/modules/openapi-generator/src/test/resources/3_0/kotlin/kotlin-member-collision.yaml index 83454fc55b4c..ee1cfa9dd443 100644 --- a/modules/openapi-generator/src/test/resources/3_0/kotlin/kotlin-member-collision.yaml +++ b/modules/openapi-generator/src/test/resources/3_0/kotlin/kotlin-member-collision.yaml @@ -95,6 +95,12 @@ paths: - name: encodeURIComponent in: query schema: {type: string} + - name: parseDateToQueryString + in: query + schema: {type: string} + - name: org + in: query + schema: {type: string} - name: body in: query schema: {type: string} diff --git a/samples/client/echo_api/kotlin-jvm-spring-3-restclient/src/main/kotlin/org/openapitools/client/apis/QueryApi.kt b/samples/client/echo_api/kotlin-jvm-spring-3-restclient/src/main/kotlin/org/openapitools/client/apis/QueryApi.kt index 556c019df1ca..701272d4e1ed 100644 --- a/samples/client/echo_api/kotlin-jvm-spring-3-restclient/src/main/kotlin/org/openapitools/client/apis/QueryApi.kt +++ b/samples/client/echo_api/kotlin-jvm-spring-3-restclient/src/main/kotlin/org/openapitools/client/apis/QueryApi.kt @@ -118,10 +118,10 @@ open class QueryApi(client: RestClient) : ApiClient(client) { val localVariableQuery = mutableMapOf>() .apply { if (datetimeQuery != null) { - put("datetime_query", listOf(org.openapitools.client.infrastructure.parseDateToQueryString(datetimeQuery))) + put("datetime_query", listOf(parseDateToQueryString(datetimeQuery))) } if (dateQuery != null) { - put("date_query", listOf(org.openapitools.client.infrastructure.parseDateToQueryString(dateQuery))) + put("date_query", listOf(parseDateToQueryString(dateQuery))) } if (stringQuery != null) { put("string_query", listOf(stringQuery.toString())) diff --git a/samples/client/echo_api/kotlin-jvm-spring-3-webclient/src/main/kotlin/org/openapitools/client/apis/QueryApi.kt b/samples/client/echo_api/kotlin-jvm-spring-3-webclient/src/main/kotlin/org/openapitools/client/apis/QueryApi.kt index 0b77e283e73f..88a5704b287c 100644 --- a/samples/client/echo_api/kotlin-jvm-spring-3-webclient/src/main/kotlin/org/openapitools/client/apis/QueryApi.kt +++ b/samples/client/echo_api/kotlin-jvm-spring-3-webclient/src/main/kotlin/org/openapitools/client/apis/QueryApi.kt @@ -122,10 +122,10 @@ open class QueryApi(client: WebClient) : ApiClient(client) { val localVariableQuery = mutableMapOf>() .apply { if (datetimeQuery != null) { - put("datetime_query", listOf(org.openapitools.client.infrastructure.parseDateToQueryString(datetimeQuery))) + put("datetime_query", listOf(parseDateToQueryString(datetimeQuery))) } if (dateQuery != null) { - put("date_query", listOf(org.openapitools.client.infrastructure.parseDateToQueryString(dateQuery))) + put("date_query", listOf(parseDateToQueryString(dateQuery))) } if (stringQuery != null) { put("string_query", listOf(stringQuery.toString())) diff --git a/samples/client/petstore/kotlin-array-nullable-items-multiplatform/src/commonMain/kotlin/org/openapitools/client/apis/DefaultApi.kt b/samples/client/petstore/kotlin-array-nullable-items-multiplatform/src/commonMain/kotlin/org/openapitools/client/apis/DefaultApi.kt index 35774f6acb67..c011a064596c 100644 --- a/samples/client/petstore/kotlin-array-nullable-items-multiplatform/src/commonMain/kotlin/org/openapitools/client/apis/DefaultApi.kt +++ b/samples/client/petstore/kotlin-array-nullable-items-multiplatform/src/commonMain/kotlin/org/openapitools/client/apis/DefaultApi.kt @@ -78,7 +78,7 @@ open class DefaultApi : ApiClient { requiresAuthentication = false, ) - return request( + return this.request( localVariableConfig, localVariableBody, localVariableAuthNames diff --git a/samples/client/petstore/kotlin-array-simple-string-multiplatform/src/commonMain/kotlin/org/openapitools/client/apis/DefaultApi.kt b/samples/client/petstore/kotlin-array-simple-string-multiplatform/src/commonMain/kotlin/org/openapitools/client/apis/DefaultApi.kt index b53895e3532b..1286fef18f4e 100644 --- a/samples/client/petstore/kotlin-array-simple-string-multiplatform/src/commonMain/kotlin/org/openapitools/client/apis/DefaultApi.kt +++ b/samples/client/petstore/kotlin-array-simple-string-multiplatform/src/commonMain/kotlin/org/openapitools/client/apis/DefaultApi.kt @@ -77,7 +77,7 @@ open class DefaultApi : ApiClient { requiresAuthentication = false, ) - return request( + return this.request( localVariableConfig, localVariableBody, localVariableAuthNames diff --git a/samples/client/petstore/kotlin-bigdecimal-default-multiplatform/src/commonMain/kotlin/org/openapitools/client/apis/DefaultApi.kt b/samples/client/petstore/kotlin-bigdecimal-default-multiplatform/src/commonMain/kotlin/org/openapitools/client/apis/DefaultApi.kt index b3d12179f872..3b8e3af64b27 100644 --- a/samples/client/petstore/kotlin-bigdecimal-default-multiplatform/src/commonMain/kotlin/org/openapitools/client/apis/DefaultApi.kt +++ b/samples/client/petstore/kotlin-bigdecimal-default-multiplatform/src/commonMain/kotlin/org/openapitools/client/apis/DefaultApi.kt @@ -77,7 +77,7 @@ open class DefaultApi : ApiClient { requiresAuthentication = false, ) - return jsonRequest( + return this.jsonRequest( localVariableConfig, localVariableBody, localVariableAuthNames 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..46dfaa72694b 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 @@ -133,7 +133,7 @@ open class DefaultApi : ApiClient { requiresAuthentication = false, ) - return multipartFormRequest( + return this.multipartFormRequest( localVariableConfig, localVariableBody, localVariableAuthNames diff --git a/samples/client/petstore/kotlin-enum-integers-multiplatform/src/commonMain/kotlin/org/openapitools/client/apis/DefaultApi.kt b/samples/client/petstore/kotlin-enum-integers-multiplatform/src/commonMain/kotlin/org/openapitools/client/apis/DefaultApi.kt index 1d947a68ddb4..4187e022e092 100644 --- a/samples/client/petstore/kotlin-enum-integers-multiplatform/src/commonMain/kotlin/org/openapitools/client/apis/DefaultApi.kt +++ b/samples/client/petstore/kotlin-enum-integers-multiplatform/src/commonMain/kotlin/org/openapitools/client/apis/DefaultApi.kt @@ -78,7 +78,7 @@ open class DefaultApi : ApiClient { requiresAuthentication = false, ) - return request( + return this.request( localVariableConfig, localVariableBody, localVariableAuthNames diff --git a/samples/client/petstore/kotlin-jvm-ktor-gson/src/main/kotlin/org/openapitools/client/apis/FakeApi.kt b/samples/client/petstore/kotlin-jvm-ktor-gson/src/main/kotlin/org/openapitools/client/apis/FakeApi.kt index ad16db242f88..7afabc77c210 100644 --- a/samples/client/petstore/kotlin-jvm-ktor-gson/src/main/kotlin/org/openapitools/client/apis/FakeApi.kt +++ b/samples/client/petstore/kotlin-jvm-ktor-gson/src/main/kotlin/org/openapitools/client/apis/FakeApi.kt @@ -71,7 +71,7 @@ import java.text.DateFormat requiresAuthentication = false, ) - return jsonRequest( + return this.jsonRequest( localVariableConfig, localVariableBody, localVariableAuthNames @@ -111,7 +111,7 @@ import java.text.DateFormat requiresAuthentication = true, ) - return urlEncodedFormRequest( + return this.urlEncodedFormRequest( localVariableConfig, localVariableBody, localVariableAuthNames diff --git a/samples/client/petstore/kotlin-jvm-ktor-gson/src/main/kotlin/org/openapitools/client/apis/PetApi.kt b/samples/client/petstore/kotlin-jvm-ktor-gson/src/main/kotlin/org/openapitools/client/apis/PetApi.kt index b2801023ac6e..01464ab7c831 100644 --- a/samples/client/petstore/kotlin-jvm-ktor-gson/src/main/kotlin/org/openapitools/client/apis/PetApi.kt +++ b/samples/client/petstore/kotlin-jvm-ktor-gson/src/main/kotlin/org/openapitools/client/apis/PetApi.kt @@ -73,7 +73,7 @@ import java.text.DateFormat requiresAuthentication = true, ) - return jsonRequest( + return this.jsonRequest( localVariableConfig, localVariableBody, localVariableAuthNames @@ -108,7 +108,7 @@ import java.text.DateFormat requiresAuthentication = true, ) - return request( + return this.request( localVariableConfig, localVariableBody, localVariableAuthNames @@ -143,7 +143,7 @@ import java.text.DateFormat requiresAuthentication = true, ) - return request( + return this.request( localVariableConfig, localVariableBody, localVariableAuthNames @@ -178,7 +178,7 @@ import java.text.DateFormat requiresAuthentication = true, ) - return request( + return this.request( localVariableConfig, localVariableBody, localVariableAuthNames @@ -212,7 +212,7 @@ import java.text.DateFormat requiresAuthentication = true, ) - return request( + return this.request( localVariableConfig, localVariableBody, localVariableAuthNames @@ -245,7 +245,7 @@ import java.text.DateFormat requiresAuthentication = true, ) - return jsonRequest( + return this.jsonRequest( localVariableConfig, localVariableBody, localVariableAuthNames @@ -283,7 +283,7 @@ import java.text.DateFormat requiresAuthentication = true, ) - return urlEncodedFormRequest( + return this.urlEncodedFormRequest( localVariableConfig, localVariableBody, localVariableAuthNames @@ -322,7 +322,7 @@ import java.text.DateFormat requiresAuthentication = true, ) - return multipartFormRequest( + return this.multipartFormRequest( localVariableConfig, localVariableBody, localVariableAuthNames diff --git a/samples/client/petstore/kotlin-jvm-ktor-gson/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt b/samples/client/petstore/kotlin-jvm-ktor-gson/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt index 906105effb18..63feb86eeb99 100644 --- a/samples/client/petstore/kotlin-jvm-ktor-gson/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt +++ b/samples/client/petstore/kotlin-jvm-ktor-gson/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt @@ -72,7 +72,7 @@ import java.text.DateFormat requiresAuthentication = false, ) - return request( + return this.request( localVariableConfig, localVariableBody, localVariableAuthNames @@ -105,7 +105,7 @@ import java.text.DateFormat requiresAuthentication = true, ) - return request( + return this.request( localVariableConfig, localVariableBody, localVariableAuthNames @@ -139,7 +139,7 @@ import java.text.DateFormat requiresAuthentication = false, ) - return request( + return this.request( localVariableConfig, localVariableBody, localVariableAuthNames @@ -172,7 +172,7 @@ import java.text.DateFormat requiresAuthentication = false, ) - return jsonRequest( + return this.jsonRequest( localVariableConfig, localVariableBody, localVariableAuthNames diff --git a/samples/client/petstore/kotlin-jvm-ktor-gson/src/main/kotlin/org/openapitools/client/apis/UserApi.kt b/samples/client/petstore/kotlin-jvm-ktor-gson/src/main/kotlin/org/openapitools/client/apis/UserApi.kt index 9353f5a3e5cd..024d4b291b0a 100644 --- a/samples/client/petstore/kotlin-jvm-ktor-gson/src/main/kotlin/org/openapitools/client/apis/UserApi.kt +++ b/samples/client/petstore/kotlin-jvm-ktor-gson/src/main/kotlin/org/openapitools/client/apis/UserApi.kt @@ -71,7 +71,7 @@ import java.text.DateFormat requiresAuthentication = true, ) - return jsonRequest( + return this.jsonRequest( localVariableConfig, localVariableBody, localVariableAuthNames @@ -103,7 +103,7 @@ import java.text.DateFormat requiresAuthentication = true, ) - return jsonRequest( + return this.jsonRequest( localVariableConfig, localVariableBody, localVariableAuthNames @@ -135,7 +135,7 @@ import java.text.DateFormat requiresAuthentication = true, ) - return jsonRequest( + return this.jsonRequest( localVariableConfig, localVariableBody, localVariableAuthNames @@ -168,7 +168,7 @@ import java.text.DateFormat requiresAuthentication = true, ) - return request( + return this.request( localVariableConfig, localVariableBody, localVariableAuthNames @@ -202,7 +202,7 @@ import java.text.DateFormat requiresAuthentication = false, ) - return request( + return this.request( localVariableConfig, localVariableBody, localVariableAuthNames @@ -239,7 +239,7 @@ import java.text.DateFormat requiresAuthentication = false, ) - return request( + return this.request( localVariableConfig, localVariableBody, localVariableAuthNames @@ -271,7 +271,7 @@ import java.text.DateFormat requiresAuthentication = true, ) - return request( + return this.request( localVariableConfig, localVariableBody, localVariableAuthNames @@ -304,7 +304,7 @@ import java.text.DateFormat requiresAuthentication = true, ) - return jsonRequest( + return this.jsonRequest( localVariableConfig, localVariableBody, localVariableAuthNames diff --git a/samples/client/petstore/kotlin-jvm-ktor-jackson/src/main/kotlin/org/openapitools/client/apis/PetApi.kt b/samples/client/petstore/kotlin-jvm-ktor-jackson/src/main/kotlin/org/openapitools/client/apis/PetApi.kt index 9c3811f3dca4..b3311c04bf68 100644 --- a/samples/client/petstore/kotlin-jvm-ktor-jackson/src/main/kotlin/org/openapitools/client/apis/PetApi.kt +++ b/samples/client/petstore/kotlin-jvm-ktor-jackson/src/main/kotlin/org/openapitools/client/apis/PetApi.kt @@ -70,7 +70,7 @@ import com.fasterxml.jackson.databind.ObjectMapper requiresAuthentication = true, ) - return jsonRequest( + return this.jsonRequest( localVariableConfig, localVariableBody, localVariableAuthNames @@ -105,7 +105,7 @@ import com.fasterxml.jackson.databind.ObjectMapper requiresAuthentication = true, ) - return request( + return this.request( localVariableConfig, localVariableBody, localVariableAuthNames @@ -140,7 +140,7 @@ import com.fasterxml.jackson.databind.ObjectMapper requiresAuthentication = true, ) - return request( + return this.request( localVariableConfig, localVariableBody, localVariableAuthNames @@ -175,7 +175,7 @@ import com.fasterxml.jackson.databind.ObjectMapper requiresAuthentication = true, ) - return request( + return this.request( localVariableConfig, localVariableBody, localVariableAuthNames @@ -209,7 +209,7 @@ import com.fasterxml.jackson.databind.ObjectMapper requiresAuthentication = true, ) - return request( + return this.request( localVariableConfig, localVariableBody, localVariableAuthNames @@ -241,7 +241,7 @@ import com.fasterxml.jackson.databind.ObjectMapper requiresAuthentication = true, ) - return jsonRequest( + return this.jsonRequest( localVariableConfig, localVariableBody, localVariableAuthNames @@ -279,7 +279,7 @@ import com.fasterxml.jackson.databind.ObjectMapper requiresAuthentication = true, ) - return urlEncodedFormRequest( + return this.urlEncodedFormRequest( localVariableConfig, localVariableBody, localVariableAuthNames @@ -318,7 +318,7 @@ import com.fasterxml.jackson.databind.ObjectMapper requiresAuthentication = true, ) - return multipartFormRequest( + return this.multipartFormRequest( localVariableConfig, localVariableBody, localVariableAuthNames diff --git a/samples/client/petstore/kotlin-jvm-ktor-jackson/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt b/samples/client/petstore/kotlin-jvm-ktor-jackson/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt index 99455f8a68fe..fd8596b9324f 100644 --- a/samples/client/petstore/kotlin-jvm-ktor-jackson/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt +++ b/samples/client/petstore/kotlin-jvm-ktor-jackson/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt @@ -70,7 +70,7 @@ import com.fasterxml.jackson.databind.ObjectMapper requiresAuthentication = false, ) - return request( + return this.request( localVariableConfig, localVariableBody, localVariableAuthNames @@ -103,7 +103,7 @@ import com.fasterxml.jackson.databind.ObjectMapper requiresAuthentication = true, ) - return request( + return this.request( localVariableConfig, localVariableBody, localVariableAuthNames @@ -137,7 +137,7 @@ import com.fasterxml.jackson.databind.ObjectMapper requiresAuthentication = false, ) - return request( + return this.request( localVariableConfig, localVariableBody, localVariableAuthNames @@ -170,7 +170,7 @@ import com.fasterxml.jackson.databind.ObjectMapper requiresAuthentication = false, ) - return jsonRequest( + return this.jsonRequest( localVariableConfig, localVariableBody, localVariableAuthNames diff --git a/samples/client/petstore/kotlin-jvm-ktor-jackson/src/main/kotlin/org/openapitools/client/apis/UserApi.kt b/samples/client/petstore/kotlin-jvm-ktor-jackson/src/main/kotlin/org/openapitools/client/apis/UserApi.kt index efaeb397bfb1..d8d36b7638a9 100644 --- a/samples/client/petstore/kotlin-jvm-ktor-jackson/src/main/kotlin/org/openapitools/client/apis/UserApi.kt +++ b/samples/client/petstore/kotlin-jvm-ktor-jackson/src/main/kotlin/org/openapitools/client/apis/UserApi.kt @@ -69,7 +69,7 @@ import com.fasterxml.jackson.databind.ObjectMapper requiresAuthentication = false, ) - return jsonRequest( + return this.jsonRequest( localVariableConfig, localVariableBody, localVariableAuthNames @@ -101,7 +101,7 @@ import com.fasterxml.jackson.databind.ObjectMapper requiresAuthentication = false, ) - return jsonRequest( + return this.jsonRequest( localVariableConfig, localVariableBody, localVariableAuthNames @@ -133,7 +133,7 @@ import com.fasterxml.jackson.databind.ObjectMapper requiresAuthentication = false, ) - return jsonRequest( + return this.jsonRequest( localVariableConfig, localVariableBody, localVariableAuthNames @@ -166,7 +166,7 @@ import com.fasterxml.jackson.databind.ObjectMapper requiresAuthentication = false, ) - return request( + return this.request( localVariableConfig, localVariableBody, localVariableAuthNames @@ -200,7 +200,7 @@ import com.fasterxml.jackson.databind.ObjectMapper requiresAuthentication = false, ) - return request( + return this.request( localVariableConfig, localVariableBody, localVariableAuthNames @@ -237,7 +237,7 @@ import com.fasterxml.jackson.databind.ObjectMapper requiresAuthentication = false, ) - return request( + return this.request( localVariableConfig, localVariableBody, localVariableAuthNames @@ -269,7 +269,7 @@ import com.fasterxml.jackson.databind.ObjectMapper requiresAuthentication = false, ) - return request( + return this.request( localVariableConfig, localVariableBody, localVariableAuthNames @@ -302,7 +302,7 @@ import com.fasterxml.jackson.databind.ObjectMapper requiresAuthentication = false, ) - return jsonRequest( + return this.jsonRequest( localVariableConfig, localVariableBody, localVariableAuthNames diff --git a/samples/client/petstore/kotlin-jvm-ktor-kotlinx_serialization/src/main/kotlin/org/openapitools/client/apis/PetApi.kt b/samples/client/petstore/kotlin-jvm-ktor-kotlinx_serialization/src/main/kotlin/org/openapitools/client/apis/PetApi.kt index 5b7ebcca37c2..30b657de16b9 100644 --- a/samples/client/petstore/kotlin-jvm-ktor-kotlinx_serialization/src/main/kotlin/org/openapitools/client/apis/PetApi.kt +++ b/samples/client/petstore/kotlin-jvm-ktor-kotlinx_serialization/src/main/kotlin/org/openapitools/client/apis/PetApi.kt @@ -68,7 +68,7 @@ import io.ktor.http.ParametersBuilder requiresAuthentication = true, ) - return jsonRequest( + return this.jsonRequest( localVariableConfig, localVariableBody, localVariableAuthNames @@ -103,7 +103,7 @@ import io.ktor.http.ParametersBuilder requiresAuthentication = true, ) - return request( + return this.request( localVariableConfig, localVariableBody, localVariableAuthNames @@ -138,7 +138,7 @@ import io.ktor.http.ParametersBuilder requiresAuthentication = true, ) - return request( + return this.request( localVariableConfig, localVariableBody, localVariableAuthNames @@ -173,7 +173,7 @@ import io.ktor.http.ParametersBuilder requiresAuthentication = true, ) - return request( + return this.request( localVariableConfig, localVariableBody, localVariableAuthNames @@ -207,7 +207,7 @@ import io.ktor.http.ParametersBuilder requiresAuthentication = true, ) - return request( + return this.request( localVariableConfig, localVariableBody, localVariableAuthNames @@ -240,7 +240,7 @@ import io.ktor.http.ParametersBuilder requiresAuthentication = true, ) - return jsonRequest( + return this.jsonRequest( localVariableConfig, localVariableBody, localVariableAuthNames @@ -278,7 +278,7 @@ import io.ktor.http.ParametersBuilder requiresAuthentication = true, ) - return urlEncodedFormRequest( + return this.urlEncodedFormRequest( localVariableConfig, localVariableBody, localVariableAuthNames @@ -317,7 +317,7 @@ import io.ktor.http.ParametersBuilder requiresAuthentication = true, ) - return multipartFormRequest( + return this.multipartFormRequest( localVariableConfig, localVariableBody, localVariableAuthNames diff --git a/samples/client/petstore/kotlin-jvm-ktor-kotlinx_serialization/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt b/samples/client/petstore/kotlin-jvm-ktor-kotlinx_serialization/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt index 5961958cc4e6..ae891cf968ee 100644 --- a/samples/client/petstore/kotlin-jvm-ktor-kotlinx_serialization/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt +++ b/samples/client/petstore/kotlin-jvm-ktor-kotlinx_serialization/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt @@ -67,7 +67,7 @@ import io.ktor.http.ParametersBuilder requiresAuthentication = false, ) - return request( + return this.request( localVariableConfig, localVariableBody, localVariableAuthNames @@ -100,7 +100,7 @@ import io.ktor.http.ParametersBuilder requiresAuthentication = true, ) - return request( + return this.request( localVariableConfig, localVariableBody, localVariableAuthNames @@ -134,7 +134,7 @@ import io.ktor.http.ParametersBuilder requiresAuthentication = false, ) - return request( + return this.request( localVariableConfig, localVariableBody, localVariableAuthNames @@ -167,7 +167,7 @@ import io.ktor.http.ParametersBuilder requiresAuthentication = false, ) - return jsonRequest( + return this.jsonRequest( localVariableConfig, localVariableBody, localVariableAuthNames diff --git a/samples/client/petstore/kotlin-jvm-ktor-kotlinx_serialization/src/main/kotlin/org/openapitools/client/apis/UserApi.kt b/samples/client/petstore/kotlin-jvm-ktor-kotlinx_serialization/src/main/kotlin/org/openapitools/client/apis/UserApi.kt index 1bba95caf26c..462966b5eb22 100644 --- a/samples/client/petstore/kotlin-jvm-ktor-kotlinx_serialization/src/main/kotlin/org/openapitools/client/apis/UserApi.kt +++ b/samples/client/petstore/kotlin-jvm-ktor-kotlinx_serialization/src/main/kotlin/org/openapitools/client/apis/UserApi.kt @@ -66,7 +66,7 @@ import io.ktor.http.ParametersBuilder requiresAuthentication = true, ) - return jsonRequest( + return this.jsonRequest( localVariableConfig, localVariableBody, localVariableAuthNames @@ -98,7 +98,7 @@ import io.ktor.http.ParametersBuilder requiresAuthentication = true, ) - return jsonRequest( + return this.jsonRequest( localVariableConfig, localVariableBody, localVariableAuthNames @@ -130,7 +130,7 @@ import io.ktor.http.ParametersBuilder requiresAuthentication = true, ) - return jsonRequest( + return this.jsonRequest( localVariableConfig, localVariableBody, localVariableAuthNames @@ -163,7 +163,7 @@ import io.ktor.http.ParametersBuilder requiresAuthentication = true, ) - return request( + return this.request( localVariableConfig, localVariableBody, localVariableAuthNames @@ -197,7 +197,7 @@ import io.ktor.http.ParametersBuilder requiresAuthentication = false, ) - return request( + return this.request( localVariableConfig, localVariableBody, localVariableAuthNames @@ -234,7 +234,7 @@ import io.ktor.http.ParametersBuilder requiresAuthentication = false, ) - return request( + return this.request( localVariableConfig, localVariableBody, localVariableAuthNames @@ -266,7 +266,7 @@ import io.ktor.http.ParametersBuilder requiresAuthentication = true, ) - return request( + return this.request( localVariableConfig, localVariableBody, localVariableAuthNames @@ -299,7 +299,7 @@ import io.ktor.http.ParametersBuilder requiresAuthentication = true, ) - return jsonRequest( + return this.jsonRequest( localVariableConfig, localVariableBody, localVariableAuthNames diff --git a/samples/client/petstore/kotlin-jvm-vertx-gson/src/main/kotlin/org/openapitools/client/apis/PetApi.kt b/samples/client/petstore/kotlin-jvm-vertx-gson/src/main/kotlin/org/openapitools/client/apis/PetApi.kt index 62456f269dd8..9a3c986a3912 100644 --- a/samples/client/petstore/kotlin-jvm-vertx-gson/src/main/kotlin/org/openapitools/client/apis/PetApi.kt +++ b/samples/client/petstore/kotlin-jvm-vertx-gson/src/main/kotlin/org/openapitools/client/apis/PetApi.kt @@ -101,8 +101,8 @@ open class PetApi(basePath: kotlin.String = ApiClient.defaultBasePath, accessTok - this.accessToken?.let { accessToken -> - localVariableRequest.bearerTokenAuthentication(accessToken) + this.accessToken?.let { localVariableAccessToken -> + localVariableRequest.bearerTokenAuthentication(localVariableAccessToken) } return localVariableRequest @@ -167,8 +167,8 @@ open class PetApi(basePath: kotlin.String = ApiClient.defaultBasePath, accessTok - this.accessToken?.let { accessToken -> - localVariableRequest.bearerTokenAuthentication(accessToken) + this.accessToken?.let { localVariableAccessToken -> + localVariableRequest.bearerTokenAuthentication(localVariableAccessToken) } return localVariableRequest @@ -243,8 +243,8 @@ open class PetApi(basePath: kotlin.String = ApiClient.defaultBasePath, accessTok status.let { localVariableRequest.queryParams().add("status", toMultiValue(it.toList(), "csv")) } - this.accessToken?.let { accessToken -> - localVariableRequest.bearerTokenAuthentication(accessToken) + this.accessToken?.let { localVariableAccessToken -> + localVariableRequest.bearerTokenAuthentication(localVariableAccessToken) } return localVariableRequest @@ -312,8 +312,8 @@ open class PetApi(basePath: kotlin.String = ApiClient.defaultBasePath, accessTok tags.let { localVariableRequest.queryParams().add("tags", toMultiValue(it.toList(), "csv")) } - this.accessToken?.let { accessToken -> - localVariableRequest.bearerTokenAuthentication(accessToken) + this.accessToken?.let { localVariableAccessToken -> + localVariableRequest.bearerTokenAuthentication(localVariableAccessToken) } return localVariableRequest @@ -451,8 +451,8 @@ open class PetApi(basePath: kotlin.String = ApiClient.defaultBasePath, accessTok - this.accessToken?.let { accessToken -> - localVariableRequest.bearerTokenAuthentication(accessToken) + this.accessToken?.let { localVariableAccessToken -> + localVariableRequest.bearerTokenAuthentication(localVariableAccessToken) } return localVariableRequest @@ -522,8 +522,8 @@ open class PetApi(basePath: kotlin.String = ApiClient.defaultBasePath, accessTok status?.let { localVariableForm.add("status", status) } - this.accessToken?.let { accessToken -> - localVariableRequest.bearerTokenAuthentication(accessToken) + this.accessToken?.let { localVariableAccessToken -> + localVariableRequest.bearerTokenAuthentication(localVariableAccessToken) } return localVariableRequest @@ -595,8 +595,8 @@ open class PetApi(basePath: kotlin.String = ApiClient.defaultBasePath, accessTok file?.let { localVariableForm.add("file", file.toString()) } - this.accessToken?.let { accessToken -> - localVariableRequest.bearerTokenAuthentication(accessToken) + this.accessToken?.let { localVariableAccessToken -> + localVariableRequest.bearerTokenAuthentication(localVariableAccessToken) } return localVariableRequest diff --git a/samples/client/petstore/kotlin-jvm-vertx-jackson-coroutines/src/main/kotlin/org/openapitools/client/apis/PetApi.kt b/samples/client/petstore/kotlin-jvm-vertx-jackson-coroutines/src/main/kotlin/org/openapitools/client/apis/PetApi.kt index 69518f9f0043..aa02c57ec192 100644 --- a/samples/client/petstore/kotlin-jvm-vertx-jackson-coroutines/src/main/kotlin/org/openapitools/client/apis/PetApi.kt +++ b/samples/client/petstore/kotlin-jvm-vertx-jackson-coroutines/src/main/kotlin/org/openapitools/client/apis/PetApi.kt @@ -105,8 +105,8 @@ open class PetApi(basePath: kotlin.String = ApiClient.defaultBasePath, accessTok - this.accessToken?.let { accessToken -> - localVariableRequest.bearerTokenAuthentication(accessToken) + this.accessToken?.let { localVariableAccessToken -> + localVariableRequest.bearerTokenAuthentication(localVariableAccessToken) } return localVariableRequest @@ -171,8 +171,8 @@ open class PetApi(basePath: kotlin.String = ApiClient.defaultBasePath, accessTok - this.accessToken?.let { accessToken -> - localVariableRequest.bearerTokenAuthentication(accessToken) + this.accessToken?.let { localVariableAccessToken -> + localVariableRequest.bearerTokenAuthentication(localVariableAccessToken) } return localVariableRequest @@ -247,8 +247,8 @@ open class PetApi(basePath: kotlin.String = ApiClient.defaultBasePath, accessTok status.let { localVariableRequest.queryParams().add("status", toMultiValue(it.toList(), "csv")) } - this.accessToken?.let { accessToken -> - localVariableRequest.bearerTokenAuthentication(accessToken) + this.accessToken?.let { localVariableAccessToken -> + localVariableRequest.bearerTokenAuthentication(localVariableAccessToken) } return localVariableRequest @@ -316,8 +316,8 @@ open class PetApi(basePath: kotlin.String = ApiClient.defaultBasePath, accessTok tags.let { localVariableRequest.queryParams().add("tags", toMultiValue(it.toList(), "csv")) } - this.accessToken?.let { accessToken -> - localVariableRequest.bearerTokenAuthentication(accessToken) + this.accessToken?.let { localVariableAccessToken -> + localVariableRequest.bearerTokenAuthentication(localVariableAccessToken) } return localVariableRequest @@ -455,8 +455,8 @@ open class PetApi(basePath: kotlin.String = ApiClient.defaultBasePath, accessTok - this.accessToken?.let { accessToken -> - localVariableRequest.bearerTokenAuthentication(accessToken) + this.accessToken?.let { localVariableAccessToken -> + localVariableRequest.bearerTokenAuthentication(localVariableAccessToken) } return localVariableRequest @@ -526,8 +526,8 @@ open class PetApi(basePath: kotlin.String = ApiClient.defaultBasePath, accessTok status?.let { localVariableForm.add("status", status) } - this.accessToken?.let { accessToken -> - localVariableRequest.bearerTokenAuthentication(accessToken) + this.accessToken?.let { localVariableAccessToken -> + localVariableRequest.bearerTokenAuthentication(localVariableAccessToken) } return localVariableRequest @@ -599,8 +599,8 @@ open class PetApi(basePath: kotlin.String = ApiClient.defaultBasePath, accessTok file?.let { localVariableForm.add("file", file.toString()) } - this.accessToken?.let { accessToken -> - localVariableRequest.bearerTokenAuthentication(accessToken) + this.accessToken?.let { localVariableAccessToken -> + localVariableRequest.bearerTokenAuthentication(localVariableAccessToken) } return localVariableRequest diff --git a/samples/client/petstore/kotlin-jvm-vertx-jackson/src/main/kotlin/org/openapitools/client/apis/PetApi.kt b/samples/client/petstore/kotlin-jvm-vertx-jackson/src/main/kotlin/org/openapitools/client/apis/PetApi.kt index 73ae32775cb9..9e55adbe5e3c 100644 --- a/samples/client/petstore/kotlin-jvm-vertx-jackson/src/main/kotlin/org/openapitools/client/apis/PetApi.kt +++ b/samples/client/petstore/kotlin-jvm-vertx-jackson/src/main/kotlin/org/openapitools/client/apis/PetApi.kt @@ -101,8 +101,8 @@ open class PetApi(basePath: kotlin.String = ApiClient.defaultBasePath, accessTok - this.accessToken?.let { accessToken -> - localVariableRequest.bearerTokenAuthentication(accessToken) + this.accessToken?.let { localVariableAccessToken -> + localVariableRequest.bearerTokenAuthentication(localVariableAccessToken) } return localVariableRequest @@ -167,8 +167,8 @@ open class PetApi(basePath: kotlin.String = ApiClient.defaultBasePath, accessTok - this.accessToken?.let { accessToken -> - localVariableRequest.bearerTokenAuthentication(accessToken) + this.accessToken?.let { localVariableAccessToken -> + localVariableRequest.bearerTokenAuthentication(localVariableAccessToken) } return localVariableRequest @@ -243,8 +243,8 @@ open class PetApi(basePath: kotlin.String = ApiClient.defaultBasePath, accessTok status.let { localVariableRequest.queryParams().add("status", toMultiValue(it.toList(), "csv")) } - this.accessToken?.let { accessToken -> - localVariableRequest.bearerTokenAuthentication(accessToken) + this.accessToken?.let { localVariableAccessToken -> + localVariableRequest.bearerTokenAuthentication(localVariableAccessToken) } return localVariableRequest @@ -312,8 +312,8 @@ open class PetApi(basePath: kotlin.String = ApiClient.defaultBasePath, accessTok tags.let { localVariableRequest.queryParams().add("tags", toMultiValue(it.toList(), "csv")) } - this.accessToken?.let { accessToken -> - localVariableRequest.bearerTokenAuthentication(accessToken) + this.accessToken?.let { localVariableAccessToken -> + localVariableRequest.bearerTokenAuthentication(localVariableAccessToken) } return localVariableRequest @@ -451,8 +451,8 @@ open class PetApi(basePath: kotlin.String = ApiClient.defaultBasePath, accessTok - this.accessToken?.let { accessToken -> - localVariableRequest.bearerTokenAuthentication(accessToken) + this.accessToken?.let { localVariableAccessToken -> + localVariableRequest.bearerTokenAuthentication(localVariableAccessToken) } return localVariableRequest @@ -522,8 +522,8 @@ open class PetApi(basePath: kotlin.String = ApiClient.defaultBasePath, accessTok status?.let { localVariableForm.add("status", status) } - this.accessToken?.let { accessToken -> - localVariableRequest.bearerTokenAuthentication(accessToken) + this.accessToken?.let { localVariableAccessToken -> + localVariableRequest.bearerTokenAuthentication(localVariableAccessToken) } return localVariableRequest @@ -595,8 +595,8 @@ open class PetApi(basePath: kotlin.String = ApiClient.defaultBasePath, accessTok file?.let { localVariableForm.add("file", file.toString()) } - this.accessToken?.let { accessToken -> - localVariableRequest.bearerTokenAuthentication(accessToken) + this.accessToken?.let { localVariableAccessToken -> + localVariableRequest.bearerTokenAuthentication(localVariableAccessToken) } return localVariableRequest diff --git a/samples/client/petstore/kotlin-jvm-vertx-moshi/src/main/kotlin/org/openapitools/client/apis/PetApi.kt b/samples/client/petstore/kotlin-jvm-vertx-moshi/src/main/kotlin/org/openapitools/client/apis/PetApi.kt index 1014a512d606..0d114e521ffa 100644 --- a/samples/client/petstore/kotlin-jvm-vertx-moshi/src/main/kotlin/org/openapitools/client/apis/PetApi.kt +++ b/samples/client/petstore/kotlin-jvm-vertx-moshi/src/main/kotlin/org/openapitools/client/apis/PetApi.kt @@ -100,8 +100,8 @@ open class PetApi(basePath: kotlin.String = ApiClient.defaultBasePath, accessTok - this.accessToken?.let { accessToken -> - localVariableRequest.bearerTokenAuthentication(accessToken) + this.accessToken?.let { localVariableAccessToken -> + localVariableRequest.bearerTokenAuthentication(localVariableAccessToken) } return localVariableRequest @@ -166,8 +166,8 @@ open class PetApi(basePath: kotlin.String = ApiClient.defaultBasePath, accessTok - this.accessToken?.let { accessToken -> - localVariableRequest.bearerTokenAuthentication(accessToken) + this.accessToken?.let { localVariableAccessToken -> + localVariableRequest.bearerTokenAuthentication(localVariableAccessToken) } return localVariableRequest @@ -242,8 +242,8 @@ open class PetApi(basePath: kotlin.String = ApiClient.defaultBasePath, accessTok status.let { localVariableRequest.queryParams().add("status", toMultiValue(it.toList(), "csv")) } - this.accessToken?.let { accessToken -> - localVariableRequest.bearerTokenAuthentication(accessToken) + this.accessToken?.let { localVariableAccessToken -> + localVariableRequest.bearerTokenAuthentication(localVariableAccessToken) } return localVariableRequest @@ -311,8 +311,8 @@ open class PetApi(basePath: kotlin.String = ApiClient.defaultBasePath, accessTok tags.let { localVariableRequest.queryParams().add("tags", toMultiValue(it.toList(), "csv")) } - this.accessToken?.let { accessToken -> - localVariableRequest.bearerTokenAuthentication(accessToken) + this.accessToken?.let { localVariableAccessToken -> + localVariableRequest.bearerTokenAuthentication(localVariableAccessToken) } return localVariableRequest @@ -450,8 +450,8 @@ open class PetApi(basePath: kotlin.String = ApiClient.defaultBasePath, accessTok - this.accessToken?.let { accessToken -> - localVariableRequest.bearerTokenAuthentication(accessToken) + this.accessToken?.let { localVariableAccessToken -> + localVariableRequest.bearerTokenAuthentication(localVariableAccessToken) } return localVariableRequest @@ -521,8 +521,8 @@ open class PetApi(basePath: kotlin.String = ApiClient.defaultBasePath, accessTok status?.let { localVariableForm.add("status", status) } - this.accessToken?.let { accessToken -> - localVariableRequest.bearerTokenAuthentication(accessToken) + this.accessToken?.let { localVariableAccessToken -> + localVariableRequest.bearerTokenAuthentication(localVariableAccessToken) } return localVariableRequest @@ -594,8 +594,8 @@ open class PetApi(basePath: kotlin.String = ApiClient.defaultBasePath, accessTok file?.let { localVariableForm.add("file", file.toString()) } - this.accessToken?.let { accessToken -> - localVariableRequest.bearerTokenAuthentication(accessToken) + this.accessToken?.let { localVariableAccessToken -> + localVariableRequest.bearerTokenAuthentication(localVariableAccessToken) } return localVariableRequest diff --git a/samples/client/petstore/kotlin-multiplatform-allOf-discriminator/src/commonMain/kotlin/org/openapitools/client/apis/BirdApi.kt b/samples/client/petstore/kotlin-multiplatform-allOf-discriminator/src/commonMain/kotlin/org/openapitools/client/apis/BirdApi.kt index 9085a9fae66d..6234da351ecb 100644 --- a/samples/client/petstore/kotlin-multiplatform-allOf-discriminator/src/commonMain/kotlin/org/openapitools/client/apis/BirdApi.kt +++ b/samples/client/petstore/kotlin-multiplatform-allOf-discriminator/src/commonMain/kotlin/org/openapitools/client/apis/BirdApi.kt @@ -79,7 +79,7 @@ open class BirdApi : ApiClient { requiresAuthentication = false, ) - return request( + return this.request( localVariableConfig, localVariableBody, localVariableAuthNames @@ -116,7 +116,7 @@ open class BirdApi : ApiClient { requiresAuthentication = false, ) - return multipartFormRequest( + return this.multipartFormRequest( localVariableConfig, localVariableBody, localVariableAuthNames diff --git a/samples/client/petstore/kotlin-multiplatform-allOf-special-discriminator/src/commonMain/kotlin/org/openapitools/client/apis/BirdApi.kt b/samples/client/petstore/kotlin-multiplatform-allOf-special-discriminator/src/commonMain/kotlin/org/openapitools/client/apis/BirdApi.kt index 9085a9fae66d..6234da351ecb 100644 --- a/samples/client/petstore/kotlin-multiplatform-allOf-special-discriminator/src/commonMain/kotlin/org/openapitools/client/apis/BirdApi.kt +++ b/samples/client/petstore/kotlin-multiplatform-allOf-special-discriminator/src/commonMain/kotlin/org/openapitools/client/apis/BirdApi.kt @@ -79,7 +79,7 @@ open class BirdApi : ApiClient { requiresAuthentication = false, ) - return request( + return this.request( localVariableConfig, localVariableBody, localVariableAuthNames @@ -116,7 +116,7 @@ open class BirdApi : ApiClient { requiresAuthentication = false, ) - return multipartFormRequest( + return this.multipartFormRequest( localVariableConfig, localVariableBody, localVariableAuthNames diff --git a/samples/client/petstore/kotlin-multiplatform-kotlinx-datetime/src/commonMain/kotlin/org/openapitools/client/apis/PetApi.kt b/samples/client/petstore/kotlin-multiplatform-kotlinx-datetime/src/commonMain/kotlin/org/openapitools/client/apis/PetApi.kt index 426caf13c53e..bc246e3969b5 100644 --- a/samples/client/petstore/kotlin-multiplatform-kotlinx-datetime/src/commonMain/kotlin/org/openapitools/client/apis/PetApi.kt +++ b/samples/client/petstore/kotlin-multiplatform-kotlinx-datetime/src/commonMain/kotlin/org/openapitools/client/apis/PetApi.kt @@ -78,7 +78,7 @@ open class PetApi : ApiClient { requiresAuthentication = true, ) - return jsonRequest( + return this.jsonRequest( localVariableConfig, localVariableBody, localVariableAuthNames @@ -113,7 +113,7 @@ open class PetApi : ApiClient { requiresAuthentication = true, ) - return request( + return this.request( localVariableConfig, localVariableBody, localVariableAuthNames @@ -166,7 +166,7 @@ open class PetApi : ApiClient { requiresAuthentication = true, ) - return request( + return this.request( localVariableConfig, localVariableBody, localVariableAuthNames @@ -209,7 +209,7 @@ open class PetApi : ApiClient { requiresAuthentication = true, ) - return request( + return this.request( localVariableConfig, localVariableBody, localVariableAuthNames @@ -251,7 +251,7 @@ open class PetApi : ApiClient { requiresAuthentication = true, ) - return request( + return this.request( localVariableConfig, localVariableBody, localVariableAuthNames @@ -282,7 +282,7 @@ open class PetApi : ApiClient { requiresAuthentication = true, ) - return jsonRequest( + return this.jsonRequest( localVariableConfig, localVariableBody, localVariableAuthNames @@ -320,7 +320,7 @@ open class PetApi : ApiClient { requiresAuthentication = true, ) - return urlEncodedFormRequest( + return this.urlEncodedFormRequest( localVariableConfig, localVariableBody, localVariableAuthNames @@ -358,7 +358,7 @@ open class PetApi : ApiClient { requiresAuthentication = true, ) - return multipartFormRequest( + return this.multipartFormRequest( localVariableConfig, localVariableBody, localVariableAuthNames diff --git a/samples/client/petstore/kotlin-multiplatform-kotlinx-datetime/src/commonMain/kotlin/org/openapitools/client/apis/StoreApi.kt b/samples/client/petstore/kotlin-multiplatform-kotlinx-datetime/src/commonMain/kotlin/org/openapitools/client/apis/StoreApi.kt index b10d35c7525d..718d0f9390eb 100644 --- a/samples/client/petstore/kotlin-multiplatform-kotlinx-datetime/src/commonMain/kotlin/org/openapitools/client/apis/StoreApi.kt +++ b/samples/client/petstore/kotlin-multiplatform-kotlinx-datetime/src/commonMain/kotlin/org/openapitools/client/apis/StoreApi.kt @@ -78,7 +78,7 @@ open class StoreApi : ApiClient { requiresAuthentication = false, ) - return request( + return this.request( localVariableConfig, localVariableBody, localVariableAuthNames @@ -110,7 +110,7 @@ open class StoreApi : ApiClient { requiresAuthentication = true, ) - return request( + return this.request( localVariableConfig, localVariableBody, localVariableAuthNames @@ -152,7 +152,7 @@ open class StoreApi : ApiClient { requiresAuthentication = false, ) - return request( + return this.request( localVariableConfig, localVariableBody, localVariableAuthNames @@ -184,7 +184,7 @@ open class StoreApi : ApiClient { requiresAuthentication = false, ) - return jsonRequest( + return this.jsonRequest( localVariableConfig, localVariableBody, localVariableAuthNames diff --git a/samples/client/petstore/kotlin-multiplatform-kotlinx-datetime/src/commonMain/kotlin/org/openapitools/client/apis/UserApi.kt b/samples/client/petstore/kotlin-multiplatform-kotlinx-datetime/src/commonMain/kotlin/org/openapitools/client/apis/UserApi.kt index 0b1e93d575bf..053bc05c89fc 100644 --- a/samples/client/petstore/kotlin-multiplatform-kotlinx-datetime/src/commonMain/kotlin/org/openapitools/client/apis/UserApi.kt +++ b/samples/client/petstore/kotlin-multiplatform-kotlinx-datetime/src/commonMain/kotlin/org/openapitools/client/apis/UserApi.kt @@ -77,7 +77,7 @@ open class UserApi : ApiClient { requiresAuthentication = false, ) - return jsonRequest( + return this.jsonRequest( localVariableConfig, localVariableBody, localVariableAuthNames @@ -109,7 +109,7 @@ open class UserApi : ApiClient { requiresAuthentication = false, ) - return jsonRequest( + return this.jsonRequest( localVariableConfig, localVariableBody, localVariableAuthNames @@ -149,7 +149,7 @@ open class UserApi : ApiClient { requiresAuthentication = false, ) - return jsonRequest( + return this.jsonRequest( localVariableConfig, localVariableBody, localVariableAuthNames @@ -190,7 +190,7 @@ open class UserApi : ApiClient { requiresAuthentication = false, ) - return request( + return this.request( localVariableConfig, localVariableBody, localVariableAuthNames @@ -223,7 +223,7 @@ open class UserApi : ApiClient { requiresAuthentication = false, ) - return request( + return this.request( localVariableConfig, localVariableBody, localVariableAuthNames @@ -259,7 +259,7 @@ open class UserApi : ApiClient { requiresAuthentication = false, ) - return request( + return this.request( localVariableConfig, localVariableBody, localVariableAuthNames @@ -290,7 +290,7 @@ open class UserApi : ApiClient { requiresAuthentication = false, ) - return request( + return this.request( localVariableConfig, localVariableBody, localVariableAuthNames @@ -322,7 +322,7 @@ open class UserApi : ApiClient { requiresAuthentication = false, ) - return jsonRequest( + return this.jsonRequest( localVariableConfig, localVariableBody, localVariableAuthNames diff --git a/samples/client/petstore/kotlin-multiplatform/src/commonMain/kotlin/org/openapitools/client/apis/PetApi.kt b/samples/client/petstore/kotlin-multiplatform/src/commonMain/kotlin/org/openapitools/client/apis/PetApi.kt index 426caf13c53e..bc246e3969b5 100644 --- a/samples/client/petstore/kotlin-multiplatform/src/commonMain/kotlin/org/openapitools/client/apis/PetApi.kt +++ b/samples/client/petstore/kotlin-multiplatform/src/commonMain/kotlin/org/openapitools/client/apis/PetApi.kt @@ -78,7 +78,7 @@ open class PetApi : ApiClient { requiresAuthentication = true, ) - return jsonRequest( + return this.jsonRequest( localVariableConfig, localVariableBody, localVariableAuthNames @@ -113,7 +113,7 @@ open class PetApi : ApiClient { requiresAuthentication = true, ) - return request( + return this.request( localVariableConfig, localVariableBody, localVariableAuthNames @@ -166,7 +166,7 @@ open class PetApi : ApiClient { requiresAuthentication = true, ) - return request( + return this.request( localVariableConfig, localVariableBody, localVariableAuthNames @@ -209,7 +209,7 @@ open class PetApi : ApiClient { requiresAuthentication = true, ) - return request( + return this.request( localVariableConfig, localVariableBody, localVariableAuthNames @@ -251,7 +251,7 @@ open class PetApi : ApiClient { requiresAuthentication = true, ) - return request( + return this.request( localVariableConfig, localVariableBody, localVariableAuthNames @@ -282,7 +282,7 @@ open class PetApi : ApiClient { requiresAuthentication = true, ) - return jsonRequest( + return this.jsonRequest( localVariableConfig, localVariableBody, localVariableAuthNames @@ -320,7 +320,7 @@ open class PetApi : ApiClient { requiresAuthentication = true, ) - return urlEncodedFormRequest( + return this.urlEncodedFormRequest( localVariableConfig, localVariableBody, localVariableAuthNames @@ -358,7 +358,7 @@ open class PetApi : ApiClient { requiresAuthentication = true, ) - return multipartFormRequest( + return this.multipartFormRequest( localVariableConfig, localVariableBody, localVariableAuthNames diff --git a/samples/client/petstore/kotlin-multiplatform/src/commonMain/kotlin/org/openapitools/client/apis/StoreApi.kt b/samples/client/petstore/kotlin-multiplatform/src/commonMain/kotlin/org/openapitools/client/apis/StoreApi.kt index b10d35c7525d..718d0f9390eb 100644 --- a/samples/client/petstore/kotlin-multiplatform/src/commonMain/kotlin/org/openapitools/client/apis/StoreApi.kt +++ b/samples/client/petstore/kotlin-multiplatform/src/commonMain/kotlin/org/openapitools/client/apis/StoreApi.kt @@ -78,7 +78,7 @@ open class StoreApi : ApiClient { requiresAuthentication = false, ) - return request( + return this.request( localVariableConfig, localVariableBody, localVariableAuthNames @@ -110,7 +110,7 @@ open class StoreApi : ApiClient { requiresAuthentication = true, ) - return request( + return this.request( localVariableConfig, localVariableBody, localVariableAuthNames @@ -152,7 +152,7 @@ open class StoreApi : ApiClient { requiresAuthentication = false, ) - return request( + return this.request( localVariableConfig, localVariableBody, localVariableAuthNames @@ -184,7 +184,7 @@ open class StoreApi : ApiClient { requiresAuthentication = false, ) - return jsonRequest( + return this.jsonRequest( localVariableConfig, localVariableBody, localVariableAuthNames diff --git a/samples/client/petstore/kotlin-multiplatform/src/commonMain/kotlin/org/openapitools/client/apis/UserApi.kt b/samples/client/petstore/kotlin-multiplatform/src/commonMain/kotlin/org/openapitools/client/apis/UserApi.kt index 0b1e93d575bf..053bc05c89fc 100644 --- a/samples/client/petstore/kotlin-multiplatform/src/commonMain/kotlin/org/openapitools/client/apis/UserApi.kt +++ b/samples/client/petstore/kotlin-multiplatform/src/commonMain/kotlin/org/openapitools/client/apis/UserApi.kt @@ -77,7 +77,7 @@ open class UserApi : ApiClient { requiresAuthentication = false, ) - return jsonRequest( + return this.jsonRequest( localVariableConfig, localVariableBody, localVariableAuthNames @@ -109,7 +109,7 @@ open class UserApi : ApiClient { requiresAuthentication = false, ) - return jsonRequest( + return this.jsonRequest( localVariableConfig, localVariableBody, localVariableAuthNames @@ -149,7 +149,7 @@ open class UserApi : ApiClient { requiresAuthentication = false, ) - return jsonRequest( + return this.jsonRequest( localVariableConfig, localVariableBody, localVariableAuthNames @@ -190,7 +190,7 @@ open class UserApi : ApiClient { requiresAuthentication = false, ) - return request( + return this.request( localVariableConfig, localVariableBody, localVariableAuthNames @@ -223,7 +223,7 @@ open class UserApi : ApiClient { requiresAuthentication = false, ) - return request( + return this.request( localVariableConfig, localVariableBody, localVariableAuthNames @@ -259,7 +259,7 @@ open class UserApi : ApiClient { requiresAuthentication = false, ) - return request( + return this.request( localVariableConfig, localVariableBody, localVariableAuthNames @@ -290,7 +290,7 @@ open class UserApi : ApiClient { requiresAuthentication = false, ) - return request( + return this.request( localVariableConfig, localVariableBody, localVariableAuthNames @@ -322,7 +322,7 @@ open class UserApi : ApiClient { requiresAuthentication = false, ) - return jsonRequest( + return this.jsonRequest( localVariableConfig, localVariableBody, localVariableAuthNames From 9074531c82114271a7abb4ac718861f42bb6298c Mon Sep 17 00:00:00 2001 From: khayashi4337 Date: Thu, 24 Sep 2026 13:44:13 +0900 Subject: [PATCH 26/31] fix(kotlin-client): escape $ in wire names for all libraries MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Wire names containing `$` (OData-style `$filter`/`$top`) were emitted unescaped inside Kotlin string literals in every library except jvm-okhttp. Kotlin string interpolation then turned the wire key into the same-named parameter's value — or failed compilation outright when no such variable was in scope (`"$top"`). Wrap every baseName/keyParamName/x-kotlin-param-base-name that renders inside a Kotlin string literal with the existing escapeDollar mustache lambda in the jvm-vertx, jvm-ktor, multiplatform, jvm-spring-restclient, jvm-spring-webclient, jvm-volley and jvm-retrofit2 templates (74 sites across 12 files), matching what jvm-okhttp already did. Add kotlin-dollar-wire-name.yaml (params `$filter`/`$top` plus a same-stem `filter` param) and a per-library regression test asserting the escaped literal is emitted; the jvm-vertx generated client compiles cleanly under kotlinc. Generated with [Devin](https://devin.ai) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com> --- .../libraries/jvm-ktor/api.mustache | 34 +++++++-------- .../jvm-retrofit2/explodedQueryParam.mustache | 2 +- .../jvm-retrofit2/formParams.mustache | 2 +- .../jvm-retrofit2/headerParams.mustache | 2 +- .../infrastructure/ApiClient.kt.mustache | 2 +- .../jvm-retrofit2/pathParams.mustache | 2 +- .../jvm-retrofit2/queryParam.mustache | 2 +- .../jvm-spring-restclient/api.mustache | 12 +++--- .../jvm-spring-webclient/api.mustache | 12 +++--- .../libraries/jvm-vertx/api.mustache | 20 ++++----- .../libraries/jvm-volley/api.mustache | 8 ++-- .../libraries/multiplatform/api.mustache | 20 ++++----- .../kotlin/KotlinClientCodegenApiTest.java | 43 +++++++++++++++++++ .../3_0/kotlin/kotlin-dollar-wire-name.yaml | 18 ++++++++ 14 files changed, 120 insertions(+), 59 deletions(-) create mode 100644 modules/openapi-generator/src/test/resources/3_0/kotlin/kotlin-dollar-wire-name.yaml 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 7c6b28238e37..f5c0b546cce3 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 @@ -76,19 +76,19 @@ import com.fasterxml.jackson.databind.ObjectMapper {{^isArray}} {{^isString}} {{^isNumber}} - {{{paramName}}}?.apply { append("{{{baseName}}}", {{{paramName}}}.toString()) } + {{{paramName}}}?.apply { append("{{#lambda.escapeDollar}}{{{baseName}}}{{/lambda.escapeDollar}}", {{{paramName}}}.toString()) } {{/isNumber}} {{#isNumber}} - {{{paramName}}}?.apply { append("{{{baseName}}}", {{{paramName}}}.toString()) } + {{{paramName}}}?.apply { append("{{#lambda.escapeDollar}}{{{baseName}}}{{/lambda.escapeDollar}}", {{{paramName}}}.toString()) } {{/isNumber}} {{/isString}} {{#isString}} - {{{paramName}}}?.apply { append("{{{baseName}}}", {{{paramName}}}) } + {{{paramName}}}?.apply { append("{{#lambda.escapeDollar}}{{{baseName}}}{{/lambda.escapeDollar}}", {{{paramName}}}) } {{/isString}} {{/isArray}} {{#isArray}} for (x in {{paramName}} ?: listOf()) { - {{#isFile}}append(it){{/isFile}}{{^isFile}}append("{{{baseName}}}", x.toString()){{/isFile}} + {{#isFile}}append(it){{/isFile}}{{^isFile}}append("{{#lambda.escapeDollar}}{{{baseName}}}{{/lambda.escapeDollar}}", x.toString()){{/isFile}} } {{/isArray}} {{/isFile}} @@ -99,25 +99,25 @@ import com.fasterxml.jackson.databind.ObjectMapper ParametersBuilder().also { {{#formParams}} {{#isFile}} - {{{paramName}}}?.apply { it.append("{{{baseName}}}", {{{paramName}}}) } + {{{paramName}}}?.apply { it.append("{{#lambda.escapeDollar}}{{{baseName}}}{{/lambda.escapeDollar}}", {{{paramName}}}) } {{/isFile}} {{^isFile}} {{^isArray}} {{^isString}} {{^isNumber}} - {{{paramName}}}?.apply { it.append("{{{baseName}}}", {{{paramName}}}.toString()) } + {{{paramName}}}?.apply { it.append("{{#lambda.escapeDollar}}{{{baseName}}}{{/lambda.escapeDollar}}", {{{paramName}}}.toString()) } {{/isNumber}} {{#isNumber}} - {{{paramName}}}?.apply { it.append("{{{baseName}}}", {{{paramName}}}.toString()) } + {{{paramName}}}?.apply { it.append("{{#lambda.escapeDollar}}{{{baseName}}}{{/lambda.escapeDollar}}", {{{paramName}}}.toString()) } {{/isNumber}} {{/isString}} {{#isString}} - {{{paramName}}}?.apply { it.append("{{{baseName}}}", {{{paramName}}}) } + {{{paramName}}}?.apply { it.append("{{#lambda.escapeDollar}}{{{baseName}}}{{/lambda.escapeDollar}}", {{{paramName}}}) } {{/isString}} {{/isArray}} {{#isArray}} for (x in {{paramName}} ?: listOf()) { - append("{{{baseName}}}", x.toString()) + append("{{#lambda.escapeDollar}}{{{baseName}}}{{/lambda.escapeDollar}}", x.toString()) } {{/isArray}} {{/isFile}} @@ -135,48 +135,48 @@ import com.fasterxml.jackson.databind.ObjectMapper {{#isModel}} {{#isDeepObject}} {{#vars}} - {{{paramName}}}?.{{{name}}}?.let { localVariableQuery["{{vendorExtensions.x-kotlin-param-base-name}}[{{baseName}}]"] = listOf("$it") } + {{{paramName}}}?.{{{name}}}?.let { localVariableQuery["{{#lambda.escapeDollar}}{{vendorExtensions.x-kotlin-param-base-name}}{{/lambda.escapeDollar}}[{{#lambda.escapeDollar}}{{baseName}}{{/lambda.escapeDollar}}]"] = listOf("$it") } {{/vars}} {{/isDeepObject}} {{^isDeepObject}} {{#isExplode}} {{#vars}} - {{{paramName}}}?.{{{name}}}?.let { localVariableQuery["{{baseName}}"] = listOf("$it") } + {{{paramName}}}?.{{{name}}}?.let { localVariableQuery["{{#lambda.escapeDollar}}{{baseName}}{{/lambda.escapeDollar}}"] = listOf("$it") } {{/vars}} {{/isExplode}} {{^isExplode}} - {{{paramName}}}?.let { _model -> listOfNotNull({{#vars}}_model.{{{name}}}?.let { "{{baseName}},$it" }{{^-last}}, {{/-last}}{{/vars}}).takeIf { it.isNotEmpty() }?.let { localVariableQuery["{{baseName}}"] = listOf(it.joinToString(",")) } } + {{{paramName}}}?.let { _model -> listOfNotNull({{#vars}}_model.{{{name}}}?.let { "{{#lambda.escapeDollar}}{{baseName}}{{/lambda.escapeDollar}},$it" }{{^-last}}, {{/-last}}{{/vars}}).takeIf { it.isNotEmpty() }?.let { localVariableQuery["{{#lambda.escapeDollar}}{{baseName}}{{/lambda.escapeDollar}}"] = listOf(it.joinToString(",")) } } {{/isExplode}} {{/isDeepObject}} {{/isModel}} {{^isModel}} {{#isMap}} {{#isDeepObject}} - {{{paramName}}}?.forEach { (key, value) -> localVariableQuery["{{baseName}}[$key]"] = listOf("$value") } + {{{paramName}}}?.forEach { (key, value) -> localVariableQuery["{{#lambda.escapeDollar}}{{baseName}}{{/lambda.escapeDollar}}[$key]"] = listOf("$value") } {{/isDeepObject}} {{^isDeepObject}} {{#isExplode}} {{{paramName}}}?.forEach { (key, value) -> localVariableQuery[key] = listOf("$value") } {{/isExplode}} {{^isExplode}} - {{{paramName}}}?.takeIf { it.isNotEmpty() }?.let { localVariableQuery["{{baseName}}"] = listOf(it.entries.joinToString(",") { (k, v) -> "$k,$v" }) } + {{{paramName}}}?.takeIf { it.isNotEmpty() }?.let { localVariableQuery["{{#lambda.escapeDollar}}{{baseName}}{{/lambda.escapeDollar}}"] = listOf(it.entries.joinToString(",") { (k, v) -> "$k,$v" }) } {{/isExplode}} {{/isDeepObject}} {{/isMap}} {{^isMap}} - {{{paramName}}}?.apply { localVariableQuery["{{baseName}}"] = {{#isContainer}}toMultiValue(this, "{{collectionFormat}}"){{/isContainer}}{{^isContainer}}listOf("${{{paramName}}}"){{/isContainer}} } + {{{paramName}}}?.apply { localVariableQuery["{{#lambda.escapeDollar}}{{baseName}}{{/lambda.escapeDollar}}"] = {{#isContainer}}toMultiValue(this, "{{collectionFormat}}"){{/isContainer}}{{^isContainer}}listOf("${{{paramName}}}"){{/isContainer}} } {{/isMap}} {{/isModel}} {{/queryParams}} val localVariableHeaders = mutableMapOf() {{#headerParams}} - {{{paramName}}}?.apply { localVariableHeaders["{{baseName}}"] = {{#isContainer}}this.joinToString(separator = collectionDelimiter("{{collectionFormat}}")){{/isContainer}}{{^isContainer}}this.toString(){{/isContainer}} } + {{{paramName}}}?.apply { localVariableHeaders["{{#lambda.escapeDollar}}{{baseName}}{{/lambda.escapeDollar}}"] = {{#isContainer}}this.joinToString(separator = collectionDelimiter("{{collectionFormat}}")){{/isContainer}}{{^isContainer}}this.toString(){{/isContainer}} } {{/headerParams}} val localVariableConfig = RequestConfig( RequestMethod.{{httpMethod}}, - "{{{path}}}"{{#pathParams}}.replace("{" + "{{baseName}}" + "}", "${{{paramName}}}"){{/pathParams}}, + "{{{path}}}"{{#pathParams}}.replace("{" + "{{#lambda.escapeDollar}}{{baseName}}{{/lambda.escapeDollar}}" + "}", "${{{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-retrofit2/explodedQueryParam.mustache b/modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm-retrofit2/explodedQueryParam.mustache index 3aaa4e67fbf4..ac18b37a3d6e 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.escapeDollar}}{{baseName}}{{/lambda.escapeDollar}}") {{#lambda.escapeDollar}}{{{baseName}}}{{/lambda.escapeDollar}}: {{#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..bf92485b7aea 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.escapeDollar}}{{baseName}}{{/lambda.escapeDollar}}") {{{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("{{#lambda.escapeDollar}}{{baseName}}{{/lambda.escapeDollar}}"){{/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..417bef8a2d79 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.escapeDollar}}{{baseName}}{{/lambda.escapeDollar}}") {{{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 diff --git a/modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm-retrofit2/infrastructure/ApiClient.kt.mustache b/modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm-retrofit2/infrastructure/ApiClient.kt.mustache index c48089c023d9..bd712ff3dd09 100644 --- a/modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm-retrofit2/infrastructure/ApiClient.kt.mustache +++ b/modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm-retrofit2/infrastructure/ApiClient.kt.mustache @@ -139,7 +139,7 @@ import okhttp3.MediaType.Companion.toMediaType val auth: Interceptor? = when (authName) { {{#authMethods}} {{#isBasicBasic}}"{{name}}" -> HttpBasicAuth() {{/isBasicBasic}}{{#isBasicBearer}}"{{name}}" -> HttpBearerAuth("{{scheme}}") - {{/isBasicBearer}}{{#isApiKey}}"{{name}}" -> ApiKeyAuth({{#isKeyInHeader}}"header"{{/isKeyInHeader}}{{#isKeyInQuery}}"query"{{/isKeyInQuery}}{{#isKeyInCookie}}"cookie"{{/isKeyInCookie}}, "{{keyParamName}}") + {{/isBasicBearer}}{{#isApiKey}}"{{name}}" -> ApiKeyAuth({{#isKeyInHeader}}"header"{{/isKeyInHeader}}{{#isKeyInQuery}}"query"{{/isKeyInQuery}}{{#isKeyInCookie}}"cookie"{{/isKeyInCookie}}, "{{#lambda.escapeDollar}}{{keyParamName}}{{/lambda.escapeDollar}}") {{/isApiKey}}{{#isOAuth}}"{{name}}" -> OAuth(OAuthFlow.{{flow}}, "{{authorizationUrl}}", "{{tokenUrl}}", "{{#scopes}}{{scope}}{{^-last}}, {{/-last}}{{/scopes}}") {{/isOAuth}}{{^isBasicBasic}}{{^isBasicBearer}}{{^isApiKey}}{{^isOAuth}}"{{name}}" -> null{{/isOAuth}}{{/isApiKey}}{{/isBasicBearer}}{{/isBasicBasic}}{{/authMethods}} else -> throw RuntimeException("auth name $authName not found in available auth names") 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..cc1ade84683c 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.escapeDollar}}{{baseName}}{{/lambda.escapeDollar}}") {{{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 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..a0213c39d72d 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.escapeDollar}}{{baseName}}{{/lambda.escapeDollar}}") {{{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 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 8a5ebb536dd1..3b6cfd7da3a9 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 @@ -107,7 +107,7 @@ import {{packageName}}.infrastructure.* }}{{#bodyParams}}{{{paramName}}}{{/bodyParams}}{{/hasBodyParam}}{{^hasBodyParam}}{{! }}{{^hasFormParams}}null{{/hasFormParams}}{{! }}{{#hasFormParams}}mapOf({{#formParams}} - "{{{baseName}}}" to PartConfig(body = {{{paramName}}}{{#isEnum}}{{^required}}?{{/required}}.value{{/isEnum}}, headers = mutableMapOf({{#contentType}}"Content-Type" to "{{contentType}}"{{/contentType}})),{{! + "{{#lambda.escapeDollar}}{{{baseName}}}{{/lambda.escapeDollar}}" to PartConfig(body = {{{paramName}}}{{#isEnum}}{{^required}}?{{/required}}.value{{/isEnum}}, headers = mutableMapOf({{#contentType}}"Content-Type" to "{{contentType}}"{{/contentType}})),{{! }}{{/formParams}}){{/hasFormParams}}{{! }}{{/hasBodyParam}} val localVariableQuery = {{^hasQueryParams}}mutableMapOf>() @@ -116,17 +116,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.escapeDollar}}{{baseName}}{{/lambda.escapeDollar}}", {{#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.escapeDollar}}{{baseName}}{{/lambda.escapeDollar}}", {{#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.escapeDollar}}{{baseName}}{{/lambda.escapeDollar}}", {{#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}} @@ -136,12 +136,12 @@ import {{packageName}}.infrastructure.* {{^hasFormParams}}{{#hasConsumes}}{{#consumes}}localVariableHeaders["Content-Type"] = "{{{mediaType}}}" {{/consumes}}{{/hasConsumes}}{{/hasFormParams}}{{#hasProduces}}localVariableHeaders["Accept"] = "{{#produces}}{{{mediaType}}}{{^-last}}, {{/-last}}{{/produces}}"{{/hasProduces}} {{#headerParams}} - {{{paramName}}}{{^required}}?{{/required}}.apply { localVariableHeaders["{{baseName}}"] = {{#isContainer}}this.joinToString(separator = collectionDelimiter("{{collectionFormat}}")){{/isContainer}}{{^isContainer}}this.toString(){{/isContainer}} } + {{{paramName}}}{{^required}}?{{/required}}.apply { localVariableHeaders["{{#lambda.escapeDollar}}{{baseName}}{{/lambda.escapeDollar}}"] = {{#isContainer}}this.joinToString(separator = collectionDelimiter("{{collectionFormat}}")){{/isContainer}}{{^isContainer}}this.toString(){{/isContainer}} } {{/headerParams}} val localVariableParams = mutableMapOf( {{#pathParams}} - "{{baseName}}" to {{#isContainer}}{{paramName}}.joinToString(","){{/isContainer}}{{^isContainer}}{{{paramName}}}{{#isEnum}}{{^required}}?{{/required}}.value{{/isEnum}}{{/isContainer}}, + "{{#lambda.escapeDollar}}{{baseName}}{{/lambda.escapeDollar}}" to {{#isContainer}}{{paramName}}.joinToString(","){{/isContainer}}{{^isContainer}}{{{paramName}}}{{#isEnum}}{{^required}}?{{/required}}.value{{/isEnum}}{{/isContainer}}, {{/pathParams}} ) 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 b9aae408a8bc..a0bed1afa692 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 @@ -94,7 +94,7 @@ import {{packageName}}.infrastructure.* }}{{#bodyParams}}{{{paramName}}}{{/bodyParams}}{{/hasBodyParam}}{{^hasBodyParam}}{{! }}{{^hasFormParams}}null{{/hasFormParams}}{{! }}{{#hasFormParams}}mapOf({{#formParams}} - "{{{baseName}}}" to PartConfig(body = {{{paramName}}}{{#isEnum}}{{^required}}?{{/required}}.value{{/isEnum}}, headers = mutableMapOf({{#contentType}}"Content-Type" to "{{contentType}}"{{/contentType}})),{{! + "{{#lambda.escapeDollar}}{{{baseName}}}{{/lambda.escapeDollar}}" to PartConfig(body = {{{paramName}}}{{#isEnum}}{{^required}}?{{/required}}.value{{/isEnum}}, headers = mutableMapOf({{#contentType}}"Content-Type" to "{{contentType}}"{{/contentType}})),{{! }}{{/formParams}}){{/hasFormParams}}{{! }}{{/hasBodyParam}} val localVariableQuery = {{^hasQueryParams}}mutableMapOf>() @@ -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.escapeDollar}}{{baseName}}{{/lambda.escapeDollar}}", {{#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.escapeDollar}}{{baseName}}{{/lambda.escapeDollar}}", {{#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.escapeDollar}}{{baseName}}{{/lambda.escapeDollar}}", {{#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}} @@ -123,12 +123,12 @@ import {{packageName}}.infrastructure.* {{^hasFormParams}}{{#hasConsumes}}{{#consumes}}localVariableHeaders["Content-Type"] = "{{{mediaType}}}" {{/consumes}}{{/hasConsumes}}{{/hasFormParams}}{{#hasProduces}}localVariableHeaders["Accept"] = "{{#produces}}{{{mediaType}}}{{^-last}}, {{/-last}}{{/produces}}"{{/hasProduces}} {{#headerParams}} - {{{paramName}}}{{^required}}?{{/required}}.apply { localVariableHeaders["{{baseName}}"] = {{#isContainer}}this.joinToString(separator = collectionDelimiter("{{collectionFormat}}")){{/isContainer}}{{^isContainer}}this.toString(){{/isContainer}} } + {{{paramName}}}{{^required}}?{{/required}}.apply { localVariableHeaders["{{#lambda.escapeDollar}}{{baseName}}{{/lambda.escapeDollar}}"] = {{#isContainer}}this.joinToString(separator = collectionDelimiter("{{collectionFormat}}")){{/isContainer}}{{^isContainer}}this.toString(){{/isContainer}} } {{/headerParams}} val localVariableParams = mutableMapOf( {{#pathParams}} - "{{baseName}}" to {{#isContainer}}{{paramName}}.joinToString(","){{/isContainer}}{{^isContainer}}{{{paramName}}}{{#isEnum}}{{^required}}?{{/required}}.value{{/isEnum}}{{/isContainer}}, + "{{#lambda.escapeDollar}}{{baseName}}{{/lambda.escapeDollar}}" to {{#isContainer}}{{paramName}}.joinToString(","){{/isContainer}}{{^isContainer}}{{{paramName}}}{{#isEnum}}{{^required}}?{{/required}}.value{{/isEnum}}{{/isContainer}}, {{/pathParams}} ) 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 418852836a8d..d12279afc75d 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 @@ -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 localVariableClient = WebClient.create(this.vertx) - val localVariableRequest = localVariableClient.requestAbs(HttpMethod.{{httpMethod}}, UriTemplate.of("${this.basePath}{{{path}}}"{{#pathParams}}.replace("{"+"{{baseName}}"+"}", this.encodeURIComponent({{#isContainer}}{{paramName}}.joinToString(","){{/isContainer}}{{^isContainer}}{{{paramName}}}{{#isEnum}}{{^required}}?{{/required}}.value{{/isEnum}}.toString(){{/isContainer}})){{/pathParams}})) + val localVariableRequest = localVariableClient.requestAbs(HttpMethod.{{httpMethod}}, UriTemplate.of("${this.basePath}{{{path}}}"{{#pathParams}}.replace("{"+"{{#lambda.escapeDollar}}{{baseName}}{{/lambda.escapeDollar}}"+"}", this.encodeURIComponent({{#isContainer}}{{paramName}}.joinToString(","){{/isContainer}}{{^isContainer}}{{{paramName}}}{{#isEnum}}{{^required}}?{{/required}}.value{{/isEnum}}.toString(){{/isContainer}})){{/pathParams}})) {{#hasFormParams}}localVariableRequest.putHeader("Content-Type", {{^consumes}}"multipart/form-data"{{/consumes}}{{#consumes.0}}"{{{mediaType}}}"{{/consumes.0}}){{/hasFormParams}} - {{#headerParams}}{{{paramName}}}{{^required}}?{{/required}}.apply { localVariableRequest.putHeader("{{baseName}}", {{#isContainer}}this.joinToString(separator = collectionDelimiter("{{collectionFormat}}")){{/isContainer}}{{^isContainer}}this.toString(){{/isContainer}})}{{/headerParams}} + {{#headerParams}}{{{paramName}}}{{^required}}?{{/required}}.apply { localVariableRequest.putHeader("{{#lambda.escapeDollar}}{{baseName}}{{/lambda.escapeDollar}}", {{#isContainer}}this.joinToString(separator = collectionDelimiter("{{collectionFormat}}")){{/isContainer}}{{^isContainer}}this.toString(){{/isContainer}})}{{/headerParams}} {{^hasFormParams}}{{#hasConsumes}} {{#consumes}} localVariableRequest.putHeader("Content-Type", "{{{mediaType}}}") @@ -152,32 +152,32 @@ import {{packageName}}.infrastructure.* {{#hasFormParams}} val localVariableForm = io.vertx.core.MultiMap.caseInsensitiveMultiMap(); {{#formParams}} - {{{paramName}}}{{^required}}?{{/required}}.let { localVariableForm.add("{{{baseName}}}", {{{paramName}}}{{#isEnum}}{{^required}}?{{/required}}.value{{/isEnum}}{{^isString}}.toString(){{/isString}}) } + {{{paramName}}}{{^required}}?{{/required}}.let { localVariableForm.add("{{#lambda.escapeDollar}}{{{baseName}}}{{/lambda.escapeDollar}}", {{{paramName}}}{{#isEnum}}{{^required}}?{{/required}}.value{{/isEnum}}{{^isString}}.toString(){{/isString}}) } {{/formParams}} {{/hasFormParams}} {{#hasQueryParams}} {{#queryParams}} - {{{paramName}}}{{^required}}?{{/required}}.let { localVariableRequest.queryParams().add("{{baseName}}", {{#isContainer}}toMultiValue(it.toList(), "{{collectionFormat}}"){{/isContainer}}{{^isContainer}}listOf({{#isDateTime}}this.parseDateToQueryString<{{{dataType}}}>(it){{/isDateTime}}{{#isDate}}this.parseDateToQueryString<{{{dataType}}}>(it){{/isDate}}{{^isDateTime}}{{^isDate}}it.toString(){{/isDate}}{{/isDateTime}}){{/isContainer}}) } + {{{paramName}}}{{^required}}?{{/required}}.let { localVariableRequest.queryParams().add("{{#lambda.escapeDollar}}{{baseName}}{{/lambda.escapeDollar}}", {{#isContainer}}toMultiValue(it.toList(), "{{collectionFormat}}"){{/isContainer}}{{^isContainer}}listOf({{#isDateTime}}this.parseDateToQueryString<{{{dataType}}}>(it){{/isDateTime}}{{#isDate}}this.parseDateToQueryString<{{{dataType}}}>(it){{/isDate}}{{^isDateTime}}{{^isDate}}it.toString(){{/isDate}}{{/isDateTime}}){{/isContainer}}) } {{/queryParams}} {{/hasQueryParams}} {{#authMethods}} {{#isApiKey}} - if (this.apiKey["{{keyParamName}}"] != null) { - if (this.apiKeyPrefix["{{keyParamName}}"] != null) { + if (this.apiKey["{{#lambda.escapeDollar}}{{keyParamName}}{{/lambda.escapeDollar}}"] != null) { + if (this.apiKeyPrefix["{{#lambda.escapeDollar}}{{keyParamName}}{{/lambda.escapeDollar}}"] != null) { {{#isKeyInHeader}} - localVariableRequest.putHeader("{{keyParamName}}", this.apiKeyPrefix["{{keyParamName}}"]!! + " " + this.apiKey["{{keyParamName}}"]!!) + localVariableRequest.putHeader("{{#lambda.escapeDollar}}{{keyParamName}}{{/lambda.escapeDollar}}", this.apiKeyPrefix["{{#lambda.escapeDollar}}{{keyParamName}}{{/lambda.escapeDollar}}"]!! + " " + this.apiKey["{{#lambda.escapeDollar}}{{keyParamName}}{{/lambda.escapeDollar}}"]!!) {{/isKeyInHeader}} {{#isKeyInQuery}} - localVariableRequest.queryParams().add("{{keyParamName}}", this.apiKeyPrefix["{{keyParamName}}"]!! + " " + this.apiKey["{{keyParamName}}"]!!) + localVariableRequest.queryParams().add("{{#lambda.escapeDollar}}{{keyParamName}}{{/lambda.escapeDollar}}", this.apiKeyPrefix["{{#lambda.escapeDollar}}{{keyParamName}}{{/lambda.escapeDollar}}"]!! + " " + this.apiKey["{{#lambda.escapeDollar}}{{keyParamName}}{{/lambda.escapeDollar}}"]!!) {{/isKeyInQuery}} } else { {{#isKeyInHeader}} - localVariableRequest.putHeader("{{keyParamName}}", this.apiKey["{{keyParamName}}"]!!) + localVariableRequest.putHeader("{{#lambda.escapeDollar}}{{keyParamName}}{{/lambda.escapeDollar}}", this.apiKey["{{#lambda.escapeDollar}}{{keyParamName}}{{/lambda.escapeDollar}}"]!!) {{/isKeyInHeader}} {{#isKeyInQuery}} - localVariableRequest.queryParams().add("{{keyParamName}}", this.apiKey["{{keyParamName}}"]!!) + localVariableRequest.queryParams().add("{{#lambda.escapeDollar}}{{keyParamName}}{{/lambda.escapeDollar}}", this.apiKey["{{#lambda.escapeDollar}}{{keyParamName}}{{/lambda.escapeDollar}}"]!!) {{/isKeyInQuery}} } } 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 52e179535a04..f8ba57fa727d 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 localVariablePath = "{{{path}}}"{{#pathParams}}.replace("{" + "{{baseName}}" + "}", {{#isContainer}}{{paramName}}.joinToString(","){{/isContainer}}{{^isContainer}}IRequestFactory.escapeString({{{paramName}}}.toString()){{/isContainer}}){{/pathParams}} + val localVariablePath = "{{{path}}}"{{#pathParams}}.replace("{" + "{{#lambda.escapeDollar}}{{baseName}}{{/lambda.escapeDollar}}" + "}", {{#isContainer}}{{paramName}}.joinToString(","){{/isContainer}}{{^isContainer}}IRequestFactory.escapeString({{{paramName}}}.toString()){{/isContainer}}){{/pathParams}} val localVariableFormParams = mapOf({{^formParams}}){{/formParams}}{{#formParams}} - "{{baseName}}" to IRequestFactory.parameterToString({{paramName}}){{^-last}},{{/-last}}{{#-last}} + "{{#lambda.escapeDollar}}{{baseName}}{{/lambda.escapeDollar}}" 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 localVariableQueryParams = mapOf({{^queryParams}}){{/queryParams}}{{#queryParams}} - "{{baseName}}" to IRequestFactory.parameterToString({{paramName}}){{^-last}},{{/-last}}{{#-last}} + "{{#lambda.escapeDollar}}{{baseName}}{{/lambda.escapeDollar}}" to IRequestFactory.parameterToString({{paramName}}){{^-last}},{{/-last}}{{#-last}} ){{/-last}}{{/queryParams}} .filter { it.value.isNotEmpty() } val localVariableHeaderParams: Map = mapOf({{^headerParams}}){{/headerParams}}{{#headerParams}} - "{{baseName}}" to IRequestFactory.parameterToString({{paramName}}){{^-last}},{{/-last}}{{#-last}} + "{{#lambda.escapeDollar}}{{baseName}}{{/lambda.escapeDollar}}" to IRequestFactory.parameterToString({{paramName}}){{^-last}},{{/-last}}{{#-last}} ){{/-last}}{{/headerParams}} return suspendCoroutine { continuation -> 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 b49ef667bef1..28dd4415d86a 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 @@ -73,28 +73,28 @@ import kotlinx.serialization.encoding.* {{#formParams}} {{#isArray}} {{{paramName}}}?.onEach { - {{#isFile}}append(it){{/isFile}}{{^isFile}}append("{{{baseName}}}", it.toString()){{/isFile}} + {{#isFile}}append(it){{/isFile}}{{^isFile}}append("{{#lambda.escapeDollar}}{{{baseName}}}{{/lambda.escapeDollar}}", it.toString()){{/isFile}} } {{/isArray}} {{^isArray}} {{#isFile}} - {{{paramName}}}?.apply { append({{{baseName}}}) } + {{{paramName}}}?.apply { append({{#lambda.escapeDollar}}{{{baseName}}}{{/lambda.escapeDollar}}) } {{/isFile}} {{^isFile}} {{#isPrimitiveType}} {{#isString}} - {{{paramName}}}?.apply { append("{{{baseName}}}", {{{paramName}}}) } + {{{paramName}}}?.apply { append("{{#lambda.escapeDollar}}{{{baseName}}}{{/lambda.escapeDollar}}", {{{paramName}}}) } {{/isString}} {{^isString}} - {{{paramName}}}?.apply { append("{{{baseName}}}", {{{paramName}}}.toString()) } + {{{paramName}}}?.apply { append("{{#lambda.escapeDollar}}{{{baseName}}}{{/lambda.escapeDollar}}", {{{paramName}}}.toString()) } {{/isString}} {{/isPrimitiveType}} {{^isPrimitiveType}} {{#isEnumOrRef}} - {{{paramName}}}?.apply { append("{{{baseName}}}", {{{paramName}}}.value.toString()) } + {{{paramName}}}?.apply { append("{{#lambda.escapeDollar}}{{{baseName}}}{{/lambda.escapeDollar}}", {{{paramName}}}.value.toString()) } {{/isEnumOrRef}} {{^isEnumOrRef}} - {{{paramName}}}?.apply { append("{{{baseName}}}", ApiClient.JSON_DEFAULT.encodeToString({{{dataType}}}.serializer(), {{{paramName}}})) } + {{{paramName}}}?.apply { append("{{#lambda.escapeDollar}}{{{baseName}}}{{/lambda.escapeDollar}}", ApiClient.JSON_DEFAULT.encodeToString({{{dataType}}}.serializer(), {{{paramName}}})) } {{/isEnumOrRef}} {{/isPrimitiveType}} {{/isFile}} @@ -105,7 +105,7 @@ import kotlinx.serialization.encoding.* {{^isMultipart}} ParametersBuilder().also { {{#formParams}} - {{{paramName}}}?.apply { it.append("{{{baseName}}}", {{{paramName}}}.toString()) } + {{{paramName}}}?.apply { it.append("{{#lambda.escapeDollar}}{{{baseName}}}{{/lambda.escapeDollar}}", {{{paramName}}}.toString()) } {{/formParams}} }.build() {{/isMultipart}} @@ -116,13 +116,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.escapeDollar}}{{baseName}}{{/lambda.escapeDollar}}"] = {{#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.escapeDollar}}{{baseName}}{{/lambda.escapeDollar}}"] = {{#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}}, + "{{{path}}}"{{#pathParams}}.replace("{" + "{{#lambda.escapeDollar}}{{baseName}}{{/lambda.escapeDollar}}" + "}", {{#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/test/java/org/openapitools/codegen/kotlin/KotlinClientCodegenApiTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/kotlin/KotlinClientCodegenApiTest.java index f453a34d82b6..fe79c15c5990 100644 --- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/kotlin/KotlinClientCodegenApiTest.java +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/kotlin/KotlinClientCodegenApiTest.java @@ -653,6 +653,49 @@ private static Set constructorMemberNames(Path template) throws IOExcept return names; } + /** + * Wire names containing `$` (OData-style `$filter`/`$top`) must be emitted + * as escaped Kotlin string literals (`"\$filter"`), otherwise Kotlin + * string interpolation turns the wire key into the same-named parameter's + * value — or fails compilation when no such variable exists. Covers every + * kotlin-client library (jvm-okhttp already escaped; the rest did not). + */ + @Test + void testKotlinLibrariesEscapeDollarInWireNames() throws IOException { + String spec = "src/test/resources/3_0/kotlin/kotlin-dollar-wire-name.yaml"; + String[][] libraries = { + {"jvm-vertx", "src/main/kotlin/org/openapitools/client/apis/DefaultApi.kt", "serializationLibrary=jackson"}, + {"jvm-volley", "src/main/java/org/openapitools/client/apis/DefaultApi.kt", "serializationLibrary=gson"}, + {"jvm-spring-restclient", "src/main/kotlin/org/openapitools/client/apis/DefaultApi.kt", "useSpringBoot3=true", "serializationLibrary=jackson"}, + {"jvm-spring-webclient", "src/main/kotlin/org/openapitools/client/apis/DefaultApi.kt", "useSpringBoot3=true", "serializationLibrary=jackson"}, + {"jvm-ktor", "src/main/kotlin/org/openapitools/client/apis/DefaultApi.kt", "serializationLibrary=jackson", "dateLibrary=java8"}, + {"jvm-retrofit2", "src/main/kotlin/org/openapitools/client/apis/DefaultApi.kt", "serializationLibrary=jackson", "dateLibrary=java8"}, + {"jvm-okhttp4", "src/main/kotlin/org/openapitools/client/apis/DefaultApi.kt", "serializationLibrary=jackson", "dateLibrary=java8"}, + {"multiplatform", "src/commonMain/kotlin/org/openapitools/client/apis/DefaultApi.kt", "dateLibrary=kotlinx-datetime"}, + }; + for (String[] lib : libraries) { + Path target = Files.createTempDirectory("kotlin-dollar-" + lib[0]); + try { + generate(lib[0], spec, target, Arrays.copyOfRange(lib, 2, lib.length)); + Path apiFile = target.resolve(lib[1]); + Assert.assertTrue(Files.exists(apiFile), lib[0] + " must emit " + lib[1]); + String api = new String(Files.readAllBytes(apiFile), StandardCharsets.UTF_8); + Assert.assertTrue(api.contains("\\$filter"), + lib[0] + ": wire name $filter must be escaped in the Kotlin literal"); + Assert.assertTrue(api.contains("\\$top"), + lib[0] + ": wire name $top must be escaped in the Kotlin literal"); + // "$top" unescaped could only come from the wire key — no `top` + // variable exists in scope, so it cannot be a legitimate + // interpolation ("$filter" appears legitimately as the + // `filter` param's value-side interpolation) + Assert.assertFalse(api.contains("\"$top\""), + lib[0] + ": bare \"$top\" means the wire key is unescaped"); + } finally { + deleteRecursively(target); + } + } + } + @Test void testNonOkhttpLibrariesSkipOpenApi32Operations() throws IOException { Path target = Files.createTempDirectory("kotlin32-skip"); diff --git a/modules/openapi-generator/src/test/resources/3_0/kotlin/kotlin-dollar-wire-name.yaml b/modules/openapi-generator/src/test/resources/3_0/kotlin/kotlin-dollar-wire-name.yaml new file mode 100644 index 000000000000..78a04d7d0dfa --- /dev/null +++ b/modules/openapi-generator/src/test/resources/3_0/kotlin/kotlin-dollar-wire-name.yaml @@ -0,0 +1,18 @@ +openapi: 3.0.3 +info: {title: Dollar, version: 1.0.0} +paths: + /items: + get: + operationId: listItems + parameters: + - name: $filter + in: query + schema: {type: string} + - name: $top + in: query + schema: {type: integer} + - name: filter + in: query + schema: {type: string} + responses: + '200': {description: ok} From f1575f38051011e36ea8f0aded29d5dbdca6d241 Mon Sep 17 00:00:00 2001 From: khayashi4337 Date: Thu, 24 Sep 2026 13:50:30 +0900 Subject: [PATCH 27/31] fix(kotlin-client): qualify multiplatform wrap-map receiver as this.value `.map(block: T.() -> V)` is a receiver lambda, so `.map { value }` normally resolves to the wrapper's `value` field. But a spec parameter named `value` shadows it and the lambda returns the caller's argument instead of the decoded response (or fails to compile when types diverge). Emit `this.value` so the receiver member is unambiguous. Fixture kotlin-receiver-value.yaml exercises array and map responses with a `value` query param; generated commonMain sources compile under kotlinc. Generated with [Devin](https://devin.ai) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com> --- .../libraries/multiplatform/api.mustache | 2 +- .../kotlin/KotlinClientCodegenApiTest.java | 28 ++++++++++++++++++ .../3_0/kotlin/kotlin-receiver-value.yaml | 29 +++++++++++++++++++ 3 files changed, 58 insertions(+), 1 deletion(-) create mode 100644 modules/openapi-generator/src/test/resources/3_0/kotlin/kotlin-receiver-value.yaml 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 28dd4415d86a..23cfb0bff591 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 @@ -132,7 +132,7 @@ import kotlinx.serialization.encoding.* localVariableConfig, localVariableBody, localVariableAuthNames - ).{{#isArray}}wrap<{{operationIdCamelCase}}Response>().map { value{{^isList}}.toTypedArray(){{/isList}} }{{/isArray}}{{^isArray}}{{#isMap}}wrap<{{operationIdCamelCase}}Response>().map { value }{{/isMap}}{{^isMap}}wrap(){{/isMap}}{{/isArray}} + ).{{#isArray}}wrap<{{operationIdCamelCase}}Response>().map { this.value{{^isList}}.toTypedArray(){{/isList}} }{{/isArray}}{{^isArray}}{{#isMap}}wrap<{{operationIdCamelCase}}Response>().map { this.value }{{/isMap}}{{^isMap}}wrap(){{/isMap}}{{/isArray}} } {{#hasBodyParam}} diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/kotlin/KotlinClientCodegenApiTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/kotlin/KotlinClientCodegenApiTest.java index fe79c15c5990..4b88badef2cd 100644 --- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/kotlin/KotlinClientCodegenApiTest.java +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/kotlin/KotlinClientCodegenApiTest.java @@ -696,6 +696,34 @@ void testKotlinLibrariesEscapeDollarInWireNames() throws IOException { } } + /** + * multiplatform wraps array/map responses via a receiver lambda + * `.map { value }`; a spec parameter named `value` shadows the + * receiver's member, so the decoded field must be referenced as + * `this.value`. + */ + @Test + void testMultiplatformWrapMapUsesExplicitReceiver() throws IOException { + Path target = Files.createTempDirectory("kotlin-mp-value"); + try { + generate("multiplatform", "src/test/resources/3_0/kotlin/kotlin-receiver-value.yaml", + target, "dateLibrary=kotlinx-datetime"); + String api = new String(Files.readAllBytes( + target.resolve("src/commonMain/kotlin/org/openapitools/client/apis/DefaultApi.kt")), + StandardCharsets.UTF_8); + Assert.assertTrue(api.contains("`value`: kotlin.String?"), + "the spec `value` param must keep its (backticked) name"); + Assert.assertTrue(api.contains("wrap().map { this.value }"), + "array response must dereference the wrapper's value via explicit receiver"); + Assert.assertTrue(api.contains("wrap().map { this.value }"), + "map response must dereference the wrapper's value via explicit receiver"); + Assert.assertFalse(api.contains(".map { value }"), + "bare `value` inside map{} resolves to the spec param, not the wrapper field"); + } finally { + deleteRecursively(target); + } + } + @Test void testNonOkhttpLibrariesSkipOpenApi32Operations() throws IOException { Path target = Files.createTempDirectory("kotlin32-skip"); diff --git a/modules/openapi-generator/src/test/resources/3_0/kotlin/kotlin-receiver-value.yaml b/modules/openapi-generator/src/test/resources/3_0/kotlin/kotlin-receiver-value.yaml new file mode 100644 index 000000000000..7b5eb2b21060 --- /dev/null +++ b/modules/openapi-generator/src/test/resources/3_0/kotlin/kotlin-receiver-value.yaml @@ -0,0 +1,29 @@ +openapi: 3.0.3 +info: {title: ReceiverValue, version: 1.0.0} +paths: + /items: + get: + operationId: listItems + parameters: + - name: value + in: query + schema: {type: string} + responses: + '200': + description: ok + content: + application/json: + schema: {type: array, items: {type: string}} + /lookup: + get: + operationId: lookupItems + parameters: + - name: value + in: query + schema: {type: string} + responses: + '200': + description: ok + content: + application/json: + schema: {type: object, additionalProperties: {type: string}} From 07530ab166f67ca2f76abc9faca8343574c6c8ec Mon Sep 17 00:00:00 2001 From: khayashi4337 Date: Thu, 24 Sep 2026 13:54:11 +0900 Subject: [PATCH 28/31] fix(kotlin-client): name the form-body ParametersBuilder lambda param MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit jvm-ktor and multiplatform built urlencoded/multipart form bodies via `ParametersBuilder().also { it.append(...) }`, relying on the implicit `it`. A form field named `it` shadows the implicit parameter, so `it.append` resolved against the String parameter — a compile error for every form field in that operation, not just the colliding one. Bind the builder to `localVariableBuilder` explicitly. Fixture kotlin-form-it-param.yaml sends form fields `it` + `name`; generated ktor and multiplatform clients compile cleanly under kotlinc. Generated with [Devin](https://devin.ai) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com> --- .../libraries/jvm-ktor/api.mustache | 10 +++--- .../libraries/multiplatform/api.mustache | 4 +-- .../kotlin/KotlinClientCodegenApiTest.java | 31 +++++++++++++++++++ .../3_0/kotlin/kotlin-form-it-param.yaml | 16 ++++++++++ 4 files changed, 54 insertions(+), 7 deletions(-) create mode 100644 modules/openapi-generator/src/test/resources/3_0/kotlin/kotlin-form-it-param.yaml 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 f5c0b546cce3..e13cf3d635b5 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 @@ -96,23 +96,23 @@ import com.fasterxml.jackson.databind.ObjectMapper } {{/isMultipart}} {{^isMultipart}} - ParametersBuilder().also { + ParametersBuilder().also { localVariableBuilder -> {{#formParams}} {{#isFile}} - {{{paramName}}}?.apply { it.append("{{#lambda.escapeDollar}}{{{baseName}}}{{/lambda.escapeDollar}}", {{{paramName}}}) } + {{{paramName}}}?.apply { localVariableBuilder.append("{{#lambda.escapeDollar}}{{{baseName}}}{{/lambda.escapeDollar}}", {{{paramName}}}) } {{/isFile}} {{^isFile}} {{^isArray}} {{^isString}} {{^isNumber}} - {{{paramName}}}?.apply { it.append("{{#lambda.escapeDollar}}{{{baseName}}}{{/lambda.escapeDollar}}", {{{paramName}}}.toString()) } + {{{paramName}}}?.apply { localVariableBuilder.append("{{#lambda.escapeDollar}}{{{baseName}}}{{/lambda.escapeDollar}}", {{{paramName}}}.toString()) } {{/isNumber}} {{#isNumber}} - {{{paramName}}}?.apply { it.append("{{#lambda.escapeDollar}}{{{baseName}}}{{/lambda.escapeDollar}}", {{{paramName}}}.toString()) } + {{{paramName}}}?.apply { localVariableBuilder.append("{{#lambda.escapeDollar}}{{{baseName}}}{{/lambda.escapeDollar}}", {{{paramName}}}.toString()) } {{/isNumber}} {{/isString}} {{#isString}} - {{{paramName}}}?.apply { it.append("{{#lambda.escapeDollar}}{{{baseName}}}{{/lambda.escapeDollar}}", {{{paramName}}}) } + {{{paramName}}}?.apply { localVariableBuilder.append("{{#lambda.escapeDollar}}{{{baseName}}}{{/lambda.escapeDollar}}", {{{paramName}}}) } {{/isString}} {{/isArray}} {{#isArray}} 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 23cfb0bff591..c6a697084a4b 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 @@ -103,9 +103,9 @@ import kotlinx.serialization.encoding.* } {{/isMultipart}} {{^isMultipart}} - ParametersBuilder().also { + ParametersBuilder().also { localVariableBuilder -> {{#formParams}} - {{{paramName}}}?.apply { it.append("{{#lambda.escapeDollar}}{{{baseName}}}{{/lambda.escapeDollar}}", {{{paramName}}}.toString()) } + {{{paramName}}}?.apply { localVariableBuilder.append("{{#lambda.escapeDollar}}{{{baseName}}}{{/lambda.escapeDollar}}", {{{paramName}}}.toString()) } {{/formParams}} }.build() {{/isMultipart}} diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/kotlin/KotlinClientCodegenApiTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/kotlin/KotlinClientCodegenApiTest.java index 4b88badef2cd..3c299800ff08 100644 --- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/kotlin/KotlinClientCodegenApiTest.java +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/kotlin/KotlinClientCodegenApiTest.java @@ -724,6 +724,37 @@ void testMultiplatformWrapMapUsesExplicitReceiver() throws IOException { } } + /** + * ktor/multiplatform build form bodies inside `ParametersBuilder().also {}`, + * whose implicit `it` is the builder. A form field named `it` shadows the + * implicit parameter and `it.append(...)` resolves against the String + * parameter instead of the builder — a compile error. The builder must be + * bound to an explicit localVariable name. + */ + @Test + void testKtorMultiplatformFormBuilderDoesNotUseImplicitIt() throws IOException { + String spec = "src/test/resources/3_0/kotlin/kotlin-form-it-param.yaml"; + String[][] libraries = { + {"jvm-ktor", "src/main/kotlin/org/openapitools/client/apis/DefaultApi.kt", "serializationLibrary=jackson", "dateLibrary=java8"}, + {"multiplatform", "src/commonMain/kotlin/org/openapitools/client/apis/DefaultApi.kt", "dateLibrary=kotlinx-datetime"}, + }; + for (String[] lib : libraries) { + Path target = Files.createTempDirectory("kotlin-formit-" + lib[0]); + try { + generate(lib[0], spec, target, Arrays.copyOfRange(lib, 2, lib.length)); + String api = new String(Files.readAllBytes(target.resolve(lib[1])), StandardCharsets.UTF_8); + Assert.assertTrue(api.contains("`it`: kotlin.String?"), + lib[0] + ": the spec `it` param must keep its (backticked) name"); + Assert.assertTrue(api.contains("localVariableBuilder.append(\"it\""), + lib[0] + ": form field `it` must be appended via the named builder"); + Assert.assertFalse(api.contains("it.append("), + lib[0] + ": implicit `it` is shadowed by the spec param inside also{}"); + } finally { + deleteRecursively(target); + } + } + } + @Test void testNonOkhttpLibrariesSkipOpenApi32Operations() throws IOException { Path target = Files.createTempDirectory("kotlin32-skip"); diff --git a/modules/openapi-generator/src/test/resources/3_0/kotlin/kotlin-form-it-param.yaml b/modules/openapi-generator/src/test/resources/3_0/kotlin/kotlin-form-it-param.yaml new file mode 100644 index 000000000000..07255c02152e --- /dev/null +++ b/modules/openapi-generator/src/test/resources/3_0/kotlin/kotlin-form-it-param.yaml @@ -0,0 +1,16 @@ +openapi: 3.0.3 +info: {title: It, version: 1.0.0} +paths: + /items: + post: + operationId: createItem + requestBody: + content: + application/x-www-form-urlencoded: + schema: + type: object + properties: + it: {type: string} + name: {type: string} + responses: + '200': {description: ok} From 75be8f402c6fc4a716f24807ce8bd6931a6f2a76 Mon Sep 17 00:00:00 2001 From: khayashi4337 Date: Thu, 24 Sep 2026 14:00:56 +0900 Subject: [PATCH 29/31] fix(kotlin-client): actually send the vertx form body MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit jvm-vertx populated a `localVariableForm` MultiMap for form params but the request was dispatched via `.sendBuffer(body)` or `.send()` only — the form map was silently dropped, a pre-existing functional gap. Send it: `.sendForm(localVariableForm)` for urlencoded forms and `.sendMultipartForm(localVariableForm)` (io.vertx.ext.web.multipart. MultipartForm) when the operation is multipart. Add an end-to-end wire test: generate the vertx client from kotlin-form-it-param.yaml, compile it with kotlinc against the vertx jars in ~/.m2, and capture the raw HTTP request on a ServerSocket — asserting `it=v1&name=n2` arrives with the urlencoded content type. Vert.x sends chunked bodies, which the capture decodes. Previously the body was empty (CAPTURE-FAIL); now it passes. Generated with [Devin](https://devin.ai) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com> --- .../libraries/jvm-vertx/api.mustache | 9 +- .../kotlin/KotlinClientCodegenApiTest.java | 74 ++++++++++++++++ .../3_0/kotlin-vertx-capture/Capture.kt | 85 +++++++++++++++++++ 3 files changed, 166 insertions(+), 2 deletions(-) create mode 100644 modules/openapi-generator/src/test/resources/3_0/kotlin-vertx-capture/Capture.kt 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 d12279afc75d..43a08323497a 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 @@ -150,9 +150,9 @@ import {{packageName}}.infrastructure.* {{#hasProduces}}localVariableRequest.putHeader("Accept", "{{#produces}}{{{mediaType}}}{{^-last}}, {{/-last}}{{/produces}}"){{/hasProduces}} {{#hasFormParams}} - val localVariableForm = io.vertx.core.MultiMap.caseInsensitiveMultiMap(); + {{#isMultipart}}val localVariableForm = io.vertx.ext.web.multipart.MultipartForm.create(){{/isMultipart}}{{^isMultipart}}val localVariableForm = io.vertx.core.MultiMap.caseInsensitiveMultiMap(){{/isMultipart}} {{#formParams}} - {{{paramName}}}{{^required}}?{{/required}}.let { localVariableForm.add("{{#lambda.escapeDollar}}{{{baseName}}}{{/lambda.escapeDollar}}", {{{paramName}}}{{#isEnum}}{{^required}}?{{/required}}.value{{/isEnum}}{{^isString}}.toString(){{/isString}}) } + {{{paramName}}}{{^required}}?{{/required}}.let { localVariableForm.{{#isMultipart}}attribute{{/isMultipart}}{{^isMultipart}}add{{/isMultipart}}("{{#lambda.escapeDollar}}{{{baseName}}}{{/lambda.escapeDollar}}", {{{paramName}}}{{#isEnum}}{{^required}}?{{/required}}.value{{/isEnum}}{{^isString}}.toString(){{/isString}}) } {{/formParams}} {{/hasFormParams}} @@ -208,7 +208,12 @@ import {{packageName}}.infrastructure.* .sendBuffer(this.responseBody({{#bodyParams}}{{{paramName}}}{{/bodyParams}})) {{/hasBodyParam}} {{^hasBodyParam}} + {{#hasFormParams}} + {{#isMultipart}}.sendMultipartForm(localVariableForm){{/isMultipart}}{{^isMultipart}}.sendForm(localVariableForm){{/isMultipart}} + {{/hasFormParams}} + {{^hasFormParams}} .send() + {{/hasFormParams}} {{/hasBodyParam}} .map { val localVariableApiResponse: ApiResponse<{{#returnType}}{{{returnType}}}?{{/returnType}}{{^returnType}}Unit?{{/returnType}}> = this.handleResponse(it) diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/kotlin/KotlinClientCodegenApiTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/kotlin/KotlinClientCodegenApiTest.java index 3c299800ff08..b35b21e0265b 100644 --- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/kotlin/KotlinClientCodegenApiTest.java +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/kotlin/KotlinClientCodegenApiTest.java @@ -883,6 +883,80 @@ void testJvmSpringGeneratedClientsCompileWithCollidingParams() throws IOExceptio } } + /** + * Issue #17 wire check: jvm-vertx filled a `localVariableForm` MultiMap but + * never attached it to the request — form fields were silently dropped. + * Compiles the generated vertx client with kotlinc and captures the raw + * HTTP request, asserting the urlencoded form body reaches the wire. + * Skipped when kotlinc or the copied vertx deps are unavailable. + */ + @Test + void testJvmVertxGeneratedClientSendsFormFields() throws IOException, InterruptedException { + Path kotlinc = requireKotlinc(); + List jars = vertxCaptureDepJars(kotlinc); + + Path target = Files.createTempDirectory("kotlin-vertx-form"); + try { + generate("jvm-vertx", "src/test/resources/3_0/kotlin/kotlin-form-it-param.yaml", + target, "serializationLibrary=jackson"); + List sources = Files.walk(target.resolve("src/main/kotlin")) + .filter(p -> p.toString().endsWith(".kt")) + .map(Path::toString) + .collect(Collectors.toList()); + Path capture = target.resolve("Capture.kt"); + Files.copy(Path.of("src/test/resources/3_0/kotlin-vertx-capture/Capture.kt"), capture); + sources.add(capture.toString()); + + String classPath = String.join(File.pathSeparator, jars); + Path classesDir = target.resolve("classes"); + List compile = new ArrayList<>(List.of( + kotlinc.toString(), "-cp", classPath, "-d", classesDir.toString(), "-jvm-target", "17")); + compile.addAll(sources); + runProcess(target, "kotlinc.log", 300, compile.toArray(new String[0])); + + String javaBin = Path.of(System.getProperty("java.home"), "bin", "java").toString(); + String output = runProcess(target, "run.log", 120, + javaBin, "-cp", classesDir + File.pathSeparator + classPath, "CaptureKt"); + Assert.assertTrue(output.contains("CAPTURE-PASS"), + "generated vertx client did not send the form fields:\n" + output); + } finally { + deleteRecursively(target); + } + } + + /** + * vertx jars are not part of the build's dependency graph, so they are + * located directly in the local repository (~/.m2) — matching the + * environment note in issue #17. Skips when absent. + */ + private static List vertxCaptureDepJars(Path kotlinc) throws IOException { + Path m2 = Path.of(System.getProperty("user.home"), ".m2", "repository"); + List jars = new ArrayList<>(); + for (String group : new String[]{"io/vertx", "io/netty", "com/fasterxml/jackson", + "org/jetbrains/kotlinx/kotlinx-coroutines-core-jvm"}) { + Path dir = m2.resolve(group); + if (!Files.isDirectory(dir)) { + continue; + } + try (var stream = Files.walk(dir)) { + stream.filter(p -> p.toString().endsWith(".jar")) + .filter(p -> !p.getFileName().toString().contains("sources")) + .filter(p -> !p.getFileName().toString().contains("javadoc")) + .forEach(p -> jars.add(p.toAbsolutePath().toString())); + } + } + if (jars.size() < 15 || jars.stream().noneMatch(j -> j.contains("vertx-web-client"))) { + throw new org.testng.SkipException("vertx jars not found in " + m2 + ", found " + jars.size()); + } + Path kotlincLib = kotlinc.getParent().getParent().resolve("lib"); + Path stdlib = kotlincLib.resolve("kotlin-stdlib.jar"); + if (!Files.exists(stdlib)) { + throw new org.testng.SkipException("kotlinc lib dir lacks kotlin-stdlib.jar: " + kotlincLib); + } + jars.add(stdlib.toAbsolutePath().toString()); + return jars; + } + private static Path requireKotlinc() throws IOException { Path kotlinc = findOnPath("kotlinc"); if (kotlinc == null) { diff --git a/modules/openapi-generator/src/test/resources/3_0/kotlin-vertx-capture/Capture.kt b/modules/openapi-generator/src/test/resources/3_0/kotlin-vertx-capture/Capture.kt new file mode 100644 index 000000000000..2f696f9b3859 --- /dev/null +++ b/modules/openapi-generator/src/test/resources/3_0/kotlin-vertx-capture/Capture.kt @@ -0,0 +1,85 @@ +import io.vertx.core.Vertx +import org.openapitools.client.apis.DefaultApi +import java.net.ServerSocket +import java.util.concurrent.CountDownLatch +import java.util.concurrent.TimeUnit + +// Raw HTTP capture for the jvm-vertx generated client: form fields must +// actually reach the wire (issue #17: localVariableForm was filled but never +// sent before the sendForm/sendMultipartForm fix). Vert.x sends the form with +// Transfer-Encoding: chunked, so the body is reassembled from chunks. +fun main() { + val vertx = Vertx.vertx() + val server = ServerSocket(0) + val port = server.localPort + val captured = StringBuilder() + val latch = CountDownLatch(1) + Thread { + try { + server.accept().use { socket -> + val reader = socket.getInputStream().bufferedReader() + var contentLength = 0 + var chunked = false + var line = reader.readLine() + while (line != null && line.isNotEmpty()) { + captured.append(line).append("\n") + if (line.startsWith("Content-Length:", ignoreCase = true)) { + contentLength = line.substringAfter(':').trim().toInt() + } + if (line.contains("chunked", ignoreCase = true)) { + chunked = true + } + line = reader.readLine() + } + if (chunked) { + var sizeLine = reader.readLine() + while (sizeLine != null) { + val size = sizeLine.trim().takeWhile { it.isDigit() || it in 'a'..'f' || it in 'A'..'F' } + .toIntOrNull(16) ?: 0 + if (size == 0) break + val chunk = CharArray(size) + var off = 0 + while (off < size) { + val n = reader.read(chunk, off, size - off) + if (n < 0) break + off += n + } + captured.append(String(chunk, 0, off)) + reader.readLine() // trailing CRLF + sizeLine = reader.readLine() + } + } else { + val body = CharArray(contentLength) + var off = 0 + while (off < contentLength) { + val n = reader.read(body, off, contentLength - off) + if (n < 0) break + off += n + } + captured.append(String(body, 0, off)) + } + socket.getOutputStream().write( + "HTTP/1.1 200 OK\r\nContent-Length: 0\r\nConnection: close\r\n\r\n".toByteArray()) + socket.getOutputStream().flush() + } + } finally { + latch.countDown() + } + }.start() + + val api = DefaultApi(vertx = vertx, basePath = "http://localhost:$port") + try { + api.createItem(`it` = "v1", name = "n2") + .toCompletionStage().toCompletableFuture().get(20, TimeUnit.SECONDS) + } catch (e: Exception) { + println("CALL-FAIL: $e") + } + latch.await(20, TimeUnit.SECONDS) + println("---CAPTURE---") + println(captured.toString()) + val text = captured.toString() + val pass = text.contains("it=v1") && text.contains("name=n2") && + (text.contains("application/x-www-form-urlencoded") || text.contains("multipart/form-data")) + println(if (pass) "CAPTURE-PASS" else "CAPTURE-FAIL") + vertx.close() +} From 3a953e5657b3eca7c8f11d5309057c8523c9bc4a Mon Sep 17 00:00:00 2001 From: khayashi4337 Date: Thu, 24 Sep 2026 14:04:14 +0900 Subject: [PATCH 30/31] fix(kotlin-client): append whole FormPart values in multipart bodies MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - multiplatform emitted `append({{{baseName}}})` for single file params — the wire name as a bare expression (`append(my-file)` is a syntax error; `append(file)` only worked by coincidence when names matched). The FormPart carries its own key: emit `append(paramName)`. - jvm-ktor's file-array loop emitted `append(it)` inside `for (x in param ?: listOf())`, where `it` is undefined — emit `append(x)`. Fixture kotlin-multipart-file.yaml uses a `my-file` wire name (param `myFile`) plus a file array and a plain field; generated ktor and multiplatform clients compile under kotlinc. Generated with [Devin](https://devin.ai) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com> --- .../libraries/jvm-ktor/api.mustache | 2 +- .../libraries/multiplatform/api.mustache | 2 +- .../kotlin/KotlinClientCodegenApiTest.java | 38 +++++++++++++++++++ .../3_0/kotlin/kotlin-multipart-file.yaml | 17 +++++++++ 4 files changed, 57 insertions(+), 2 deletions(-) create mode 100644 modules/openapi-generator/src/test/resources/3_0/kotlin/kotlin-multipart-file.yaml 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 e13cf3d635b5..12f292db1321 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 @@ -88,7 +88,7 @@ import com.fasterxml.jackson.databind.ObjectMapper {{/isArray}} {{#isArray}} for (x in {{paramName}} ?: listOf()) { - {{#isFile}}append(it){{/isFile}}{{^isFile}}append("{{#lambda.escapeDollar}}{{{baseName}}}{{/lambda.escapeDollar}}", x.toString()){{/isFile}} + {{#isFile}}append(x){{/isFile}}{{^isFile}}append("{{#lambda.escapeDollar}}{{{baseName}}}{{/lambda.escapeDollar}}", x.toString()){{/isFile}} } {{/isArray}} {{/isFile}} 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 c6a697084a4b..2a1a4664828e 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 @@ -78,7 +78,7 @@ import kotlinx.serialization.encoding.* {{/isArray}} {{^isArray}} {{#isFile}} - {{{paramName}}}?.apply { append({{#lambda.escapeDollar}}{{{baseName}}}{{/lambda.escapeDollar}}) } + {{{paramName}}}?.apply { append({{{paramName}}}) } {{/isFile}} {{^isFile}} {{#isPrimitiveType}} diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/kotlin/KotlinClientCodegenApiTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/kotlin/KotlinClientCodegenApiTest.java index b35b21e0265b..bdf207b9e6aa 100644 --- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/kotlin/KotlinClientCodegenApiTest.java +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/kotlin/KotlinClientCodegenApiTest.java @@ -755,6 +755,44 @@ void testKtorMultiplatformFormBuilderDoesNotUseImplicitIt() throws IOException { } } + /** + * File parts in a multipart body are appended as whole FormPart values. + * multiplatform embedded the wire name as a bare expression + * (`append(my-file)` — a syntax error), and jvm-ktor's array loop + * appended the undefined implicit `it` instead of the loop variable. + * The whole FormPart carries its own key, so append the parameter + * (or loop variable) itself. + */ + @Test + void testKtorMultiplatformMultipartFileAppendUsesParameter() throws IOException { + String spec = "src/test/resources/3_0/kotlin/kotlin-multipart-file.yaml"; + String[][] libraries = { + {"jvm-ktor", "src/main/kotlin/org/openapitools/client/apis/DefaultApi.kt", "serializationLibrary=jackson", "dateLibrary=java8"}, + {"multiplatform", "src/commonMain/kotlin/org/openapitools/client/apis/DefaultApi.kt", "dateLibrary=kotlinx-datetime"}, + }; + for (String[] lib : libraries) { + Path target = Files.createTempDirectory("kotlin-mpfile-" + lib[0]); + try { + generate(lib[0], spec, target, Arrays.copyOfRange(lib, 2, lib.length)); + String api = new String(Files.readAllBytes(target.resolve(lib[1])), StandardCharsets.UTF_8); + Assert.assertTrue(api.contains("append(myFile)"), + lib[0] + ": file part must append the FormPart parameter"); + Assert.assertFalse(api.contains("append(my-file)"), + lib[0] + ": wire name must not be embedded as a bare expression"); + if (lib[0].equals("jvm-ktor")) { + Assert.assertTrue(api.contains("for (x in files ?: listOf()) {\n append(x)"), + "jvm-ktor: file array must append the loop variable"); + } + if (lib[0].equals("multiplatform")) { + Assert.assertTrue(api.contains("files?.onEach {\n append(it)"), + "multiplatform: file array appends each FormPart element"); + } + } finally { + deleteRecursively(target); + } + } + } + @Test void testNonOkhttpLibrariesSkipOpenApi32Operations() throws IOException { Path target = Files.createTempDirectory("kotlin32-skip"); diff --git a/modules/openapi-generator/src/test/resources/3_0/kotlin/kotlin-multipart-file.yaml b/modules/openapi-generator/src/test/resources/3_0/kotlin/kotlin-multipart-file.yaml new file mode 100644 index 000000000000..02b0b5c30d32 --- /dev/null +++ b/modules/openapi-generator/src/test/resources/3_0/kotlin/kotlin-multipart-file.yaml @@ -0,0 +1,17 @@ +openapi: 3.0.3 +info: {title: MultipartFile, version: 1.0.0} +paths: + /upload: + post: + operationId: upload + requestBody: + content: + multipart/form-data: + schema: + type: object + properties: + my-file: {type: string, format: binary} + files: {type: array, items: {type: string, format: binary}} + note: {type: string} + responses: + '200': {description: ok} From a274eae15ef74e77bc8b5a16633694a852fb3a3c Mon Sep 17 00:00:00 2001 From: khayashi4337 Date: Thu, 24 Sep 2026 14:09:09 +0900 Subject: [PATCH 31/31] chore(samples): regenerate kotlin samples for the existing-bug fixes 12 files across kotlin-jvm-ktor (gson/jackson/kotlinx_serialization), kotlin-jvm-vertx (gson/jackson/jackson-coroutines/moshi) and kotlin-multiplatform samples, covering: - vertx: `.send()` -> `.sendForm()`/`.sendMultipartForm()` so form bodies actually reach the wire; multipart ops now build a MultipartForm - multiplatform: `.map { value }` -> `.map { this.value }` and the named `localVariableBuilder` form builder - jvm-ktor: named `localVariableBuilder` form builder No `$`-escape or file-append drift: no committed sample spec uses `$` wire names or file-array form fields. Generated with [Devin](https://devin.ai) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com> --- .../kotlin/org/openapitools/client/apis/FakeApi.kt | 8 ++++---- .../kotlin/org/openapitools/client/apis/PetApi.kt | 6 +++--- .../kotlin/org/openapitools/client/apis/PetApi.kt | 6 +++--- .../kotlin/org/openapitools/client/apis/PetApi.kt | 6 +++--- .../kotlin/org/openapitools/client/apis/PetApi.kt | 12 ++++++------ .../kotlin/org/openapitools/client/apis/PetApi.kt | 12 ++++++------ .../kotlin/org/openapitools/client/apis/PetApi.kt | 12 ++++++------ .../kotlin/org/openapitools/client/apis/PetApi.kt | 12 ++++++------ .../kotlin/org/openapitools/client/apis/PetApi.kt | 10 +++++----- .../kotlin/org/openapitools/client/apis/StoreApi.kt | 2 +- .../kotlin/org/openapitools/client/apis/PetApi.kt | 10 +++++----- .../kotlin/org/openapitools/client/apis/StoreApi.kt | 2 +- 12 files changed, 49 insertions(+), 49 deletions(-) diff --git a/samples/client/petstore/kotlin-jvm-ktor-gson/src/main/kotlin/org/openapitools/client/apis/FakeApi.kt b/samples/client/petstore/kotlin-jvm-ktor-gson/src/main/kotlin/org/openapitools/client/apis/FakeApi.kt index 7afabc77c210..7346f8e3f6ff 100644 --- a/samples/client/petstore/kotlin-jvm-ktor-gson/src/main/kotlin/org/openapitools/client/apis/FakeApi.kt +++ b/samples/client/petstore/kotlin-jvm-ktor-gson/src/main/kotlin/org/openapitools/client/apis/FakeApi.kt @@ -93,10 +93,10 @@ import java.text.DateFormat val localVariableAuthNames = listOf("petstore_auth") val localVariableBody = - ParametersBuilder().also { - name?.apply { it.append("name", name) } - status?.apply { it.append("status", status.toString()) } - status2?.apply { it.append("status2", status2.toString()) } + ParametersBuilder().also { localVariableBuilder -> + name?.apply { localVariableBuilder.append("name", name) } + status?.apply { localVariableBuilder.append("status", status.toString()) } + status2?.apply { localVariableBuilder.append("status2", status2.toString()) } }.build() val localVariableQuery = mutableMapOf>() diff --git a/samples/client/petstore/kotlin-jvm-ktor-gson/src/main/kotlin/org/openapitools/client/apis/PetApi.kt b/samples/client/petstore/kotlin-jvm-ktor-gson/src/main/kotlin/org/openapitools/client/apis/PetApi.kt index 01464ab7c831..df3bed1fd570 100644 --- a/samples/client/petstore/kotlin-jvm-ktor-gson/src/main/kotlin/org/openapitools/client/apis/PetApi.kt +++ b/samples/client/petstore/kotlin-jvm-ktor-gson/src/main/kotlin/org/openapitools/client/apis/PetApi.kt @@ -266,9 +266,9 @@ import java.text.DateFormat val localVariableAuthNames = listOf("petstore_auth") val localVariableBody = - ParametersBuilder().also { - name?.apply { it.append("name", name) } - status?.apply { it.append("status", status) } + ParametersBuilder().also { localVariableBuilder -> + name?.apply { localVariableBuilder.append("name", name) } + status?.apply { localVariableBuilder.append("status", status) } }.build() val localVariableQuery = mutableMapOf>() diff --git a/samples/client/petstore/kotlin-jvm-ktor-jackson/src/main/kotlin/org/openapitools/client/apis/PetApi.kt b/samples/client/petstore/kotlin-jvm-ktor-jackson/src/main/kotlin/org/openapitools/client/apis/PetApi.kt index b3311c04bf68..beec66042526 100644 --- a/samples/client/petstore/kotlin-jvm-ktor-jackson/src/main/kotlin/org/openapitools/client/apis/PetApi.kt +++ b/samples/client/petstore/kotlin-jvm-ktor-jackson/src/main/kotlin/org/openapitools/client/apis/PetApi.kt @@ -262,9 +262,9 @@ import com.fasterxml.jackson.databind.ObjectMapper val localVariableAuthNames = listOf("petstore_auth") val localVariableBody = - ParametersBuilder().also { - name?.apply { it.append("name", name) } - status?.apply { it.append("status", status) } + ParametersBuilder().also { localVariableBuilder -> + name?.apply { localVariableBuilder.append("name", name) } + status?.apply { localVariableBuilder.append("status", status) } }.build() val localVariableQuery = mutableMapOf>() diff --git a/samples/client/petstore/kotlin-jvm-ktor-kotlinx_serialization/src/main/kotlin/org/openapitools/client/apis/PetApi.kt b/samples/client/petstore/kotlin-jvm-ktor-kotlinx_serialization/src/main/kotlin/org/openapitools/client/apis/PetApi.kt index 30b657de16b9..e246ecd4e9bf 100644 --- a/samples/client/petstore/kotlin-jvm-ktor-kotlinx_serialization/src/main/kotlin/org/openapitools/client/apis/PetApi.kt +++ b/samples/client/petstore/kotlin-jvm-ktor-kotlinx_serialization/src/main/kotlin/org/openapitools/client/apis/PetApi.kt @@ -261,9 +261,9 @@ import io.ktor.http.ParametersBuilder val localVariableAuthNames = listOf("petstore_auth") val localVariableBody = - ParametersBuilder().also { - name?.apply { it.append("name", name) } - status?.apply { it.append("status", status) } + ParametersBuilder().also { localVariableBuilder -> + name?.apply { localVariableBuilder.append("name", name) } + status?.apply { localVariableBuilder.append("status", status) } }.build() val localVariableQuery = mutableMapOf>() diff --git a/samples/client/petstore/kotlin-jvm-vertx-gson/src/main/kotlin/org/openapitools/client/apis/PetApi.kt b/samples/client/petstore/kotlin-jvm-vertx-gson/src/main/kotlin/org/openapitools/client/apis/PetApi.kt index 9a3c986a3912..d125b5a0f692 100644 --- a/samples/client/petstore/kotlin-jvm-vertx-gson/src/main/kotlin/org/openapitools/client/apis/PetApi.kt +++ b/samples/client/petstore/kotlin-jvm-vertx-gson/src/main/kotlin/org/openapitools/client/apis/PetApi.kt @@ -517,7 +517,7 @@ open class PetApi(basePath: kotlin.String = ApiClient.defaultBasePath, accessTok - val localVariableForm = io.vertx.core.MultiMap.caseInsensitiveMultiMap(); + val localVariableForm = io.vertx.core.MultiMap.caseInsensitiveMultiMap() name?.let { localVariableForm.add("name", name) } status?.let { localVariableForm.add("status", status) } @@ -527,7 +527,7 @@ open class PetApi(basePath: kotlin.String = ApiClient.defaultBasePath, accessTok } return localVariableRequest - .send() + .sendForm(localVariableForm) .map { val localVariableApiResponse: ApiResponse = this.handleResponse(it) localVariableApiResponse @@ -590,9 +590,9 @@ open class PetApi(basePath: kotlin.String = ApiClient.defaultBasePath, accessTok localVariableRequest.putHeader("Accept", "application/json") - val localVariableForm = io.vertx.core.MultiMap.caseInsensitiveMultiMap(); - additionalMetadata?.let { localVariableForm.add("additionalMetadata", additionalMetadata) } - file?.let { localVariableForm.add("file", file.toString()) } + val localVariableForm = io.vertx.ext.web.multipart.MultipartForm.create() + additionalMetadata?.let { localVariableForm.attribute("additionalMetadata", additionalMetadata) } + file?.let { localVariableForm.attribute("file", file.toString()) } this.accessToken?.let { localVariableAccessToken -> @@ -600,7 +600,7 @@ open class PetApi(basePath: kotlin.String = ApiClient.defaultBasePath, accessTok } return localVariableRequest - .send() + .sendMultipartForm(localVariableForm) .map { val localVariableApiResponse: ApiResponse = this.handleResponse(it) localVariableApiResponse diff --git a/samples/client/petstore/kotlin-jvm-vertx-jackson-coroutines/src/main/kotlin/org/openapitools/client/apis/PetApi.kt b/samples/client/petstore/kotlin-jvm-vertx-jackson-coroutines/src/main/kotlin/org/openapitools/client/apis/PetApi.kt index aa02c57ec192..3bc78bcb6ae4 100644 --- a/samples/client/petstore/kotlin-jvm-vertx-jackson-coroutines/src/main/kotlin/org/openapitools/client/apis/PetApi.kt +++ b/samples/client/petstore/kotlin-jvm-vertx-jackson-coroutines/src/main/kotlin/org/openapitools/client/apis/PetApi.kt @@ -521,7 +521,7 @@ open class PetApi(basePath: kotlin.String = ApiClient.defaultBasePath, accessTok - val localVariableForm = io.vertx.core.MultiMap.caseInsensitiveMultiMap(); + val localVariableForm = io.vertx.core.MultiMap.caseInsensitiveMultiMap() name?.let { localVariableForm.add("name", name) } status?.let { localVariableForm.add("status", status) } @@ -531,7 +531,7 @@ open class PetApi(basePath: kotlin.String = ApiClient.defaultBasePath, accessTok } return localVariableRequest - .send() + .sendForm(localVariableForm) .map { val localVariableApiResponse: ApiResponse = this.handleResponse(it) localVariableApiResponse @@ -594,9 +594,9 @@ open class PetApi(basePath: kotlin.String = ApiClient.defaultBasePath, accessTok localVariableRequest.putHeader("Accept", "application/json") - val localVariableForm = io.vertx.core.MultiMap.caseInsensitiveMultiMap(); - additionalMetadata?.let { localVariableForm.add("additionalMetadata", additionalMetadata) } - file?.let { localVariableForm.add("file", file.toString()) } + val localVariableForm = io.vertx.ext.web.multipart.MultipartForm.create() + additionalMetadata?.let { localVariableForm.attribute("additionalMetadata", additionalMetadata) } + file?.let { localVariableForm.attribute("file", file.toString()) } this.accessToken?.let { localVariableAccessToken -> @@ -604,7 +604,7 @@ open class PetApi(basePath: kotlin.String = ApiClient.defaultBasePath, accessTok } return localVariableRequest - .send() + .sendMultipartForm(localVariableForm) .map { val localVariableApiResponse: ApiResponse = this.handleResponse(it) localVariableApiResponse diff --git a/samples/client/petstore/kotlin-jvm-vertx-jackson/src/main/kotlin/org/openapitools/client/apis/PetApi.kt b/samples/client/petstore/kotlin-jvm-vertx-jackson/src/main/kotlin/org/openapitools/client/apis/PetApi.kt index 9e55adbe5e3c..3045091b2d75 100644 --- a/samples/client/petstore/kotlin-jvm-vertx-jackson/src/main/kotlin/org/openapitools/client/apis/PetApi.kt +++ b/samples/client/petstore/kotlin-jvm-vertx-jackson/src/main/kotlin/org/openapitools/client/apis/PetApi.kt @@ -517,7 +517,7 @@ open class PetApi(basePath: kotlin.String = ApiClient.defaultBasePath, accessTok - val localVariableForm = io.vertx.core.MultiMap.caseInsensitiveMultiMap(); + val localVariableForm = io.vertx.core.MultiMap.caseInsensitiveMultiMap() name?.let { localVariableForm.add("name", name) } status?.let { localVariableForm.add("status", status) } @@ -527,7 +527,7 @@ open class PetApi(basePath: kotlin.String = ApiClient.defaultBasePath, accessTok } return localVariableRequest - .send() + .sendForm(localVariableForm) .map { val localVariableApiResponse: ApiResponse = this.handleResponse(it) localVariableApiResponse @@ -590,9 +590,9 @@ open class PetApi(basePath: kotlin.String = ApiClient.defaultBasePath, accessTok localVariableRequest.putHeader("Accept", "application/json") - val localVariableForm = io.vertx.core.MultiMap.caseInsensitiveMultiMap(); - additionalMetadata?.let { localVariableForm.add("additionalMetadata", additionalMetadata) } - file?.let { localVariableForm.add("file", file.toString()) } + val localVariableForm = io.vertx.ext.web.multipart.MultipartForm.create() + additionalMetadata?.let { localVariableForm.attribute("additionalMetadata", additionalMetadata) } + file?.let { localVariableForm.attribute("file", file.toString()) } this.accessToken?.let { localVariableAccessToken -> @@ -600,7 +600,7 @@ open class PetApi(basePath: kotlin.String = ApiClient.defaultBasePath, accessTok } return localVariableRequest - .send() + .sendMultipartForm(localVariableForm) .map { val localVariableApiResponse: ApiResponse = this.handleResponse(it) localVariableApiResponse diff --git a/samples/client/petstore/kotlin-jvm-vertx-moshi/src/main/kotlin/org/openapitools/client/apis/PetApi.kt b/samples/client/petstore/kotlin-jvm-vertx-moshi/src/main/kotlin/org/openapitools/client/apis/PetApi.kt index 0d114e521ffa..1be1f8a116f9 100644 --- a/samples/client/petstore/kotlin-jvm-vertx-moshi/src/main/kotlin/org/openapitools/client/apis/PetApi.kt +++ b/samples/client/petstore/kotlin-jvm-vertx-moshi/src/main/kotlin/org/openapitools/client/apis/PetApi.kt @@ -516,7 +516,7 @@ open class PetApi(basePath: kotlin.String = ApiClient.defaultBasePath, accessTok - val localVariableForm = io.vertx.core.MultiMap.caseInsensitiveMultiMap(); + val localVariableForm = io.vertx.core.MultiMap.caseInsensitiveMultiMap() name?.let { localVariableForm.add("name", name) } status?.let { localVariableForm.add("status", status) } @@ -526,7 +526,7 @@ open class PetApi(basePath: kotlin.String = ApiClient.defaultBasePath, accessTok } return localVariableRequest - .send() + .sendForm(localVariableForm) .map { val localVariableApiResponse: ApiResponse = this.handleResponse(it) localVariableApiResponse @@ -589,9 +589,9 @@ open class PetApi(basePath: kotlin.String = ApiClient.defaultBasePath, accessTok localVariableRequest.putHeader("Accept", "application/json") - val localVariableForm = io.vertx.core.MultiMap.caseInsensitiveMultiMap(); - additionalMetadata?.let { localVariableForm.add("additionalMetadata", additionalMetadata) } - file?.let { localVariableForm.add("file", file.toString()) } + val localVariableForm = io.vertx.ext.web.multipart.MultipartForm.create() + additionalMetadata?.let { localVariableForm.attribute("additionalMetadata", additionalMetadata) } + file?.let { localVariableForm.attribute("file", file.toString()) } this.accessToken?.let { localVariableAccessToken -> @@ -599,7 +599,7 @@ open class PetApi(basePath: kotlin.String = ApiClient.defaultBasePath, accessTok } return localVariableRequest - .send() + .sendMultipartForm(localVariableForm) .map { val localVariableApiResponse: ApiResponse = this.handleResponse(it) localVariableApiResponse diff --git a/samples/client/petstore/kotlin-multiplatform-kotlinx-datetime/src/commonMain/kotlin/org/openapitools/client/apis/PetApi.kt b/samples/client/petstore/kotlin-multiplatform-kotlinx-datetime/src/commonMain/kotlin/org/openapitools/client/apis/PetApi.kt index bc246e3969b5..ccfb548d8098 100644 --- a/samples/client/petstore/kotlin-multiplatform-kotlinx-datetime/src/commonMain/kotlin/org/openapitools/client/apis/PetApi.kt +++ b/samples/client/petstore/kotlin-multiplatform-kotlinx-datetime/src/commonMain/kotlin/org/openapitools/client/apis/PetApi.kt @@ -170,7 +170,7 @@ open class PetApi : ApiClient { localVariableConfig, localVariableBody, localVariableAuthNames - ).wrap().map { value } + ).wrap().map { this.value } } @Serializable(FindPetsByStatusResponse.Companion::class) @@ -213,7 +213,7 @@ open class PetApi : ApiClient { localVariableConfig, localVariableBody, localVariableAuthNames - ).wrap().map { value } + ).wrap().map { this.value } } @Serializable(FindPetsByTagsResponse.Companion::class) @@ -304,9 +304,9 @@ open class PetApi : ApiClient { val localVariableAuthNames = listOf("petstore_auth") val localVariableBody = - ParametersBuilder().also { - name?.apply { it.append("name", name.toString()) } - status?.apply { it.append("status", status.toString()) } + ParametersBuilder().also { localVariableBuilder -> + name?.apply { localVariableBuilder.append("name", name.toString()) } + status?.apply { localVariableBuilder.append("status", status.toString()) } }.build() val localVariableQuery = mutableMapOf>() diff --git a/samples/client/petstore/kotlin-multiplatform-kotlinx-datetime/src/commonMain/kotlin/org/openapitools/client/apis/StoreApi.kt b/samples/client/petstore/kotlin-multiplatform-kotlinx-datetime/src/commonMain/kotlin/org/openapitools/client/apis/StoreApi.kt index 718d0f9390eb..d089f136d7a7 100644 --- a/samples/client/petstore/kotlin-multiplatform-kotlinx-datetime/src/commonMain/kotlin/org/openapitools/client/apis/StoreApi.kt +++ b/samples/client/petstore/kotlin-multiplatform-kotlinx-datetime/src/commonMain/kotlin/org/openapitools/client/apis/StoreApi.kt @@ -114,7 +114,7 @@ open class StoreApi : ApiClient { localVariableConfig, localVariableBody, localVariableAuthNames - ).wrap().map { value } + ).wrap().map { this.value } } @Serializable(GetInventoryResponse.Companion::class) diff --git a/samples/client/petstore/kotlin-multiplatform/src/commonMain/kotlin/org/openapitools/client/apis/PetApi.kt b/samples/client/petstore/kotlin-multiplatform/src/commonMain/kotlin/org/openapitools/client/apis/PetApi.kt index bc246e3969b5..ccfb548d8098 100644 --- a/samples/client/petstore/kotlin-multiplatform/src/commonMain/kotlin/org/openapitools/client/apis/PetApi.kt +++ b/samples/client/petstore/kotlin-multiplatform/src/commonMain/kotlin/org/openapitools/client/apis/PetApi.kt @@ -170,7 +170,7 @@ open class PetApi : ApiClient { localVariableConfig, localVariableBody, localVariableAuthNames - ).wrap().map { value } + ).wrap().map { this.value } } @Serializable(FindPetsByStatusResponse.Companion::class) @@ -213,7 +213,7 @@ open class PetApi : ApiClient { localVariableConfig, localVariableBody, localVariableAuthNames - ).wrap().map { value } + ).wrap().map { this.value } } @Serializable(FindPetsByTagsResponse.Companion::class) @@ -304,9 +304,9 @@ open class PetApi : ApiClient { val localVariableAuthNames = listOf("petstore_auth") val localVariableBody = - ParametersBuilder().also { - name?.apply { it.append("name", name.toString()) } - status?.apply { it.append("status", status.toString()) } + ParametersBuilder().also { localVariableBuilder -> + name?.apply { localVariableBuilder.append("name", name.toString()) } + status?.apply { localVariableBuilder.append("status", status.toString()) } }.build() val localVariableQuery = mutableMapOf>() diff --git a/samples/client/petstore/kotlin-multiplatform/src/commonMain/kotlin/org/openapitools/client/apis/StoreApi.kt b/samples/client/petstore/kotlin-multiplatform/src/commonMain/kotlin/org/openapitools/client/apis/StoreApi.kt index 718d0f9390eb..d089f136d7a7 100644 --- a/samples/client/petstore/kotlin-multiplatform/src/commonMain/kotlin/org/openapitools/client/apis/StoreApi.kt +++ b/samples/client/petstore/kotlin-multiplatform/src/commonMain/kotlin/org/openapitools/client/apis/StoreApi.kt @@ -114,7 +114,7 @@ open class StoreApi : ApiClient { localVariableConfig, localVariableBody, localVariableAuthNames - ).wrap().map { value } + ).wrap().map { this.value } } @Serializable(GetInventoryResponse.Companion::class)