caixw / apidoc Goto Github PK
View Code? Open in Web Editor NEWRESTful API 文档生成工具,支持 Go、Java、Swift、JavaScript、Rust、PHP、Python、Typescript、Kotlin 和 Ruby 等大部分语言。
Home Page: https://apidoc.tools
License: MIT License
RESTful API 文档生成工具,支持 Go、Java、Swift、JavaScript、Rust、PHP、Python、Typescript、Kotlin 和 Ruby 等大部分语言。
Home Page: https://apidoc.tools
License: MIT License
api和example都已经有了,用go模拟测试完全可以啊
建议为apiParam添加来源(例如path/query)和是否必须(required)参数,在请求的参数中这两个标记还是很常用的。
“产生此配置文件的 apidoc 版本号”,存在这个版本号,
难道是为了不兼容的情况,这个不应该向下自动兼容吗?
配置:
{
"version": "1",
"inputs": [
{
"lang": "go",
"dir": "./",
"recursive": true
}
],
"output": {
"dir": "./output/doc",
"type": "html",
"template":"",
"port":":9999"
}
}
错误:
[ERRO] 配置文件[.apidoc.json]中配置项[version]错误[格式不正确]
但是我项目里面还没有打tag,没有version
需求:简洁,扁平化,能体现 apidoc 功能,能用简短的 svg 描述。能很地转换成 favicon。
/** 回车 能够生成默认的注释, 那么如何能够简单的生成apidoc模板的注释,尽量减少使用的成本
为什么要去掉html方式呢?是否可以恢复html的输出方式。
使用 @ApiStatus xxx 来代替原来的 @apiSuccess 和 @ApiError。
input, output 等子包应该只向调用方反馈信息,但是信息具体输出到哪儿,应该由调用方来决定。
目前 output 包中在调试模式下,会直接调用 app.Info 输出一条提示信息,以及 500 错误时,会调用 app.Error 输出一条错误信息,是否应该像 input 一条传递一个 log.Logger 变量来获取这些信息!
跟随系统语言自动选择最适合的语言,若不存在,则显示默认的中文;
使用 golang.org/x/text/message
包管理多语种的相关内容。
这里用于跟踪对各个语言的支持情况。
目前已经支持
C#、C/C++、Go、Java、Javascript、Pascal/Delphi、Perl、PHP、Python、Rust、Ruby 和 Swift。
目前没有排序,输出不是严格按照顺序的,每次编译后输出顺序都不一致。
panic: 字段[Title]错误:[不能为空]
goroutine 1 [running]:
panic(0x1ad160, 0xc82007a220)
/home/travis/.gimme/versions/go1.6.linux.amd64/src/runtime/panic.go:464 +0x3e6
main.main()
/home/travis/gopath/src/github.com/caixw/apidoc/main.go:41 +0xa9
资源 https://cdn.bootcss.com/prism/1.5.1/components/ 404,导致代码无法高亮
该资源是否可以改成放在本地,不要请求网络资源
所有行前导的相同数据空格或是相同数量的 tab
类似于 C 和 Go 的 '"'
无法正确处理,初当作一个字符串的开始。
该如何使用这个艺术呢?
目前的 flag.Usage 采用字符串拼接方式完成。不方便作本地化的转换。
output.Options 添加一个新的字段 Groups,用于指定哪些分组会被输出。
apiExmaple 改为 apiExample
生成后的页面,比较简单,能否像apidocjs一样,带有目录结构;
如果是长文档,找起来比较麻烦,
按照apidoc.tools的示例进行,不生成html文档。
配置文件如下:
{
"version": "3.1.3-alpha+20160726",
"inputs": [
{
"lang": "php",
"dir": "E:\\mycode\\act\\ad",
"recursive": true
}
],
"output": {
"dir": "E:\\mycode\\act\\ad\\doc",
"type": "html",
"template":"C:\\GOLIB\\src\\github.com\\caixw\\apidoc\\output\\static",
"port":":9999"
}
}
但是doc目录下只有app.js、jquery、style.css三个文件,并没有其他文件。
通过go build编译的报错。
panic: template: html:1: unexpected "-" in define clause
goroutine 1 [running]:
html/template.Must(0x0, 0x52d028, 0xc82026a140, 0x0)
/usr/local/go/src/html/template/template.go:330 +0x4b
github.com/caixw/apidoc/output.compileHTMLTemplate(0xc820010c40, 0x296f5, 0x0, 0x0)
/Users/xxxx/gocode/src/github.com/caixw/apidoc/output/html.go:88 +0x6cd
github.com/caixw/apidoc/output.renderHTML(0xc8201f16d0, 0xc820010c40, 0x0, 0x0)
/Users/xxxx/gocode/src/github.com/caixw/apidoc/output/html.go:41 +0x45
github.com/caixw/apidoc/output.Render(0xc8201f16d0, 0xc820010c40, 0x0, 0x0)
/Users/xxxx/gocode/src/github.com/caixw/apidoc/output/output.go:56 +0xab
main.main()
/Users/xxxx/gocode/src/github.com/caixw/apidoc/main.go:50 +0x194
生成doc的时候发现
apidoc会把vendor目录也包含进去.
但是vendor都是引用的项目,并非自己的.
有些还会造成语法错误,导致apidoc报错.
是否可以直接在配置文件中添加例外?
xxxx@mac:~/Document > ~/apidoc/apidoc -g
[WARN] 该目录下没有支持的语言文件
如何配置?
比如:@apiQuery status string all 状态类型,all: 所有, locked: 锁定, normal: 正常
根据注释中的特殊格式,提取其中的枚举值
允许同时从多个不同的语言的项目产生文档。
I presume this is Chinese, do you plan to put an international version, so non Chinese readers would be able to understand the project?
目前貌似是只能UTF-8编码,其他编码生成的文档会乱码。可以考虑支持其他编码的支持么?
一个注释块中,同时包含一个以上的文档信息,则解析时会了出错
// @api 第一个文档
// @apiParam xxx
//
// @api 另一个文档
// @apiParam
添加一个表示默认值的字段。
在语法上会与2.0版本不兼容
taskstatus OPEN|CLOSE|COMPLETE
OPEN (默认值) 表示此任务开启
CLOSE 表示此任务关闭,比如任务不可行,服务端关闭,或任务成本过高,客户关闭
COMPLETE 表示任务顺利完成
能否增加像这样的显示样式的支持
* @apiParam taskstatus string OPEN|CLOSE|COMPLETE 三种状态值</br>
* OPEN (默认值) 表示此任务开启</br>
* CLOSE 表示此任务关闭,比如任务不可行,服务端关闭,或任务成本过高,客户关闭</br>
* COMPLETE 表示任务顺利完成</br>
无法达到效果
https://apidoc.tools 网站 访问不了,可否给出详细的使用用例呢?
比如,以下这一段代码,应该要每一行去掉第一个空格:
// @apiExample json
// {
// "username":"admin",
// "password":"123456"
// }
怎么看看效果,go run main.go ?
.\main.go:33: undefined: logWriter
.\main.go:34: undefined: logWriter
.\main.go:35: undefined: logWriter
.\main.go:131: undefined: loadConfig
.\main.go:202: undefined: config
出现语法错误[不认识的标签:@apiName]
能否忽略不认识的标签
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.