#[non_exhaustive]pub enum ResolveError {
NotALocalReference {
reference: String,
},
ExternalDocument {
document: String,
},
MalformedPointer {
reference: String,
},
UnsupportedRootSection {
section: String,
},
UnknownSection {
section: String,
},
ComponentsMissing {
section: Section,
},
NotFound {
section: Section,
name: String,
},
SectionMismatch {
expected: Section,
found: Section,
},
PointerTooDeep {
reference: String,
},
ReferenceChainTooLong {
reference: String,
last: String,
max_hops: usize,
},
CyclicReference {
reference: String,
},
DiscriminatorMappingMismatch {
property_name: String,
value: String,
schema: String,
},
}Expand description
Everything that can go wrong while resolving a $ref.
The variants distinguish a broken document (a dangling name, a $ref to
the wrong kind of component) from a reference this crate structurally
cannot follow (another file, a pointer into the middle of a component), so
a caller can decide which ones are worth aborting on.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
NotALocalReference
The reference is not a JSON pointer into the current document.
ExternalDocument
The reference points into another document, which this crate does not load.
MalformedPointer
The reference is a local pointer but has too few segments to name a component.
UnsupportedRootSection
The pointer starts at a section of the document that cannot hold $ref targets.
UnknownSection
The pointer names a #/components sub-section that does not exist.
ComponentsMissing
The pointer names a component but the document has no components object.
NotFound
The pointer is well formed but names something the section does not contain.
Fields
SectionMismatch
The pointer names a valid component of a different kind than the caller asked for.
Fields
PointerTooDeep
The pointer continues past a component, into its contents.
ReferenceChainTooLong
The chain of references never reached an inline item; the document is most likely cyclic.
Fields
max_hops: usizeThe hop limit that was hit, crate::MAX_REFERENCE_HOPS.
CyclicReference
A component other than a schema contains, directly or through other
components, a $ref back to itself, so it has no finite fully resolved
form. A header whose content encoding names that same header is the
one way a document can do this.
Schemas are allowed to contain themselves; see
NestedSchema. Only
ResolvedOpenAPI reports this; borrowing
resolution stops at the first item and never notices the cycle.
DiscriminatorMappingMismatch
A discriminator on a oneOf or anyOf schema maps a value to a
schema that is not one of the alternatives, so the mapping could never
select anything. Only
ResolvedOpenAPI reports this.
Trait Implementations§
Source§impl Clone for ResolveError
impl Clone for ResolveError
Source§fn clone(&self) -> ResolveError
fn clone(&self) -> ResolveError
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ResolveError
impl Debug for ResolveError
Source§impl Display for ResolveError
impl Display for ResolveError
impl Eq for ResolveError
Source§impl Error for ResolveError
impl Error for ResolveError
1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()
Source§impl PartialEq for ResolveError
impl PartialEq for ResolveError
impl StructuralPartialEq for ResolveError
Auto Trait Implementations§
impl Freeze for ResolveError
impl RefUnwindSafe for ResolveError
impl Send for ResolveError
impl Sync for ResolveError
impl Unpin for ResolveError
impl UnsafeUnpin for ResolveError
impl UnwindSafe for ResolveError
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<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.