Struct vector_config::schema::SchemaObject
source · pub struct SchemaObject {
pub metadata: Option<Box<Metadata>>,
pub instance_type: Option<SingleOrVec<InstanceType>>,
pub format: Option<String>,
pub enum_values: Option<Vec<Value>>,
pub const_value: Option<Value>,
pub subschemas: Option<Box<SubschemaValidation>>,
pub number: Option<Box<NumberValidation>>,
pub string: Option<Box<StringValidation>>,
pub array: Option<Box<ArrayValidation>>,
pub object: Option<Box<ObjectValidation>>,
pub reference: Option<String>,
pub extensions: BTreeMap<String, Value>,
}
Expand description
A JSON Schema object.
Fields§
§metadata: Option<Box<Metadata>>
Properties which annotate the SchemaObject
which typically have no effect when an object is being validated against the schema.
instance_type: Option<SingleOrVec<InstanceType>>
The type
keyword.
See JSON Schema Validation 6.1.1. “type” and JSON Schema 4.2.1. Instance Data Model.
format: Option<String>
The format
keyword.
See JSON Schema Validation 7. A Vocabulary for Semantic Content With “format”.
enum_values: Option<Vec<Value>>
The enum
keyword.
const_value: Option<Value>
The const
keyword.
subschemas: Option<Box<SubschemaValidation>>
Properties of the SchemaObject
which define validation assertions in terms of other schemas.
number: Option<Box<NumberValidation>>
Properties of the SchemaObject
which define validation assertions for numbers.
string: Option<Box<StringValidation>>
Properties of the SchemaObject
which define validation assertions for strings.
array: Option<Box<ArrayValidation>>
Properties of the SchemaObject
which define validation assertions for arrays.
object: Option<Box<ObjectValidation>>
Properties of the SchemaObject
which define validation assertions for objects.
reference: Option<String>
The $ref
keyword.
extensions: BTreeMap<String, Value>
Arbitrary extra properties which are not part of the JSON Schema specification, or which schemars
does not support.
Implementations§
source§impl SchemaObject
impl SchemaObject
sourcepub fn new_ref(reference: String) -> SchemaObject
pub fn new_ref(reference: String) -> SchemaObject
Creates a new $ref
schema.
The given reference string should be a URI reference. This will usually be a JSON Pointer in URI Fragment representation.
sourcepub fn is_ref(&self) -> bool
pub fn is_ref(&self) -> bool
Returns true
if self
is a $ref
schema.
If self
has Some
reference
set, this returns true
.
Otherwise, returns false
.
sourcepub fn has_type(&self, ty: InstanceType) -> bool
pub fn has_type(&self, ty: InstanceType) -> bool
Returns true
if self
accepts values of the given type, according to the Self::instance_type
field.
This is a basic check that always returns true
if no instance_type
is specified on the schema,
and does not check any subschemas. Because of this, both {}
and {"not": {}}
accept any type according
to this method.
sourcepub fn metadata(&mut self) -> &mut Metadata
pub fn metadata(&mut self) -> &mut Metadata
Returns a mutable reference to this schema’s Metadata
, creating it if it was None
.
sourcepub fn subschemas(&mut self) -> &mut SubschemaValidation
pub fn subschemas(&mut self) -> &mut SubschemaValidation
Returns a mutable reference to this schema’s SubschemaValidation
, creating it if it was None
.
sourcepub fn number(&mut self) -> &mut NumberValidation
pub fn number(&mut self) -> &mut NumberValidation
Returns a mutable reference to this schema’s NumberValidation
, creating it if it was None
.
sourcepub fn string(&mut self) -> &mut StringValidation
pub fn string(&mut self) -> &mut StringValidation
Returns a mutable reference to this schema’s StringValidation
, creating it if it was None
.
sourcepub fn array(&mut self) -> &mut ArrayValidation
pub fn array(&mut self) -> &mut ArrayValidation
Returns a mutable reference to this schema’s ArrayValidation
, creating it if it was None
.
sourcepub fn object(&mut self) -> &mut ObjectValidation
pub fn object(&mut self) -> &mut ObjectValidation
Returns a mutable reference to this schema’s ObjectValidation
, creating it if it was None
.
Trait Implementations§
source§impl Clone for SchemaObject
impl Clone for SchemaObject
source§fn clone(&self) -> SchemaObject
fn clone(&self) -> SchemaObject
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for SchemaObject
impl Debug for SchemaObject
source§impl Default for SchemaObject
impl Default for SchemaObject
source§fn default() -> SchemaObject
fn default() -> SchemaObject
source§impl<'de> Deserialize<'de> for SchemaObjectwhere
SchemaObject: Default,
impl<'de> Deserialize<'de> for SchemaObjectwhere
SchemaObject: Default,
source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<SchemaObject, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<SchemaObject, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
source§impl<'a> From<&'a SchemaObject> for SimpleSchema<'a>
impl<'a> From<&'a SchemaObject> for SimpleSchema<'a>
source§fn from(schema: &'a SchemaObject) -> Self
fn from(schema: &'a SchemaObject) -> Self
source§impl From<Schema> for SchemaObject
impl From<Schema> for SchemaObject
source§fn from(schema: Schema) -> SchemaObject
fn from(schema: Schema) -> SchemaObject
source§impl From<SchemaObject> for Schema
impl From<SchemaObject> for Schema
source§fn from(o: SchemaObject) -> Schema
fn from(o: SchemaObject) -> Schema
source§impl PartialEq for SchemaObject
impl PartialEq for SchemaObject
source§fn eq(&self, other: &SchemaObject) -> bool
fn eq(&self, other: &SchemaObject) -> bool
self
and other
values to be equal, and is used
by ==
.source§impl<'a> QueryableSchema for &'a SchemaObject
impl<'a> QueryableSchema for &'a SchemaObject
fn schema_type(&self) -> SchemaType<'_>
fn description(&self) -> Option<&str>
fn title(&self) -> Option<&str>
fn get_attributes(&self, key: &str) -> Option<OneOrMany<CustomAttribute>>
fn get_attribute( &self, key: &str, ) -> Result<Option<CustomAttribute>, QueryError>
fn has_flag_attribute(&self, key: &str) -> Result<bool, QueryError>
source§impl Serialize for SchemaObject
impl Serialize for SchemaObject
source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
impl StructuralPartialEq for SchemaObject
Auto Trait Implementations§
impl Freeze for SchemaObject
impl RefUnwindSafe for SchemaObject
impl Send for SchemaObject
impl Sync for SchemaObject
impl Unpin for SchemaObject
impl UnwindSafe for SchemaObject
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
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)
clone_to_uninit
)§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
§impl<Source, Target> OctetsInto<Target> for Sourcewhere
Target: OctetsFrom<Source>,
impl<Source, Target> OctetsInto<Target> for Sourcewhere
Target: OctetsFrom<Source>,
type Error = <Target as OctetsFrom<Source>>::Error
§fn try_octets_into(
self,
) -> Result<Target, <Source as OctetsInto<Target>>::Error>
fn try_octets_into( self, ) -> Result<Target, <Source as OctetsInto<Target>>::Error>
§fn octets_into(self) -> Targetwhere
Self::Error: Into<Infallible>,
fn octets_into(self) -> Targetwhere
Self::Error: Into<Infallible>,
§impl<D> OwoColorize for D
impl<D> OwoColorize for D
§fn fg<C>(&self) -> FgColorDisplay<'_, C, Self>where
C: Color,
fn fg<C>(&self) -> FgColorDisplay<'_, C, Self>where
C: Color,
§fn bg<C>(&self) -> BgColorDisplay<'_, C, Self>where
C: Color,
fn bg<C>(&self) -> BgColorDisplay<'_, C, Self>where
C: Color,
§fn on_yellow<'a>(&'a self) -> BgColorDisplay<'a, Yellow, Self>
fn on_yellow<'a>(&'a self) -> BgColorDisplay<'a, Yellow, Self>
§fn magenta<'a>(&'a self) -> FgColorDisplay<'a, Magenta, Self>
fn magenta<'a>(&'a self) -> FgColorDisplay<'a, Magenta, Self>
§fn on_magenta<'a>(&'a self) -> BgColorDisplay<'a, Magenta, Self>
fn on_magenta<'a>(&'a self) -> BgColorDisplay<'a, Magenta, Self>
§fn on_purple<'a>(&'a self) -> BgColorDisplay<'a, Magenta, Self>
fn on_purple<'a>(&'a self) -> BgColorDisplay<'a, Magenta, Self>
§fn default_color<'a>(&'a self) -> FgColorDisplay<'a, Default, Self>
fn default_color<'a>(&'a self) -> FgColorDisplay<'a, Default, Self>
§fn on_default_color<'a>(&'a self) -> BgColorDisplay<'a, Default, Self>
fn on_default_color<'a>(&'a self) -> BgColorDisplay<'a, Default, Self>
§fn bright_black<'a>(&'a self) -> FgColorDisplay<'a, BrightBlack, Self>
fn bright_black<'a>(&'a self) -> FgColorDisplay<'a, BrightBlack, Self>
§fn on_bright_black<'a>(&'a self) -> BgColorDisplay<'a, BrightBlack, Self>
fn on_bright_black<'a>(&'a self) -> BgColorDisplay<'a, BrightBlack, Self>
§fn bright_red<'a>(&'a self) -> FgColorDisplay<'a, BrightRed, Self>
fn bright_red<'a>(&'a self) -> FgColorDisplay<'a, BrightRed, Self>
§fn on_bright_red<'a>(&'a self) -> BgColorDisplay<'a, BrightRed, Self>
fn on_bright_red<'a>(&'a self) -> BgColorDisplay<'a, BrightRed, Self>
§fn bright_green<'a>(&'a self) -> FgColorDisplay<'a, BrightGreen, Self>
fn bright_green<'a>(&'a self) -> FgColorDisplay<'a, BrightGreen, Self>
§fn on_bright_green<'a>(&'a self) -> BgColorDisplay<'a, BrightGreen, Self>
fn on_bright_green<'a>(&'a self) -> BgColorDisplay<'a, BrightGreen, Self>
§fn bright_yellow<'a>(&'a self) -> FgColorDisplay<'a, BrightYellow, Self>
fn bright_yellow<'a>(&'a self) -> FgColorDisplay<'a, BrightYellow, Self>
§fn on_bright_yellow<'a>(&'a self) -> BgColorDisplay<'a, BrightYellow, Self>
fn on_bright_yellow<'a>(&'a self) -> BgColorDisplay<'a, BrightYellow, Self>
§fn bright_blue<'a>(&'a self) -> FgColorDisplay<'a, BrightBlue, Self>
fn bright_blue<'a>(&'a self) -> FgColorDisplay<'a, BrightBlue, Self>
§fn on_bright_blue<'a>(&'a self) -> BgColorDisplay<'a, BrightBlue, Self>
fn on_bright_blue<'a>(&'a self) -> BgColorDisplay<'a, BrightBlue, Self>
§fn bright_magenta<'a>(&'a self) -> FgColorDisplay<'a, BrightMagenta, Self>
fn bright_magenta<'a>(&'a self) -> FgColorDisplay<'a, BrightMagenta, Self>
§fn on_bright_magenta<'a>(&'a self) -> BgColorDisplay<'a, BrightMagenta, Self>
fn on_bright_magenta<'a>(&'a self) -> BgColorDisplay<'a, BrightMagenta, Self>
§fn bright_purple<'a>(&'a self) -> FgColorDisplay<'a, BrightMagenta, Self>
fn bright_purple<'a>(&'a self) -> FgColorDisplay<'a, BrightMagenta, Self>
§fn on_bright_purple<'a>(&'a self) -> BgColorDisplay<'a, BrightMagenta, Self>
fn on_bright_purple<'a>(&'a self) -> BgColorDisplay<'a, BrightMagenta, Self>
§fn bright_cyan<'a>(&'a self) -> FgColorDisplay<'a, BrightCyan, Self>
fn bright_cyan<'a>(&'a self) -> FgColorDisplay<'a, BrightCyan, Self>
§fn on_bright_cyan<'a>(&'a self) -> BgColorDisplay<'a, BrightCyan, Self>
fn on_bright_cyan<'a>(&'a self) -> BgColorDisplay<'a, BrightCyan, Self>
§fn bright_white<'a>(&'a self) -> FgColorDisplay<'a, BrightWhite, Self>
fn bright_white<'a>(&'a self) -> FgColorDisplay<'a, BrightWhite, Self>
§fn on_bright_white<'a>(&'a self) -> BgColorDisplay<'a, BrightWhite, Self>
fn on_bright_white<'a>(&'a self) -> BgColorDisplay<'a, BrightWhite, Self>
§fn blink_fast<'a>(&'a self) -> BlinkFastDisplay<'a, Self>
fn blink_fast<'a>(&'a self) -> BlinkFastDisplay<'a, Self>
§fn strikethrough<'a>(&'a self) -> StrikeThroughDisplay<'a, Self>
fn strikethrough<'a>(&'a self) -> StrikeThroughDisplay<'a, Self>
§fn color<Color>(&self, color: Color) -> FgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
fn color<Color>(&self, color: Color) -> FgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
OwoColorize::fg
or
a color-specific method, such as OwoColorize::green
, Read more§fn on_color<Color>(&self, color: Color) -> BgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
fn on_color<Color>(&self, color: Color) -> BgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
OwoColorize::bg
or
a color-specific method, such as OwoColorize::on_yellow
, Read more