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

help getting started with jackson generation #5785

Closed
npomfret opened this issue Jun 6, 2017 · 4 comments
Closed

help getting started with jackson generation #5785

npomfret opened this issue Jun 6, 2017 · 4 comments

Comments

@npomfret
Copy link

npomfret commented Jun 6, 2017

I'm trying to generate a java jackson api (with @JsonProperty annotation etc) from https://github.com/npomfret/coinsbank-php-sdk/blob/master/reference/coinsbank-sapi.json.

So i run:

swagger-codegen generate -i https://raw.githubusercontent.com/npomfret/coinsbank-php-sdk/master/reference/coinsbank-sapi.json -l java -o temp

How do I get it to generate the jackson annotations?

Also, it crashes after generating some classes at Resource: put /card/name/_{cardUniqueId} with:

Caused by: java.lang.NullPointerException
        at io.swagger.codegen.DefaultCodegen.isDataTypeBinary(DefaultCodegen.java:2590)

This isn't my json, so I'm not too familiar with it. Maybe it's not well formed swagger?

@ravinikam
Copy link
Contributor

ravinikam commented Jun 6, 2017

I used spring language and it generated all Jackson annotations in models, if that is what you looking for then you run following command:
swagger-codegen generate -i https://raw.githubusercontent.com/npomfret/coinsbank-php-sdk/master/reference/coinsbank-sapi.json -l spring -o temp

@npomfret
Copy link
Author

npomfret commented Jun 6, 2017

Thanks, that's exactly the command I'm using. Some objects get generated - but then it crashes.

@ravinikam
Copy link
Contributor

In your question you said you are using "java", so suggested to use "spring" language instead to get Jackson annotation in your models.

About your second question: You have huge specification file, I would recommend to split it. Thats aside I tried to import your specification to swagger editor and saw there are errors, so I would recommend to fix those errors before trying anything.

@npomfret
Copy link
Author

npomfret commented Jun 6, 2017

Thanks for the reply.

It's not my file unfortunately. Using the spring flag worked. Well, it at least generated some useful classes.

@npomfret npomfret closed this as completed Jun 6, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants