OpenAPITools / openapi-generator

OpenAPI Generator allows generation of API client libraries (SDK generation), server stubs, documentation and configuration automatically given an OpenAPI Spec (v2, v3)
https://openapi-generator.tech
Apache License 2.0
21.5k stars 6.51k forks source link

[BUG][csharp-netcore] Bug generating Array of Array with $ref #12335

Open ttrunck opened 2 years ago

ttrunck commented 2 years ago

Bug Report Checklist

Description

When generating a object with an array of array member the generated code is List<List>. This does not compile because of this error: error CS0305: Using the generic type 'List<T>' requires 1 type arguments

Note that if I don't use $ref (the manualPairStream) the generated code works as it's List<List<int>>

openapi-generator version

6.0.0-SNAPSHOT

OpenAPI declaration file content or url
openapi: 3.0.1
info:
  title: List of list
  version: v1
paths: {}
components:
  schemas:
    MyClass:
      type: object
      properties:
        manualPairStream:
          type: array
          items:
            type: array
            items:
              type: integer
        pairStream:
          $ref: '#/components/schemas/PairStream'
        pair:
          $ref: '#/components/schemas/Pair'
    PairStream:
      type: array
      items:
        $ref: '#/components/schemas/Pair'
    Pair:
      type: array
      items:
        type: integer
Generation Details

podman run --rm -v ${PWD}:/local docker.io/openapitools/openapi-generator-cli generate -i /local/swagger.yaml -g csharp-netcore -o /local/bugExample

Steps to reproduce

Generate the client with the previous command and run dotnet build in the openapi-bug/bugExample/src/Org.OpenAPITools folder

devhl-labs commented 2 years ago

same as https://github.com/OpenAPITools/openapi-generator/issues/12155