Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • O openapi-generator
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 3,476
    • Issues 3,476
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 402
    • Merge requests 402
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • OpenAPI Tools
  • openapi-generator
  • Issues
  • #9029
Closed
Open
Issue created Mar 21, 2021 by Administrator@rootContributor4 of 6 checklist items completed4/6 checklist items

[BUG][Dart] Generator creates a model class name that conflicts with a core lib class name (Type)

Created by: robrbecker

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)?
  • 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 Dart code, an OAS is using a reserved(ish) word (Type) which the generator defines a class for which then conflicts and causes errors. (It's not technically a reserved word of the language, it's a class in the core library. Something that's always available and you can't import it with a namespace)

image

openapi-generator version

5.1.0 release on both dart-dio and dart-dio-next

OpenAPI declaration file content or url

https://cdn-prod.wdesk.com/endpoints-admin/1.342.0/openapi/platform-v1.yaml

Problem arises from line 813

Generation Details

I used the jar release for 5.1.0 with this command: java -jar openapi-generator-cli.jar generate -i https://cdn-prod.wdesk.com/endpoints-admin/1.342.0/openapi/platform-v1.yaml -g dart-dio -o ./ --additional-properties="pubDescription=Workiva Platform API (Dart),pubName=wk,pubVersion=1.0.0"

Steps to reproduce

Generate Dart code with the above command. Have Dart installed (2.12.2) Then run pub get pub run build_runner build --delete-conflicting-outputs -o build (then remove the build directory .. you only need to run a build to do built_value code generation Then either open in an IDE with the Dart plugin (VS Code, intelliJ) or just run dartanalyzer . which will show the errors.

Related issues/PRs
Suggest a fix

I'm not actually sure what a good fix would be. I might actually prefer if generation failed when creating the code and suggested a way to work around it, possibly by using the [--reserved-words-mappings <reserved word mappings>...] option ?

Assignee
Assign to
Time tracking