Skip to content

How to show a Struct as an i32 #860

Closed Answered by DenuxPlays
DenuxPlays asked this question in Q&A
Discussion options

You must be logged in to vote

I found the answer.
I had to implement it the following way:

// 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(),
		)
	}
}

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by DenuxPlays
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant