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

swagger-codegen crashes when generating swift #2538

Closed
bherila opened this issue Apr 10, 2016 · 5 comments · Fixed by #3535
Closed

swagger-codegen crashes when generating swift #2538

bherila opened this issue Apr 10, 2016 · 5 comments · Fixed by #3535

Comments

@bherila
Copy link
Contributor

bherila commented Apr 10, 2016

$ swagger-codegen-local generate -l swift -i midtier-swagger.json 
[main] INFO io.swagger.parser.Swagger20Parser - reading from midtier-swagger.json
Exception in thread "main" java.lang.RuntimeException: Could not process model 'CampaignApiModel'
    at io.swagger.codegen.DefaultGenerator.generate(DefaultGenerator.java:244)
    at io.swagger.codegen.cmd.Generate.run(Generate.java:223)
    at io.swagger.codegen.SwaggerCodegen.main(SwaggerCodegen.java:36)
Caused by: java.lang.ClassCastException: java.lang.Integer cannot be cast to java.lang.String
    at io.swagger.codegen.languages.SwiftCodegen.fromProperty(SwiftCodegen.java:322)
    at io.swagger.codegen.DefaultCodegen.addVars(DefaultCodegen.java:2232)
    at io.swagger.codegen.DefaultCodegen.addVars(DefaultCodegen.java:2206)
    at io.swagger.codegen.DefaultCodegen.addVars(DefaultCodegen.java:2193)
    at io.swagger.codegen.DefaultCodegen.fromModel(DefaultCodegen.java:1013)
    at io.swagger.codegen.DefaultGenerator.processModels(DefaultGenerator.java:799)
    at io.swagger.codegen.DefaultGenerator.generate(DefaultGenerator.java:237)
    ... 2 more

this is building from latest source (same branch as my other PR)

input .json : https://gist.github.com/bherila/e664670b38d4d9c979b094bbcf0134ff (caution: it's big)

Unfortunately I am very novice at swift so I probably cannot be helpful in terms of PR fixing this one. But some community help would really be appreciated 😄

@wing328
Copy link
Contributor

wing328 commented Apr 10, 2016

@bherila thanks for reporting the issue with the spec. We'll look into that ...

@wing328
Copy link
Contributor

wing328 commented Apr 10, 2016

@bherila it's due to number used in enum values. I filed #2508 to support number in enum and will merge it on Monday.

Will let you know once it's merged.

@alecgorge
Copy link

@wing328 I am still seeing this exact same error on 2.2.0 even though #2508 seems to indicate that it should be fixed

@wing328 wing328 added this to the v2.2.1 milestone Aug 5, 2016
wing328 added a commit to wing328/swagger-codegen that referenced this issue Aug 5, 2016
wing328 added a commit that referenced this issue Aug 5, 2016
@wing328
Copy link
Contributor

wing328 commented Aug 5, 2016

@bherila @alecgorge fixed via #3535. Please pull the latest master to give it a try.

@alecgorge
Copy link

@wing328 yup, it works great. Thanks so much for the quick turn around.

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

Successfully merging a pull request may close this issue.

3 participants