1 Star 0 Fork 49

swmwlm / apidoc

forked from caixw / apidoc 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
MIT

apidoc Build Status

apidoc 是一个简单的 RESTful API 文档生成工具,它从代码注释中提取特定格式的内容,生成文档。 目前支持支持以下语言:C#、C/C++、Go、Java、Javascript、Perl、PHP、Python、Ruby、Rust 和 Swift

具体文档可参考:http://apidoc.tools

/**
 * @api get /users 获取所有的用户信息
 * @apiGroup users
 * @apiQuery page int 显示第几页的内容
 * @apiQuery size int 每页显示的数量
 *
 * @apiSuccess 200 ok
 * @apiParam count int 符合条件的所有用户数量
 * @apiParam users array 用户列表。
 * @apiExample json
 * {
 *     "count": 500,
 *     "users": [
 *         {"id":1, "username": "admin1", "name": "管理员2"},
 *         {"id":2, "username": "admin2", "name": "管理员2"}
 *     ],
 * }
 * @apiExmaple xml
 * <users count="500">
 *     <user id="1" username="admin1" name="管理员1" />
 *     <user id="2" username="admin2" name="管理员2" />
 * </users>
 */
func login(w http.ResponseWriter, r *http.Request){
    // TODO
}

安装

go get github.com/caixw/apidoc

集成

若需要将 apidoc 当作包集成到其它 Go 程序中,可分别引用 inputoutput 的相关函数:

start := time.Now()
docs := doc.New()

// 分析文档内容
inputOptions := &input.Options{...}
docs, err := input.Parse(docs, inputOptions)
if err != nil {
    // TODO
}

// 输出内容
outputOptions := &output.Options{...}
outputOptions.Elapsed = time.Now().Sub(start)
if err = output.Render(docs, outputOptions); err != nil {
    // TODO
}

版权

本项目采用 MIT 开源授权许可证,完整的授权说明可在 LICENSE 文件中找到。

The MIT License (MIT) Copyright (c) 2015 caixw Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

简介

RESTful API 文档生成工具 展开 收起
MIT
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
1
https://gitee.com/swmwlm/apidoc.git
git@gitee.com:swmwlm/apidoc.git
swmwlm
apidoc
apidoc
master

搜索帮助

14c37bed 8189591 565d56ea 8189591