[BUG] [client] [java] [native] [csharp-netcore] multiple use of parameters in deepobjects naming failure
Bug Report Checklist
-
Have you provided a full/minimal spec to reproduce the issue? -
Have you validated the input using an OpenAPI validator (example)? -
Have you tested with the latest master to confirm the issue still exists? -
Have you searched for related issues/PRs? -
What's the actual output vs expected output? -
[Optional] Sponsorship to speed up the bug fix or feature request (example)
Description
If a parameter is used multiple times in the same deepObject, then the parameters have all the same name. In the example below all parameters are named inputOptions. But it should be "options" and "inputOptions"
openapi-generator version
6.2.0
OpenAPI declaration file content or url
openapi: 3.0.3
info:
title: deepobject-test
version: 1.0.0
paths:
/test:
get:
operationId: test
parameters:
- name: options
in: query
required: false
style: deepObject
schema:
$ref: '#/components/schemas/Options'
explode: true
- name: inputOptions
in: query
required: false
style: deepObject
schema:
$ref: '#/components/schemas/Options'
explode: true
responses:
'200':
description: OK
content:
text/plain:
schema:
type: string
components:
schemas:
Options:
type: object
properties:
a:
nullable: true
type: string
format: date-time
b:
type: string
nullable: true
format: date-time
c:
type: array
items:
type: string
(for YAML code) or
######## actual result
if (options != null)
{
if (options.A != null)
{
localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("", "inputOptions[a]", options.A));
}
if (options.B != null)
{
localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("", "inputOptions[b]", options.B));
}
if (options.C != null)
{
localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("", "inputOptions[c]", options.C));
}
}
if (inputOptions != null)
{
if (inputOptions.A != null)
{
localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("", "inputOptions[a]", inputOptions.A));
}
if (inputOptions.B != null)
{
localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("", "inputOptions[b]", inputOptions.B));
}
if (inputOptions.C != null)
{
localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("", "inputOptions[c]", inputOptions.C));
}
}
######## expected result
if (options != null)
{
if (options.A != null)
{
localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("", "options[a], options.A));
}
if (options.B != null)
{
localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("", "options[b], options.B));
}
if (options.C != null)
{
localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("", "options[c], options.C));
}
}
if (inputOptions != null)
{
if (inputOptions.A != null)
{
localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("", "inputOptions[a], inputOptions.A));
}
if (inputOptions.B != null)
{
localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("", "inputOptions[b], inputOptions.B));
}
if (inputOptions.C != null)
{
localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("", "inputOptions[c], inputOptions.C));
}
}
Command line used for generation
java -jar openapi-generator-cli.jar generate -g csharp-netcore -i deepobject.yaml java -jar openapi-generator-cli.jar generate -g java -i deepobject.yaml
Steps to reproduce
Related issues/PRs
##13662
Suggest a fix/enhancement
PR #13662 #13662