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
impl UntypedReason
Sourcepub fn inline_drop(schema_type: &SchemaType) -> Option<Self>
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
impl UntypedReason
Sourcepub fn verdict(self) -> UntypedVerdict
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
impl Clone for UntypedReason
Source§fn clone(&self) -> UntypedReason
fn clone(&self) -> UntypedReason
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for UntypedReason
Source§impl Debug for UntypedReason
impl Debug for UntypedReason
impl Eq for UntypedReason
Source§impl Ord for UntypedReason
impl Ord for UntypedReason
Source§fn cmp(&self, other: &UntypedReason) -> Ordering
fn cmp(&self, other: &UntypedReason) -> Ordering
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl PartialEq for UntypedReason
impl PartialEq for UntypedReason
Source§impl PartialOrd for UntypedReason
impl PartialOrd for UntypedReason
Source§impl Serialize for UntypedReason
impl Serialize for UntypedReason
impl StructuralPartialEq for UntypedReason
Auto Trait Implementations§
impl Freeze for UntypedReason
impl RefUnwindSafe for UntypedReason
impl Send for UntypedReason
impl Sync for UntypedReason
impl Unpin for UntypedReason
impl UnsafeUnpin for UntypedReason
impl UnwindSafe for UntypedReason
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.