Struct kube_core::schema::StructuralSchemaRewriter
source · pub struct StructuralSchemaRewriter;
Expand description
schemars Visitor
that rewrites a Schema
to conform to Kubernetes’ “structural schema” rules
The following two transformations are applied
- Rewrite enums from
oneOf
toobject
s with multiple variants (schemars#84) - Rewrite untagged enums from
anyOf
toobject
s with multiple variants (kube#1028) - Rewrite
additionalProperties
from#[serde(flatten)]
tox-kubernetes-preserve-unknown-fields
(kube#844)
This is used automatically by kube::derive
’s #[derive(CustomResource)]
,
but it can also be used manually with SchemaSettings::with_visitor
.
§Panics
The Visitor
functions may panic if the transform could not be applied. For example,
there must not be any overlapping properties between oneOf
branches.
Trait Implementations§
source§impl Clone for StructuralSchemaRewriter
impl Clone for StructuralSchemaRewriter
source§fn clone(&self) -> StructuralSchemaRewriter
fn clone(&self) -> StructuralSchemaRewriter
Returns a copy 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 StructuralSchemaRewriter
impl Debug for StructuralSchemaRewriter
source§impl Visitor for StructuralSchemaRewriter
impl Visitor for StructuralSchemaRewriter
source§fn visit_schema_object(&mut self, schema: &mut SchemaObject)
fn visit_schema_object(&mut self, schema: &mut SchemaObject)
Override this method to modify a
SchemaObject
and (optionally) its subschemas. Read moresource§fn visit_root_schema(&mut self, root: &mut RootSchema)
fn visit_root_schema(&mut self, root: &mut RootSchema)
Override this method to modify a
RootSchema
and (optionally) its subschemas. Read moreAuto Trait Implementations§
impl Freeze for StructuralSchemaRewriter
impl RefUnwindSafe for StructuralSchemaRewriter
impl Send for StructuralSchemaRewriter
impl Sync for StructuralSchemaRewriter
impl Unpin for StructuralSchemaRewriter
impl UnwindSafe for StructuralSchemaRewriter
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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)