Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] [DART] Wrong code generated for List if enums #5583

Open
5 tasks done
gibahjoe opened this issue Mar 11, 2020 · 2 comments
Open
5 tasks done

[BUG] [DART] Wrong code generated for List if enums #5583

gibahjoe opened this issue Mar 11, 2020 · 2 comments

Comments

@gibahjoe
Copy link

gibahjoe commented Mar 11, 2020

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

Screen Shot 2020-03-12 at 12 30 02 AM

@gibahjoe
Copy link
Author

I dont know if I am the one doing something wrong but none of the dart generators work. They have a lot of compile issues including the one above.

I am happy to contribute over the weekend of anyone can point me in the right direction

@agilob
Copy link
Contributor

agilob commented Jun 21, 2020

#6729 will fix dart2, not dart-jaguar but it shows how to fix it, so you can go ahead and port my MR from dart2 to dart-jaguar

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants