Skip to content

[BUG][csharp] oneOf with arrays is generating duplicated 'GetList' #20739

@GregoryMerlet

Description

@GregoryMerlet

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

When generating a model with a oneOf of arrays, the generated model contains two GetList which result in the following error when building:

error CS0111: Type 'OneOfArrayRequest' already defines a member called 'GetList' with the same parameter types
openapi-generator version

7.12.0 (latest master)

OpenAPI declaration file content or url
openapi: 3.0.1
info:
  title: Oneof array test
  version: 1.0.0
servers:
- url: /
paths:
  /one-of-array:
    post:
      description: Oneof array test
      operationId: oneOfArray
      requestBody:
        content:
          application/json:
            schema:
              oneOf:
              - items:
                  type: string
                type: array
              - items:
                  $ref: '#/components/schemas/TestObject'
                type: array
      responses:
        "204":
          description: Successful operation
components:
  schemas:
    TestObject:
      properties:
        name:
          type: string
      type: object
Generation Details
java -jar modules/openapi-generator-cli/target/openapi-generator-cli.jar generate -i ./oneOfArray.yaml -g csharp -o test
Steps to reproduce

Generate using the command above and try to build the generated code

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions