简体   繁体   English

是否有将使用 io.swagger 1.5.x 注释的 Java 代码迁移到 io.swagger 2.x 注释的工具?

[英]Is there a tool to migrate Java code using io.swagger 1.5.x annotations to io.swagger 2.x annotations?

We currently have a java code base with a fair number of REST endpoints that have been annotated with io.swagger 1.5 annotations.我们目前有一个 Java 代码库,其中包含相当数量的 REST 端点,这些端点已使用 io.swagger 1.5 注释进行注释。 We would like to move to OpenAPI 3.0 so I am looking for a tool that will update the annotations in our code to the io.swagger 2.x annotations.我们想迁移到 OpenAPI 3.0,所以我正在寻找一种工具,可以将我们代码中的注释更新为 io.swagger 2.x 注释。 Does such a tool exist?有这样的工具吗?

Not that I know of.从来没听说过。 I only know of tools that can migrate swagger yml or swagger json specifications from 1.x versions to 2.x or even from swagger to openApi.我只知道可以将 swagger yml 或 swagger json 规范从 1.x 版本迁移到 2.x 甚至从 swagger 迁移到 openApi 的工具。 Swagger Converter would be one of those. Swagger Converter就是其中之一。

But migrating Java code with annotations would be a lot of manual work.但是迁移带有注释的 Java 代码将是大量的手动工作。

Maybe this guide from David Merrick and some find-and-replace with your favorite IDE can spare you some time.也许David Merrick 的这份指南和一些用您最喜欢的 IDE 进行查找和替换的方法可以为您节省一些时间。

A good future investment could be to refactor all swagger related code into a yaml specification and to generate the javacode from this spec.未来一项不错的投资可能是将所有与 swagger 相关的代码重构为 yaml 规范,并从该规范生成 javacode。

This way, you could make a tool based migration of the spec files and generate the Javacode afterwards.这样,您可以对规范文件进行基于工具的迁移,然后生成 Java 代码。

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM