简体   繁体   English

Swagger 代码生成 RX JAVA + Retrofit 不工作

[英]Swagger codegen RX JAVA + Retrofit not working

I tried to export RX JAVA + Retrofit client from swagger hub, by entering Codegen Options and enabling check box of (useRxJava2) in the java client, however when i export the java client it does not work as expected and the code doesn't have neither retrofit nor rx java ! I tried to export RX JAVA + Retrofit client from swagger hub, by entering Codegen Options and enabling check box of (useRxJava2) in the java client, however when i export the java client it does not work as expected and the code doesn't have既不是 retrofit 也不是 rx java ! (uses oktthp only) (仅使用 oktthp)

Also i tried to download the json file from swagger hub (Export -> Download Api) and followed the steps here我还尝试从 swagger 集线器(导出 - > 下载 Api)下载 json 文件并按照此处的步骤操作

RX JAVA + Retrofit sdk generation using Swagger codegen RX JAVA + Retrofit sdk 生成使用 Z336FF1E9AA6177EA7A71984FA8C241B 代码

But when i run the command, i get this in the command line:但是当我运行命令时,我在命令行中得到了这个:

[main] INFO io.swagger.parser.Swagger20Parser - reading from openapi.json
[main] INFO io.swagger.parser.Swagger20Parser - reading from openapi.json
[main] INFO io.swagger.codegen.ignore.CodegenIgnoreProcessor - No .swagger-codeg
en-ignore file found.
Exception in thread "main" java.lang.RuntimeException: missing swagger input or
config!
        at io.swagger.codegen.DefaultGenerator.generate(DefaultGenerator.java:13
2)
        at io.swagger.codegen.cmd.Generate.run(Generate.java:223)
        at io.swagger.codegen.SwaggerCodegen.main(SwaggerCodegen.java:36)

Any clue how can i bypass this?任何线索我怎么能绕过这个?

I could not manage to export client apis with rxjava and retrofit directly from swagger hub.我无法直接从 swagger 集线器导出带有 rxjava 和 retrofit 的客户端 API。 However i found out that the tool that used to make code generation by command line (code generator cli) is now called (openapi cli).但是我发现用于通过命令行生成代码的工具(代码生成器 cli)现在被称为(openapi cli)。

And now by looking again to this answer:现在再次查看这个答案:

https://stackoverflow.com/a/41086671/2469133 https://stackoverflow.com/a/41086671/2469133

Use the same command mentioned in the answer, but:使用答案中提到的相同命令,但是:

Download openapi cli from here:从这里下载 openapi cli:

https://mvnrepository.com/artifact/org.openapitools/openapi-generator-cli/4.1.3 https://mvnrepository.com/artifact/org.openapitools/openapi-generator-cli/4.1.3

Use:利用:

openapi cli jar file instead of code generator cli jar file. openapi cli jar 文件而不是代码生成器 cli jar 文件。

and

"-g" instead of "-l"

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 使用Swagger Codegen的Android Retrofit sdk生成 - Android Retrofit sdk generation using Swagger codegen Swagger Codegen:继承和组合未按预期工作 - Swagger Codegen: Inheritance and Composition not working as expected Swagger Codegen在为具有OAuth2.0安全性的Rest API生成Java客户端时无法正常工作 - Swagger Codegen is not working while generating java client for a Rest API having OAuth2.0 security 带有弹簧靴2 / Spring 5的Swagger Codegen swagger-jersey2-jaxrs无法正常工作 - Swagger codegen swagger-jersey2-jaxrs with spring boot 2 /Spring 5 not working 如何使用 swagger-codegen 为 Java 生成具有不同控制器名称的 API? - How to generate API with swagger-codegen with a different controller name for Java? Java REST Client的swagger-codegen头参数 - swagger-codegen header parameter for Java REST Client 如何禁用 swagger-codegen java.io.InputStream 转换 - How to disable swagger-codegen java.io.InputStream convertation Swagger 字典类型(Java 代码生成)使用 LinkedHashMap 而不是 HashMap? - Use LinkedHashMap instead of HashMap for Swagger dictionary type (Java codegen)? Swagger Codegen CLI Java 客户端 - 如何正确使用它 - Swagger Codegen CLI Java Client - How to use it right 编译 swagger-codegen java Petstore sdk 时出错 - Error while compiling swagger-codegen java Petstore sdk
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM