openapi / actix-swagger

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

Custom type #12

Open sergeysova opened 4 years ago

sergeysova commented 4 years ago

Implemented in the printer:

https://github.com/sergeysova/actix-swagger/blob/60c65a54e829a7ca8e86463d27b7c14eecfd99f6/swagg/src/printer/components/component.rs#L169-L171

schema:
  properties:
    demo:
      type: string
        x-rust-type: crate::app::MyType

Output:

struct Example {
    demo: Option<crate::app::MyType>,
}

Required:

schema:
  required:
    - demo
  properties:
    demo:
      type: string
        x-rust-type: crate::app::MyType

Output:

struct Example {
    demo: crate::app::MyType,
}