Generate and publish Ruby based REST APIs documentation

前端 未结 4 1652
别跟我提以往
别跟我提以往 2020-12-23 19:24

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 Ru

相关标签:
4条回答
  • 2020-12-23 19:41

    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.

    • 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!)

    • 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.

    • You can also generate your client with swagger-codegen.

    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.

    0 讨论(0)
  • 2020-12-23 19:41

    We've just started playing with apipie for this. So far seems pretty neat.

    0 讨论(0)
  • 2020-12-23 19:48

    Please have a look at ApiDoco gem (https://github.com/72pulses/apidoco/) for documentation. It is very easy to setup and has a good user experience.

    0 讨论(0)
  • 2020-12-23 19:54

    Swagger can be used with ruby as client to automatically generate client libraries from a Swagger-compliant server https://github.com/wordnik/swagger-codegen

    If you use RoR than I think you should look at https://github.com/elc/rapi_doc , but it is not easy to use.

    0 讨论(0)
提交回复
热议问题