Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • O openapi-generator
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 3,476
    • Issues 3,476
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 402
    • Merge requests 402
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • OpenAPI Tools
  • openapi-generator
  • Issues
  • #13658
Closed
Open
Issue created Oct 10, 2022 by Reinhard-PTV@Reinhard-PTVContributor5 of 6 checklist items completed5/6 checklist items

[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

Assignee
Assign to
Time tracking