Skip to main content

SpecError

Enum SpecError 

Source
#[non_exhaustive]
pub enum SpecError {
Show 31 variants DuplicateOperationId { operation_id: String, first: String, }, DuplicatePathTemplate { template: String, existing: String, }, InvalidPathTemplate { template: String, reason: InvalidPathTemplate, }, UndeclaredPathVariable { name: String, }, UnusedPathParameter { name: String, }, PathParameterNotRequired { name: String, }, DuplicateParameter { name: String, location: String, }, ShortCircuitMismatch { name: String, declared: Vec<u16>, described: Vec<u16>, }, IllegalStyle { style: String, location: String, }, IgnoredHeaderParameter { name: String, }, IgnoredHeader { name: String, }, NoResponses, ConflictingEncoding, MissingResponseDescription, InvalidComponentName { name: String, }, DuplicateTag { name: String, }, UnknownTagParent { name: String, parent: String, }, TagParentCycle { name: String, }, UnknownSecurityScheme { name: String, }, UndocumentedTag { name: String, }, EmptyServerVariableEnum { name: String, }, ServerVariableDefaultNotInEnum { name: String, }, InvalidExtensionName { name: String, }, UncheckedSchema, NotAuthoritative, OpaqueOperation { reasons: Vec<OpaqueReason>, }, OpaqueRoute { pattern: String, }, AuthorityNotStamped, MalformedAnnotation { name: String, detail: String, }, EmptyDocument, RequiresV3_2 { blockers: Vec<String>, },
}
Expand description

A way in which a document fails to conform.

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

DuplicateOperationId

The same operationId was used more than once.

Fields

§operation_id: String

The repeated identifier.

§first: String

Where it was first seen.

§

DuplicatePathTemplate

Two path templates differ only in the names of their variables.

Fields

§template: String

The template being added.

§existing: String

The template already present.

§

InvalidPathTemplate

A paths key is not a legal path template.

Reachable only for a description read from somewhere else: a template Kynos constructs is checked when it is parsed.

reason holds the parse failure itself rather than its text, so a caller can match on which rule the key broke. It is interpolated rather than declared as a #[source]: a violation is rendered in a list, so its message has to be self-contained, and a cause could then only repeat it.

Fields

§template: String

The offending key.

§reason: InvalidPathTemplate

Why it is not one.

§

UndeclaredPathVariable

A path template variable has no corresponding parameter.

Fields

§name: String

The variable named in the template.

§

UnusedPathParameter

A path parameter does not appear in the path template.

Fields

§name: String

The declared parameter.

§

PathParameterNotRequired

A path parameter was not marked required.

Fields

§name: String

The offending parameter.

§

DuplicateParameter

Two parameters share a name and location.

Fields

§name: String

The parameter name.

§location: String

Where it is carried.

§

ShortCircuitMismatch

An interceptor’s short circuit declared statuses its responses do not describe, or the reverse.

Only reachable from a hand-written ShortCircuit; the one the ApiError derive emits comes from the same declaration as the responses and cannot disagree with them.

Fields

§name: String

The short-circuit type.

§declared: Vec<u16>

What its STATUSES const claimed.

§described: Vec<u16>

What its Responses actually described.

§

IllegalStyle

A serialization style is not legal at a parameter’s location.

Fields

§style: String

The style used.

§location: String

The location it was used at.

§

IgnoredHeaderParameter

A header was declared as a parameter despite being ignored.

Fields

§name: String

The offending header name.

§

IgnoredHeader

A header was declared in a headers map despite being ignored.

The parameter-side counterpart is SpecError::IgnoredHeaderParameter.

Fields

§name: String

The offending header name.

§

NoResponses

An operation declared no responses.

§

ConflictingEncoding

encoding was declared beside prefixEncoding or itemEncoding.

3.2 makes the three mutually exclusive: the first names properties, the other two name array positions, and an object cannot be both.

Gated, because the two fields it conflicts with are 3.2’s — under 3.1 there is nothing for encoding to conflict with, so a variant that existed there would be one no document could ever provoke.

§

MissingResponseDescription

A response carried no description, which 3.1 requires.

3.2 makes it optional, so this is raised only when validating against 3.1. The model holds Option<String> because a 3.2 document may state only a summary; the version is what decides whether that is legal.

§

InvalidComponentName

A component key used characters the specification forbids.

Fields

§name: String

The offending key.

§

DuplicateTag

Two tags share a name.

Fields

§name: String

The repeated tag name.

§

UnknownTagParent

A tag named a parent that does not exist.

Fields

§name: String

The tag with the parent.

§parent: String

The parent that does not exist.

§

TagParentCycle

A chain of tag parents forms a cycle.

Fields

§name: String

A tag on the cycle.

§

UnknownSecurityScheme

A security requirement named a scheme that is not declared.

Fields

§name: String

The name used in the requirement.

§

UndocumentedTag

An operation used a tag with no metadata.

Fields

§name: String

The tag used.

§

EmptyServerVariableEnum

A server variable’s enum was empty.

Fields

§name: String

The variable name.

§

ServerVariableDefaultNotInEnum

A server variable’s default was not among its permitted values.

Fields

§name: String

The variable name.

§

InvalidExtensionName

An extension field name was malformed or reserved.

Fields

§name: String

The offending field name.

§

UncheckedSchema

A schema was deliberately left unconstrained.

Located at the schema itself: one carrying the x-kynos-unchecked annotation wherever it is nested, or the permissive schema true where it is a media type’s own schema or itemSchema. A $ref is not followed, so a component is reported once, where it is defined.

§

NotAuthoritative

The description does not fully describe the service.

§

OpaqueOperation

An operation is emitted but is covered by an unchecked waiver.

It is still described; what it does is no longer verified.

Fields

§reasons: Vec<OpaqueReason>

Why the waiver was needed.

§

OpaqueRoute

A route is served but has no path template that could express it.

Fields

§pattern: String

The router’s matching pattern, verbatim.

§

AuthorityNotStamped

The description is opaque somewhere but does not say so at the root.

The document-level stamp is the one-glance signal a consumer reads before deciding whether to trust anything else, so a description that omits it while carrying an opaque operation or route is worse than one that is honestly incomplete.

§

MalformedAnnotation

A Kynos annotation was present but not in the shape Kynos emits.

detail is text where InvalidPathTemplate’s reason is a value, and the asymmetry is forced rather than chosen: this cause is a serde_json::Error, which is neither Clone nor PartialEq, so keeping it would cost the derives every other value in the validation model has.

Fields

§name: String

The offending field name.

§detail: String

What went wrong reading it.

§

EmptyDocument

The document declared nothing at all.

§

RequiresV3_2

The document uses constructs that only OpenAPI 3.2 can express.

Fields

§blockers: Vec<String>

Locations of the constructs standing in the way.

Trait Implementations§

Source§

impl Clone for SpecError

Source§

fn clone(&self) -> Self

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 Debug for SpecError

Source§

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

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

impl Display for SpecError

Source§

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

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

impl Eq for SpecError

Source§

impl Error for SpecError

1.30.0 · Source§

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

👎Deprecated since 1.42.0:

use the Display impl or to_string()

1.0.0 · Source§

fn cause(&self) -> Option<&dyn Error>

👎Deprecated since 1.33.0:

replaced by Error::source, which can support downcasting

Source§

fn provide<'a>(&'a self, request: &mut Request<'a>)

🔬This is a nightly-only experimental API. (error_generic_member_access)
Provides type-based access to context intended for error reports. Read more
Source§

impl PartialEq for SpecError

Source§

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

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

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

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for SpecError

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> 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> 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, 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> 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> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. 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, !>

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.