) 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/java/org/openapitools/codegen/languages/PhpClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PhpClientCodegen.java
index cc666a5723b03..e027d0b352d74 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
+ public 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/java/org/openapitools/codegen/languages/PythonClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PythonClientCodegen.java
index c1032cfa88a89..384570ee258ef 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
@@ -37,6 +37,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;
@@ -44,6 +45,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;
@@ -623,18 +625,48 @@ 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
+ public 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) {
postProcessClientOperations(objs, 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) {
postProcessClientOperations(objs, objs.getWebhooks().getOperation());
- return super.postProcessWebhooksWithModels(objs, allModels);
+ // webhooks render through api.mustache as well, so their non-standard
+ // methods and querystring parameters need the same flags
+ WebhooksMap result = super.postProcessWebhooksWithModels(objs, allModels);
+ flagOpenAPI32Operations(result.getWebhooks().getOperation());
+ return result;
}
private void postProcessClientOperations(
@@ -655,6 +687,31 @@ private boolean hasJsonHeaderParameter(List operations) {
parameter.vendorExtensions.containsKey("x-python-json-header"));
}
+ // 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(
List operations) {
Set apiMembers = independentClientApiMembers();
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 4e902c0921dba..b2c0b156e16d7 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;
@@ -598,6 +599,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
+ public 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);
@@ -606,6 +664,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/java/org/openapitools/codegen/languages/RustClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/RustClientCodegen.java
index b0e80e246639d..ff61ae290dfc4 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
@@ -32,6 +32,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;
@@ -837,11 +838,100 @@ 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
+ public 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);
+ // `|`, `*`, `_` and a backtick are valid RFC 9110 tchars but have special
+ // meaning in the markdown tables/code spans used by the doc templates
+ operation.vendorExtensions.put("x-rust-http-method-doc",
+ method.replaceAll("([*|_`])", "\\\\$1"));
+ }
+ }
+
+ @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`.
@@ -983,6 +1073,21 @@ public OperationsMap postProcessOperationsWithModels(OperationsMap objs, List 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
+ public boolean supportsQueryStringParameters() {
+ // the raw, already-encoded query string is appended to the request
+ // path verbatim by the api template
+ return true;
+ }
+
+ 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("|", "\\|"));
+ // CONNECT and TRACE are standard methods yet forbidden by the fetch
+ // spec, and CONNECT only ever arrives via additionalOperations
+ // (PathItem has no native field for it) - evaluate this independently
+ // of the standard-method branch below or it would never fire
+ 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);
+ }
+ 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;
+ }
+ // 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 WebhooksMap postProcessWebhooksWithModels(WebhooksMap webhooks, List allModels) {
+ // webhooks render through apis.mustache as well, so their
+ // non-standard methods and querystring parameters need the same flags
+ webhooks = super.postProcessWebhooksWithModels(webhooks, allModels);
if (webhooks.getWebhooks().getOperation().stream()
.anyMatch(operation -> operation.headerParams != null && operation.headerParams.stream()
.anyMatch(parameter -> ((ExtendedCodegenParameter) parameter).jsonHeaderUsesModelSerializer))) {
@@ -1007,6 +1081,9 @@ public WebhooksMap postProcessWebhooksWithModels(WebhooksMap webhooks, List additionalOperation : pathItem.getAdditionalOperations().entrySet()) {
+ addOperationLookupEntry(path, additionalOperation.getKey(), additionalOperation.getValue());
+ }
+ }
+ {{/hasQueryOrAdditionalOperations}}
}
return this;
}
@@ -2003,6 +2012,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 d676deaa42605..72adfcc7c225f 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}}
@@ -241,7 +241,7 @@ public class {{classname}} {
{{/dynamicOperations}}
String[] localVarAuthNames = new String[] { {{#withAWSV4Signature}}"AWS4Auth"{{/withAWSV4Signature}}{{#authMethods}}{{#-first}}{{#withAWSV4Signature}}, {{/withAWSV4Signature}}{{/-first}}"{{name}}"{{^-last}}, {{/-last}}{{/authMethods}} };
- return localVarApiClient.buildCall(basePath, localVarPath, {{^dynamicOperations}}"{{httpMethod}}"{{/dynamicOperations}}{{#dynamicOperations}}apiOperation.getMethod(){{/dynamicOperations}}, localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback);
+ return localVarApiClient.buildCall(basePath, localVarPath, {{^dynamicOperations}}"{{{httpMethod}}}"{{/dynamicOperations}}{{#dynamicOperations}}apiOperation.getMethod(){{/dynamicOperations}}, localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback);
}
{{#isDeprecated}}
diff --git a/modules/openapi-generator/src/main/resources/csharp/README.mustache b/modules/openapi-generator/src/main/resources/csharp/README.mustache
index 0ef94566a1dbc..79f3cfd0b558f 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 ca85bfa7ffaa6..00afb9e4e1749 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 380e3f0476d82..6e18adc62e522 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
@@ -434,7 +434,9 @@ namespace {{packageName}}.{{apiPackage}}
{{#-first}}
{{/-first}}
+ {{^isQueryStringParam}}
parseQueryStringLocalVar["{{baseName}}"] = ClientUtils.ParameterToString({{paramName}});
+ {{/isQueryStringParam}}
{{/required}}
{{/queryParams}}
@@ -446,9 +448,11 @@ namespace {{packageName}}.{{apiPackage}}
{{/constantParams}}
{{#queryParams}}
{{^required}}
+ {{^isQueryStringParam}}
if ({{paramName}}.IsSet)
parseQueryStringLocalVar["{{baseName}}"] = ClientUtils.ParameterToString({{paramName}}.Value);
+ {{/isQueryStringParam}}
{{/required}}
{{#-last}}
uriBuilderLocalVar.Query = parseQueryStringLocalVar.ToString();
@@ -627,6 +631,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}}
@@ -707,6 +725,14 @@ namespace {{packageName}}.{{apiPackage}}
httpRequestMessageLocalVar.Headers.Accept.Add(acceptLocalVar);
{{/-first}}
{{/produces}}
+ {{#vendorExtensions.x-csharp-http-method-literal}}
+
+ // 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}}
{{#net60OrLater}}
httpRequestMessageLocalVar.Method = HttpMethod.{{#lambda.titlecase}}{{#lambda.lowercase}}{{httpMethod}}{{/lambda.lowercase}}{{/lambda.titlecase}};
@@ -714,6 +740,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/main/resources/go/api.mustache b/modules/openapi-generator/src/main/resources/go/api.mustache
index 4283f34c09561..fabf77cab29ae 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 ba38d143a66f4..94bff6aaf0df4 100644
--- a/modules/openapi-generator/src/main/resources/go/client.mustache
+++ b/modules/openapi-generator/src/main/resources/go/client.mustache
@@ -587,6 +587,12 @@ 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 keep it verbatim ahead of the encoded
+ // parameters (path-declared query data first, as before).
+ rawQueryString := url.RawQuery
+ url.RawQuery = ""
query := url.Query()
for k, v := range queryParams {
for _, iv := range v {
@@ -595,11 +601,19 @@ 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 != "" {
+ rawQueryString += "&"
+ }
+ url.RawQuery = rawQueryString + encodedQuery
+ } else {
+ url.RawQuery = encodedQuery
+ }
// Generate a new request
if body != nil {
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 125035933d465..a01904bbaeb35 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 facfb481b9ec8..67b628f74f748 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 4bd02a0fde58e..9fd376a2466e9 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}}
{{^vendorExtensions.x-kotlin-explode-form-object}}
{{^required}}
if ({{{paramName}}} != null) {
@@ -253,6 +254,7 @@ import {{packageName}}.infrastructure.Serializer
{{/isNullable}}
{{/required}}
{{/vendorExtensions.x-kotlin-explode-form-object}}
+ {{/isQueryStringParam}}
{{/queryParams}}
{{#queryParams}}
{{#vendorExtensions.x-kotlin-explode-form-object}}
@@ -280,9 +282,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 ee84b6c7bd87b..c4d7180ed4b80 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
@@ -83,6 +83,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.",
@@ -496,6 +503,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
@@ -526,7 +541,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/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
+ }
+ 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 0000000000000..0639f616c8fdf
--- /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/main/resources/php/README.mustache b/modules/openapi-generator/src/main/resources/php/README.mustache
index e4a17f15d17b8..b5dd0ad9fb383 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 80105341b93aa..56a47a7c51755 100644
--- a/modules/openapi-generator/src/main/resources/php/api.mustache
+++ b/modules/openapi-generator/src/main/resources/php/api.mustache
@@ -617,6 +617,7 @@ use {{invokerPackage}}\ObjectSerializer;
$multipart = false;
{{#queryParams}}
+ {{^isQueryStringParam}}
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
${{paramName}},
@@ -626,6 +627,7 @@ use {{invokerPackage}}\ObjectSerializer;
{{#isExplode}}true{{/isExplode}}{{^isExplode}}false{{/isExplode}}, // explode
{{required}} // required
) ?? []);
+ {{/isQueryStringParam}}
{{/queryParams}}
{{#headerParams}}
@@ -786,12 +788,62 @@ use {{invokerPackage}}\ObjectSerializer;
$operationHost = $this->config->getHost();
{{/servers.0}}
$query = ObjectSerializer::buildQuery($queryParams);
+ {{#vendorExtensions.x-php-has-querystring-param}}
+ // $__-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}}
+ $__requestUri .= (str_contains($__requestUri, '?') ? '&' : '?') . ${{paramName}};
+ {{/required}}
+ {{^required}}
+ if (${{paramName}} !== null) {
+ $__requestUri .= (str_contains($__requestUri, '?') ? '&' : '?') . ${{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}}$__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 {
+ 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}}$__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
);
+ {{/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 ea5dad63de835..b72b486f3b5cd 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/main/resources/php/composer.mustache b/modules/openapi-generator/src/main/resources/php/composer.mustache
index ae8adeb731b43..c6364cc570ec5 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 || ^8.0",
- "guzzlehttp/psr7": "^1.7 || ^2.0 || ^3.0",
+ "guzzlehttp/psr7": "^2.10 || ^3.0",
"psr/http-client": "^1.0"
},
"require-dev": {
diff --git a/modules/openapi-generator/src/main/resources/python/api.mustache b/modules/openapi-generator/src/main/resources/python/api.mustache
index c771516a8a498..afaabe0eca53f 100644
--- a/modules/openapi-generator/src/main/resources/python/api.mustache
+++ b/modules/openapi-generator/src/main/resources/python/api.mustache
@@ -322,6 +322,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):
@@ -382,6 +383,7 @@ https://github.com/OpenAPITools/openapi-generator/blob/c84b949df1a9ec04ba75989cb
{{/isModel}}
{{/isMap}}
{{/isDate}}{{/isDateTime}}
+{{/isQueryStringParam}}
{{/queryParams}}
# process the header parameters
{{#headerParams}}
@@ -466,9 +468,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 8c9d283b44897..59fc88b4b134a 100644
--- a/modules/openapi-generator/src/main/resources/python/api_client.mustache
+++ b/modules/openapi-generator/src/main/resources/python/api_client.mustache
@@ -409,7 +409,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 efefcf1178821..8b4f05d93abf0 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 in self._STANDARD_METHODS:
+ return self.pool_manager.request(method, url, **kwargs)
+ if method.upper() 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,16 +212,18 @@ class RESTClientObject:
timeout. It can also be a pair (tuple) of
(connection, read) timeouts.
"""
- method = method.upper()
- assert method in [
- 'GET',
- 'HEAD',
- 'DELETE',
- 'POST',
- 'PUT',
- 'PATCH',
- 'OPTIONS'
- ]
+ # OpenAPI 3.2 allows arbitrary HTTP method names (query operations,
+ # additionalOperations keys). The generator emits standard methods
+ # already uppercase; anything else is validated as an HTTP token
+ # (RFC 9110 tchar) and sent verbatim so casing like 'customMethod'
+ # or 'get' (as a distinct additionalOperations key) survives. Do not
+ # use `assert` here: it is stripped under `python -O`.
+ if method not in self._STANDARD_METHODS:
+ if re.fullmatch(r"[!#$%&'*+\-.^_`|~0-9A-Za-z]+", method) is None:
+ raise ApiValueError(
+ "Unrecognized HTTP method name %r: not a valid "
+ "RFC 9110 token" % method
+ )
if post_params and body:
raise ApiValueError(
@@ -228,8 +247,13 @@ class RESTClientObject:
)
try:
- # For `POST`, `PUT`, `PATCH`, `OPTIONS`, `DELETE`
- if method in ['POST', 'PUT', 'PATCH', 'OPTIONS', 'DELETE']:
+ # For `POST`, `PUT`, `PATCH`, `OPTIONS`, `DELETE` - or a
+ # non-standard OpenAPI 3.2 method that actually carries a
+ # body/form data. GET/HEAD keep the historic no-body path even
+ # when a spec defines one.
+ if (method in ['POST', 'PUT', 'PATCH', 'OPTIONS', 'DELETE']
+ or (method not in self._STANDARD_METHODS
+ and (body is not None or post_params))):
content_type = headers.get('Content-Type')
is_json = (
@@ -252,7 +276,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 +285,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 +301,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 +314,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 +324,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 +339,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/main/resources/ruby-client/README.mustache b/modules/openapi-generator/src/main/resources/ruby-client/README.mustache
index 5f58934696079..cf35a42898446 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 e795e1d328607..315b33b669592 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
@@ -199,8 +211,10 @@ module {{moduleName}}
{{/isMap}}
{{/queryIsJsonMimeType}}
{{/required}}
+ {{/isQueryStringParam}}
{{/queryParams}}
{{#queryParams}}
+ {{^isQueryStringParam}}
{{^required}}
{{#queryIsJsonMimeType}}
query_params[:'{{{baseName}}}'] = opts[:'{{{paramName}}}'].to_json if !opts[:'{{{paramName}}}'].nil?
@@ -225,6 +239,7 @@ module {{moduleName}}
{{/isMap}}
{{/queryIsJsonMimeType}}
{{/required}}
+ {{/isQueryStringParam}}
{{/queryParams}}
# header parameters
@@ -283,7 +298,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.mustache b/modules/openapi-generator/src/main/resources/ruby-client/api_client.mustache
index a4609a59fc275..7513a21e187c7 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 7dd5221daccbf..ad3c1bf0e214b 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:
@@ -51,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 = {
@@ -62,7 +68,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 ab2e666e1eb90..ba466f8a4ae54 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/main/resources/rust/README.mustache b/modules/openapi-generator/src/main/resources/rust/README.mustache
index 0e8bfb373f99c..79fda06b3efd1 100644
--- a/modules/openapi-generator/src/main/resources/rust/README.mustache
+++ b/modules/openapi-generator/src/main/resources/rust/README.mustache
@@ -34,7 +34,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-rust-http-method-doc}}{{{vendorExtensions.x-rust-http-method-doc}}}{{/vendorExtensions.x-rust-http-method-doc}}{{^vendorExtensions.x-rust-http-method-doc}}{{{httpMethod}}}{{/vendorExtensions.x-rust-http-method-doc}}** {{{path}}} | {{{summary}}}
{{/operation}}{{/operations}}{{/apis}}{{/apiInfo}}
## Documentation For Models
diff --git a/modules/openapi-generator/src/main/resources/rust/api_doc.mustache b/modules/openapi-generator/src/main/resources/rust/api_doc.mustache
index c360817554004..d9aa615f267b9 100644
--- a/modules/openapi-generator/src/main/resources/rust/api_doc.mustache
+++ b/modules/openapi-generator/src/main/resources/rust/api_doc.mustache
@@ -6,7 +6,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-rust-http-method-doc}}{{{vendorExtensions.x-rust-http-method-doc}}}{{/vendorExtensions.x-rust-http-method-doc}}{{^vendorExtensions.x-rust-http-method-doc}}{{{httpMethod}}}{{/vendorExtensions.x-rust-http-method-doc}}** {{{path}}} | {{{summary}}}
{{/operation}}{{/operations}}
{{#operations}}
diff --git a/modules/openapi-generator/src/main/resources/rust/reqwest/api.mustache b/modules/openapi-generator/src/main/resources/rust/reqwest/api.mustache
index bde8e132c3d22..9aed3a7763e01 100644
--- a/modules/openapi-generator/src/main/resources/rust/reqwest/api.mustache
+++ b/modules/openapi-generator/src/main/resources/rust/reqwest/api.mustache
@@ -153,10 +153,27 @@ pub {{#supportAsync}}async {{/supportAsync}}fn {{{operationId}}}(configuration:
{{/allParams}}
{{/vendorExtensions.x-group-parameters}}
- let uri_str = format!("{}{{{path}}}", configuration.base_path{{#pathParams}}, {{{baseName}}}={{#isString}}crate::apis::urlencode({{/isString}}{{{vendorExtensions.x-rust-param-identifier}}}{{^required}}.unwrap(){{/required}}{{#required}}{{#isNullable}}.unwrap(){{/isNullable}}{{/required}}{{#isArray}}.join(",").as_ref(){{/isArray}}{{#vendorExtensions.x-rust-chrono-date-time}}.to_rfc3339(){{/vendorExtensions.x-rust-chrono-date-time}}{{^isString}}{{^isUuid}}{{^isPrimitiveType}}{{^isContainer}}.to_string(){{/isContainer}}{{/isPrimitiveType}}{{/isUuid}}{{/isString}}{{#isString}}){{/isString}}{{/pathParams}});
- let mut req_builder = configuration.client.request(reqwest::Method::{{{httpMethod}}}, &uri_str);
+ let {{#vendorExtensions.x-rust-has-querystring-param}}mut {{/vendorExtensions.x-rust-has-querystring-param}}uri_str = format!("{}{{{path}}}", configuration.base_path{{#pathParams}}, {{{baseName}}}={{#isString}}crate::apis::urlencode({{/isString}}{{{vendorExtensions.x-rust-param-identifier}}}{{^required}}.unwrap(){{/required}}{{#required}}{{#isNullable}}.unwrap(){{/isNullable}}{{/required}}{{#isArray}}.join(",").as_ref(){{/isArray}}{{#vendorExtensions.x-rust-chrono-date-time}}.to_rfc3339(){{/vendorExtensions.x-rust-chrono-date-time}}{{^isString}}{{^isUuid}}{{^isPrimitiveType}}{{^isContainer}}.to_string(){{/isContainer}}{{/isPrimitiveType}}{{/isUuid}}{{/isString}}{{#isString}}){{/isString}}{{/pathParams}});
+ {{#allParams}}
+ {{#isQueryStringParam}}
+ {{#required}}
+ // OpenAPI 3.2 `in: querystring`: the parameter value IS the query component
+ // (without the leading `?`), appended verbatim without re-encoding
+ uri_str.push_str(if uri_str.contains('?') { "&" } else { "?" });
+ uri_str.push_str(&{{{vendorExtensions.x-rust-param-identifier}}});
+ {{/required}}
+ {{^required}}
+ if let Some(ref param_value) = {{{vendorExtensions.x-rust-param-identifier}}} {
+ uri_str.push_str(if uri_str.contains('?') { "&" } else { "?" });
+ uri_str.push_str(param_value);
+ }
+ {{/required}}
+ {{/isQueryStringParam}}
+ {{/allParams}}
+ let mut req_builder = configuration.client.request({{#vendorExtensions.x-rust-http-method-literal}}reqwest::Method::from_bytes(b"{{{httpMethod}}}").expect("valid HTTP method"){{/vendorExtensions.x-rust-http-method-literal}}{{^vendorExtensions.x-rust-http-method-literal}}reqwest::Method::{{{httpMethod}}}{{/vendorExtensions.x-rust-http-method-literal}}, &uri_str);
{{#queryParams}}
+ {{^isQueryStringParam}}
{{#required}}
{{#isArray}}
req_builder = match "{{collectionFormat}}" {
@@ -289,6 +306,7 @@ pub {{#supportAsync}}async {{/supportAsync}}fn {{{operationId}}}(configuration:
{{/isArray}}
}
{{/required}}
+ {{/isQueryStringParam}}
{{/queryParams}}
{{#hasAuthMethods}}
{{#authMethods}}
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 b73c64591fc0f..0d9d1bf2e8923 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 f5c49271a9fc2..6be95ae3425a7 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 c36f8c3b61a3e..2abf467546e24 100644
--- a/modules/openapi-generator/src/main/resources/typescript-fetch/apis.mustache
+++ b/modules/openapi-generator/src/main/resources/typescript-fetch/apis.mustache
@@ -193,6 +193,7 @@ export class {{classname}} extends runtime.BaseAPI {
const queryParameters: any = {};
{{#queryParams}}
+ {{^isQueryStringParam}}
{{#queryIsJsonMimeType}}
if (requestParameters['{{paramName}}'] != null) {
queryParameters['{{baseName}}'] = JSON.stringify({{#jsonQueryUsesModelSerializer}}{{^withoutRuntimeChecks}}{{dataType}}ToJSON({{/withoutRuntimeChecks}}{{/jsonQueryUsesModelSerializer}}{{#uniqueItems}}Array.from({{/uniqueItems}}requestParameters['{{paramName}}']{{#uniqueItems}}){{/uniqueItems}}{{#jsonQueryUsesModelSerializer}}{{^withoutRuntimeChecks}}){{/withoutRuntimeChecks}}{{/jsonQueryUsesModelSerializer}});
@@ -239,6 +240,7 @@ export class {{classname}} extends runtime.BaseAPI {
{{/isArray}}
{{/queryIsJsonMimeType}}
+ {{/isQueryStringParam}}
{{/queryParams}}
const headerParameters: runtime.HTTPHeaders = {};
@@ -373,6 +375,19 @@ 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
+ // ('?' is only searched before any '#': a '?' inside the fragment is
+ // fragment content, not an existing query string)
+ if (requestParameters['{{paramName}}'] != null && requestParameters['{{paramName}}'] !== '') {
+ urlPath += (urlPath.split('#')[0].includes('?') ? '&' : '?') + requestParameters['{{paramName}}'];
+ }
+ {{/isQueryStringParam}}
+ {{/queryParams}}
+ {{/vendorExtensions.x-ts-has-querystring-param}}
{{#hasContentTypeRequestVariants}}
{{! `contentType` selects the body's type, so narrow on it before serialising }}
@@ -397,7 +412,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,
@@ -407,7 +427,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 1f87c8df17b22..e933345cdd391 100644
--- a/modules/openapi-generator/src/main/resources/typescript-fetch/runtime.mustache
+++ b/modules/openapi-generator/src/main/resources/typescript-fetch/runtime.mustache
@@ -144,7 +144,9 @@ 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);
+ // the '?' check must only consider the part before the fragment: a '?' inside
+ // '#...' is fragment content, not an existing query string.
+ url += (url.split('#')[0].includes('?') ? '&' : '?') + this.configuration.queryParamsStringify(context.query);
}
const headers = Object.assign({}, this.configuration.headers, context.headers);
@@ -326,7 +328,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/DefaultCodegenTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/DefaultCodegenTest.java
index b3bf31a24c76e..15a6068f86c44 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;
@@ -525,6 +526,16 @@ public void testOAS31ContentMediaTypeBinaryFormParameter() {
assertFalse(image.isFile);
}
+
+
+
+
+
+
+
+
+
+
@Test
public void testOriginalOpenApiDocumentVersion() {
// Test with OAS 2.0 document.
@@ -2330,6 +2341,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();
@@ -2746,6 +2783,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 24d1e3d5e3700..9824635ea8e39 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
@@ -504,6 +504,103 @@ 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() {
+ @Override
+ public boolean supportsAdditionalOperations() {
+ return true;
+ }
+ });
+
+ 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);
+ Map httpMethodByOperationId = new HashMap<>();
+ for (CodegenOperation op : defaultList) {
+ httpMethodByOperationId.put(op.operationId, op.httpMethod);
+ }
+ Assert.assertEquals(httpMethodByOperationId.get("queryPets"), "QUERY");
+ Assert.assertEquals(httpMethodByOperationId.get("purgePets"), "PURGE");
+ // additionalOperations keys are HTTP method names and must be sent verbatim
+ Assert.assertEquals(httpMethodByOperationId.get("customPets"), "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();
+ 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() {
+ @Override
+ public boolean supportsAdditionalOperations() {
+ return true;
+ }
+ });
+
+ 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 b6b81d765a036..35dc94abc2ede 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,122 @@ 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/"));
+ Schema> resolvedRetry = openAPI.getComponents().getSchemas()
+ .get(ModelUtils.getSimpleRef(retrySchema.get$ref()));
+ assertNotNull(resolvedRetry);
+ assertTrue(resolvedRetry.getProperties().get("retryId") instanceof StringSchema);
+ }
+
+ @Test
+ public void callbacksOn32OperationsSkippedWhenUnsupported() {
+ // OpenAPI 3.2: when the target generator does not support
+ // query/additionalOperations those operations are dropped, so callbacks
+ // attached to them must not have their inline schemas flattened either
+ Operation queryOp = new Operation()
+ .operationId("queryPets")
+ .responses(new ApiResponses().addApiResponse("200",
+ new ApiResponse().description("ok")))
+ .addCallback("hook", callbackWithInlineBody("queryHookReceive"));
+ Operation notifyOp = new Operation()
+ .operationId("notifyPets")
+ .responses(new ApiResponses().addApiResponse("200",
+ new ApiResponse().description("ok")))
+ .addCallback("hook", callbackWithInlineBody("notifyHookReceive"));
+ // a fixed-method operation's callback must still be discovered
+ Operation getOp = new Operation()
+ .operationId("getPets")
+ .responses(new ApiResponses().addApiResponse("200",
+ new ApiResponse().description("ok")))
+ .addCallback("hook", callbackWithInlineBody("getHookReceive"));
+ OpenAPI openAPI = new OpenAPI()
+ .paths(new Paths().addPathItem("/pets", new PathItem()
+ .get(getOp)
+ .query(queryOp)
+ .addAdditionalOperation("NOTIFY", notifyOp)));
+
+ InlineModelResolver resolver = new InlineModelResolver();
+ resolver.setCodegen(new DefaultCodegen()); // default: supportsAdditionalOperations() == false
+ resolver.flatten(openAPI);
+
+ // the QUERY/additionalOperations callbacks keep their inline schema
+ assertNull(openAPI.getPaths().get("/pets").getQuery()
+ .getCallbacks().get("hook").get("{$request.body#/url}")
+ .getPost().getRequestBody().getContent().get("application/json")
+ .getSchema().get$ref());
+ assertNull(openAPI.getPaths().get("/pets").getAdditionalOperations().get("NOTIFY")
+ .getCallbacks().get("hook").get("{$request.body#/url}")
+ .getPost().getRequestBody().getContent().get("application/json")
+ .getSchema().get$ref());
+ // the GET callback's inline schema is still extracted to components
+ Schema> getCallbackSchema = openAPI.getPaths().get("/pets").getGet()
+ .getCallbacks().get("hook").get("{$request.body#/url}")
+ .getPost().getRequestBody().getContent().get("application/json").getSchema();
+ assertNotNull(getCallbackSchema.get$ref());
+ assertTrue(getCallbackSchema.get$ref().startsWith("#/components/schemas/"));
+ Schema> resolved = openAPI.getComponents().getSchemas()
+ .get(ModelUtils.getSimpleRef(getCallbackSchema.get$ref()));
+ assertNotNull(resolved);
+ assertTrue(resolved.getProperties().get("id") instanceof StringSchema);
+ }
+
@Test
public void testInlineSchemaNameMapping() {
OpenAPI openAPI = TestUtils.parseSpec("src/test/resources/3_0/inline_model_resolver.yaml");
@@ -1636,6 +1753,19 @@ private static Schema refToDuplicate() {
return new Schema<>().$ref("#/components/schemas/Duplicate");
}
+ /** A callback whose single POST operation has an inline request-body schema. */
+ private static Callback callbackWithInlineBody(String operationId) {
+ return new Callback().addPathItem("{$request.body#/url}",
+ new PathItem().post(new Operation()
+ .operationId(operationId)
+ .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")))));
+ }
+
private static void assertRewritten(String carrier, Schema schema) {
assertNotNull("no schema found for carrier " + carrier, schema);
assertEquals("$ref in " + carrier + " must be rewritten to the canonical schema",
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 4312bcddb772d..110aa7a8a0b97 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
@@ -920,6 +920,71 @@ 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);
+ }
+
+ @Test
+ public void testFilterWithCaseCollidingAdditionalOperation() {
+ // OpenAPI 3.2: an additionalOperations key differing from a fixed method only by
+ // case (e.g. "GET") must not hide the fixed method's operation from FILTER:
+ // both operations have to be evaluated and marked with x-internal
+ OpenAPI openAPI = TestUtils.createOpenAPI();
+ PathItem pathItem = new PathItem()
+ .get(new Operation().operationId("fixedGet"))
+ .addAdditionalOperation("GET", new Operation().operationId("additionalGet"));
+ openAPI.path("/pets", pathItem);
+
+ Map options = Map.of("FILTER", "operationId:additionalGet");
+ new OpenAPINormalizer(openAPI, options).normalize();
+
+ assertEquals(pathItem.getGet().getExtensions().get(X_INTERNAL), true);
+ assertEquals(pathItem.getAdditionalOperations().get("GET").getExtensions().get(X_INTERNAL), false);
+
+ // `method:` filtering matches both operations by the lowercased method name
+ OpenAPI openAPI2 = TestUtils.createOpenAPI();
+ PathItem pathItem2 = new PathItem()
+ .get(new Operation().operationId("fixedGet"))
+ .addAdditionalOperation("GET", new Operation().operationId("additionalGet"));
+ openAPI2.path("/pets", pathItem2);
+
+ Map options2 = Map.of("FILTER", "method:get");
+ new OpenAPINormalizer(openAPI2, options2).normalize();
+
+ assertEquals(pathItem2.getGet().getExtensions().get(X_INTERNAL), false);
+ assertEquals(pathItem2.getAdditionalOperations().get("GET").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/config/MergedSpecBuilderTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/config/MergedSpecBuilderTest.java
index 744c5e71f219c..252b92c5a9ee1 100644
--- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/config/MergedSpecBuilderTest.java
+++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/config/MergedSpecBuilderTest.java
@@ -826,6 +826,49 @@ private void shouldDeepMergeResolvesExternalRefs(String fileExt) throws IOExcept
assertNotNull(openAPI.getPaths().get("/extref"), "/extref must be present");
}
+ /**
+ * Root-level security must reach OpenAPI 3.2 {@code additionalOperations} too: the propagation
+ * relies on {@code PathItem.readOperations()}, which in the 3.2 model includes
+ * {@code additionalOperations} values — this test pins that contract.
+ */
+ @Test
+ public void shouldPropagateRootSecurityToAdditionalOperations() {
+ io.swagger.v3.oas.models.security.SecurityRequirement req =
+ new io.swagger.v3.oas.models.security.SecurityRequirement().addList("apiKeyAuth");
+
+ OpenAPI spec1 = new OpenAPI().openapi("3.2.0")
+ .info(new Info().title("s1").version("1.0.0"))
+ .security(Collections.singletonList(req));
+ spec1.setPaths(new io.swagger.v3.oas.models.Paths());
+ spec1.setComponents(new Components());
+ PathItem path = new PathItem()
+ .get(new io.swagger.v3.oas.models.Operation().operationId("getA"));
+ path.addAdditionalOperation("REPORT",
+ new io.swagger.v3.oas.models.Operation().operationId("reportA"));
+ spec1.getPaths().addPathItem("/a", path);
+
+ // Same path URL in a second spec forces mergePathItem (the addAdditionalOperation branch)
+ OpenAPI spec2 = new OpenAPI().openapi("3.2.0")
+ .info(new Info().title("s2").version("1.0.0"));
+ spec2.setPaths(new io.swagger.v3.oas.models.Paths());
+ spec2.setComponents(new Components());
+ spec2.getPaths().addPathItem("/a", new PathItem()
+ .post(new io.swagger.v3.oas.models.Operation().operationId("postA")));
+
+ MergedSpecBuilder builder = new MergedSpecBuilder("dummy", "_merged")
+ .withMergeMode(MergedSpecBuilder.MergeMode.DEEP);
+ OpenAPI merged = builder.mergeSpecs(Arrays.asList(spec1, spec2), Collections.emptyList());
+
+ PathItem mergedPath = merged.getPaths().get("/a");
+ assertNotNull(mergedPath.getAdditionalOperations(), "additionalOperations must survive the merge");
+ io.swagger.v3.oas.models.Operation report = mergedPath.getAdditionalOperations().get("REPORT");
+ assertNotNull(report, "REPORT operation must be present after merge");
+ assertNotNull(report.getSecurity(),
+ "Root security must be propagated to additionalOperations");
+ assertTrue(report.getSecurity().stream().anyMatch(r -> r.containsKey("apiKeyAuth")),
+ "apiKeyAuth requirement must be present on the additionalOperation");
+ }
+
@Test
public void shouldDeepMergePreservesRootSecurityOnOperations_yaml() throws IOException {
shouldDeepMergePreservesRootSecurityOnOperations("yaml");
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 1d90037296df0..20df8144b2b13 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
@@ -22,7 +22,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;
@@ -33,6 +35,7 @@
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;
@@ -481,6 +484,227 @@ public void testJsonContentHeaderUsesJsonSerialization() throws IOException {
"localVarRequestOptions.HeaderParameters.Add(\"X-Plain-Arg\", Org.OpenAPITools.Client.ClientUtils.ParameterToString(xPlainArg)); // header parameter");
}
+ @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; 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);
+ }
+ 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");
+ // 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("? searchQuery :"),
+ "a querystring param named `searchQuery` must reach the wire verbatim");
+ } 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());
+ }
+ }
+
+ @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());
+ }
+ }
+
+
+
+ /**
+ * 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;
+ }
+ }
+
@Test
public void testJsonContentHeaderUsesJsonSerializationGenericHost() throws IOException {
File output = Files.createTempDirectory("test").toFile().getCanonicalFile();
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 f9887417b6349..881eea2e188a6 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
@@ -24,6 +24,7 @@
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;
@@ -32,6 +33,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;
@@ -41,6 +43,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();
@@ -127,7 +142,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")
@@ -137,7 +152,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");
@@ -408,6 +422,112 @@ public void testNullableStringEnumRefValidation() throws IOException {
TestUtils.assertFileNotContains(model, "validateStringEnumValues");
}
+ @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();
+ TEMP_DIRS.add(output);
+
+ 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();
+
+ 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();
+ TEMP_DIRS.add(output);
+
+ 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();
+
+ Path clientFile = Paths.get(output + "/client.go");
+ // the full verbatim-preservation chain: the path-embedded raw query is
+ // captured before url.Query() merges it, then written back ahead of the
+ // encoded parameters (path-declared query data first)
+ TestUtils.assertFileContains(clientFile,
+ "rawQueryString := url.RawQuery",
+ "url.RawQuery = \"\"",
+ "url.RawQuery = rawQueryString + encodedQuery");
+ // and the capture must precede the merge into url.Query()
+ String client = new String(Files.readAllBytes(clientFile), java.nio.charset.StandardCharsets.UTF_8);
+ Assert.assertTrue(
+ client.indexOf("rawQueryString := url.RawQuery")
+ < client.indexOf("query := url.Query()"),
+ "raw query must be captured before url.Query() reads it");
+ }
+
+ @Test(description = "in:querystring together with a path parameter imports strings only once")
+ public void testOpenAPI32QueryStringWithPathParamImports() throws IOException {
+ File output = Files.createTempDirectory("test").toFile();
+ TEMP_DIRS.add(output);
+
+ 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();
+
+ 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), java.nio.charset.StandardCharsets.UTF_8);
+ 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();
+ TEMP_DIRS.add(output);
+
+ final CodegenConfigurator configurator = new CodegenConfigurator()
+ .setGeneratorName("go")
+ .setInputSpec("src/test/resources/3_2/webhook-operations.yaml")
+ .setOutputDir(output.getAbsolutePath().replace("\\", "/"));
+
+ DefaultGenerator generator = new DefaultGenerator();
+ List files = generator.opts(configurator.toClientOptInput()).generate();
+
+ // 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\"");
+ }
+
@Test(description = "Verify form style query parameters explode an object instead of bracketing it")
public void testExplodedObjectQueryParameter() throws IOException {
File output = Files.createTempDirectory("test").toFile();
@@ -442,7 +562,7 @@ public void testExplodedObjectQueryParameter() 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")
@@ -451,7 +571,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");
}
@@ -459,7 +578,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")
@@ -469,7 +588,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\")}");
@@ -481,7 +599,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")
@@ -491,7 +609,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");
}
@@ -503,7 +620,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")
@@ -513,7 +630,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");
@@ -539,7 +655,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")
@@ -548,7 +664,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"),
@@ -558,7 +673,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")
@@ -569,7 +684,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"),
@@ -579,7 +693,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")
@@ -588,7 +702,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"),
@@ -598,7 +711,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")
@@ -609,7 +722,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"),
@@ -623,7 +735,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")
@@ -634,7 +746,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"),
@@ -644,7 +755,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")
@@ -655,7 +766,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"),
@@ -665,7 +775,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")
@@ -676,7 +786,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"),
@@ -689,7 +798,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")
@@ -699,7 +808,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");
}
@@ -707,7 +815,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")
@@ -717,7 +825,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);
@@ -750,7 +857,7 @@ public void testGoModContainsTestifyWithoutOAuth2() 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")
@@ -761,7 +868,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);
@@ -776,7 +882,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")
@@ -786,7 +892,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");
}
@@ -794,7 +899,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")
@@ -803,7 +908,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\"}";
@@ -816,7 +920,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")
@@ -825,7 +929,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
@@ -866,7 +969,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")
@@ -876,7 +979,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).
@@ -889,7 +991,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")
@@ -898,7 +1000,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,
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 7c6ddee9e2b37..86c23b6bc48ee 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
@@ -17,6 +17,10 @@
package org.openapitools.codegen.java;
+import ch.qos.logback.classic.spi.ILoggingEvent;
+import ch.qos.logback.core.filter.Filter;
+import ch.qos.logback.core.read.ListAppender;
+import ch.qos.logback.core.spi.FilterReply;
import com.github.javaparser.StaticJavaParser;
import com.github.javaparser.ast.CompilationUnit;
import com.github.javaparser.ast.body.FieldDeclaration;
@@ -48,6 +52,7 @@
import org.openapitools.codegen.model.OperationMap;
import org.openapitools.codegen.model.OperationsMap;
import org.openapitools.codegen.testutils.ConfigAssert;
+import org.slf4j.LoggerFactory;
import org.testng.Assert;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
@@ -6624,6 +6629,127 @@ 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("\\", "/"));
+
+ List files = new DefaultGenerator().opts(configurator.toClientOptInput()).generate();
+
+ validateJavaSourceFiles(files);
+ // 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\"")
+ // additionalOperations keys are RFC 9110 tchar (no '"' or '\\')
+ // and must reach the wire verbatim, not HTML-escaped by Mustache
+ .contains("\"CHECK&FETCH\"")
+ .doesNotContain("&")
+ .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("\\", "/"));
+
+ List files = new DefaultGenerator().opts(configurator.toClientOptInput()).generate();
+
+ validateJavaSourceFiles(files);
+ // 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 testAdditionalOperationsSkipsInvalidHttpMethodTokens() {
+ final Path output = newTempFolder();
+ ch.qos.logback.classic.Logger logger =
+ (ch.qos.logback.classic.Logger) LoggerFactory.getLogger(JavaClientCodegen.class);
+ final String testThreadName = Thread.currentThread().getName();
+ ListAppender listAppender = new ListAppender<>();
+ listAppender.addFilter(new Filter() {
+ @Override
+ public FilterReply decide(ILoggingEvent event) {
+ return testThreadName.equals(event.getThreadName())
+ ? FilterReply.NEUTRAL : FilterReply.DENY;
+ }
+ });
+ listAppender.start();
+ logger.addAppender(listAppender);
+ try {
+ final CodegenConfigurator configurator = new CodegenConfigurator()
+ .setGeneratorName(JAVA_GENERATOR) // default library okhttp-gson
+ .setInputSpec("src/test/resources/3_2/java-invalid-method.yaml")
+ .setOutputDir(output.toString().replace("\\", "/"));
+
+ List files = new DefaultGenerator().opts(configurator.toClientOptInput()).generate();
+
+ validateJavaSourceFiles(files);
+ // additionalOperations keys that are not RFC 9110 tokens are
+ // skipped with a warning; valid tokens (including tchar
+ // punctuation) reach the generated code verbatim
+ assertThat(output.resolve("src/main/java/org/openapitools/client/api/DefaultApi.java"))
+ .content()
+ .contains("searchPetsCall(")
+ .contains("checkFetchPetsCall(")
+ .contains("\"SEARCH\"")
+ .contains("\"CHECK&FETCH\"")
+ .doesNotContain("badMethod")
+ .doesNotContain("quotedMethod")
+ .doesNotContain("unicodeMethod");
+ for (String method : new String[]{"BAD METHOD", "A\"B", "ÄÖ"}) {
+ boolean warned = listAppender.list.stream()
+ .filter(e -> e.getLevel() == ch.qos.logback.classic.Level.WARN)
+ .map(ILoggingEvent::getFormattedMessage)
+ .anyMatch(msg -> msg.contains(method)
+ && msg.contains("not a valid RFC 9110 token"));
+ Assert.assertTrue(warned,
+ "expected a WARN mentioning '" + method + "' and 'not a valid RFC 9110 token'");
+ }
+ } finally {
+ logger.detachAppender(listAppender);
+ }
+ }
+
+ @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("\\", "/"));
+
+ List files = new DefaultGenerator().opts(configurator.toClientOptInput()).generate();
+
+ validateJavaSourceFiles(files);
+ // 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()");
+ }
+
@Test(dataProvider = "jerseyLibraries")
public void testArrayPathParamSerializedAsCollection(String library) {
Path output = newTempFolder();
diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/k6/K6ClientCodegenTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/k6/K6ClientCodegenTest.java
new file mode 100644
index 0000000000000..e7ba033134437
--- /dev/null
+++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/k6/K6ClientCodegenTest.java
@@ -0,0 +1,86 @@
+package org.openapitools.codegen.k6;
+
+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.responses.ApiResponse;
+import io.swagger.v3.oas.models.responses.ApiResponses;
+import org.apache.commons.io.FileUtils;
+import org.openapitools.codegen.ClientOptInput;
+import org.openapitools.codegen.DefaultGenerator;
+import org.openapitools.codegen.TestUtils;
+import org.openapitools.codegen.languages.K6ClientCodegen;
+import org.testng.annotations.Test;
+
+import java.io.File;
+import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.util.Map;
+
+public class K6ClientCodegenTest {
+
+ @Test
+ public void testQueryOperationIsSkipped() throws IOException {
+ // generators without supportsAdditionalOperations() must skip OpenAPI 3.2
+ // `query` operations: k6's JS http module has no `query` function, so
+ // emitting them would generate a script that fails at runtime with
+ // `TypeError: http.query is not a function`
+ OpenAPI openAPI = TestUtils.createOpenAPI();
+ openAPI.getPaths().addPathItem("/search",
+ new PathItem()
+ .get(new Operation().operationId("getItems")
+ .responses(new ApiResponses().addApiResponse("200", new ApiResponse().description("OK"))))
+ .query(new Operation().operationId("searchItems")
+ .responses(new ApiResponses().addApiResponse("200", new ApiResponse().description("OK")))));
+
+ Path scriptJs = generate(openAPI);
+ try {
+ TestUtils.assertFileContains(scriptJs, "http.get(");
+ TestUtils.assertFileNotContains(scriptJs, "http.query(", "searchItems");
+ } finally {
+ FileUtils.deleteDirectory(scriptJs.getParent().toFile());
+ }
+ }
+
+ @Test
+ public void testQueryOnlyPathLeavesNoEmptyGroup() throws IOException {
+ // a path declaring only a `query` operation must not leave an empty
+ // group() block behind; the dataextract extension on the second path
+ // additionally exercises the substitute-parameter pre-scan against a
+ // spec containing a skipped path
+ OpenAPI openAPI = TestUtils.createOpenAPI();
+ openAPI.getPaths().addPathItem("/queryOnly",
+ new PathItem().query(new Operation().operationId("searchItems")
+ .responses(new ApiResponses().addApiResponse("200", new ApiResponse().description("OK")))));
+
+ Operation getPets = new Operation().operationId("getPets")
+ .responses(new ApiResponses().addApiResponse("200", new ApiResponse().description("OK")));
+ getPets.addExtension("x-k6-openapi-operation-dataextract",
+ Map.of("operationId", "getPets", "valuePath", "id", "parameterName", "petId"));
+ openAPI.getPaths().addPathItem("/pets", new PathItem().get(getPets));
+
+ Path scriptJs = generate(openAPI);
+ try {
+ TestUtils.assertFileContains(scriptJs, "http.get(");
+ TestUtils.assertFileNotContains(scriptJs, "http.query(", "searchItems", "queryOnly");
+ } finally {
+ FileUtils.deleteDirectory(scriptJs.getParent().toFile());
+ }
+ }
+
+ private Path generate(OpenAPI openAPI) throws IOException {
+ File output = Files.createTempDirectory("test").toFile();
+
+ K6ClientCodegen codegen = new K6ClientCodegen();
+ codegen.setOutputDir(output.getAbsolutePath().replace("\\", "/"));
+
+ ClientOptInput input = new ClientOptInput();
+ input.openAPI(openAPI);
+ input.config(codegen);
+
+ new DefaultGenerator().opts(input).generate();
+
+ return output.toPath().resolve("script.js");
+ }
+}
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 2960319ce41b2..afe7ff9b94464 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
@@ -17,11 +17,15 @@
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.List;
import java.util.regex.Pattern;
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;
@@ -278,6 +282,237 @@ public void testJvmKtorQueryParamWithTypeObject() throws IOException {
assertFileNotContains(defaultApi.toPath(), "mapDeep?.apply {");
}
+ @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", "REPORT", "PROPPATCH"}) {
+ 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");
+ Assert.assertTrue(api.contains("encodedQueryString = listOfNotNull(searchQuery).joinToString"),
+ "querystring param should be passed verbatim");
+
+ 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");
+ // 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 |");
+ } 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", "reportItems", "propPatch", "searchItems"}) {
+ 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 = requireKotlinc();
+ List jars = captureDepJars(kotlinc);
+
+ 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 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")
+ .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();
+ }
+
+ 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 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());
+ }
+ }
+ }
+
@Test(description = "Verify a form style, exploded map query parameter goes on the wire one entry per parameter")
public void testExplodedObjectQueryParameterJvmOkhttp() throws IOException {
OpenAPI openAPI = readOpenAPI("src/test/resources/3_0/exploded-object-query-param.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 803a460aea0a6..1d9ac84457441 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;
@@ -182,6 +187,211 @@ public void testEnumUnknownDefaultCaseDeserializationDisabled() throws Exception
Assert.assertListNotContains(serializerContent, a -> a.equals("return constant(\"$class::UNKNOWN_DEFAULT_OPEN_API\");"), "");
}
+ @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;
+ // 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");
+ 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
+ // 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());
+ }
+ }
+
+ @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/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;
+ }
+ }
+
@Test
public void testDateTimeLengthValidationIsNotGenerated() throws Exception {
File output = Files.createTempDirectory("test").toFile().getCanonicalFile();
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 ecbe366649ce8..8ab7c382cbc2b 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
@@ -2063,6 +2063,86 @@ public void testIndependentImplicitClientsPreserveDefaultsWhenDisabled() throws
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/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");
+ }
+
@Test( description = "test src-layout with setuptools" )
public void testSrcLayoutSetuptools() throws IOException {
PythonClientCodegen codegen = new PythonClientCodegen();
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 d866e2d65f4df..9ad800d1a08fa 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
@@ -24,6 +24,7 @@
import io.swagger.v3.oas.models.media.StringSchema;
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;
@@ -33,6 +34,7 @@
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;
@@ -804,6 +806,209 @@ public void testQueryParamJsonSerializationSetsQueryIsJsonMimeType() {
"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");
+ // 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)"),
+ "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);
+ }
+ // `in: querystring` on a standard method is skipped entirely for
+ // libraries without querystring support - emitting it as a
+ // name=value pair would corrupt the encoded query on the wire
+ Assert.assertFalse(generated.contains("def find_pets"),
+ "typhoeus must skip the GET+querystring operation");
+ } finally {
+ FileUtils.deleteDirectory(target.toFile());
+ }
+ }
+
+ @Test
+ public void testFaradaySkipsQueryStringParam() 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.assertFalse(generated.contains("def find_pets"),
+ "faraday must skip the GET+querystring operation");
+ } 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/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;
+ }
+ }
+
@Test(description = "an allOf child's build_from_hash and to_hash include the attributes inherited from its parents")
public void testBuildFromHashMapsInheritedAttributes() throws Exception {
final File output = Files.createTempDirectory("test").toFile();
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 9b3bc906224e7..91384ab1890d9 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
@@ -17,21 +17,33 @@
package org.openapitools.codegen.rust;
+import ch.qos.logback.classic.spi.ILoggingEvent;
+import ch.qos.logback.core.filter.Filter;
+import ch.qos.logback.core.read.ListAppender;
+import ch.qos.logback.core.spi.FilterReply;
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;
import org.openapitools.codegen.config.CodegenConfigurator;
import org.openapitools.codegen.languages.RustClientCodegen;
+import org.slf4j.LoggerFactory;
import org.testng.Assert;
import org.testng.annotations.Test;
+import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.IOException;
import java.math.BigDecimal;
+import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Path;
+import java.util.ArrayList;
+import java.util.Arrays;
import java.util.List;
+import java.util.Objects;
+import java.util.concurrent.TimeUnit;
import static org.openapitools.codegen.TestUtils.linearize;
@@ -282,20 +294,23 @@ 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
@@ -395,22 +410,25 @@ public void testOneOfEnumDiscriminatorKeepsTagInContent() throws IOException {
@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
@@ -472,40 +490,344 @@ public void testExplodedDeepObjectMapQueryParams() throws IOException {
@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");
+ 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());
+ }
+ }
+
+ @Test
+ public void testReqwestOpenApi32QueryStringParamGrouped() throws IOException {
+ Path target = Files.createTempDirectory("test");
+ 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 testReqwestEscapesMarkdownSpecialsInMethodDoc() throws IOException {
+ Path target = Files.createTempDirectory("test");
+ try {
+ final CodegenConfigurator configurator = new CodegenConfigurator()
+ .setGeneratorName("rust")
+ .setLibrary("reqwest")
+ .setInputSpec("src/test/resources/3_2/rust-method-doc-escape.yaml")
+ .setSkipOverwrite(false)
+ .setOutputDir(target.toAbsolutePath().toString().replace("\\", "/"));
+ new DefaultGenerator().opts(configurator.toClientOptInput()).generate();
+ Path docPath = Path.of(target.toString(), "docs/DefaultApi.md");
+ TestUtils.assertFileExists(docPath);
+ String docs = new String(Files.readAllBytes(docPath), StandardCharsets.UTF_8);
+ // markdown-significant tchars must be escaped inside the method cell
+ for (String escaped : new String[]{"A\\|B", "A\\*B", "A\\_B", "A\\`B"}) {
+ Assert.assertTrue(docs.contains(escaped),
+ "expected escaped method " + escaped + " in generated docs");
+ }
+ // the wire method itself stays verbatim in the API source
+ Path outputPath = Path.of(target.toString(), "src/apis/default_api.rs");
+ String generated = new String(Files.readAllBytes(outputPath), StandardCharsets.UTF_8);
+ for (String method : new String[]{"A|B", "A*B", "A_B", "A`B"}) {
+ Assert.assertTrue(generated.contains("reqwest::Method::from_bytes(b\"" + method + "\")"),
+ "expected verbatim method literal for " + method);
+ }
+ } finally {
+ FileUtils.deleteDirectory(target.toFile());
+ }
+ }
+
+ @Test
+ public void testReqwestSkipsInvalidMethodNames() throws IOException {
+ Path target = Files.createTempDirectory("test");
+ ch.qos.logback.classic.Logger logger =
+ (ch.qos.logback.classic.Logger) LoggerFactory.getLogger(RustClientCodegen.class);
+ final String testThreadName = Thread.currentThread().getName();
+ ListAppender listAppender = new ListAppender<>();
+ listAppender.addFilter(new Filter() {
+ @Override
+ public FilterReply decide(ILoggingEvent event) {
+ return testThreadName.equals(event.getThreadName())
+ ? FilterReply.NEUTRAL : FilterReply.DENY;
+ }
+ });
+ listAppender.start();
+ logger.addAppender(listAppender);
+ 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");
+ boolean warned = listAppender.list.stream()
+ .filter(e -> e.getLevel() == ch.qos.logback.classic.Level.WARN)
+ .map(ILoggingEvent::getFormattedMessage)
+ .anyMatch(msg -> msg.contains("MY METHOD")
+ && msg.contains("not a valid RFC 9110 token"));
+ Assert.assertTrue(warned,
+ "expected a WARN mentioning 'MY METHOD' and 'not a valid RFC 9110 token'");
+ } finally {
+ logger.detachAppender(listAppender);
+ FileUtils.deleteDirectory(target.toFile());
+ }
+ }
+
+ @Test
+ public void testReqwestWebhookOpenApi32Operations() throws IOException {
+ Path target = Files.createTempDirectory("test");
+ try {
+ final CodegenConfigurator configurator = new CodegenConfigurator()
+ .setGeneratorName("rust")
+ .setLibrary("reqwest")
+ .setInputSpec("src/test/resources/3_2/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());
+ }
+ }
+
+ @Test
+ public void testHyperSkipsOpenApi32Operations() throws IOException {
+ Path target = Files.createTempDirectory("test");
+ 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());
+ }
+ }
+
+ /**
+ * 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 (!Boolean.getBoolean("rust.e2e")) {
+ throw new org.testng.SkipException("rust.e2e system property is not enabled; skipping generated-client verification");
+ }
+ 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");
+ 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();
+ // 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;
+ }
+ }
+
+ 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();
+ // Drain the merged stdout/stderr pipe on a separate thread while we wait: reading
+ // only after waitFor() lets a full OS pipe buffer (~64KB on Linux) block cargo's
+ // writes, deadlocking the wait.
+ ByteArrayOutputStream captured = new ByteArrayOutputStream();
+ Thread drainer = new Thread(() -> {
+ try {
+ p.getInputStream().transferTo(captured);
+ } catch (IOException ignored) {
+ // process died or the stream closed; whatever was captured is still reported
+ }
+ });
+ drainer.setDaemon(true);
+ drainer.start();
+ boolean finished = p.waitFor(15, TimeUnit.MINUTES);
+ if (!finished) {
+ p.destroyForcibly();
+ }
+ // process exit (or destroyForcibly) closes the pipe, so the drainer hits EOF and ends;
+ // bound the join so a stray cargo child still holding the pipe can't hang the test
+ drainer.join(30_000);
+ String output = new String(captured.toByteArray(), 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;
}
@Test
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 66471d35f881a..445d501011463 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
@@ -1,5 +1,7 @@
package org.openapitools.codegen.typescript.fetch;
+import ch.qos.logback.classic.spi.ILoggingEvent;
+import ch.qos.logback.core.read.ListAppender;
import io.swagger.v3.oas.models.OpenAPI;
import io.swagger.v3.oas.models.PathItem;
import io.swagger.v3.oas.models.media.ArraySchema;
@@ -16,6 +18,7 @@
import org.openapitools.codegen.languages.TypeScriptFetchClientCodegen;
import org.openapitools.codegen.typescript.TypeScriptGroups;
import org.openapitools.codegen.utils.ModelUtils;
+import org.slf4j.LoggerFactory;
import org.testng.Assert;
import org.testng.SkipException;
import org.testng.annotations.DataProvider;
@@ -325,6 +328,69 @@ public void testAnyTypeFormParamUsesQualifiedAnyToJSON() throws IOException {
TestUtils.assertFileNotContains(api, "JSON.stringify(anyToJSON(");
}
+ @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.split('#')[0].includes('?') ? '&' : '?') + requestParameters['qs']");
+ TestUtils.assertFileNotContains(api, "queryParameters['qs']");
+
+ // the HTTPMethod type admits arbitrary method strings
+ TestUtils.assertFileContains(Paths.get(output + "/runtime.ts"), "| (string & {})");
+ // an existing query string is detected only before the fragment: a '?'
+ // inside '#...' must not make the runtime append with '&'
+ TestUtils.assertFileContains(Paths.get(output + "/runtime.ts"),
+ "url += (url.split('#')[0].includes('?') ? '&' : '?')");
+ }
+
+ @Test
+ public void testFetchForbiddenMethodsStillWarn() throws IOException {
+ // CONNECT arrives only via additionalOperations and TRACE via the
+ // native PathItem field, yet fetch() rejects all three at runtime -
+ // the warning must not depend on the standard-method branch
+ ch.qos.logback.classic.Logger logger =
+ (ch.qos.logback.classic.Logger) LoggerFactory.getLogger(TypeScriptFetchClientCodegen.class);
+ ListAppender listAppender = new ListAppender<>();
+ listAppender.start();
+ logger.addAppender(listAppender);
+ try {
+ File output = generate(Collections.emptyMap(),
+ "src/test/resources/3_2/typescript-fetch-forbidden-methods.yaml");
+
+ for (String op : new String[]{"connectPets", "tracePets", "trackPets"}) {
+ Assert.assertTrue(listAppender.list.stream().anyMatch(e ->
+ e.getLevel() == ch.qos.logback.classic.Level.WARN
+ && e.getFormattedMessage().contains("forbidden by the fetch specification")
+ && e.getFormattedMessage().contains(op)),
+ "missing fetch-forbidden WARN for " + op);
+ }
+
+ // output format is unchanged: standard names stay single-quoted,
+ // TRACK (non-standard) is emitted as an escaped literal
+ Path api = Paths.get(output + "/apis/DefaultApi.ts");
+ TestUtils.assertFileContains(api, "method: 'CONNECT'");
+ TestUtils.assertFileContains(api, "method: 'TRACE'");
+ TestUtils.assertFileContains(api, "method: \"TRACK\"");
+ } finally {
+ logger.detachAppender(listAppender);
+ }
+ }
+
@Test
public void testMergesContentTypeVariantsIntoOneMethod() throws IOException {
File output = Files.createTempDirectory("test").toFile();
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 2a4f4c877aab8..f2e4e2a863cac 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/csharp-generichost-capture/Capture.csproj b/modules/openapi-generator/src/test/resources/3_2/csharp-generichost-capture/Capture.csproj
new file mode 100644
index 0000000000000..94a099c6039ba
--- /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 0000000000000..eefa90155036c
--- /dev/null
+++ b/modules/openapi-generator/src/test/resources/3_2/csharp-generichost-capture/Program.cs
@@ -0,0 +1,109 @@
+// 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);
+ 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);
+ }
+ 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 `?`;
+// 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&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) { }
+
+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;
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 0000000000000..25425ba73bb44
--- /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/java-invalid-method.yaml b/modules/openapi-generator/src/test/resources/3_2/java-invalid-method.yaml
new file mode 100644
index 0000000000000..f0fedeffff25d
--- /dev/null
+++ b/modules/openapi-generator/src/test/resources/3_2/java-invalid-method.yaml
@@ -0,0 +1,40 @@
+openapi: 3.2.0
+info:
+ title: invalid method name test
+ version: '1.0'
+paths:
+ /pets:
+ get:
+ operationId: listPets
+ responses:
+ '200':
+ description: ok
+ additionalOperations:
+ # valid RFC 9110 tokens - must be generated verbatim
+ SEARCH:
+ operationId: searchPets
+ responses:
+ '204':
+ description: done
+ "CHECK&FETCH":
+ operationId: checkFetchPets
+ responses:
+ '204':
+ description: done
+ # not valid RFC 9110 tokens - must be skipped with a warning;
+ # '"' would also break the emitted Java string literal
+ "BAD METHOD":
+ operationId: badMethod
+ responses:
+ '204':
+ description: done
+ "A\"B":
+ operationId: quotedMethod
+ responses:
+ '204':
+ description: done
+ "ÄÖ":
+ operationId: unicodeMethod
+ responses:
+ '204':
+ description: done
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 0000000000000..e1253d01565c8
--- /dev/null
+++ b/modules/openapi-generator/src/test/resources/3_2/kotlin-okhttp-capture/Capture.kt
@@ -0,0 +1,94 @@
+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()
+ }
+ 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()
+ }
+}
+
+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() }
+ // 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 `searchQuery`
+ run("REPORT reportItems(searchQuery)") { api.reportItemsWithHttpInfo("r=1") }
+ run("PROPPATCH propPatch(body)") { api.propPatchWithHttpInfo("") }
+
+ 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]",
+ "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=\"\""
+ )
+ 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/php-guzzle-capture/capture.php b/modules/openapi-generator/src/test/resources/3_2/php-guzzle-capture/capture.php
new file mode 100644
index 0000000000000..c3ae52cb10462
--- /dev/null
+++ b/modules/openapi-generator/src/test/resources/3_2/php-guzzle-capture/capture.php
@@ -0,0 +1,113 @@
+`.
+//
+// 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] . " [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);
+}
+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 `?`;
+// embedded `//` must reach the wire intact.
+$calls = [
+ 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&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;
+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);
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 0000000000000..1a19749c599a0
--- /dev/null
+++ b/modules/openapi-generator/src/test/resources/3_2/query-operation.yaml
@@ -0,0 +1,125 @@
+openapi: 3.2.0
+info:
+ title: query operation test
+ version: '1.0'
+paths:
+ /pets:
+ get:
+ operationId: listPets
+ responses:
+ '200':
+ description: ok
+ 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
+ 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
+ # `#` is valid tchar but would trigger interpolation inside a Ruby :"..." literal
+ "X#Y":
+ operationId: hashPets
+ 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
+ /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:
+ - name: searchQuery
+ 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/querystring-object.yaml b/modules/openapi-generator/src/test/resources/3_2/querystring-object.yaml
new file mode 100644
index 0000000000000..508e8a76fa796
--- /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/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 0000000000000..2022471977870
--- /dev/null
+++ b/modules/openapi-generator/src/test/resources/3_2/ruby-httpx-capture/capture.rb
@@ -0,0 +1,71 @@
+# 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 (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'
+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
+ 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
+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 `?`;
+# 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&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 = 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
+abort('CAPTURE-FAIL') unless got == expected
+puts 'CAPTURE-PASS'
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 0000000000000..8efef49a5f032
--- /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-method-doc-escape.yaml b/modules/openapi-generator/src/test/resources/3_2/rust-method-doc-escape.yaml
new file mode 100644
index 0000000000000..8c63c2a55faf4
--- /dev/null
+++ b/modules/openapi-generator/src/test/resources/3_2/rust-method-doc-escape.yaml
@@ -0,0 +1,34 @@
+openapi: 3.2.0
+info:
+ title: method doc escape test
+ version: '1.0'
+paths:
+ /pets:
+ get:
+ operationId: listPets
+ responses:
+ '200':
+ description: ok
+ additionalOperations:
+ # all four are valid RFC 9110 tchar but have special meaning in the
+ # markdown tables/code spans emitted by the rust doc templates
+ "A|B":
+ operationId: pipePets
+ responses:
+ '204':
+ description: done
+ "A*B":
+ operationId: starPets
+ responses:
+ '204':
+ description: done
+ "A_B":
+ operationId: underscorePets
+ responses:
+ '204':
+ description: done
+ "A`B":
+ operationId: backtickPets
+ 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 0000000000000..468449800fdc1
--- /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");
+}
diff --git a/modules/openapi-generator/src/test/resources/3_2/typescript-fetch-forbidden-methods.yaml b/modules/openapi-generator/src/test/resources/3_2/typescript-fetch-forbidden-methods.yaml
new file mode 100644
index 0000000000000..c3b454297e39c
--- /dev/null
+++ b/modules/openapi-generator/src/test/resources/3_2/typescript-fetch-forbidden-methods.yaml
@@ -0,0 +1,28 @@
+openapi: 3.2.0
+info:
+ title: fetch-forbidden method test
+ version: '1.0'
+paths:
+ /pets:
+ # TRACE is a native PathItem field and a fetch-forbidden method at the
+ # same time; the generated client must still warn about it
+ trace:
+ operationId: tracePets
+ responses:
+ '200':
+ description: ok
+ additionalOperations:
+ # CONNECT has no native PathItem field, so it always arrives through
+ # additionalOperations while still counting as a standard method name
+ CONNECT:
+ operationId: connectPets
+ responses:
+ '204':
+ description: done
+ # TRACK is neither a PathItem field nor a standard name: the forbidden
+ # warning must fire for it as well
+ TRACK:
+ operationId: trackPets
+ responses:
+ '204':
+ description: done
diff --git a/modules/openapi-generator/src/test/resources/3_2/webhook-operations.yaml b/modules/openapi-generator/src/test/resources/3_2/webhook-operations.yaml
new file mode 100644
index 0000000000000..a6d8d664ef4dc
--- /dev/null
+++ b/modules/openapi-generator/src/test/resources/3_2/webhook-operations.yaml
@@ -0,0 +1,49 @@
+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
+ # 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
diff --git a/pom.xml b/pom.xml
index 0ac0bb1c17a73..7d65a6f240962 100644
--- a/pom.xml
+++ b/pom.xml
@@ -1226,6 +1226,27 @@
modules/openapi-generator-online
+
+
+ swagger-fork
+
+ 2.1.49-oas32.1
+
+
+
+ swagger-fork
+ ${swagger.fork.repo.url}
+
+ true
+
+
+ false
+
+
+
+
target/site
diff --git a/samples/client/echo_api/go-external-refs/client.go b/samples/client/echo_api/go-external-refs/client.go
index 74bc9048de0d3..7907268826a63 100644
--- a/samples/client/echo_api/go-external-refs/client.go
+++ b/samples/client/echo_api/go-external-refs/client.go
@@ -566,6 +566,12 @@ 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 keep it verbatim ahead of the encoded
+ // parameters (path-declared query data first, as before).
+ rawQueryString := url.RawQuery
+ url.RawQuery = ""
query := url.Query()
for k, v := range queryParams {
for _, iv := range v {
@@ -574,11 +580,19 @@ 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 != "" {
+ rawQueryString += "&"
+ }
+ url.RawQuery = rawQueryString + encodedQuery
+ } else {
+ 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 74bc9048de0d3..7907268826a63 100644
--- a/samples/client/echo_api/go/client.go
+++ b/samples/client/echo_api/go/client.go
@@ -566,6 +566,12 @@ 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 keep it verbatim ahead of the encoded
+ // parameters (path-declared query data first, as before).
+ rawQueryString := url.RawQuery
+ url.RawQuery = ""
query := url.Query()
for k, v := range queryParams {
for _, iv := range v {
@@ -574,11 +580,19 @@ 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 != "" {
+ rawQueryString += "&"
+ }
+ url.RawQuery = rawQueryString + encodedQuery
+ } else {
+ url.RawQuery = encodedQuery
+ }
// Generate a new request
if body != nil {
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 516f7fb1a206f..9723675f4585a 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
@@ -263,7 +263,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 702a9b13b966a..ed9aaf8342ad1 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 in self._STANDARD_METHODS:
+ return self.pool_manager.request(method, url, **kwargs)
+ if method.upper() 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,16 +217,18 @@ def request(
timeout. It can also be a pair (tuple) of
(connection, read) timeouts.
"""
- method = method.upper()
- assert method in [
- 'GET',
- 'HEAD',
- 'DELETE',
- 'POST',
- 'PUT',
- 'PATCH',
- 'OPTIONS'
- ]
+ # OpenAPI 3.2 allows arbitrary HTTP method names (query operations,
+ # additionalOperations keys). The generator emits standard methods
+ # already uppercase; anything else is validated as an HTTP token
+ # (RFC 9110 tchar) and sent verbatim so casing like 'customMethod'
+ # or 'get' (as a distinct additionalOperations key) survives. Do not
+ # use `assert` here: it is stripped under `python -O`.
+ if method not in self._STANDARD_METHODS:
+ if re.fullmatch(r"[!#$%&'*+\-.^_`|~0-9A-Za-z]+", method) is None:
+ raise ApiValueError(
+ "Unrecognized HTTP method name %r: not a valid "
+ "RFC 9110 token" % method
+ )
if post_params and body:
raise ApiValueError(
@@ -233,8 +252,13 @@ def request(
)
try:
- # For `POST`, `PUT`, `PATCH`, `OPTIONS`, `DELETE`
- if method in ['POST', 'PUT', 'PATCH', 'OPTIONS', 'DELETE']:
+ # For `POST`, `PUT`, `PATCH`, `OPTIONS`, `DELETE` - or a
+ # non-standard OpenAPI 3.2 method that actually carries a
+ # body/form data. GET/HEAD keep the historic no-body path even
+ # when a spec defines one.
+ if (method in ['POST', 'PUT', 'PATCH', 'OPTIONS', 'DELETE']
+ or (method not in self._STANDARD_METHODS
+ and (body is not None or post_params))):
content_type = headers.get('Content-Type')
is_json = (
@@ -257,7 +281,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 +290,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 +306,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 +319,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 +329,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 +344,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 516f7fb1a206f..9723675f4585a 100644
--- a/samples/client/echo_api/python/openapi_client/api_client.py
+++ b/samples/client/echo_api/python/openapi_client/api_client.py
@@ -263,7 +263,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 3c35dc796332a..777f344e9ed49 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 in self._STANDARD_METHODS:
+ return self.pool_manager.request(method, url, **kwargs)
+ if method.upper() 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,16 +217,18 @@ def request(
timeout. It can also be a pair (tuple) of
(connection, read) timeouts.
"""
- method = method.upper()
- assert method in [
- 'GET',
- 'HEAD',
- 'DELETE',
- 'POST',
- 'PUT',
- 'PATCH',
- 'OPTIONS'
- ]
+ # OpenAPI 3.2 allows arbitrary HTTP method names (query operations,
+ # additionalOperations keys). The generator emits standard methods
+ # already uppercase; anything else is validated as an HTTP token
+ # (RFC 9110 tchar) and sent verbatim so casing like 'customMethod'
+ # or 'get' (as a distinct additionalOperations key) survives. Do not
+ # use `assert` here: it is stripped under `python -O`.
+ if method not in self._STANDARD_METHODS:
+ if re.fullmatch(r"[!#$%&'*+\-.^_`|~0-9A-Za-z]+", method) is None:
+ raise ApiValueError(
+ "Unrecognized HTTP method name %r: not a valid "
+ "RFC 9110 token" % method
+ )
if post_params and body:
raise ApiValueError(
@@ -233,8 +252,13 @@ def request(
)
try:
- # For `POST`, `PUT`, `PATCH`, `OPTIONS`, `DELETE`
- if method in ['POST', 'PUT', 'PATCH', 'OPTIONS', 'DELETE']:
+ # For `POST`, `PUT`, `PATCH`, `OPTIONS`, `DELETE` - or a
+ # non-standard OpenAPI 3.2 method that actually carries a
+ # body/form data. GET/HEAD keep the historic no-body path even
+ # when a spec defines one.
+ if (method in ['POST', 'PUT', 'PATCH', 'OPTIONS', 'DELETE']
+ or (method not in self._STANDARD_METHODS
+ and (body is not None or post_params))):
content_type = headers.get('Content-Type')
is_json = (
@@ -257,7 +281,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 +290,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 +306,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 +319,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 +329,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 +344,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/ruby-faraday/lib/openapi_client/api/auth_api.rb b/samples/client/echo_api/ruby-faraday/lib/openapi_client/api/auth_api.rb
index 62a8e7592438c..d55ed5e5bdb7d 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 0cdd3c446c70a..830f9e3d4ace2 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 246a676062f6e..b02722f3d86ef 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 becc90198b33e..1ff25d2f6d311 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 12a4e3774c4d4..700647cc443e8 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 ca69f8b3319c3..1dc4cfe17683f 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-faraday/lib/openapi_client/api_client.rb b/samples/client/echo_api/ruby-faraday/lib/openapi_client/api_client.rb
index e67b30cdda081..79fabe3c4cb86 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/auth_api.rb b/samples/client/echo_api/ruby-httpx/lib/openapi_client/api/auth_api.rb
index 62a8e7592438c..d55ed5e5bdb7d 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 0cdd3c446c70a..830f9e3d4ace2 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 246a676062f6e..b02722f3d86ef 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 becc90198b33e..1ff25d2f6d311 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 12a4e3774c4d4..700647cc443e8 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 ca69f8b3319c3..1dc4cfe17683f 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 2e89e66490df9..47e0296cfcb53 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:
@@ -97,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 = {
@@ -108,7 +114,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
@@ -275,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/auth_api.rb b/samples/client/echo_api/ruby-typhoeus/lib/openapi_client/api/auth_api.rb
index 62a8e7592438c..d55ed5e5bdb7d 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 0cdd3c446c70a..830f9e3d4ace2 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 246a676062f6e..b02722f3d86ef 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 becc90198b33e..1ff25d2f6d311 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 12a4e3774c4d4..700647cc443e8 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 ca69f8b3319c3..1dc4cfe17683f 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/echo_api/ruby-typhoeus/lib/openapi_client/api_client.rb b/samples/client/echo_api/ruby-typhoeus/lib/openapi_client/api_client.rb
index b166b05a94169..9c2e517dfc4bc 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/others/go/allof_multiple_ref_and_discriminator/client.go b/samples/client/others/go/allof_multiple_ref_and_discriminator/client.go
index 8dfa32b53fe73..4bb584f62adfc 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
@@ -547,6 +547,12 @@ 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 keep it verbatim ahead of the encoded
+ // parameters (path-declared query data first, as before).
+ rawQueryString := url.RawQuery
+ url.RawQuery = ""
query := url.Query()
for k, v := range queryParams {
for _, iv := range v {
@@ -555,11 +561,19 @@ 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 != "" {
+ rawQueryString += "&"
+ }
+ url.RawQuery = rawQueryString + encodedQuery
+ } else {
+ 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 64785cdb20f74..38e1b5f8e1830 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
@@ -550,6 +550,12 @@ 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 keep it verbatim ahead of the encoded
+ // parameters (path-declared query data first, as before).
+ rawQueryString := url.RawQuery
+ url.RawQuery = ""
query := url.Query()
for k, v := range queryParams {
for _, iv := range v {
@@ -558,11 +564,19 @@ 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 != "" {
+ rawQueryString += "&"
+ }
+ url.RawQuery = rawQueryString + encodedQuery
+ } else {
+ 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 8dfa32b53fe73..4bb584f62adfc 100644
--- a/samples/client/others/go/oneof-anyof-required/client.go
+++ b/samples/client/others/go/oneof-anyof-required/client.go
@@ -547,6 +547,12 @@ 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 keep it verbatim ahead of the encoded
+ // parameters (path-declared query data first, as before).
+ rawQueryString := url.RawQuery
+ url.RawQuery = ""
query := url.Query()
for k, v := range queryParams {
for _, iv := range v {
@@ -555,11 +561,19 @@ 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 != "" {
+ rawQueryString += "&"
+ }
+ url.RawQuery = rawQueryString + encodedQuery
+ } else {
+ 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 8dfa32b53fe73..4bb584f62adfc 100644
--- a/samples/client/others/go/oneof-discriminator-lookup/client.go
+++ b/samples/client/others/go/oneof-discriminator-lookup/client.go
@@ -547,6 +547,12 @@ 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 keep it verbatim ahead of the encoded
+ // parameters (path-declared query data first, as before).
+ rawQueryString := url.RawQuery
+ url.RawQuery = ""
query := url.Query()
for k, v := range queryParams {
for _, iv := range v {
@@ -555,11 +561,19 @@ 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 != "" {
+ rawQueryString += "&"
+ }
+ url.RawQuery = rawQueryString + encodedQuery
+ } else {
+ url.RawQuery = encodedQuery
+ }
// Generate a new request
if body != nil {
diff --git a/samples/client/others/go/oneof-not-enum/client.go b/samples/client/others/go/oneof-not-enum/client.go
index 064a207e71567..ef5f102c022f7 100644
--- a/samples/client/others/go/oneof-not-enum/client.go
+++ b/samples/client/others/go/oneof-not-enum/client.go
@@ -547,6 +547,12 @@ 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 keep it verbatim ahead of the encoded
+ // parameters (path-declared query data first, as before).
+ rawQueryString := url.RawQuery
+ url.RawQuery = ""
query := url.Query()
for k, v := range queryParams {
for _, iv := range v {
@@ -555,11 +561,19 @@ 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 != "" {
+ rawQueryString += "&"
+ }
+ url.RawQuery = rawQueryString + encodedQuery
+ } else {
+ url.RawQuery = encodedQuery
+ }
// Generate a new request
if body != nil {
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 5302b6c1ebec0..08eb15a30b1db 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
@@ -340,7 +340,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 705b48b5625c4..4a4b673fd8460 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 in self._STANDARD_METHODS:
+ return self.pool_manager.request(method, url, **kwargs)
+ if method.upper() 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,16 +216,18 @@ def request(
timeout. It can also be a pair (tuple) of
(connection, read) timeouts.
"""
- method = method.upper()
- assert method in [
- 'GET',
- 'HEAD',
- 'DELETE',
- 'POST',
- 'PUT',
- 'PATCH',
- 'OPTIONS'
- ]
+ # OpenAPI 3.2 allows arbitrary HTTP method names (query operations,
+ # additionalOperations keys). The generator emits standard methods
+ # already uppercase; anything else is validated as an HTTP token
+ # (RFC 9110 tchar) and sent verbatim so casing like 'customMethod'
+ # or 'get' (as a distinct additionalOperations key) survives. Do not
+ # use `assert` here: it is stripped under `python -O`.
+ if method not in self._STANDARD_METHODS:
+ if re.fullmatch(r"[!#$%&'*+\-.^_`|~0-9A-Za-z]+", method) is None:
+ raise ApiValueError(
+ "Unrecognized HTTP method name %r: not a valid "
+ "RFC 9110 token" % method
+ )
if post_params and body:
raise ApiValueError(
@@ -232,8 +251,13 @@ def request(
)
try:
- # For `POST`, `PUT`, `PATCH`, `OPTIONS`, `DELETE`
- if method in ['POST', 'PUT', 'PATCH', 'OPTIONS', 'DELETE']:
+ # For `POST`, `PUT`, `PATCH`, `OPTIONS`, `DELETE` - or a
+ # non-standard OpenAPI 3.2 method that actually carries a
+ # body/form data. GET/HEAD keep the historic no-body path even
+ # when a spec defines one.
+ if (method in ['POST', 'PUT', 'PATCH', 'OPTIONS', 'DELETE']
+ or (method not in self._STANDARD_METHODS
+ and (body is not None or post_params))):
content_type = headers.get('Content-Type')
is_json = (
@@ -256,7 +280,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 +289,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 +305,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 +318,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 +328,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 +343,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/typescript-fetch/additional-properties-in-multipart-issue/runtime.ts b/samples/client/others/typescript-fetch/additional-properties-in-multipart-issue/runtime.ts
index 78beb1b2aec79..fc444173e9c28 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,9 @@ 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);
+ // the '?' check must only consider the part before the fragment: a '?' inside
+ // '#...' is fragment content, not an existing query string.
+ url += (url.split('#')[0].includes('?') ? '&' : '?') + this.configuration.queryParamsStringify(context.query);
}
const headers = Object.assign({}, this.configuration.headers, context.headers);
@@ -312,7 +314,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 78beb1b2aec79..fc444173e9c28 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,9 @@ 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);
+ // the '?' check must only consider the part before the fragment: a '?' inside
+ // '#...' is fragment content, not an existing query string.
+ url += (url.split('#')[0].includes('?') ? '&' : '?') + this.configuration.queryParamsStringify(context.query);
}
const headers = Object.assign({}, this.configuration.headers, context.headers);
@@ -312,7 +314,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 9f53eb69ffe81..0014e356f6279 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,9 @@ 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);
+ // the '?' check must only consider the part before the fragment: a '?' inside
+ // '#...' is fragment content, not an existing query string.
+ url += (url.split('#')[0].includes('?') ? '&' : '?') + this.configuration.queryParamsStringify(context.query);
}
const headers = Object.assign({}, this.configuration.headers, context.headers);
@@ -312,7 +314,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 1f3918ee2809a..4eddd64668c90 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,9 @@ 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);
+ // the '?' check must only consider the part before the fragment: a '?' inside
+ // '#...' is fragment content, not an existing query string.
+ url += (url.split('#')[0].includes('?') ? '&' : '?') + this.configuration.queryParamsStringify(context.query);
}
const headers = Object.assign({}, this.configuration.headers, context.headers);
@@ -312,7 +314,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/go/go-petstore/client.go b/samples/client/petstore/go/go-petstore/client.go
index 6f15e133568d7..b32346b26b7f0 100644
--- a/samples/client/petstore/go/go-petstore/client.go
+++ b/samples/client/petstore/go/go-petstore/client.go
@@ -566,6 +566,12 @@ 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 keep it verbatim ahead of the encoded
+ // parameters (path-declared query data first, as before).
+ rawQueryString := url.RawQuery
+ url.RawQuery = ""
query := url.Query()
for k, v := range queryParams {
for _, iv := range v {
@@ -574,11 +580,19 @@ 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 != "" {
+ rawQueryString += "&"
+ }
+ url.RawQuery = rawQueryString + encodedQuery
+ } else {
+ url.RawQuery = encodedQuery
+ }
// Generate a new request
if body != nil {
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 a8e8364c570cc..05da07962ac0e 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
@@ -1822,6 +1822,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());
}
diff --git a/samples/client/petstore/php/OpenAPIClient-php/composer.json b/samples/client/petstore/php/OpenAPIClient-php/composer.json
index 5a727aacd9d68..1c579745a99ef 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 || ^8.0",
- "guzzlehttp/psr7": "^1.7 || ^2.0 || ^3.0",
+ "guzzlehttp/psr7": "^2.10 || ^3.0",
"psr/http-client": "^1.0"
},
"require-dev": {
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 788a5f6744cd6..6b99127ddc791 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 ddf8fce3c9919..aaec0c0b65eaf 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 b44b286a0a399..3e0e2b95095b1 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
@@ -1584,7 +1584,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
@@ -1650,7 +1650,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 7d5b5d65f7844..f50137e561092 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 295e05381a89c..06271c49550b3 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 a1d9c2901d71e..e12d08815a172 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 4a5ca9de089d7..9cf73471c2bdd 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-autoload/lib/petstore/api_client.rb b/samples/client/petstore/ruby-autoload/lib/petstore/api_client.rb
index b40ec9ac298ef..313a02bc4f2b1 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/another_fake_api.rb b/samples/client/petstore/ruby-faraday/lib/petstore/api/another_fake_api.rb
index 788a5f6744cd6..6b99127ddc791 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 ddf8fce3c9919..aaec0c0b65eaf 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 386658c625b39..3af37d89eb01e 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
@@ -1599,7 +1599,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
@@ -1665,7 +1665,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 7d5b5d65f7844..f50137e561092 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 b7654292b30ea..bd5e1a0c3d702 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 986e8fc1ae5e1..27a4e415ed78d 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 d0608eb79f844..d5a042dfb0695 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-faraday/lib/petstore/api_client.rb b/samples/client/petstore/ruby-faraday/lib/petstore/api_client.rb
index d59e1b68b408f..66f3298b9ce43 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/another_fake_api.rb b/samples/client/petstore/ruby-httpx/lib/petstore/api/another_fake_api.rb
index 788a5f6744cd6..6b99127ddc791 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 ddf8fce3c9919..aaec0c0b65eaf 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 386658c625b39..3af37d89eb01e 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
@@ -1599,7 +1599,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
@@ -1665,7 +1665,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 7d5b5d65f7844..f50137e561092 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 b7654292b30ea..bd5e1a0c3d702 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 986e8fc1ae5e1..27a4e415ed78d 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 d0608eb79f844..d5a042dfb0695 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 2ca54c691e68d..03f83cfff11a8 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:
@@ -97,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 = {
@@ -108,7 +114,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
@@ -275,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/another_fake_api.rb b/samples/client/petstore/ruby/lib/petstore/api/another_fake_api.rb
index 788a5f6744cd6..6b99127ddc791 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 ddf8fce3c9919..aaec0c0b65eaf 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 5eb91f062034b..470134e46cd72 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
@@ -1599,7 +1599,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
@@ -1665,7 +1665,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 7d5b5d65f7844..f50137e561092 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 295e05381a89c..06271c49550b3 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 a1d9c2901d71e..e12d08815a172 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 4a5ca9de089d7..9cf73471c2bdd 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/client/petstore/ruby/lib/petstore/api_client.rb b/samples/client/petstore/ruby/lib/petstore/api_client.rb
index b40ec9ac298ef..313a02bc4f2b1 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/client/petstore/typescript-fetch/builds/allOf-nullable/runtime.ts b/samples/client/petstore/typescript-fetch/builds/allOf-nullable/runtime.ts
index cf320bd439d04..7c552439ab0d2 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,9 @@ 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);
+ // the '?' check must only consider the part before the fragment: a '?' inside
+ // '#...' is fragment content, not an existing query string.
+ url += (url.split('#')[0].includes('?') ? '&' : '?') + this.configuration.queryParamsStringify(context.query);
}
const headers = Object.assign({}, this.configuration.headers, context.headers);
@@ -312,7 +314,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 cf320bd439d04..7c552439ab0d2 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,9 @@ 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);
+ // the '?' check must only consider the part before the fragment: a '?' inside
+ // '#...' is fragment content, not an existing query string.
+ url += (url.split('#')[0].includes('?') ? '&' : '?') + this.configuration.queryParamsStringify(context.query);
}
const headers = Object.assign({}, this.configuration.headers, context.headers);
@@ -312,7 +314,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 46f1ab4c1ecf8..b1cfab4adca4d 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,9 @@ 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);
+ // the '?' check must only consider the part before the fragment: a '?' inside
+ // '#...' is fragment content, not an existing query string.
+ url += (url.split('#')[0].includes('?') ? '&' : '?') + this.configuration.queryParamsStringify(context.query);
}
const headers = Object.assign({}, this.configuration.headers, context.headers);
@@ -312,7 +314,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 90dc2c8044903..b59ebdc8c4fc8 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,9 @@ 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);
+ // the '?' check must only consider the part before the fragment: a '?' inside
+ // '#...' is fragment content, not an existing query string.
+ url += (url.split('#')[0].includes('?') ? '&' : '?') + this.configuration.queryParamsStringify(context.query);
}
const headers = Object.assign({}, this.configuration.headers, context.headers);
@@ -312,7 +314,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 bb819a4909ca0..c7cb601c5e6d6 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,9 @@ 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);
+ // the '?' check must only consider the part before the fragment: a '?' inside
+ // '#...' is fragment content, not an existing query string.
+ url += (url.split('#')[0].includes('?') ? '&' : '?') + this.configuration.queryParamsStringify(context.query);
}
const headers = Object.assign({}, this.configuration.headers, context.headers);
@@ -312,7 +314,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 0ae0c88fe3398..5e35f86d4ce88 100644
--- a/samples/client/petstore/typescript-fetch/builds/default/runtime.ts
+++ b/samples/client/petstore/typescript-fetch/builds/default/runtime.ts
@@ -145,7 +145,9 @@ 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);
+ // the '?' check must only consider the part before the fragment: a '?' inside
+ // '#...' is fragment content, not an existing query string.
+ url += (url.split('#')[0].includes('?') ? '&' : '?') + this.configuration.queryParamsStringify(context.query);
}
const headers = Object.assign({}, this.configuration.headers, context.headers);
@@ -312,7 +314,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 d6d2c10a68d2f..623f163f449f2 100644
--- a/samples/client/petstore/typescript-fetch/builds/enum/runtime.ts
+++ b/samples/client/petstore/typescript-fetch/builds/enum/runtime.ts
@@ -145,7 +145,9 @@ 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);
+ // the '?' check must only consider the part before the fragment: a '?' inside
+ // '#...' is fragment content, not an existing query string.
+ url += (url.split('#')[0].includes('?') ? '&' : '?') + this.configuration.queryParamsStringify(context.query);
}
const headers = Object.assign({}, this.configuration.headers, context.headers);
@@ -312,7 +314,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 0ae0c88fe3398..5e35f86d4ce88 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,9 @@ 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);
+ // the '?' check must only consider the part before the fragment: a '?' inside
+ // '#...' is fragment content, not an existing query string.
+ url += (url.split('#')[0].includes('?') ? '&' : '?') + this.configuration.queryParamsStringify(context.query);
}
const headers = Object.assign({}, this.configuration.headers, context.headers);
@@ -312,7 +314,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 bb819a4909ca0..c7cb601c5e6d6 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,9 @@ 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);
+ // the '?' check must only consider the part before the fragment: a '?' inside
+ // '#...' is fragment content, not an existing query string.
+ url += (url.split('#')[0].includes('?') ? '&' : '?') + this.configuration.queryParamsStringify(context.query);
}
const headers = Object.assign({}, this.configuration.headers, context.headers);
@@ -312,7 +314,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 0ae0c88fe3398..5e35f86d4ce88 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,9 @@ 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);
+ // the '?' check must only consider the part before the fragment: a '?' inside
+ // '#...' is fragment content, not an existing query string.
+ url += (url.split('#')[0].includes('?') ? '&' : '?') + this.configuration.queryParamsStringify(context.query);
}
const headers = Object.assign({}, this.configuration.headers, context.headers);
@@ -312,7 +314,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-not-enum/src/runtime.ts b/samples/client/petstore/typescript-fetch/builds/oneOf-not-enum/src/runtime.ts
index c426906a51f7d..03c74e12c7340 100644
--- a/samples/client/petstore/typescript-fetch/builds/oneOf-not-enum/src/runtime.ts
+++ b/samples/client/petstore/typescript-fetch/builds/oneOf-not-enum/src/runtime.ts
@@ -145,7 +145,9 @@ 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);
+ // the '?' check must only consider the part before the fragment: a '?' inside
+ // '#...' is fragment content, not an existing query string.
+ url += (url.split('#')[0].includes('?') ? '&' : '?') + this.configuration.queryParamsStringify(context.query);
}
const headers = Object.assign({}, this.configuration.headers, context.headers);
@@ -312,7 +314,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 df559bf93682a..ba847856c1ea8 100644
--- a/samples/client/petstore/typescript-fetch/builds/oneOf/runtime.ts
+++ b/samples/client/petstore/typescript-fetch/builds/oneOf/runtime.ts
@@ -145,7 +145,9 @@ 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);
+ // the '?' check must only consider the part before the fragment: a '?' inside
+ // '#...' is fragment content, not an existing query string.
+ url += (url.split('#')[0].includes('?') ? '&' : '?') + this.configuration.queryParamsStringify(context.query);
}
const headers = Object.assign({}, this.configuration.headers, context.headers);
@@ -312,7 +314,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 0ae0c88fe3398..5e35f86d4ce88 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,9 @@ 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);
+ // the '?' check must only consider the part before the fragment: a '?' inside
+ // '#...' is fragment content, not an existing query string.
+ url += (url.split('#')[0].includes('?') ? '&' : '?') + this.configuration.queryParamsStringify(context.query);
}
const headers = Object.assign({}, this.configuration.headers, context.headers);
@@ -312,7 +314,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 0ae0c88fe3398..5e35f86d4ce88 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,9 @@ 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);
+ // the '?' check must only consider the part before the fragment: a '?' inside
+ // '#...' is fragment content, not an existing query string.
+ url += (url.split('#')[0].includes('?') ? '&' : '?') + this.configuration.queryParamsStringify(context.query);
}
const headers = Object.assign({}, this.configuration.headers, context.headers);
@@ -312,7 +314,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 bb819a4909ca0..c7cb601c5e6d6 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,9 @@ 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);
+ // the '?' check must only consider the part before the fragment: a '?' inside
+ // '#...' is fragment content, not an existing query string.
+ url += (url.split('#')[0].includes('?') ? '&' : '?') + this.configuration.queryParamsStringify(context.query);
}
const headers = Object.assign({}, this.configuration.headers, context.headers);
@@ -312,7 +314,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 936e3bbf55581..15ea55fcbaaf8 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,9 @@ 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);
+ // the '?' check must only consider the part before the fragment: a '?' inside
+ // '#...' is fragment content, not an existing query string.
+ url += (url.split('#')[0].includes('?') ? '&' : '?') + this.configuration.queryParamsStringify(context.query);
}
const headers = Object.assign({}, this.configuration.headers, context.headers);
@@ -325,7 +327,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 0ae0c88fe3398..5e35f86d4ce88 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,9 @@ 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);
+ // the '?' check must only consider the part before the fragment: a '?' inside
+ // '#...' is fragment content, not an existing query string.
+ url += (url.split('#')[0].includes('?') ? '&' : '?') + this.configuration.queryParamsStringify(context.query);
}
const headers = Object.assign({}, this.configuration.headers, context.headers);
@@ -312,7 +314,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 0ae0c88fe3398..5e35f86d4ce88 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,9 @@ 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);
+ // the '?' check must only consider the part before the fragment: a '?' inside
+ // '#...' is fragment content, not an existing query string.
+ url += (url.split('#')[0].includes('?') ? '&' : '?') + this.configuration.queryParamsStringify(context.query);
}
const headers = Object.assign({}, this.configuration.headers, context.headers);
@@ -312,7 +314,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 0ae0c88fe3398..5e35f86d4ce88 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,9 @@ 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);
+ // the '?' check must only consider the part before the fragment: a '?' inside
+ // '#...' is fragment content, not an existing query string.
+ url += (url.split('#')[0].includes('?') ? '&' : '?') + this.configuration.queryParamsStringify(context.query);
}
const headers = Object.assign({}, this.configuration.headers, context.headers);
@@ -312,7 +314,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 d6d2c10a68d2f..623f163f449f2 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,9 @@ 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);
+ // the '?' check must only consider the part before the fragment: a '?' inside
+ // '#...' is fragment content, not an existing query string.
+ url += (url.split('#')[0].includes('?') ? '&' : '?') + this.configuration.queryParamsStringify(context.query);
}
const headers = Object.assign({}, this.configuration.headers, context.headers);
@@ -312,7 +314,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