openapi / actix-swagger

Swagger code generator for actix-web framework
https://crates.io/crates/cargo-swagg
MIT License
113 stars 8 forks source link

Isolate implementation details from application #4

Open sergeysova opened 4 years ago

sergeysova commented 4 years ago

Instead of passing body, header, path extractors to a route:

pub async fn route(
    body: web::Json<request_bodies::Register>,
    app: web::Data<crate::App>,
) -> Answer<'static, register_request::Response> {

Generate a single extractor for all data. Router implementation doesn't know about API details:

pub async fn route(
    params: paths::register_request::Params,
    app: web::Data<crate::App>,
) -> Answer<'static, register_request::Response> {