问题描述
我是 RAML 的新手,我正在寻找一种工具或任何可以通过传递一些细节来创建 RAML 文件的方法。如果我尝试手动为现有 API 编写 RAML 文件会花费很多时间。
以下是所需的 RAML 文件格式。
%rAML 1.0
baseUri: https://api.test.com/abc
title: Test
version: v1
traits:
id-required:
headers:
id:
type: string
secret:
type: string
/test/:
description:Test API
post:
is: [id-required]
description: Test
body:
application/json:
example: !include examples/TestRequest.json
type: !include schemas/TestRequestSchema.json
responses:
200:
body:
application/json:
example: !include examples/TestResponse.json
type: !include schemas/TestResponseSchema.json
400:
body:
application/json:
example: !include examples/TestErrorResponse.json
type: !include schemas/TestResponseSchema.json
谢谢, 拉恰纳
解决方法
您可以使用 DocDog。
从那里它从现有的源代码创建 RAML。
如果是 SpringBoot,您可以使用 -lang=spring
轻松运行它。如果是纯JAVA,你可以在你的代码中添加注释(参见readme.md或示例),以便DogDoc可以理解。
希望对你有帮助: https://github.com/skalski/docdog