You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am using utoipa and utoipauto to create a documentation for an api rest inside a workspace.
I'll start explaining my project structure :
mod1
src
main.rs
Cargo.toml
mod2
src
lib.rs
Cargo.toml
Cargo.toml
mod2 is a library including all models for API rest defined in mod1. mod2 is a separate crate because all these models can be use by other modules (in same workspace).
mod2 is declared as depencency of mod1 as follow :
mod2 = { path = "../mod2" }
API is fully working, unfortunately i have an issue with OpenApi documentation. It doesn't include struct/type coming from mod2. For example for params my type is defined as :
{recursive: mod2.Params}
and body example are defined as :
"#/components/schemas/mod2.ExampleBody"
My configuration is generated via (inside mod1):
#[utoipauto(paths = "./mod1/src, ./mod2/src from mod2")]
#[derive(OpenApi)]
#[openapi(
info(title = "Example API", version = "1.0.0"),
)]
Did i miss something ? Is it possible to generate schema from another crate inside the same workspace ?
ps: i cannot send real types for confidentials reasons but it tried to reproduce as close as possible.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hello,
I am using
utoipa
andutoipauto
to create a documentation for an api rest inside a workspace.I'll start explaining my project structure :
mod2
is a library including all models for API rest defined inmod1
.mod2
is a separate crate because all these models can be use by other modules (in same workspace).Example of struct within lib.rs in mod2 :
mod2
is declared as depencency ofmod1
as follow :API is fully working, unfortunately i have an issue with OpenApi documentation. It doesn't include struct/type coming from
mod2
. For example for params my type is defined as :and body example are defined as :
"#/components/schemas/mod2.ExampleBody"
My configuration is generated via (inside
mod1
):Did i miss something ? Is it possible to generate schema from another crate inside the same workspace ?
ps: i cannot send real types for confidentials reasons but it tried to reproduce as close as possible.
Beta Was this translation helpful? Give feedback.
All reactions