provenant/license_detection/embedded/schema.rs
1//! Schema definitions for the embedded loader artifact.
2//!
3//! This module defines the top-level wrapper types for the serialized
4//! loader artifact that is embedded in the binary.
5
6use serde::{Deserialize, Serialize};
7
8use crate::license_detection::models::{LoadedLicense, LoadedRule};
9
10/// Schema version for the embedded loader artifact.
11///
12/// This version should be incremented whenever the artifact format changes
13/// in a way that is not backwards-compatible.
14pub const SCHEMA_VERSION: u32 = 1;
15
16/// Top-level wrapper for the embedded loader artifact.
17///
18/// This structure is serialized at build time and embedded in the binary.
19/// At runtime, it is deserialized and fed into the build stage to construct
20/// the runtime `LicenseIndex`.
21#[derive(Debug, Clone, Serialize, Deserialize)]
22pub struct EmbeddedLoaderSnapshot {
23 /// Schema version for compatibility checking.
24 pub schema_version: u32,
25
26 /// Loaded rules from the ScanCode dataset.
27 pub rules: Vec<LoadedRule>,
28
29 /// Loaded licenses from the ScanCode dataset.
30 pub licenses: Vec<LoadedLicense>,
31}