【发布时间】:2019-02-13 15:50:42
【问题描述】:
我是 Spring-Boot 的新手。我想将我的 REST api 文档从我的 Spring MVC 控制器自动生成到 RAML 中。有什么办法吗?或者我可以使用它来将我的 rest api 生成到 RAML 中的任何指南?
【问题讨论】:
标签: spring raml spring-restdocs spring-auto-restdocs raml-java-parser
我是 Spring-Boot 的新手。我想将我的 REST api 文档从我的 Spring MVC 控制器自动生成到 RAML 中。有什么办法吗?或者我可以使用它来将我的 rest api 生成到 RAML 中的任何指南?
【问题讨论】:
标签: spring raml spring-restdocs spring-auto-restdocs raml-java-parser
Spring REST Docs 有一个 Spring REST 文档到 RAML 扩展:https://github.com/ePages-de/restdocs-raml 但是,该项目不再维护,作者建议使用他们的新项目 https://github.com/ePages-de/restdocs-openapi 转换为 OpenAPI (Swagger) 而不是 RAML .他们提供了如何将 OpenAPI 转换为 RAML 的指南:https://github.com/ePages-de/restdocs-openapi#convert-to-raml 有一个示例项目演示了如何转换为 OpenAPI 和 RAML https://github.com/ePages-de/restdocs-openapi/tree/master/samples/restdocs-openapi-sample 该扩展的一个限制是它目前仅适用于 Gradle。
【讨论】:
restdocs-openapi 重构为restdocs-api-spec,最终我们也会在那里支持RAML。
我知道,您的问题已过时,但有些东西可能会有所帮助。
您可以使用 DocDog。从那里它从现有的源代码创建 RAML。如果是 SpringBoot,您可以使用 -lang=spring 轻松运行它。如果是纯 JAVA,可以在代码中添加 cmets(参见 readme.md 或示例),以便 DogDoc 可以理解。
【讨论】: