utoipa icon indicating copy to clipboard operation
utoipa copied to clipboard

A way to import schemas? - import schemas from a path to module instead of the full path

Open juhaku opened this issue 1 year ago • 0 comments

Discussed in https://github.com/juhaku/utoipa/discussions/788

Originally posted by ctron October 31, 2023 The documented approach I see is:

#[derive(OpenApi)]
#[openapi(
    paths(),
    components(
        schemas(
            foo::Bar,
            foo::Baz,
        )
    ),
)]
pub struct ApiDoc;

Now, if I don't want to repeat myself, listing every type of the schema again, is there a way to import a full module? Like:

#[openapi(
    paths(),
    components(
        schemas(
            foo
        )
    ),
)]
```</div>

juhaku avatar Aug 11 '24 18:08 juhaku