Module schema_discovery

Module schema_discovery 

Source
Expand description

Intelligent schema discovery from content and HTML Intelligent schema discovery service

Automatically infers JSON Schema definitions from:

  1. JSON/object examples — type-inspects values to generate schema
  2. HTML content — uses an AI provider to suggest extraction schemas
  3. User corrections — applies overrides stored in a correction map
  4. Evolution detection — compares new inferences against cached schemas

The service sits in the application layer and depends on AIProvider for LLM-assisted HTML schema inference.

§Example

use stygian_graph::application::schema_discovery::{SchemaDiscoveryService, SchemaDiscoveryConfig};
use serde_json::json;

let service = SchemaDiscoveryService::new(SchemaDiscoveryConfig::default(), None);

// Infer from a JSON example
let example = json!({"name": "Alice", "age": 30, "active": true});
let schema = service.infer_from_example(&example);
assert_eq!(schema["type"].as_str().unwrap(), "object");

Structs§

DiscoveredSchema
Discovered schema with metadata
SchemaDiff
Schema evolution diff — describes changes between two schema versions
SchemaDiscoveryConfig
Configuration for the schema discovery service
SchemaDiscoveryService
Intelligent schema discovery service

Enums§

SchemaSource
How a schema was derived