()
| 362 | |
| 363 | #[test] |
| 364 | fn test_validate_nested_object() { |
| 365 | let schema = serde_json::json!({ |
| 366 | "type": "object", |
| 367 | "required": ["user"], |
| 368 | "properties": { |
| 369 | "user": { |
| 370 | "type": "object", |
| 371 | "required": ["email"], |
| 372 | "properties": { |
| 373 | "email": {"type": "string"} |
| 374 | } |
| 375 | } |
| 376 | } |
| 377 | }); |
| 378 | let good = serde_json::json!({"user": {"email": "a@b.com"}}); |
| 379 | assert!(validate_against_schema(&good, &schema).is_ok()); |
| 380 | |
| 381 | let bad = serde_json::json!({"user": {}}); |
| 382 | let errors = validate_against_schema(&bad, &schema).unwrap_err(); |
| 383 | assert!(errors.iter().any(|e| e.contains("email"))); |
| 384 | } |
| 385 | |
| 386 | // ======================================================================== |
| 387 | // generate_blocking tests |
nothing calls this directly
no test coverage detected