dump_expertise_schema

Function dump_expertise_schema 

Source
pub fn dump_expertise_schema() -> Value
Expand description

Generate JSON Schema for Expertise type

Returns the JSON Schema as a serde_json::Value for inspection or storage.

Examples found in repository?
examples/generate_schema.rs (line 9)
5fn main() {
6    println!("=== Expertise JSON Schema Generator ===\n");
7
8    // Generate schema
9    let schema = dump_expertise_schema();
10
11    // Print to stdout
12    println!("--- JSON Schema ---\n");
13    println!(
14        "{}",
15        serde_json::to_string_pretty(&schema).expect("Failed to serialize schema")
16    );
17
18    // Optionally save to file
19    // Uncomment to save:
20    /*
21    let output_path = "expertise-schema.json";
22    match save_expertise_schema(output_path) {
23        Ok(_) => println!("\n✅ Schema saved to: {}", output_path),
24        Err(e) => eprintln!("\n❌ Failed to save schema: {}", e),
25    }
26    */
27
28    println!("\n--- Schema Stats ---");
29    if let Some(obj) = schema.as_object() {
30        println!("Top-level keys: {}", obj.keys().count());
31        if let Some(defs) = obj.get("definitions").and_then(|v| v.as_object()) {
32            println!("Type definitions: {}", defs.keys().count());
33            println!("Defined types:");
34            for key in defs.keys() {
35                println!("  - {}", key);
36            }
37        }
38    }
39}