forked from loafle/openapi-generator-original
[BUG] [client] [java] [native] [csharp-netcore] Multi use of schema params within deepobjects (#13662)
* multiple use of parameters in deepobjects * fix java native * support camelCase * revert modifying baseName because it is not used anymore * remove commented line
This commit is contained in:
parent
c5e79681c5
commit
6c9246ca3d
@ -5071,7 +5071,6 @@ public class DefaultCodegen implements CodegenConfig {
|
|||||||
properties.entrySet().stream()
|
properties.entrySet().stream()
|
||||||
.map(entry -> {
|
.map(entry -> {
|
||||||
CodegenProperty property = fromProperty(entry.getKey(), entry.getValue(), requiredVarNames.contains(entry.getKey()));
|
CodegenProperty property = fromProperty(entry.getKey(), entry.getValue(), requiredVarNames.contains(entry.getKey()));
|
||||||
property.baseName = codegenParameter.baseName + "[" + entry.getKey() + "]";
|
|
||||||
return property;
|
return property;
|
||||||
}).collect(Collectors.toList());
|
}).collect(Collectors.toList());
|
||||||
} else {
|
} else {
|
||||||
|
@ -351,10 +351,10 @@ public class {{classname}} {
|
|||||||
if ({{paramName}} != null) {
|
if ({{paramName}} != null) {
|
||||||
{{#items.vars}}
|
{{#items.vars}}
|
||||||
{{#isArray}}
|
{{#isArray}}
|
||||||
localVarQueryParams.addAll(ApiClient.parameterToPairs("csv", "{{baseName}}", {{paramName}}.{{getter}}()));
|
localVarQueryParams.addAll(ApiClient.parameterToPairs("csv", "{{paramName}}[{{name}}]", {{paramName}}.{{getter}}()));
|
||||||
{{/isArray}}
|
{{/isArray}}
|
||||||
{{^isArray}}
|
{{^isArray}}
|
||||||
localVarQueryParams.addAll(ApiClient.parameterToPairs("{{baseName}}", {{paramName}}.{{getter}}()));
|
localVarQueryParams.addAll(ApiClient.parameterToPairs("{{paramName}}[{{name}}]", {{paramName}}.{{getter}}()));
|
||||||
{{/isArray}}
|
{{/isArray}}
|
||||||
{{/items.vars}}
|
{{/items.vars}}
|
||||||
}
|
}
|
||||||
|
@ -333,7 +333,7 @@ namespace {{packageName}}.{{apiPackage}}
|
|||||||
{{#items.vars}}
|
{{#items.vars}}
|
||||||
if ({{paramName}}.{{name}} != null)
|
if ({{paramName}}.{{name}} != null)
|
||||||
{
|
{
|
||||||
localVarRequestOptions.QueryParameters.Add({{packageName}}.Client.ClientUtils.ParameterToMultiMap("{{collectionFormat}}", "{{baseName}}", {{paramName}}.{{name}}));
|
localVarRequestOptions.QueryParameters.Add({{packageName}}.Client.ClientUtils.ParameterToMultiMap("{{collectionFormat}}", "{{paramName}}[{{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}}]", {{paramName}}.{{name}}));
|
||||||
}
|
}
|
||||||
{{/items.vars}}
|
{{/items.vars}}
|
||||||
{{^items}}
|
{{^items}}
|
||||||
|
@ -59,6 +59,6 @@ public class CSharpNetCoreClientDeepObjectTest {
|
|||||||
generator.setGeneratorPropertyDefault(CodegenConstants.SUPPORTING_FILES, "false");
|
generator.setGeneratorPropertyDefault(CodegenConstants.SUPPORTING_FILES, "false");
|
||||||
generator.opts(input).generate();
|
generator.opts(input).generate();
|
||||||
assertFileContains(Paths.get(outputPath + "/src/Org.OpenAPITools/Api/DefaultApi.cs"),
|
assertFileContains(Paths.get(outputPath + "/src/Org.OpenAPITools/Api/DefaultApi.cs"),
|
||||||
"options[a]", "options[b]");
|
"options[a]", "options[b]","inputOptions[b]");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -58,6 +58,6 @@ public class JavaClientDeepObjectTest {
|
|||||||
generator.opts(input).generate();
|
generator.opts(input).generate();
|
||||||
|
|
||||||
assertFileContains(Paths.get(outputPath + "/src/main/java/org/openapitools/client/api/DefaultApi.java"),
|
assertFileContains(Paths.get(outputPath + "/src/main/java/org/openapitools/client/api/DefaultApi.java"),
|
||||||
"options[a]", "options[b]", "\"csv\", \"options[c]\"");
|
"options[a]", "options[b]", "\"csv\", \"options[c]\"", "inputOptions[a]");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -14,6 +14,13 @@ paths:
|
|||||||
schema:
|
schema:
|
||||||
$ref: '#/components/schemas/Options'
|
$ref: '#/components/schemas/Options'
|
||||||
explode: true
|
explode: true
|
||||||
|
- name: inputOptions
|
||||||
|
in: query
|
||||||
|
required: false
|
||||||
|
style: deepObject
|
||||||
|
schema:
|
||||||
|
$ref: '#/components/schemas/Options'
|
||||||
|
explode: true
|
||||||
responses:
|
responses:
|
||||||
'200':
|
'200':
|
||||||
description: OK
|
description: OK
|
||||||
|
Loading…
x
Reference in New Issue
Block a user