问题描述
我一直在考虑一种文档工具,用于为要在多个客户端中使用的 Web 服务构建后端,以及 OAuth 和多个修订的可能性.我已经了解养蜂场,但做了一些研究,我发现其他相当不错的 解决方案 承诺有利可图.
I have been considering a documentation tool for building a backend for a web service to be used in multiple clients along with OAuth and possibility of multiple revisions. I already knew about apiary but doing a little research I found other considerably good solutions with lucrative promises.
RAML 似乎有望实现良好的代码生成和 api 可重用性.但它似乎无法创建模拟服务器.而且我不明白为什么不能使用 apiblueprint 为 REST API 生成客户端库和服务器端骨架.
RAML seems to be promising good code generation and api reusability. But it doesn't seem to be capable of creating a mock server. And I can't understand why apiblueprint can't be used to generate client side libs and server side skeletons for REST API.
对我们来说最好的用例将是 API 的文档,用于使用服务的客户端 iOS/Android/wp/js 库可以与节点 express/restify 应用程序一起自动生成,该应用程序提供框架来编写代码.以及 api 测试和负载测试.
The best use case for us will be upon documentation of the api, client iOS/Android/wp/js library for consuming the service can be auto generated along with an node express/restify app which provides skeleton to write code. Along with api tests and load tests.
RAML/Swagger/Apiary 中的哪种解决方案最适合此问题?
Which solution out of RAML/Swagger/Apiary fits the best for this?
推荐答案
请查看 Swagger Codegen(免费、开源),可以生成不同语言的服务器存根和 API 客户端.
Please check out Swagger Codegen (free, open-source), which can generate both server stubs and API clients in different languages.
许多公司/项目在生产中使用它:https://github.com/swagger-api/swagger-codegen#companiesprojects-using-swagger-codegen
Many companies/projects are using it in production: https://github.com/swagger-api/swagger-codegen#companiesprojects-using-swagger-codegen
支持的语言/框架:
API 客户端:ActionScript、Bash、C#(.net 2.0、4.0 或更高版本)、C++(cpprest、Qt5、Tizen)、Clojure、Dart、Elixir、Go、Groovy、Haskell、Java(Jersey1.x、Jersey2.x、OkHttp、Retrofit1.x、Retrofit2.x、Feign)、Node.js(带有 Google Closure Compiler 注释的 ES5、ES6、AngularJS)Objective-C、Perl、PHP、Python、Ruby、Scala, Swift (2.x, 3.x), Typescript (Angular1.x, Angular2.x, Fetch, jQuery, Node)
API clients: ActionScript, Bash, C# (.net 2.0, 4.0 or later), C++ (cpprest, Qt5, Tizen), Clojure, Dart, Elixir, Go, Groovy, Haskell, Java (Jersey1.x, Jersey2.x, OkHttp, Retrofit1.x, Retrofit2.x, Feign), Node.js (ES5, ES6, AngularJS with Google Closure Compiler annotations) Objective-C, Perl, PHP, Python, Ruby, Scala, Swift (2.x, 3.x), Typescript (Angular1.x, Angular2.x, Fetch, jQuery, Node)
服务器存根:C#(ASP.NET Core、NancyFx)、Erlang、Go、Haskell、Java(MSF4J、Spring、Undertow、JAX-RS:CDI、CXF、Inflector、RestEasy)、PHP(Lumen、Slim、Silex、Zend Expressive)、Python(Flask)、NodeJS、Ruby(Sinatra、Rails5)、Scala(Finch、Scalatra)
Server stubs: C# (ASP.NET Core, NancyFx), Erlang, Go, Haskell, Java (MSF4J, Spring, Undertow, JAX-RS: CDI, CXF, Inflector, RestEasy), PHP (Lumen, Slim, Silex, Zend Expressive), Python (Flask), NodeJS, Ruby (Sinatra, Rails5), Scala (Finch, Scalatra)
API 文档生成器:HTML、Confluence Wiki
API documentation generators: HTML, Confluence Wiki
免责声明:我是开源项目的主要贡献者之一.
Disclaimer: I'm one of the top contributors to the open-source project.
更新:2018 年 5 月,Swagger Codegen 的大约 50 位顶级贡献者和模板创建者决定分叉 Swagger Codegen 以维护一个名为 OpenAPI 生成器.更多信息请参考问答.
UPDATE: On May 2018, about 50 top contributors and template creators of Swagger Codegen decided to fork Swagger Codegen to maintain a community-driven version called OpenAPI Generator. Please refer to the Q&A for more information.
这篇关于良好的剩余代码生成和文档工具的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!