4

大家现在还用 swagger 生成 API 文档吗

 2 years ago
source link: https://www.v2ex.com/t/795831
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

V2EX  ›  程序员

大家现在还用 swagger 生成 API 文档吗

  shadowfish0 · 5 小时 35 分钟前 · 373 次点击

之前我试过纯粹用编辑 API 的软件写 API 文档,但是发现坚持不下去,每个 API 返回值啥的都要我一个个写好,而且接口改动之后往往就忘记了改 API 文档,毕竟是在两个地方的,要开两个软件。

用了 swagger 感觉会轻松很多,只需要定义传入参数就行了,传出参数也只需要简单描述一下每个字段是干啥的,返回值直接就动态生成了。注释就在代码里,总能比上面这种方法不容易忘吧

但是现在写着写着又感觉不爽了,遇到复杂的接口,参数很多,注释比代码都长有时候,而且 idea 的 swagger 注释和其他注释一样黄黄的看着人眼都要晃了,突然想到如果能把 swagger 的注释颜色改成普通注释颜色应该会舒服很多,不知道可不可行。


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK