如何为OpenAPI 3.0.0运行swagger-codegen [英] How to run swagger-codegen for OpenAPI 3.0.0
问题描述
看起来像官方 swagger 的问题="/questions/tagged/openapi" class ="post-tag" title =显示已标记'openapi'的问题" rel =" tag> openapi 规范V3支持即将发布 https://github.com/swagger-api/swagger-codegen 在3.0.0
分支上
looks like official swagger for openapi specification V3 support is near release https://blog.readme.io/an-example-filled-guide-to-swagger-3-2/, and the swagger-codegen has 3.0.0 support developed and passing some level of testing https://github.com/swagger-api/swagger-codegen on the 3.0.0
branch
我有一个摇摇欲坠的规范(通过从https://github.com/mermade/swagger2openapi从我现有的2.0规范生成,输出看起来不错)
I have a swagger spec (generated from my existing 2.0 spec via https://github.com/mermade/swagger2openapi, output looks good)
是否有一种简单的方法来运行swagger-codegen,而无需自己打包jar?
Is there an easy way to run the swagger-codegen without having to package the jar myself?
- 这是我发现的唯一结果: https://oss.sonatype.org/content/repositories/snapshots/io/swagger/swagger-codegen-cli/3.0.0-SNAPSHOT/,但运行似乎被破坏了(从输出,可能实际上运行的是2.0而不是3.0.0?):
- this is the single result i found: https://oss.sonatype.org/content/repositories/snapshots/io/swagger/swagger-codegen-cli/3.0.0-SNAPSHOT/ but running that seems to be broken (from the output, possibly actually running 2.0 not 3.0.0?):
[main]信息io.swagger.parser.Swagger20Parser-从/input/myspec.openapi3.json中读取 [main]信息io.swagger.codegen.ignore.CodegenIgnoreProcessor-未找到.swagger-codegen-ignore文件. 线程主"中的异常java.lang.RuntimeException:缺少挥舞的输入或配置! 在io.swagger.codegen.DefaultGenerator.generate(DefaultGenerator.java:685) 在io.swagger.codegen.cmd.Generate.run(Generate.java:285) 在io.swagger.codegen.SwaggerCodegen.main(SwaggerCodegen.java:35)
[main] INFO io.swagger.parser.Swagger20Parser - reading from /input/myspec.openapi3.json [main] INFO io.swagger.codegen.ignore.CodegenIgnoreProcessor - No .swagger-codegen-ignore file found. Exception in thread "main" java.lang.RuntimeException: missing swagger input or config! at io.swagger.codegen.DefaultGenerator.generate(DefaultGenerator.java:685) at io.swagger.codegen.cmd.Generate.run(Generate.java:285) at io.swagger.codegen.SwaggerCodegen.main(SwaggerCodegen.java:35)
看起来,swagger-codegen存储库具有某种受支持的方式,可以在构建后运行 的docker容器.我只是希望/猜测有一种受支持的方法可以执行此操作,而无需在本地编译,因为我需要在几个地方进行设置.
It looks like the swagger-codegen repo has a somewhat supported way to run a docker container after you build; I'm just hoping/guessing there is a supported way to do this without needing to compile locally, as I need to set this up in several places.
推荐答案
OpenAPI Generator (由杰出贡献者发现) Swagger Codegen的代码)同时支持OpenAPI规范v2和v3.
OpenAPI Generator (found by top contributors of Swagger Codegen) supports both OpenAPI specification v2 and v3.
您可以使用 docker映像, Java JAR(SNAPSHOT),酿造或
You can use the docker images, Java JAR (SNAPSHOT), Brew or npm to give it a try.
有关OpenAPI Generator的更多信息,请参阅项目的自述文件
For more information about OpenAPI Generator, please refer to the project's README
如果您需要任何帮助,请打开问题,我们我会调查一下.
If you need any help, please open an issue and we'll look into it.
更新:第一个稳定版本3.0.0已发布: https ://github.com/OpenAPITools/openapi-generator/releases/tag/v3.0.0
UPDATE: 1st stable version 3.0.0 has been released: https://github.com/OpenAPITools/openapi-generator/releases/tag/v3.0.0
这篇关于如何为OpenAPI 3.0.0运行swagger-codegen的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!