lintel_validate/catalog.rs
1use lintel_schema_cache::SchemaCache;
2use schema_catalog::Catalog;
3
4/// Fetch the `SchemaStore` catalog via the schema cache.
5///
6/// # Errors
7///
8/// Returns an error if the catalog cannot be fetched or parsed.
9pub async fn fetch_catalog(
10 cache: &SchemaCache,
11) -> Result<Catalog, Box<dyn core::error::Error + Send + Sync>> {
12 let (value, _status) = cache.fetch(schemastore::CATALOG_URL).await?;
13 let catalog = schemastore::parse_catalog(value)?;
14 Ok(catalog)
15}