Render a minimal valid JSON example for the schema. Always ends with a newline so the output is line-clean when piped to a file or another command.
(rs: &RootSchema, obj: &SchemaObject)
| 376 | /// Render a minimal valid JSON example for the schema. Always ends with a newline |
| 377 | /// so the output is line-clean when piped to a file or another command. |
| 378 | fn render_example(rs: &RootSchema, obj: &SchemaObject) -> String { |
| 379 | let v = example_for(rs, obj, &mut Vec::new()); |
| 380 | let mut s = serde_json::to_string_pretty(&v).unwrap_or_else(|_| String::from("null")); |
| 381 | s.push('\n'); |
| 382 | s |
| 383 | } |
| 384 | |
| 385 | /// Render the raw JSON Schema for this target, pretty-printed. |
| 386 | /// |
no test coverage detected
searching dependent graphs…