(input: &Input)
| 153 | } |
| 154 | |
| 155 | fn validate_input(input: &Input) -> Result<(), ValidationErrors> { |
| 156 | let mut errs = ValidationErrors::new(); |
| 157 | if input.a.is_empty() && input.b > 2 { |
| 158 | errs.add(ValidationError::new_schema( |
| 159 | "A is empty and b is more than 2", |
| 160 | )); |
| 161 | } |
| 162 | if errs.is_empty() { |
| 163 | return Ok(()); |
| 164 | } |
| 165 | Err(errs) |
| 166 | } |
| 167 | |
| 168 | fn validate_nested(nested: &NestedInput) -> Result<(), ValidationErrors> { |
| 169 | let mut errs = ValidationErrors::new(); |