Skip to main content

ValidationError

Enum ValidationError 

Source
pub enum ValidationError {
Show 22 variants NoQuestions, MissingInstructions(String), ChoiceCriteriaEmpty(String), ScoreCriteriaTooFew(String), ScoreLevelEmpty { id: String, index: usize, }, NoulTrueEmpty(String), NoulFalseEmpty(String), ChoiceNotInCriteria(String), ProbabilityKeysMismatch(String), ProbabilitiesDontSum { id: String, sum: f64, }, ProbabilityOutOfRange { id: String, value: f64, }, ConfidenceOutOfRange { id: String, value: f64, }, NoulOutOfRange { id: String, value: f64, }, ScoreLegendMismatch(String), ScoreIndexNotNumeric { id: String, key: String, }, ScoreOutOfRange { id: String, max: f64, value: f64, }, ScoreExpectationMismatch { id: String, expected: f64, value: f64, }, TooManyQuestions { count: usize, max: usize, }, TooManyCriteriaOptions { id: String, count: usize, max: usize, }, MissingAnswer(String), UnexpectedAnswer(String), AnswerTypeMismatch { id: String, expected: &'static str, actual: &'static str, },
}
Expand description

Validation errors representing violations of the Jev protocol specification.

When encountered in the API layer, these errors are translated directly into HTTP 422 Unprocessable Entity responses (invalid_body code) with detailed diagnostic messages.

Variants§

§

NoQuestions

Emitted when a request contains an empty questions map. The Jev specification requires at least one question per evaluation request.

§

MissingInstructions(String)

Emitted when a question does not provide non-empty instructions. Instructions must be a non-empty string, object, or array.

§

ChoiceCriteriaEmpty(String)

Emitted when a choice question provides an empty criteria map. A choice question must have at least one selectable option.

§

ScoreCriteriaTooFew(String)

Emitted when a score question provides fewer than 2 rubric levels in criteria. An ordinal rating rubric requires at least 2 distinct levels.

§

ScoreLevelEmpty

Emitted when any rubric level description in a score question is empty.

Fields

§id: String

Identifier of the question with the empty level description.

§index: usize

Zero-based index of the invalid empty level.

§

NoulTrueEmpty(String)

Emitted when a noul question’s criteria specifies an empty true description.

§

NoulFalseEmpty(String)

Emitted when a noul question’s criteria specifies an empty false description.

§

ChoiceNotInCriteria(String)

Emitted when a choice answer’s selected choice string does not match any key in the question’s criteria.

§

ProbabilityKeysMismatch(String)

Emitted when the keys in a choice answer’s probabilities map do not exactly match the question’s criteria keys.

§

ProbabilitiesDontSum

Emitted when probabilities in an answer distribution do not sum to 1.0 (within epsilon tolerance).

Fields

§id: String

Question identifier.

§sum: f64

Calculated sum of the probability distribution.

§

ProbabilityOutOfRange

Emitted when any probability value in an answer distribution is outside the valid range [0.0, 1.0] or NaN.

Fields

§id: String

Question identifier.

§value: f64

Invalid probability value.

§

ConfidenceOutOfRange

Emitted when an answer’s confidence score is outside [0.0, 1.0] or NaN.

Fields

§id: String

Question identifier.

§value: f64

Invalid confidence value.

§

NoulOutOfRange

Emitted when a noul answer value is outside [0.0, 1.0] or NaN.

Fields

§id: String

Question identifier.

§value: f64

Invalid noul probability value.

§

ScoreLegendMismatch(String)

Emitted when a score answer’s legend disagrees with its probability keys or the requested rubric.

§

ScoreIndexNotNumeric

Emitted when a score answer’s legend or probability key cannot be parsed as a numeric index string (e.g. “0”, “1”).

Fields

§id: String

Question identifier.

§key: String

Non-numeric key string encountered.

§

ScoreOutOfRange

Emitted when a score answer’s score is outside [0.0, max_level], NaN, or infinite.

Fields

§id: String

Question identifier.

§max: f64

Maximum allowed score index.

§value: f64

Invalid score value.

§

ScoreExpectationMismatch

Emitted when a score disagrees with its probability-weighted rubric levels.

Fields

§id: String

Question identifier.

§expected: f64

Probability-weighted mean of the returned level indices.

§value: f64

Inconsistent returned score.

§

TooManyQuestions

Emitted when a request contains more questions than the maximum allowed limit.

Fields

§count: usize

Number of questions in the request.

§max: usize

Maximum allowed questions.

§

TooManyCriteriaOptions

Emitted when a question’s criteria options exceed the maximum allowed limit.

Fields

§id: String

Question identifier.

§count: usize

Number of criteria options.

§max: usize

Maximum allowed criteria options.

§

MissingAnswer(String)

Emitted when a response lacks an answer for a question id the caller supplied.

§

UnexpectedAnswer(String)

Emitted when a response contains an answer for a question id that was not requested.

§

AnswerTypeMismatch

Emitted when an answer uses a different primitive than its question.

Fields

§id: String

Question identifier.

§expected: &'static str

Requested primitive.

§actual: &'static str

Returned primitive.

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

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

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, 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 = !

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.