-
Notifications
You must be signed in to change notification settings - Fork 6k
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
[dart] "type: object" with no properties generates invalid code #9182
Comments
Modify DartClientCodegen.java Add "Object" in "languageSpecificPrimitives" ex: languageSpecificPrimitives = new HashSet( |
Maybe it needs a pull request? |
Having the same problem with OpenAPI-generator. I don't think it should be a primitive type. A Spec Object should become a With the OpenAPI-generator you can workaround it by providing the template option to the generator and overriding the |
@kuhnroyal Can you provide a tiny how-to for people like me that aren't familiar with the OpenAPI Generator? We're currently doing a regex after the code generation 🤔 |
@maxfriedmann Basically you copy the You can find the templates here: https://github.com/swagger-api/swagger-codegen/tree/master/modules/swagger-codegen/src/main/resources/dart (use the correct tag/branch) - your folder |
@kuhnroyal cool, that sounds easy enough to even me! Thanks a lot |
Description
Generating a swagger api that has definitions of type=object and no properties generates
Object.mapFromJson(json['parameterBag'])
. This code is not valid and it should(I think) generatejson['parameterBag']
.The api I am using is returning a map with key value pairs that are dynamic. That is why there are no properties defined in the swagger file.
Swagger-codegen version
2.4.1
Swagger declaration file content or url
Command line used for generation
java -jar swagger-codegen-cli.jar generate -i dart.json -l dart -o generated_code/ -D browserClient=false
Steps to reproduce
Suggest a fix/enhancement
If the type has no properties do not render the
Object.mapFromJson
The text was updated successfully, but these errors were encountered: