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
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).
ProbabilityOutOfRange
Emitted when any probability value in an answer distribution is outside the valid range [0.0, 1.0] or NaN.
ConfidenceOutOfRange
Emitted when an answer’s confidence score is outside [0.0, 1.0] or NaN.
NoulOutOfRange
Emitted when a noul answer value is outside [0.0, 1.0] or NaN.
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”).
ScoreOutOfRange
Emitted when a score answer’s score is outside [0.0, max_level], NaN, or infinite.
Fields
ScoreExpectationMismatch
Emitted when a score disagrees with its probability-weighted rubric levels.
Fields
TooManyQuestions
Emitted when a request contains more questions than the maximum allowed limit.
TooManyCriteriaOptions
Emitted when a question’s criteria options exceed the maximum allowed limit.
Fields
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.
Trait Implementations§
Source§impl Debug for ValidationError
impl Debug for ValidationError
Source§impl Display for ValidationError
impl Display for ValidationError
Source§impl Error for ValidationError
impl Error for ValidationError
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()