arlicle / panda-api Goto Github PK
View Code? Open in Web Editor NEWPanda api is a simple and powerful api docs design tool.
License: MIT License
Panda api is a simple and powerful api docs design tool.
License: MIT License
There are parts of code that do not appear to be properly formatted. Maybe run rustfmt across the repository for potential improvements in readability? 🙏
panda: error while loading shared libraries: libssl.so.1.0.0: cannot open shared object file: No such file or directory
使用下载的Linux安装包,直接在解压的目录里运行./panda
, 无法加载网页内容。(使用安装命令以后可以)。希望能添加无需安装的运行方式以及源码编译运行的命令。
将 -h
和 --help
留给使用说明。
很多文档都是 swagger 自动生成的,能复用的话会减少很多维护压力。
你好,我执行cargo run
无法正确构建项目
我的环境如下:
rustc 1.41.1 (f3e1a954d 2020-02-24)
rustup 1.21.1 (7832b2ebe 2019-12-20)
cargo 1.41.0 (626f0f40e 2019-12-03)
rustup show
Default host: x86_64-apple-darwin
我执行cargo run
出现以下错误:
Compiling failure_derive v0.1.6
Compiling serde_json v1.0.48
Compiling serde_urlencoded v0.6.1
Compiling actix-router v0.2.4
error[E0433]: failed to resolve: could not find __rt
in quote
--> /Users/xuexi/.cargo/registry/src/github.com-1ecc6299db9ec823/failure_derive-0.1.6/src/lib.rs:107:70
|
107 | fn display_body(s: &synstructure::Structure) -> Result<Optionquote::__rt::TokenStream, Error> {
| ^^^^ could not find __rt
in quote
error: aborting due to previous error
For more information about this error, try rustc --explain E0433
.
error: could not compile failure_derive
.
warning: build failed, waiting for other jobs to finish...
error: build failed
是我的环境问题吗?我对rust了解不是很多,希望能得到帮助,谢谢。
INFO actix_server::builder > Starting 32 workers
thread '' panicked at 'called Result::unwrap()
on an Err
value: Io(Os { code: 28, kind: Other, message: "No space left on device" })', src/libcore/result.rs:1188:5
stack backtrace:
INFO actix_server::builder > Starting "actix-web-service-0.0.0.0:8081" service on 0.0.0.0:8081
0: backtrace::backtrace::libunwind::trace
at /cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.40/src/backtrace/libunwind.rs:88
1: backtrace::backtrace::trace_unsynchronized
at /cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.40/src/backtrace/mod.rs:66
2: std::sys_common::backtrace::_print_fmt
at src/libstd/sys_common/backtrace.rs:84
3: <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt
at src/libstd/sys_common/backtrace.rs:61
4: core::fmt::write
at src/libcore/fmt/mod.rs:1025
5: std::io::Write::write_fmt
at src/libstd/io/mod.rs:1426
6: std::sys_common::backtrace::_print
at src/libstd/sys_common/backtrace.rs:65
7: std::sys_common::backtrace::print
at src/libstd/sys_common/backtrace.rs:50
8: std::panicking::default_hook::{{closure}}
at src/libstd/panicking.rs:193
9: std::panicking::default_hook
at src/libstd/panicking.rs:210
10: std::panicking::rust_panic_with_hook
at src/libstd/panicking.rs:471
11: rust_begin_unwind
at src/libstd/panicking.rs:375
12: core::panicking::panic_fmt
at src/libcore/panicking.rs:84
13: core::result::unwrap_failed
at src/libcore/result.rs:1188
14: core::result::Result<T,E>::unwrap
at /rustc/5e1a799842ba6ed4a57e91f7ab9435947482f7d8/src/libcore/result.rs:956
15: panda_api::utils::watch_api_docs_change::{{closure}}
at src/utils.rs:22
note: Some details are omitted, run with RUST_BACKTRACE=full
for a verbose backtrace.
像这样用
docs/projectA/XXX.json5
docs/projectB/YYY.json5
docs/projectC/ZZZ.json5
cd docs && panda
在mock 的时候, 想调用projectA 中的API 则需要带上 projectA 前缀 e.g. /projectA/login
apis里的字段排序规则并不是按照编写顺序下来的?
试用了下,看下来是按照字段名字首字母排序自动排序的,这样话的可能会给编写文档带来困扰,不会按照预想排序执行了!
例如:article.json5 文件内容如下:
method 为 ["POST", "PUT"],在 test_case 中每个 api 明确具体的 method.
{
name:"Article",
apis:[
{
name:"Article add or edit",
url:"/post/add/",
method:["POST", "PUT"],
body_mode:"json",
body:{
id:{name:"article id", desc:"has id field is edit, no id field is add", type:"number", required:false},
title:{},
},
response:{
code:{name:"response result code", type:"int", desc:"success is 1"},
msg:{name:"response result message", type:"string", desc:""},
id: {name:"article id"}
},
test_data:[
{
// add a article
method:"POST",
body:{
title:"Hello World",
},
response:{
code: 1,
msg:"post done",
id: 1,
}
},
{
// edit a article
method:"PUT",
body:{
title:"Hello World",
},
response:{
code: 1,
msg:"post done",
id: 1,
}
}
]
},
在线浏览时,此接口的 method 默认显示为 GET,但点击下拉框时会出现"POST" 和 "PUT" 两个可选择项。这里为什么不是默认显示数据中的第一个字段,如 "POST",点击下拉框时显示出 "PUT" 呢。
若 json5 文件中 method 为数据,但是数据中只有一个字段,如 ["POST"],在线浏览时查看这个接口的数据返回则是正常的。
article.json5 文件内容如下:
{
name:"Article",
apis:[
{
name:"Article add or edit",
url:"/post/add/",
method:["POST"],
body_mode:"json",
body:{
id:{name:"article id", desc:"has id field is edit, no id field is add", type:"number", required:false},
title:{},
},
response:{
code:{name:"response result code", type:"int", desc:"success is 1"},
msg:{name:"response result message", type:"string", desc:""},
id: {name:"article id"}
},
test_data:[
{
// add a article
method:"POST",
body:{
title:"Hello World",
},
response:{
code: 1,
msg:"post done",
id: 1,
}
}
]
},
rt,建议rocket或hyper
[email protected]
看作者的视频觉得作者的vscode 特别好用,求教
接口中字段参数名为type,启动服务后报错
thread 'main' panicked at 'called `Option::unwrap()` on a `None` value', /rustc/5e1a799842ba6ed4a57e91f7ab9435947482f7d8/src/libcore/macros/mod.rs:15:40
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace.
Panic in Arbiter thread.
使用 panda-api 源代码在本地运行,内容显示正常
接口文档例子:
{
name: "name",
desc: "desc",
order: 1,
apis: [
{
name: "name",
desc: "desc",
method: "POST",
url: "my_api_url",
body_mode: "json",
body: {
type: { name: "查询时间类型,[Day|Week|Month]" }, // 这里的 type 字段被认为是数据类型了导致服务报错
beginDate: { name: "查询开始时间" },
endDate: { name: "查询截至时间" },
},
response: {
code: {
name: "返回结果的代码",
type: "int",
desc: "登录成功返回1, 登录失败返回-1",
enum: [-1, 1]
},
msg: {
name: "登录成功返回消息",
type: "csentence",
desc: "通常返回都是空"
}
},
test_data: [
.....
]
}
]
}
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.