Closed squadgazzz closed 7 months ago
Hello,
Right now, utoipauto only supports struct that derives ToSchema, because we don't have access to the Rust type system in the macro.
I think we may add an optional macro annotation to explicitly say that a struct impl ToSchema manually. Or we could just search for ToSchema impl block in the whole source code.
As a workaround, you can add the struct to utoipa manually. Utoipauto supports having both automatic and manual imports.
#[utoipauto] // auto imports
#[derive(OpenApi)]
#[openapi(
components(
schemas(TestDTO) //manual imports
),
)]
pub struct ApiDoc;
Hey, it's been fixed in 1.7 thanks to this PR
Let's consider the following example:
Where
ethereum_types::U256
is external type andserialize::U256
is a wrapper which implements the following:Is there a way to use
utoipauto
for this scenario? It looks like I need to explicitly declare whichToSchema
to use for the type like it's done forserde
:#[serde_as(as = "HashMap<_, serialize::U256>")]
. Is there a workaround?