Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] [client] [java] [native] [csharp-netcore] multiple use of parameters in deepobjects naming failure #13658

Open
5 of 6 tasks
Reinhard-PTV opened this issue Oct 10, 2022 · 0 comments

Comments

@Reinhard-PTV
Copy link
Contributor

Reinhard-PTV commented Oct 10, 2022

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

@Reinhard-PTV Reinhard-PTV changed the title [BUG] [client] [csharp-netcore] multiple use of parameters in deepobjects naming failure [BUG] [client] [java] [native] [csharp-netcore] multiple use of parameters in deepobjects naming failure Oct 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant