从 Spring MVC 控制器自动将 REST api 文档生成到 RAML 中

5 spring raml raml-java-parser spring-restdocs spring-auto-restdocs

我是 Spring Boot 的新手。我想从 Spring MVC 控制器自动将 REST api 文档生成到 RAML 中。有什么可以做的吗?或者有什么指南可以让我用它来将我的 REST API 生成到 RAML 中?

小智 2

Spring REST Docs 有一个 Spring REST Docs到 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。

  • 感谢弗洛里安的回答。同时这里有一个maven插件。https://github.com/BerkleyTechnologyServices/restdocs-spec - 另请参阅相关文档 (https://github.com/ePages-de/restdocs-openapi#maven)。此外,我们计划将 `restdocs-openapi` 重构为 `restdocs-api-spec`,最终我们还将在那里获得 RAML 支持。 (2认同)