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
  • #5149
Closed
Open
Issue created Jan 29, 2020 by Administrator@rootContributor0 of 1 checklist item completed0/1 checklist item

[BUG] [dart][dart-dio] Generator does not work with property named "source" or definition named "URL"

Created by: cputoaster

Bug Report Checklist

  • [ x] Have you provided a full/minimal spec to reproduce the issue?
  • [ x] Have you validated the input using an OpenAPI validator (example)?
  • [ x] What's the version of OpenAPI Generator used?
  • [x ] Have you search for related issues/PRs?
  • [x ] What's the actual output vs expected output?
  • [Optional] Bounty to sponsor the fix ([example]
Description

When trying to generate dart-dio source from a json openapi definition that includes a property called "source" or a definition called "URL", it does not compile

openapi-generator version

MacOS Catalina, openapi-generator 4.2.2

OpenAPI declaration file content or url
...
"definitions": {
  "URL": {
     "type": "object",
     "properties": {
        "myproperty": {
        "type": "string"
       }
    }
  },
  "Document":{
    "type": "object",
    "properties": {
      "source": {
       "type": "string"
    }
  }
 }
}
...
Command line used for generation

openapi-generator generate -g dart-dio -i openapi.json -o openapi/

Steps to reproduce
  1. create openapi.json with a definition called "URL" and / or a field called "source"
  2. generate dart-dio source
  3. try building the source with mentioned command-line below

Error in BuiltValueGenerator for /openapi/lib/model/url.dart.
Please make the following changes to use built_value serialization:

1. Declare URL.serializer as: static Serializer<URL> get serializer => _$uRLSerializer; got static Serializer<URL> get serializer => _$URLSerializer;

Error in BuiltValueGenerator for abstract class Document implements Built<Document, dynamic>.
Please make the following changes to use BuiltValue:

1. Make field _source public; remove the underscore.
Related issues/PRs

https://github.com/OpenAPITools/openapi-generator/issues/4865

Suggest a fix

renaming the variables in the dart source like mentioned in the error messages works: _source -> source _$URLSerializer -> _$uRLSerializer (for the instance variable, not the class)

Assignee
Assign to
Time tracking