Generate Java code using the library retrofit2 and the option useRxJava2

swagger-codegen

  • Generate code and documentation for your REST api from a OpenAPI/swagger definition.
    More information: <https://github.com/swagger-api/swagger-codegen>.
  • Trick copyright: tl;dr; <https://github.com/tldr-pages/tldr>

swagger-codegen generate -i {{http://petstore.swagger.io/v2/swagger.json}} -l {{java}} --library {{retrofit2}} -D{{useRxJava2}}={{true}}

click the source code to copy