jsonschema_schema/extensions/lintel.rs
1use alloc::collections::BTreeMap;
2
3use serde::{Deserialize, Serialize};
4use serde_json::Value;
5
6/// [Lintel] provenance metadata (`x-lintel`).
7///
8/// Embedded by the Lintel catalog builder to record where a schema was
9/// fetched from and its content hash, enabling cache validation and
10/// source attribution.
11///
12/// Serialized as a single nested JSON object under the `x-lintel` key:
13///
14/// ```json
15/// {
16/// "x-lintel": {
17/// "source": "https://json.schemastore.org/tsconfig.json",
18/// "sourceSha256": "a1b2c3..."
19/// }
20/// }
21/// ```
22///
23/// [Lintel]: https://github.com/lintel-rs/lintel
24#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize, schemars::JsonSchema)]
25#[serde(rename_all = "camelCase")]
26pub struct LintelSchemaExt {
27 /// URL the schema was originally fetched from.
28 #[serde(skip_serializing_if = "Option::is_none")]
29 pub source: Option<String>,
30 /// SHA-256 hex digest of the original schema content before any
31 /// transformations (migration, injection, etc.).
32 #[serde(skip_serializing_if = "Option::is_none")]
33 pub source_sha256: Option<String>,
34 /// Catch-all for any additional Lintel-specific properties added in
35 /// the future.
36 #[serde(flatten)]
37 pub extra: BTreeMap<String, Value>,
38}