swagger-api / swagger-codegen

swagger-codegen contains a template-driven engine to generate documentation, API clients and server stubs in different languages by parsing your OpenAPI / Swagger definition.
http://swagger.io
Apache License 2.0
17.04k stars 6.03k forks source link

[Java] Retrofit2Rx2 code generation problem #5320

Closed steven0529 closed 7 years ago

steven0529 commented 7 years ago
Description

Hi,

I noticed the petstore sample from petstore sample still uses RxJava 1 (rx.Observable). I also tried generating an sdk using this swagger-codegen-cli-2.2.1.jar with this config.json

{ "sourceFolder": "src", "modelPackage": "com.gatebuzz.oxford.model", "apiPackage": "com.gatebuzz.oxford.api", "library": "retrofit2", "useRxJava2": true }

but still generates the same RxJava 1(rx.Observable).

Is this a bug or is this the expected result?

How can we generate the Retrofit code with RxJava2(io.reactive.Observable)?

Swagger-codegen version

swagger-codegen-cli-2.2.1.jar

wing328 commented 7 years ago

Can you try the latest stable version 2.2.2 instead?

steven0529 commented 7 years ago

I also tried the 2.2.2 jar but still experience same problem. :( Actually the sample petstore also shows the same issue. Both rxretrofit2 and rx2retrofit have the same reference to rxjava 1.

wing328 commented 7 years ago

@steven0529 ok. I'll take a look...

wing328 commented 7 years ago

Fixed via https://github.com/swagger-api/swagger-codegen/pull/5321 with useRxJava2

Please pull the latest master to give it a try.

steven0529 commented 7 years ago

Worked, thanks!