Skip to main content

UntypedReason

Enum UntypedReason 

Source
pub enum UntypedReason {
Show 15 variants AnySchema, OpaqueObject, UntypedAdditionalProperties, ArrayWithoutItems, OpenPositionalItems, UnrepresentableUnion, UnrepresentableComposition, UnsupportedTypeKeyword, UnresolvedReference, InlineCompositionDropped, InlineUnionDropped, InlineObjectDropped, InlineEnumDropped, UntypedUnionBranch, Unclassified,
}
Expand description

Why a schema produced an untyped value.

The split that matters is UntypedReason::verdict: a schema that says “any JSON” has no better Rust type and is generated correctly, while a schema that carried type information the generator dropped is a defect with a fix. Counting the two together would make the corpus look worse than it is and hide which cases are worth work.

Variants§

§

AnySchema

{}, true, or a schema with no constraining keyword at all: the spec declares any JSON value.

§

OpaqueObject

type: object with no properties and no typed additionalProperties: an object of unknown shape.

§

UntypedAdditionalProperties

additionalProperties: true or absent, so map values are unconstrained.

§

ArrayWithoutItems

type: array with no items at all.

§

OpenPositionalItems

Positional items that permit extra elements of any type (issue #62, tier 3), so neither a tuple nor a Vec<T> is sound.

§

UnrepresentableUnion

A union (oneOf/anyOf) whose branches did not reduce to one generated Rust type.

§

UnrepresentableComposition

An allOf composition that could not be merged into a struct.

§

UnsupportedTypeKeyword

The schema declared a type keyword the generator has no mapping for.

§

UnresolvedReference

A $ref that analysis could not resolve to a generated schema.

§

InlineCompositionDropped

An allOf composition sitting in a field position. Analysis did not merge or hoist it, and a field cannot hold one, so the generator emits serde_json::Value — dropping a type the schema fully described. A single-branch allOf around a scalar is the common shape.

§

InlineUnionDropped

A union in a field position that was never hoisted to a named enum.

§

InlineObjectDropped

An inline object in a field position that was never hoisted to a struct.

§

InlineEnumDropped

An inline enum in a field position that was never hoisted.

§

UntypedUnionBranch

A oneOf/anyOf branch that mapped to an untyped value, so the generated union carries a serde_json::Value variant. Whether that is faithful depends on the branch, which the analyzed type no longer says.

§

Unclassified

Reached a fallback that has not been classified yet. Every one of these is a gap in this taxonomy, not in the generator.

Implementations§

Source§

impl UntypedReason

Source

pub fn inline_drop(schema_type: &SchemaType) -> Option<Self>

The reason a non-inline-renderable type reaching a field position gets dropped to serde_json::Value.

Source§

impl UntypedReason

Source

pub fn verdict(self) -> UntypedVerdict

Whether the untyped output is the honest reading of the schema, or a case where the generator can do better.

Trait Implementations§

Source§

impl Clone for UntypedReason

Source§

fn clone(&self) -> UntypedReason

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for UntypedReason

Source§

impl Debug for UntypedReason

Source§

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

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

impl Eq for UntypedReason

Source§

impl Ord for UntypedReason

Source§

fn cmp(&self, other: &UntypedReason) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 (const: unstable) · Source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 (const: unstable) · Source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 (const: unstable) · Source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized,

Restrict a value to a certain interval. Read more
Source§

impl PartialEq for UntypedReason

Source§

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

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

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

Inequality operator !=. Read more
Source§

impl PartialOrd for UntypedReason

Source§

fn partial_cmp(&self, other: &UntypedReason) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 (const: unstable) · Source§

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

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 (const: unstable) · Source§

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

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 (const: unstable) · Source§

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

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 (const: unstable) · Source§

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

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl Serialize for UntypedReason

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 UntypedReason

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> AsOut<T> for T
where T: Copy,

Source§

fn as_out(&mut self) -> Out<'_, T>

Returns an out reference to self.
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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Comparable<K> for Q
where Q: Ord + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn compare(&self, key: &K) -> Ordering

Compare self to key and return their ordering.
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

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

Source§

type Error = !

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.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more