Expand description
Schema.org vocabulary validation engine.
Validates a StructuredDataGraph
against the official Schema.org vocabulary definitions. Produces a
ValidationResult containing typed diagnostics with severity levels,
machine-readable codes, and human-readable messages.
§Architecture
StructuredDataGraph
+---- for each SchemaNode:
+---- Type checker: unknown, deprecated, pending
+---- Property checker: unknown, wrong domain, superseded
+---- Value checker: type mismatch, coercion, enum validationAll Schema.org knowledge is compiled into static lookup functions at
build time – see vocabulary for details.
§Examples
use schemaorg_rs::{extract_all, validation};
let html = r#"<script type="application/ld+json">{
"@context": "https://schema.org",
"@type": "Product",
"name": "Widget"
}</script>"#;
let graph = extract_all(html).unwrap();
let result = validation::validate(&graph);
if result.has_errors() {
for diag in result.errors() {
eprintln!("{}: {}", diag.path, diag.message);
}
}Re-exports§
pub use diagnostics::DiagnosticCode;pub use diagnostics::Severity;pub use diagnostics::ValidationDiagnostic;
Modules§
- diagnostics
- Diagnostic types for Schema.org validation.
Structs§
- Validation
Result - Result of validating a
StructuredDataGraphagainst Schema.org.
Functions§
- validate
- Validates a
StructuredDataGraphagainst the Schema.org vocabulary.