-
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
CSharp client generation fails but PHP and Java works for the the json schema #6456
Comments
The latest version if 2.2.3. Please give it a try: https://github.com/swagger-api/swagger-codegen#compatibility or you can use the latest master (snapshot version), which has a few API clients refactored (e.g. C#, PHP, etc) |
Unfortunately I got the same error with latest master snapshot version- C:\Users\DevAdmin\Documents>java -jar swagger-codegen-cli-2.3.0-20170906.155839-
ntCodegen.java:446) |
@nimisha84 I've fixed the NPE issue via #6462. Please pull the latest master to give it a try. |
Thanks it worked! |
FYI. I also reviewed other generators and found only ObjC client generator had similar issue, which has been fixed by #6465 |
Description
I am using the attached json file for run the swagger codegen for getting the SDK in CSharp.
However I get this error everytime-
C:\Users\DevAdmin\Documents>java -jar swagger-codegen-cli-2.2.1.jar generate -i
V4schema.json -l csharp
[main] INFO io.swagger.parser.Swagger20Parser - reading from V4schema.json
[main] INFO io.swagger.codegen.languages.CSharpClientCodegen - Generating code f
or .NET Framework v4.5
Exception in thread "main" java.lang.RuntimeException: Could not process model '
access/CompanyAccess'.Please make sure that your schema is correct!
at io.swagger.codegen.DefaultGenerator.generate(DefaultGenerator.java:29
7)
at io.swagger.codegen.cmd.Generate.run(Generate.java:223)
at io.swagger.codegen.SwaggerCodegen.main(SwaggerCodegen.java:36)
Caused by: java.lang.NullPointerException
at io.swagger.codegen.languages.AbstractCSharpCodegen.getSwaggerType(Abs
tractCSharpCodegen.java:509)
at io.swagger.codegen.DefaultCodegen.getTypeDeclaration(DefaultCodegen.j
ava:1119)
at io.swagger.codegen.languages.AbstractCSharpCodegen.getTypeDeclaration
(AbstractCSharpCodegen.java:532)
at io.swagger.codegen.languages.AbstractCSharpCodegen.getTypeDeclaration
(AbstractCSharpCodegen.java:525)
at io.swagger.codegen.DefaultCodegen.fromProperty(DefaultCodegen.java:15
72)
at io.swagger.codegen.DefaultCodegen.addVars(DefaultCodegen.java:2738)
at io.swagger.codegen.DefaultCodegen.addVars(DefaultCodegen.java:2709)
at io.swagger.codegen.DefaultCodegen.fromModel(DefaultCodegen.java:1270)
ntCodegen.java:313)
at io.swagger.codegen.DefaultGenerator.processModels(DefaultGenerator.ja
va:875)
at io.swagger.codegen.DefaultGenerator.generate(DefaultGenerator.java:29
0)
... 2 more
If the schema was not correct it should have failed for PHP and Java as well. Can you help me figure out the issue?
Swagger-codegen version
Latest version- 2.2.1
Swagger declaration file content or url
Added in the gist here-https://gist.github.com/nimisha84/6f7af0e607eb6aa2a764a095d6424ec2
Command line used for generation
java -jar swagger-codegen-cli-2.2.1.jar generate -i V4schema.json -l csharp
Steps to reproduce
Run the cmd above in either mac or windows. I tried both.
The text was updated successfully, but these errors were encountered: