pub struct BodyValidationError {
pub expected_type: String,
pub field_path: String,
pub expected: String,
pub got: String,
pub hint: String,
pub expected_cardinality: String,
pub got_cardinality: String,
pub got_length: Option<u64>,
pub remediation_url: String,
}Expand description
Structured body-validation error. The HTTP layer projects this into a 400 Bad Request with the field/expected/got triple so adopter clients can correct their request without server-side log diving.
Fields§
§expected_type: StringTop-level body type the validation was attempted against (e.g.
"LoanApplication").
field_path: StringDotted path to the offending field: "applicant.address.street"
for nested structures, "[2].name" for list-element index 2.
Empty string when the violation is at the top-level body itself
(e.g. expected object, got string).
expected: StringDeclared type the validator expected.
got: StringJSON-type tag observed ("string", "number", "integer",
"boolean", "array", "object", "null", "missing").
hint: StringAdopter-facing diagnostic — full sentence with a corrective hint. Stable across versions per D8 backwards-compat surface.
expected_cardinality: String§Fase 38.x.f (D2) — Declared cardinality kind of the expected
type: "singular" | "plural" | "stream" | "unit" |
"unknown". Empty string for primitive-type validation errors
where the cardinality isn’t load-bearing (the existing v1.39.0
surface). Serde #[serde(default)] keeps adopter consumers of
older versions byte-compatible.
got_cardinality: String§Fase 38.x.f (D2) — Observed cardinality kind of the response
body: same alphabet as expected_cardinality. Empty when not
applicable. The asymmetry expected/got is the diagnostic
payload adopters reach for first when D5 fires.
got_length: Option<u64>§Fase 38.x.f (D2) — Length of the observed value when it is
array (plural). None for non-array gots. Helps adopters
confirm “the flow returned 1 row, but the contract said
singular — collapse with result[0] or change the endpoint
to output: List<T>”.
remediation_url: String§Fase 38.x.f (D2) — Documentation URL adopters can follow for the canonical remediation steps. Empty when the error is not a cardinality mismatch (the existing v1.39.0 surface). The URL is stable; the page may evolve.
Trait Implementations§
Source§impl Clone for BodyValidationError
impl Clone for BodyValidationError
Source§fn clone(&self) -> BodyValidationError
fn clone(&self) -> BodyValidationError
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 BodyValidationError
impl Debug for BodyValidationError
Source§impl Default for BodyValidationError
impl Default for BodyValidationError
Source§fn default() -> BodyValidationError
fn default() -> BodyValidationError
Source§impl Display for BodyValidationError
impl Display for BodyValidationError
Source§impl Error for BodyValidationError
impl Error for BodyValidationError
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 BodyValidationError
impl PartialEq for BodyValidationError
Source§fn eq(&self, other: &BodyValidationError) -> bool
fn eq(&self, other: &BodyValidationError) -> bool
self and other values to be equal, and is used by ==.Source§impl Serialize for BodyValidationError
impl Serialize for BodyValidationError
impl StructuralPartialEq for BodyValidationError
Auto Trait Implementations§
impl Freeze for BodyValidationError
impl RefUnwindSafe for BodyValidationError
impl Send for BodyValidationError
impl Sync for BodyValidationError
impl Unpin for BodyValidationError
impl UnsafeUnpin for BodyValidationError
impl UnwindSafe for BodyValidationError
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<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more