OpenAPITools / OpenAPITools/openapi-generator
[BUG][csharp-netcore] Bug generating Array of Array with $ref
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 26.8k
- Forks
- 7.7k
- PR merge metrics
- PR metrics pending
Description
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 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
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the supplied OpenAPI declaration and generate the csharp-netcore client using the documented Podman command. Run dotnet build in openapi-bug/bugExample/src/Org.OpenAPITools and inspect the generated PairStream and Pair models; done means the referenced array-of-array property compiles with the expected nested list type.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 45/100