#[non_exhaustive]pub enum StrictResolveError {
Fatal(ResolveError),
Partial(PartialResolveError),
}Expand description
Unified error for resolve_strict.
Covers both fatal resolution failures and non-fatal ref errors that are promoted to errors in strict mode.
§Inspecting failures
use serde_json::json;
use openapi_deref::{resolve_strict, StrictResolveError};
let spec = json!({ "a": { "$ref": "#/nope" } });
let err = resolve_strict(&spec).unwrap_err();
// Access partial value and ref errors without pattern matching
if let Some(value) = err.partial_value() {
assert_eq!(value["a"]["$ref"], "#/nope");
}
assert_eq!(err.ref_errors().len(), 1);Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
Fatal(ResolveError)
Fatal resolution error (e.g. depth limit exceeded).
Partial(PartialResolveError)
One or more refs could not be resolved.
Implementations§
Source§impl StrictResolveError
impl StrictResolveError
Sourcepub fn partial_value(&self) -> Option<&Value>
pub fn partial_value(&self) -> Option<&Value>
Returns the partially resolved value if this was a partial failure.
Returns None for fatal errors where no value was produced.
Sourcepub fn ref_errors(&self) -> &[RefError]
pub fn ref_errors(&self) -> &[RefError]
Returns ref-level errors if this was a partial failure.
Returns an empty slice for fatal errors.
Trait Implementations§
Source§impl Clone for StrictResolveError
impl Clone for StrictResolveError
Source§fn clone(&self) -> StrictResolveError
fn clone(&self) -> StrictResolveError
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for StrictResolveError
impl Debug for StrictResolveError
Source§impl Display for StrictResolveError
impl Display for StrictResolveError
Source§impl Error for StrictResolveError
impl Error for StrictResolveError
Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
👎Deprecated since 1.42.0: use the Display impl or to_string()
Source§impl From<PartialResolveError> for StrictResolveError
impl From<PartialResolveError> for StrictResolveError
Source§fn from(source: PartialResolveError) -> Self
fn from(source: PartialResolveError) -> Self
Converts to this type from the input type.
Source§impl From<ResolveError> for StrictResolveError
impl From<ResolveError> for StrictResolveError
Source§fn from(source: ResolveError) -> Self
fn from(source: ResolveError) -> Self
Converts to this type from the input type.
Auto Trait Implementations§
impl Freeze for StrictResolveError
impl RefUnwindSafe for StrictResolveError
impl Send for StrictResolveError
impl Sync for StrictResolveError
impl Unpin for StrictResolveError
impl UnsafeUnpin for StrictResolveError
impl UnwindSafe for StrictResolveError
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
Mutably borrows from an owned value. Read more