生成和发布基于Ruby的REST API的文档 [英] Generate and publish Ruby based REST APIs documentation

查看:147
本文介绍了生成和发布基于Ruby的REST API的文档的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

什么是时尚的年轻人使用时下轻松地分析/生成/发布REST API的?我把在扬鞭一看,它看起来不错,但是从我的角度来看它不适合红宝石OK。也许我只是错了,我失去了一些东西,帮助将是AP preciated。

What are cool kids using nowadays to easily parse/generate/publish REST APIs? I took a look on Swagger and It looks nice but from my point of view it doesn't fit ok with Ruby. Maybe I'm just wrong and I'm missing something, help would be appreciated.

推荐答案

听起来像是你没有一个API了吗?如果是这样的话,这是我推荐的方法。

Sounds like you don't have an API yet? If that's the case, this is the approach that I recommend.

  • Create an interface for the API by using the swagger-specification. You can do this without using a server, see here.

确认使用招摇的UI 的接口。这可以让你看到你定义的所有端点(依然,没有编码,除了JSON文件!)

Verify the interface by using swagger-ui. This allows you to see all the endpoints that you've defined (still, no coding, except for the json files!)

一旦你有你想要的界面,使用 swagger- codeGEN 建设一个废止版本的服务器。目前有模板<一个href=\"https://github.com/wordnik/swagger-$c$cgen/tree/master/samples/server-generator/node\">nodejs和<一个href=\"https://github.com/wordnik/swagger-$c$cgen/tree/master/samples/server-generator/scalatra\">scalatra有更多的道路上。制作一个新的服务器生成器只需创建/修改某些小胡子模板的问题。

Once you have an interface you want, use swagger-codegen to build a stubbed-out version of your server. There are currently templates for nodejs and scalatra with more on the way. Making a new server generator is simply a matter of creating/modifying some mustache templates.

您还可以生成与swagger- codeGEN客户端。

You can also generate your client with swagger-codegen.

这样做的好处是,你可以做你的API接口驱动开发。构建接口和填补空白。该管道是为你做。

The beauty of this is that you can do interface-driven development of your API. Build the interfaces and fill in the blanks. The plumbing is done for you.

这篇关于生成和发布基于Ruby的REST API的文档的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆