OpenAPITools / OpenAPITools/openapi-generator
[BUG] [DART] Wrong code generated for List if enums
Open
Nobody has claimed this yet.
Issue: Bug
- 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?
Yes - Have you validated the input using an OpenAPI validator (example)?
Yes - What's the version of OpenAPI Generator used?
4.2.3 - Have you search for related issues/PRs?
YES - What's the actual output vs expected output?
The generated files have compile time errors related to enums
Description
List of Enums are not properly generated in dart model files
openapi-generator version
I used version 4.2.3 jar
OpenAPI declaration file content or url
(here your code)
(for YAML code) or
{
"openapi": "3.0.1",
"info": {
"title": "OpenAPI definition",
"version": "v0"
},
"servers": [
{
"url": "http://localhost",
"description": "Generated server url"
}
],
"paths": {
"/test": {
"get": {
"tags": [
"greeting-controller"
],
"operationId": "sayHello2",
"parameters": [
{
"name": "helloDto",
"in": "query",
"required": true,
"schema": {
"$ref": "#/components/schemas/HelloDto"
}
}
],
"responses": {
"200": {
"description": "default response",
"content": {
"*/*": {
"schema": {
"type": "object"
}
}
}
}
}
}
},
"/test-multiple": {
"get": {
"tags": [
"greeting-controller"
],
"operationId": "searchDummyEntity",
"parameters": [
{
"name": "predicate",
"in": "query",
"required": true,
"schema": {
"$ref": "#/components/schemas/DummyEntityPredicateG"
}
}
],
"responses": {
"200": {
"description": "default response",
"content": {
"*/*": {
"schema": {
"type": "object"
}
}
}
}
}
}
}
},
"components": {
"schemas": {
"HelloDto": {
"type": "object",
"properties": {
"enumParams": {
"type": "array",
"items": {
"type": "string",
"enum": [
"ENUM1",
"ENUM2"
]
}
}
}
},
"DummyEntityPredicateG": {
"type": "object",
"properties": {
"name": {
"type": "string"
},
"notCode": {
"type": "string"
}
}
}
}
}
}
Command line used for generation
openapi-generator generate -i spec.json -g dart-jaguar
Steps to reproduce
Generate SDK from spec files that have List of enums as fields in their pojo
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
Run openapi-generator generate -i spec.json -g dart-jaguar using the OpenAPI declaration in this issue and inspect the generated Dart model for HelloDto.enumParams. Confirm the generated files fail to compile because of the list-of-enum representation; done means the generated Dart model compiles for this specification.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- dart, openapi
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100