schemastore
Parse and match files against the SchemaStore catalog.
SchemaStore is a community-maintained collection of JSON Schema definitions for common configuration files. This crate deserializes the catalog and matches file paths to their corresponding schemas using the fileMatch glob patterns.
Usage
use ;
// Fetch the catalog JSON yourself (using ureq, reqwest, etc.)
let json: String = get.call?.body_mut.read_to_string?;
let value: Value = from_str?;
let catalog = parse_catalog?;
let compiled = compile;
compiled.find_schema;
// => Some("https://json.schemastore.org/tsconfig.json")
compiled.find_schema;
// => Some("https://www.schemastore.org/github-workflow.json")
API
CATALOG_URL— the well-known URL for the SchemaStore catalog JSONCatalog/SchemaEntry— serde types for the catalogparse_catalog(Value)— deserialize the catalog from aserde_json::ValueCompiledCatalog::compile(&Catalog)— pre-compile allfileMatchglobsCompiledCatalog::find_schema(path, file_name)— look up the schema URL for a file path
Bare filename patterns (e.g. tsconfig.json) are automatically expanded to also match nested paths (**/tsconfig.json). Negation patterns (starting with !) are skipped.
Design
This crate is #![no_std] — it only depends on alloc, serde, serde_json, and glob-match. No HTTP client is included; callers fetch the catalog JSON themselves.