The shared Rust crate for loading, parsing, and validating the YAML regulation corpus.
The corpus library is a shared Rust crate for loading and managing the regulation corpus. It abstracts over multiple source types (local filesystem and GitHub repositories) and handles YAML parsing, registry management, and schema validation.
packages/corpus/The corpus library provides a single API for loading law files regardless of where they are stored. It reads the corpus-registry.yaml manifest, authenticates with remote sources, fetches YAML files, and parses them into typed Rust structures.
Other packages use it:
| Module | Purpose |
|---|---|
registry.rs | CorpusRegistry - loads corpus-registry.yaml, merges local overrides |
source_map.rs | SourceMap - maps law IDs to parsed regulation YAML |
models.rs | Source, SourceType (Local/GitHub), RegistryManifest |
github.rs | GitHubFetcher - fetches YAML via GitHub API (feature-gated) |
validation.rs | Schema validation against the JSON schema |
auth.rs | Token management for private repositories |
client.rs | CorpusClient - higher-level read/write access used by editor-api |
backend.rs, pr_client.rs | Git/GitHub write backends for editing through pull requests |
repo_access.rs | Validates that a token can reach a private repository |
annotation_schema.rs, dto.rs, config.rs | Annotation schema, transfer types, and deployment config |
The github feature flag enables remote fetching from GitHub repositories. Without it, only local filesystem sources are available.
An exploration by Bureau Architectuur of the Dutch Ministry of the Interior into the possibilities of transparent, executable legislation.
Bureau Architectuur
Ministry of the Interior and Kingdom Relations