Expand description
Input object-level validation.
This module provides validation capabilities at the input object level, applying cross-field rules and aggregating errors from multiple validators.
§Examples
use fraiseql_core::validation::{InputObjectRule, validate_input_object};
use serde_json::json;
// Validate entire input object
let input = json!({
"name": "John",
"email": "john@example.com",
"phone": null
});
let validators = vec![
InputObjectRule::AnyOf { fields: vec!["email".to_string(), "phone".to_string()] },
InputObjectRule::ConditionalRequired {
if_field: "name".to_string(),
then_fields: vec!["email".to_string()],
},
];
validate_input_object(&input, &validators, None).unwrap();Structs§
- Input
Object Validation Result - Result of validating an input object, aggregating multiple errors.
Enums§
- Input
Object Rule - Rules that apply at the input object level.
Functions§
- validate_
input_ object - Validate an input object against a set of rules.