Enum ChangeKind

Source
pub enum ChangeKind {
Show 14 variants TypeAdd { added: JsonSchemaType, }, TypeRemove { removed: JsonSchemaType, }, ConstAdd { added: Value, }, ConstRemove { removed: Value, }, PropertyAdd { lhs_additional_properties: bool, added: String, }, PropertyRemove { lhs_additional_properties: bool, removed: String, }, RangeAdd { added: Range, }, RangeRemove { removed: Range, }, RangeChange { old_value: Range, new_value: Range, }, TupleToArray { old_length: usize, }, ArrayToTuple { new_length: usize, }, TupleChange { new_length: usize, }, RequiredRemove { property: String, }, RequiredAdd { property: String, },
}
Expand description

The kind of change + data relevant to the change.

Variants§

§

TypeAdd

A type has been added and is now additionally allowed.

Fields

§added: JsonSchemaType

The type in question.

§

TypeRemove

A type has been removed and is no longer allowed.

Fields

§removed: JsonSchemaType

The type in question.

§

ConstAdd

A const value has been added as an allowed value.

Fields

§added: Value

The value of the added const.

§

ConstRemove

A const has been removed as an allowed value.

Fields

§removed: Value

The value of the removed const.

§

PropertyAdd

A property has been added and (depending on additionalProperties) is now additionally allowed.

Fields

§lhs_additional_properties: bool

The value of additionalProperties within the current JSON object.

§added: String

The name of the added property.

§

PropertyRemove

A property has been removed and (depending on additionalProperties) might now no longer be allowed.

Fields

§lhs_additional_properties: bool

The value of additionalProperties within the current JSON object.

§removed: String

The name of the added property.

§

RangeAdd

A minimum/maximum constraint has been added.

Fields

§added: Range

The value of the added constraint.

§

RangeRemove

A minimum/maximum constraint has been removed.

Fields

§removed: Range

The value of the removed constraint.

§

RangeChange

A minimum/maximum constraint has been updated.

Fields

§old_value: Range

The old constraint value.

§new_value: Range

The new constraint value.

§

TupleToArray

An array-type item has been changed from tuple validation to array validation.

See https://json-schema.org/understanding-json-schema/reference/array.html

Changes will still be emitted for inner items.

Fields

§old_length: usize

The length of the (old) tuple

§

ArrayToTuple

An array-type item has been changed from array validation to tuple validation.

See https://json-schema.org/understanding-json-schema/reference/array.html

Changes will still be emitted for inner items.

Fields

§new_length: usize

The length of the (new) tuple

§

TupleChange

An array-type item with tuple validation has changed its length (“items” array got longer or shorter.

See https://json-schema.org/understanding-json-schema/reference/array.html

Changes will still be emitted for inner items.

Fields

§new_length: usize

The new length of the tuple

§

RequiredRemove

A previously required property has been removed

Fields

§property: String

The property that is no longer required

§

RequiredAdd

A previously optional property has been made required

Fields

§property: String

The property that is now required

Implementations§

Source§

impl ChangeKind

Source

pub fn is_breaking(&self) -> bool

Whether the change is breaking.

What is considered breaking is WIP. Changes are intentionally exposed as-is in public API so that the user can develop their own logic as to what they consider breaking.

Currently the rule of thumb is, a change is breaking if it would cause messages that used to validate fine under RHS to no longer validate under LHS.

Trait Implementations§

Source§

impl Debug for ChangeKind

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl PartialEq for ChangeKind

Source§

fn eq(&self, other: &ChangeKind) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

const fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Serialize for ChangeKind

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for ChangeKind

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.