11个版本
0.3.1 | 2022年9月29日 |
---|---|
0.3.0 | 2021年5月27日 |
0.3.0-beta.4 | 2022年9月29日 |
0.3.0-beta.3 | 2021年10月21日 |
0.2.1 | 2020年3月30日 |
1221 在 HTTP服务器 中
每月下载量 151
8KB
153 行代码
actix swagger
使用方法
目前不适用于生产使用
# Add cargo command to simplify usage
cargo install cargo-swagg
# Add support library to your project (via cargo-edit or manual)
cargo add actix-swagger
# Generate your code with cargo subcommand
cargo swagg ./openapi.yaml --out-file ./src/api.rs
# Format file after
rustfmt ./src/api.rs
开发
它使用 insta 进行快照测试。
安装 cargo-insta
以获得更好的审查体验。
成员
cargo-actix
— 支持库,包含名为Answer
的类型化响应以及支持在swagg中的自定义Method
和ContentType
swagg
— 将openapi3 (yaml|json) 规范转换为rust代码的库cargo-swagg
— 与swagg
相同,但用于命令行demo
— 检查生成的代码是否可编译
演示
# to convert ./demo/openapi.yaml to ./demo/src/lib.rs
# format ./demo/src/lib.rs
# and check just run
cargo install cargo-make
cargo make
依赖项
~15–28MB
~468K SLoC