API documentation

agolangf · 2018-02-03 18:30:22 · 582 次点击    
这是一个分享于 2018-02-03 18:30:22 的资源,其中的信息可能已经有所发展或是发生改变。

Good day,

I've been using swagger as an api documentation tool, usually using the go swagger with the doc-first approach. This results in a clusterfuck of generated code with a json file 10 billion lines long that has nothing to do with the code you wrote. On the other hand, doing it the other way round results in a clusterfuck of annotations in the code.

Is there a better way to document API's? What do you guys use?


评论:

qu33ksilver:

I have been using goa successfully in a project. Works very nicely and auto-generates swagger docs from your code.

Then I just dump the generated json into swagger-ui to show to my PM. Has worked okay for me so far.

Robjloranger:

I've been working on a project using goa as well and it's been great.

peterhellberg:

I use this tool that I wrote: https://github.com/peterhellberg/hiro

Example of service that use Hiro: https://search.b17g.services/

Tikiatua:

Graphql and GRPC

kemitche:

I've been using go-swagger to much success. (There was a bit of learning curve to get things integrated in my workflow, once I sorted that out I reached a point where I can entirely ignore the generated code directory and focus on the business logic.)

What are you finding to be a clusterfuck about it? I might be able to point you in the right direction.

(Side note: I hate the annotations approach because it usually degrades into "I must manually keep my annotations up to date with the actual validation logic that happens a few lines down")


入群交流(和以上内容无关):加入Go大咖交流群,或添加微信:liuxiaoyan-s 备注:入群;或加QQ群:692541889

582 次点击  
加入收藏 微博
暂无回复
添加一条新回复 (您需要 登录 后才能回复 没有账号 ?)
  • 请尽量让自己的回复能够对别人有帮助
  • 支持 Markdown 格式, **粗体**、~~删除线~~、`单行代码`
  • 支持 @ 本站用户;支持表情(输入 : 提示),见 Emoji cheat sheet
  • 图片支持拖拽、截图粘贴等方式上传