How to show a Struct as an i32 #860
-
Hey, "id": {
"id": i32
} What do I have to do to simply show it as an i32? And I want just the integer($i32) without wrapping it in another object. |
Beta Was this translation helpful? Give feedback.
Answered by
DenuxPlays
Feb 8, 2024
Replies: 1 comment
-
I found the answer. // We need this because of the generic Phantom struct that we cannot build an OpenApi schema for.
pub struct PhantomSchema;
impl<'__s> ToSchema<'__s> for PhantomSchema {
fn schema() -> (&'__s str, RefOr<Schema>) {
(
"Phantom",
schema!(
#[inline]
i32
)
.nullable(false)
.into(),
)
}
} |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
DenuxPlays
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I found the answer.
I had to implement it the following way: