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 | The RepoBackend trait and the factory that picks an implementation per source |
github_api_backend.rs | API-only backend: no local clone, reads through the Contents API, writes buffered in memory and flushed as one PUT or DELETE per file |
implements_index.rs | Reads the committed implements-index, the precomputed artefact that replaces a full-corpus scan for IoC resolution |
timing.rs | Request-scoped phase timings, surfaced as a Server-Timing header and as tracing spans |
annotation_schema.rs, dto.rs, config.rs, error.rs | Annotation schema, transfer types, deployment config, and error types |
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 Economic Affairs and Climate Policy into the possibilities of transparent, executable legislation.
GitHub repository
How it works
Stay informed
Roadmap (Dutch)
Documentation
Research
Bureau Architectuur
Ministry of Economic Affairs and Climate Policy