Replies: 2 comments 2 replies
-
I belive this comes from framework specific extensions. E.g. it did automatically update the parameter types based on function arguments. But it only supports naively "known" types e.g. primitive and Uuid etc.
|
Beta Was this translation helpful? Give feedback.
-
When using
#[derive(serde::Deserialize, ToSchema, Default)]
struct Name {
firstname: String,
lastname: String,
}
#[derive(serde::Deserialize, ToSchema, Default)]
#[schema(default = json!({ "firstname": "Jean-Luc", "lastname": "Picard" }))]
struct OwnerName(
Name,
);
#[derive(serde::Deserialize, ToSchema, Default)]
struct Owner {
num_books: u64,
#[schema(inline)]
#[serde(flatten)]
name: OwnerName,
} (note how And AFAIK the only solution is to set What's unsettling is that without inlining/flattening, there is no |
Beta Was this translation helpful? Give feedback.
-
We recently moved from having lots of use of
format: uuid
throughout our schemas to having dedicated struct for each "id", where each one was likeThis has the benefit that now all of our
foo_id
fields are strictly only able to contain aFooId
and cant accidentally contain aBarId
.The main issue we had was that this meant we needed to be explicit when declaring the
params
i.e. they now look like
When we were directly using
uuid::Uuid
, such aspub async fn fetch_foo(app_data: Data<AppData>, foo_id: Path<FooId>) ...
we did not need to do the= FooId
i.e. there is some special support for
uuid::Uuid
so it was implicit, but when we wrapped the uuid, we needed to do this change everywhereThis is not a 'problem', but if it is easy to avoid, it would be worth attempting. What section of the code should I start looking to improve utoipa's support for this wrapped Uuid.
Beta Was this translation helpful? Give feedback.
All reactions