#actix #actix-web #swagger #codegen

archived actix-swagger

Code generator from swagger file for actix-web framework

11 releases

0.3.1 Sep 29, 2022
0.3.0 May 27, 2021
0.3.0-beta.4 Sep 29, 2022
0.3.0-beta.3 Oct 21, 2021
0.2.1 Mar 30, 2020

#21 in #openapi3

Download history 128/week @ 2023-10-18 82/week @ 2023-10-25 10/week @ 2023-11-01 25/week @ 2023-11-08 25/week @ 2023-11-15 31/week @ 2023-11-22 49/week @ 2023-11-29 6/week @ 2023-12-06 19/week @ 2023-12-13 21/week @ 2023-12-20 19/week @ 2023-12-27 6/week @ 2024-01-03 11/week @ 2024-01-10 23/week @ 2024-01-17 62/week @ 2024-01-24 44/week @ 2024-01-31

142 downloads per month

MIT license

8KB
153 lines

actix swagger

Usage

Not for production use yet

# 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

Development

It uses insta for snapshot testing.

Install cargo-insta to better review experience.

Members

  • cargo-actix — support library, contents typed response named Answer and custom Method and ContentType that supports in swagg
  • swagg — library that transforms openapi3 (yaml|json) spec to rust code
  • cargo-swagg — same as swagg but for cli
  • demo — checks that generated code is compiles

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

Dependencies

~17–29MB
~519K SLoC