MCPcopy Create free account
hub / github.com/biblius/validify / validate_nested

Function validate_nested

derive_tests/tests/validify.rs:168–184  ·  view source on GitHub ↗
(nested: &NestedInput)

Source from the content-addressed store, hash-verified

166}
167
168fn validate_nested(nested: &NestedInput) -> Result<(), ValidationErrors> {
169 let mut errs = ValidationErrors::new();
170
171 if nested.a.is_none() && nested.b.is_none() {
172 errs.add(ValidationError::new_schema("Can't both be empty"));
173 }
174
175 if nested.a.is_some() && nested.b.is_some() {
176 errs.add(ValidationError::new_schema("Can't both be some"));
177 }
178
179 if errs.is_empty() {
180 return Ok(());
181 }
182
183 Err(errs)
184}
185
186#[test]
187fn schema_mod_val() {

Callers

nothing calls this directly

Calls 2

addMethod · 0.80
is_emptyMethod · 0.80

Tested by

no test coverage detected