Skip to main content

ValidationError

Enum ValidationError 

Source
#[non_exhaustive]
pub enum ValidationError {
Show 72 variants UnsupportedOpenApiVersion { version: String, }, UnsupportedComponentType { schema: String, kind: String, }, MissingComponentSchemaType { schema: String, }, MissingObjectProperties { schema: String, }, MissingPaths, UnsupportedEnumType { context: String, kind: String, }, NonArrayEnum { context: String, }, EmptyEnum { context: String, }, NonStringEnumValue { context: String, }, InvalidSatayEnumVariants { context: String, }, UnknownSatayEnumVariantValue { context: String, wire_name: String, }, InvalidSatayEnumVariantName { context: String, wire_name: String, }, DuplicateSatayEnumVariantName { context: String, rust_name: String, }, NonArrayRequired { context: String, }, NonStringRequiredField { context: String, }, UnsupportedIntegerFormat { context: String, format: String, }, UnsupportedNumberFormat { context: String, format: String, }, UnsupportedSatayParseAs { context: String, parse_as: String, }, InvalidSatayParseAs { context: String, }, SatayParseAsRequiresString { context: String, parse_as: String, kind: String, }, UnsupportedSatayIntegerType { context: String, integer_type: String, }, InvalidSatayIntegerType { context: String, }, SatayIntegerTypeRequiresInteger { context: String, integer_type: String, kind: String, }, MissingArrayItems { context: String, }, InlineObjectSchema { context: String, }, UnsupportedMapObjectSchema { context: String, }, UnsupportedSchemaType { context: String, kind: String, }, MissingSchemaType { context: String, }, UnsupportedBooleanSchema { context: String, }, MultipleNonNullSchemaTypesUnsupported { context: String, }, UnsupportedComposition { context: String, keyword: &'static str, }, InvalidStringLengthBounds { context: String, min_length: u64, max_length: u64, }, UniqueItemsUnsupported { context: String, }, InvalidArrayLengthBounds { context: String, min_items: u64, max_items: u64, }, UnsupportedKeyword { context: String, keyword: &'static str, }, InvalidNonNegativeIntegerKeyword { context: String, keyword: &'static str, }, InvalidBooleanKeyword { context: String, keyword: &'static str, }, ExclusiveLimitRequiresBound { context: String, exclusive_keyword: &'static str, keyword: &'static str, }, InvalidFiniteNumberKeyword { context: String, keyword: &'static str, }, ExpectedInteger { context: String, }, EmptyIntegerBounds { context: String, }, ExclusiveIntegerMinimumOverflow, ExclusiveIntegerMaximumOverflow, EmptyNumberBounds { context: String, }, MissingOperationResponses { operation_id: String, }, ExpectedArray { context: String, }, UnsupportedParameterLocation { context: String, wire_name: String, location: String, }, ContentParameterUnsupported { context: String, wire_name: String, }, MissingParameterSchema { context: String, wire_name: String, }, NullableParameterUnsupported { wire_name: String, }, ArrayPathParameterUnsupported { wire_name: String, }, ArrayHeaderParameterUnsupported { wire_name: String, }, PathParameterNotRequired { wire_name: String, }, MissingContent { context: String, }, MissingJsonContent { context: String, }, MissingJsonSchema { context: String, }, DefaultResponseBodyUnsupported { context: String, }, InvalidStatusCode { context: String, status: String, }, OutOfRangeStatusCode { context: String, status_code: u16, }, MissingResponseJsonContent { context: String, status: String, }, UnclosedPathParameter { path: String, }, EmptyPathParameter { path: String, }, UndeclaredPathParameter { path: String, name: String, }, UnusedPathParameter { path: String, name: String, }, ResolveReference { reference: String, context: String, source: Box<ValidationError>, }, NonLocalReference, InvalidLocalReference, MissingJsonPointerToken { token: String, }, InvalidComponentReference { reference: String, section: &'static str, }, CircularReference { reference: String, }, ExpectedObject { context: String, }, ExpectedObjectField { context: String, field: &'static str, },
}
Expand description

Errors that can occur while validating an OpenAPI document.

This enum is non_exhaustive so new variants may be added in future releases without a semver break.

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

UnsupportedOpenApiVersion

The OpenAPI version is not supported.

Error message: unsupported OpenAPI version {version}; Satay supports OpenAPI 3.1

Fields

§version: String
§

UnsupportedComponentType

A schema component uses a type that is not supported.

Error message: unsupported type {kind}in schema{schema}``

Fields

§schema: String
§kind: String
§

MissingComponentSchemaType

A schema component is missing a required type, $ref, enum, or properties declaration.

Error message: schema {schema}must declaretype, $ref, enum, or properties``

Fields

§schema: String
§

MissingObjectProperties

An object schema is missing the required properties field.

Error message: object schema {schema}must declareproperties``

Fields

§schema: String
§

MissingPaths

The OpenAPI document is missing the required paths field.

Error message: OpenAPI document must declare paths``

§

UnsupportedEnumType

A schema uses an enum with a non-string type.

Error message: {context} uses enum type {kind}; only string enums are supported

Fields

§context: String
§kind: String
§

NonArrayEnum

A schema declares an enum that is not an array.

Error message: {context} has a non-array enum

Fields

§context: String
§

EmptyEnum

A schema declares an enum with no values.

Error message: {context} has an empty enum

Fields

§context: String
§

NonStringEnumValue

A schema enum contains a non-string value.

Error message: {context} contains a non-string enum value; only string enums are supported

Fields

§context: String
§

InvalidSatayEnumVariants

An x-satay.enum-variants value is not an object.

Error message: {context}.x-satay.enum-variants must be an object

Fields

§context: String
§

UnknownSatayEnumVariantValue

An x-satay.enum-variants entry points at a value that is not in the enum.

Error message: {context}.x-satay.enum-variants contains {wire_name}, which is not declared in the enum

Fields

§context: String
§wire_name: String
§

InvalidSatayEnumVariantName

An x-satay.enum-variants entry has a non-string Rust variant name.

Error message: {context}.x-satay.enum-variants[{wire_name:?}] must be a string

Fields

§context: String
§wire_name: String
§

DuplicateSatayEnumVariantName

Two x-satay.enum-variants entries produce the same Rust variant name.

Error message: {context}.x-satay.enum-variants maps multiple values to {rust_name}``

Fields

§context: String
§rust_name: String
§

NonArrayRequired

A schema has a required field that is not an array.

Error message: {context} has a non-array required field

Fields

§context: String
§

NonStringRequiredField

A schema required array contains a non-string element.

Error message: {context} has a non-string required field name

Fields

§context: String
§

UnsupportedIntegerFormat

An integer schema uses an unsupported format.

Error message: {context} uses unsupported integer format {format}``

Fields

§context: String
§format: String
§

UnsupportedNumberFormat

A number schema uses an unsupported format.

Error message: {context} uses unsupported number format {format}``

Fields

§context: String
§format: String
§

UnsupportedSatayParseAs

An x-satay.parse-as value is not a supported target type.

Error message: {context} uses unsupported x-satay.parse-as {parse_as}``

Fields

§context: String
§parse_as: String
§

InvalidSatayParseAs

An x-satay.parse-as value is not a string.

Error message: {context}.x-satay.parse-as must be a string

Fields

§context: String
§

SatayParseAsRequiresString

x-satay.parse-as was applied to an unsupported wire schema.

Error message: {context} uses x-satay.parse-as {parse_as}on{kind}; supported parse-as wire schemas are string schemas, plus integer schemas for bool

Fields

§context: String
§parse_as: String
§kind: String
§

UnsupportedSatayIntegerType

An x-satay.integer-type value is not a supported Rust integer type.

Error message: {context} uses unsupported x-satay.integer-type {integer_type}``

Fields

§context: String
§integer_type: String
§

InvalidSatayIntegerType

An x-satay.integer-type value is not a string.

Error message: {context}.x-satay.integer-type must be a string

Fields

§context: String
§

SatayIntegerTypeRequiresInteger

x-satay.integer-type was applied to a non-integer schema.

Error message: {context} uses x-satay.integer-type {integer_type}on{kind}; supported integer-type wire schemas are integer schemas and string schemas with x-satay.parse-as integer-range

Fields

§context: String
§integer_type: String
§kind: String
§

MissingArrayItems

An array schema is missing the required items field.

Error message: {context} array schema must declare items``

Fields

§context: String
§

InlineObjectSchema

A schema defines an inline object instead of using a $ref.

Error message: {context} is an inline object schema; move it to components/schemas and use $ref``

Fields

§context: String
§

UnsupportedMapObjectSchema

An object schema has no properties (i.e. acts as a map/dictionary), which is unsupported.

Error message: {context} is an object without properties; map/object schemas are not supported yet

Fields

§context: String
§

UnsupportedSchemaType

A schema uses an unsupported type.

Error message: {context} uses unsupported schema type {kind}``

Fields

§context: String
§kind: String
§

MissingSchemaType

A schema is missing a required type, $ref, or enum declaration.

Error message: {context} must declare type, $ref, or enum``

Fields

§context: String
§

UnsupportedBooleanSchema

A JSON Schema boolean schema was used; Satay has no IR equivalent yet.

Error message: {context} is a boolean schema; boolean JSON Schemas are not supported yet

Fields

§context: String
§

MultipleNonNullSchemaTypesUnsupported

A schema type array contains more than one non-null type.

Error message: {context} declares multiple non-null schema types; Satay supports at most one plus null

Fields

§context: String
§

UnsupportedComposition

A schema uses a composition keyword (allOf, anyOf, oneOf) that is outside MVP scope.

Error message: {context} uses {keyword}, which is not in the MVP scope

Fields

§context: String
§keyword: &'static str
§

InvalidStringLengthBounds

A string schema specifies a minLength greater than its maxLength.

Error message: {context} has minLength {min_length} greater than maxLength {max_length}

Fields

§context: String
§min_length: u64
§max_length: u64
§

UniqueItemsUnsupported

A schema uses uniqueItems, which cannot be enforced by generated Vec-backed types.

Error message: {context} uses uniqueItems; generated Vec-backed types cannot enforce uniqueness yet

Fields

§context: String
§

InvalidArrayLengthBounds

An array schema specifies minItems greater than maxItems.

Error message: {context} has minItems {min_items} greater than maxItems {max_items}

Fields

§context: String
§min_items: u64
§max_items: u64
§

UnsupportedKeyword

A schema uses a keyword that is not safely supported.

Error message: {context} uses {keyword}, which is not safely supported yet

Fields

§context: String
§keyword: &'static str
§

InvalidNonNegativeIntegerKeyword

A schema keyword that must be a non-negative integer has an invalid value.

Error message: {context}.{keyword} must be a non-negative integer

Fields

§context: String
§keyword: &'static str
§

InvalidBooleanKeyword

A schema keyword that must be a boolean has an invalid value.

Error message: {context}.{keyword} must be a boolean

Fields

§context: String
§keyword: &'static str
§

ExclusiveLimitRequiresBound

An exclusiveMinimum/exclusiveMaximum keyword is present but the corresponding bound is missing.

Error message: {context}.{exclusive_keyword} requires {keyword}``

Fields

§context: String
§exclusive_keyword: &'static str
§keyword: &'static str
§

InvalidFiniteNumberKeyword

A schema keyword that must be a finite number has a non-finite value.

Error message: {context}.{keyword} must be a finite number

Fields

§context: String
§keyword: &'static str
§

ExpectedInteger

A value expected to be an integer is not.

Error message: {context} must be an integer

Fields

§context: String
§

EmptyIntegerBounds

Integer bounds (minimum/maximum) do not permit any value.

Error message: {context} integer bounds do not allow any value

Fields

§context: String
§

ExclusiveIntegerMinimumOverflow

An exclusive integer minimum overflows i64.

Error message: exclusive integer minimum overflows

§

ExclusiveIntegerMaximumOverflow

An exclusive integer maximum overflows i64.

Error message: exclusive integer maximum overflows

§

EmptyNumberBounds

Number bounds (minimum/maximum) do not permit any value.

Error message: {context} number bounds do not allow any value

Fields

§context: String
§

MissingOperationResponses

An operation does not declare any responses.

Error message: operation {operation_id} must declare responses

Fields

§operation_id: String
§

ExpectedArray

A value expected to be an array is not.

Error message: {context} must be an array

Fields

§context: String
§

UnsupportedParameterLocation

A parameter uses an unsupported location (e.g. cookie) instead of path, query, or header.

Error message: {context} parameter {wire_name}is in{location}; only path, query, and header parameters are supported

Fields

§context: String
§wire_name: String
§location: String
§

ContentParameterUnsupported

A parameter uses content instead of schema.

Error message: {context} parameter {wire_name}usescontent; schema parameters are required

Fields

§context: String
§wire_name: String
§

MissingParameterSchema

A parameter is missing a required schema declaration.

Error message: {context} parameter {wire_name} must declare schema

Fields

§context: String
§wire_name: String
§

NullableParameterUnsupported

A parameter is nullable, which is not supported.

Error message: parameter {wire_name} is nullable; nullable parameters are not supported

Fields

§wire_name: String
§

ArrayPathParameterUnsupported

A path parameter is an array, which is not supported.

Error message: path parameter {wire_name} is an array; array path parameter styles are not supported

Fields

§wire_name: String
§

ArrayHeaderParameterUnsupported

A header parameter is an array, which is not supported.

Error message: header parameter {wire_name} is an array; array header parameter styles are not supported

Fields

§wire_name: String
§

PathParameterNotRequired

A path parameter does not set required: true.

Error message: path parameter {wire_name} must set required: true

Fields

§wire_name: String
§

MissingContent

A context is missing a required content declaration.

Error message: {context} must declare content

Fields

§context: String
§

MissingJsonContent

A context is missing the required application/json content type.

Error message: {context} must declare application/json content

Fields

§context: String
§

MissingJsonSchema

A context’s application/json content is missing a schema.

Error message: {context} application/json content must declare schema

Fields

§context: String
§

DefaultResponseBodyUnsupported

A response body uses the default status, which is not yet supported for decoding.

Error message: {context} contains a default response body; default response decoding is not supported yet

Fields

§context: String
§

InvalidStatusCode

A response contains an invalid HTTP status code string.

Error message: {context} contains invalid status code {status}``

Fields

§context: String
§status: String
§

OutOfRangeStatusCode

A response contains a status code outside the valid 100–599 range.

Error message: {context} contains out-of-range status code {status_code}``

Fields

§context: String
§status_code: u16
§

MissingResponseJsonContent

A response for a given status code is missing application/json content.

Error message: {context} {status} response must declare application/json content

Fields

§context: String
§status: String
§

UnclosedPathParameter

A path template contains a parameter that is never closed.

Error message: path {path} contains an unclosed parameter

Fields

§path: String
§

EmptyPathParameter

A path template contains an empty parameter (e.g. {}).

Error message: path {path} contains an empty parameter

Fields

§path: String
§

UndeclaredPathParameter

A path template references a parameter that is not declared in the operation’s parameters.

Error message: path {path}uses parameter{name} but it is not declared

Fields

§path: String
§name: String
§

UnusedPathParameter

A parameter is declared for a path but never used in the path template.

Error message: path parameter {name}is declared but not used in path{path}``

Fields

§path: String
§name: String
§

ResolveReference

A $ref could not be resolved because the referenced component failed validation.

Error message: failed to resolve reference {reference} in {context}: {source}

Fields

§reference: String
§context: String
§

NonLocalReference

A reference points to an external document; only local (#) references are supported.

Error message: only local references are supported

§

InvalidLocalReference

A local reference is not a valid JSON pointer.

Error message: local reference must be a JSON pointer

§

MissingJsonPointerToken

A JSON pointer is missing a required token segment.

Error message: missing {token}``

Fields

§token: String
§

InvalidComponentReference

A $ref does not point to the expected #/components/{section}/… path.

Error message: reference {reference} must point to #/components/{section}/...

Fields

§reference: String
§section: &'static str
§

CircularReference

A local $ref chain references itself.

Error message: circular reference {reference}``

Fields

§reference: String
§

ExpectedObject

A value expected to be an object is not.

Error message: {context} must be an object

Fields

§context: String
§

ExpectedObjectField

A nested field expected to be an object is not.

Error message: {context}.{field} must be an object

Fields

§context: String
§field: &'static str

Trait Implementations§

Source§

impl Debug for ValidationError

Source§

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

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

impl Display for ValidationError

Source§

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

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

impl Error for ValidationError

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 From<ValidationError> for Error

Source§

fn from(source: ValidationError) -> Self

Converts to this type from the input type.

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> 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> 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 = Infallible

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