1#![forbid(unsafe_code)]
4
5mod collector;
6mod parser;
7mod protocol;
8mod scan;
9mod schema;
10mod semantics;
11#[cfg(test)]
12mod test_support;
13mod validator;
14
15pub use collector::{CollectPathError, collect_candidate_paths, project_path};
16pub use parser::{ParseError, ParseOptions, ParsedNorm, parse_norm};
17pub use protocol::{
18 CollectResponse, CollectedNorm, CompatibilityConformance, CompatibilityProduct,
19 CompatibilityResponse, CompatibilityRustApi, Diagnostic, ErrorDetail, ErrorResponse,
20 InitAction, InitResponse, ParseResponse, ValidateResponse, ValidationResult, ValidationStatus,
21 ValidationSummary,
22};
23pub use scan::{
24 DirectoryObservation, NormCoverage, RecurringFilename, ScanNaming, ScanResponse, ScanSymlink,
25 ScanSymlinkAction, ScanSymlinkKind, ScannedDirectory, classify_name, is_ignored_directory,
26};
27pub use schema::{SchemaCompileError, SchemaViolation, validate_draft7};
28pub use semantics::{ReferenceResolver, ReferenceStatus, validate_frontmatter};
29pub use validator::{SchemaBundle, ValidationDiagnostics, ValidationOptions, validate_structure};
30
31pub const FORMAT_ID: &str = "norm-spec/a1";
33
34pub const PARSE_API_VERSION: &str = "norm-spec/parse/v1";
36
37pub const COLLECT_API_VERSION: &str = "norm-spec/collect/v1";
39
40pub const VALIDATE_API_VERSION: &str = "norm-spec/validate/v1";
42
43pub const INIT_API_VERSION: &str = "norm-spec/init/v1";
45
46pub const SCAN_API_VERSION: &str = "norm-spec/scan/v1";
48
49pub const ERROR_API_VERSION: &str = "norm-spec/error/v1";
51
52pub const COMPATIBILITY_API_VERSION: &str = "norm-spec/compatibility/v1";
54
55pub const RUST_API_VERSION: &str = "norm-spec/rust-api/v1";
57
58pub const CONTRACT_BUNDLE_API_VERSION: &str = "norm-spec/contract-bundle/v1";
60
61pub const CONFORMANCE_API_VERSION: &str = "norm-spec/conformance/v1";
63
64pub const A1_CLI_SUITE_ID: &str = "norm-spec/a1-cli/v1";
66
67pub const A1_CLI_CASE_COUNT: usize = 82;
69
70pub const A1_CLI_CONTRACT_DIGEST: &str =
72 "sha256:3d94441e9cde3ef9489618bdb8fbf37f6979331bea099acadf0136b65df7e2eb";
73
74#[must_use]
76pub const fn crate_version() -> &'static str {
77 env!("CARGO_PKG_VERSION")
78}
79
80#[cfg(test)]
81mod tests {
82 use super::{
83 A1_CLI_CASE_COUNT, A1_CLI_CONTRACT_DIGEST, A1_CLI_SUITE_ID, COLLECT_API_VERSION,
84 COMPATIBILITY_API_VERSION, CONFORMANCE_API_VERSION, CONTRACT_BUNDLE_API_VERSION,
85 ERROR_API_VERSION, FORMAT_ID, INIT_API_VERSION, PARSE_API_VERSION, RUST_API_VERSION,
86 SCAN_API_VERSION, VALIDATE_API_VERSION,
87 };
88
89 #[test]
90 fn protocol_identifiers_are_explicitly_versioned() {
91 assert_eq!(PARSE_API_VERSION, "norm-spec/parse/v1");
92 assert_eq!(COLLECT_API_VERSION, "norm-spec/collect/v1");
93 assert_eq!(VALIDATE_API_VERSION, "norm-spec/validate/v1");
94 assert_eq!(INIT_API_VERSION, "norm-spec/init/v1");
95 assert_eq!(SCAN_API_VERSION, "norm-spec/scan/v1");
96 assert_eq!(ERROR_API_VERSION, "norm-spec/error/v1");
97 assert_eq!(COMPATIBILITY_API_VERSION, "norm-spec/compatibility/v1");
98 assert_eq!(RUST_API_VERSION, "norm-spec/rust-api/v1");
99 assert_eq!(CONTRACT_BUNDLE_API_VERSION, "norm-spec/contract-bundle/v1");
100 assert_eq!(CONFORMANCE_API_VERSION, "norm-spec/conformance/v1");
101 assert_eq!(A1_CLI_SUITE_ID, "norm-spec/a1-cli/v1");
102 assert_eq!(A1_CLI_CASE_COUNT, 82);
103 assert_eq!(
104 A1_CLI_CONTRACT_DIGEST,
105 "sha256:3d94441e9cde3ef9489618bdb8fbf37f6979331bea099acadf0136b65df7e2eb"
106 );
107 assert_eq!(FORMAT_ID, "norm-spec/a1");
108 }
109}