(nested: &NestedInput)
| 166 | } |
| 167 | |
| 168 | fn 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] |
| 187 | fn schema_mod_val() { |