pub struct OptionalEnum;Expand description
Recursively restructures JSON Schema objects so that the Option
In kube 2.x the schema output behavior for Option<Enum> types changed.
Previously given an enum like:
enum LogLevel {
Debug,
Info,
Error,
}The following would be generated for Optional
{ "enum": ["Debug", "Info", "Error"], "type": "string", "nullable": true }Now, schemars generates anyOf for Option<LogLevel> like:
{
"anyOf": [
{ "enum": ["Debug", "Info", "Error"], "type": "string" },
{ "enum": [null], "nullable": true }
]
}This transform implementation prevents this specific case from happening.
Trait Implementations§
Source§impl Clone for OptionalEnum
impl Clone for OptionalEnum
Source§fn clone(&self) -> OptionalEnum
fn clone(&self) -> OptionalEnum
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for OptionalEnum
impl Debug for OptionalEnum
Source§impl Default for OptionalEnum
impl Default for OptionalEnum
Source§fn default() -> OptionalEnum
fn default() -> OptionalEnum
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for OptionalEnum
impl RefUnwindSafe for OptionalEnum
impl Send for OptionalEnum
impl Sync for OptionalEnum
impl Unpin for OptionalEnum
impl UnwindSafe for OptionalEnum
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more