pub enum Warning {
UnexpectedField,
NonSpecField,
MissingField {
name: &'static str,
},
NullField,
InvalidType {
expected: ValueKind,
actual: ValueKind,
},
StringTooLong {
max: usize,
len: usize,
},
InvalidValue {
expected: &'static [&'static str],
actual: String,
},
IncorrectCase {
expected: &'static str,
actual: String,
},
Cardinality,
}Expand description
A structural problem found while validating a JSON document against the OCPI schema.
Variants§
UnexpectedField
A field present in the JSON that the schema does not list.
NonSpecField
A field the spec for this version does not define, which this layer reads anyway because real-world documents carry it. The value is still validated and retained.
MissingField
A required field absent from its containing object.
NullField
A field whose value is JSON null. null fields can simply be omitted.
InvalidType
A value whose JSON kind does not match the schema.
Fields
StringTooLong
A string longer than the maximum length the schema permits.
Fields
InvalidValue
A string value that is not one of an enum field’s permitted variants, read without regard to case.
Fields
IncorrectCase
A string value that names one of an enum field’s variants, but not in the spec’s case.
Both OCPI versions state that strings in messages and enumerations are case-sensitive, so the value is off-spec rather than merely unconventional. This crate reads it anyway, and says which variant it read.
Fields
Cardinality
An empty array for a field whose schema requires one or more elements.
The only cardinality the schema can violate is “one or more”, and the only way to violate it is to hold nothing, so this variant carries no data.
Trait Implementations§
impl Eq for Warning
impl StructuralPartialEq for Warning
Auto Trait Implementations§
impl Freeze for Warning
impl RefUnwindSafe for Warning
impl Send for Warning
impl Sync for Warning
impl Unpin for Warning
impl UnsafeUnpin for Warning
impl UnwindSafe for Warning
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§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoCaveat for T
impl<T> IntoCaveat for T
Source§fn into_caveat<W>(self, warnings: Set<W>) -> Caveat<T, W>where
W: Warning,
fn into_caveat<W>(self, warnings: Set<W>) -> Caveat<T, W>where
W: Warning,
Caveat<T> by supplying a list of Warnings.Source§fn into_infallible_caveat(self) -> Caveat<Self, Infallible>
fn into_infallible_caveat(self) -> Caveat<Self, Infallible>
FromSchema is infallible a Caveat can be created using this method.