# `monochange_schema`
<br />
<!-- {=crateReadmeBadgeRow:"monochange_schema"} -->
[](https://crates.io/crates/monochange_schema) [](https://docs.rs/monochange_schema/) [](https://github.com/monochange/monochange/actions/workflows/ci.yml) [](https://codecov.io/gh/monochange/monochange?flag=monochange_schema) [](https://opensource.org/license/unlicense)
<!-- {/crateReadmeBadgeRow} -->
<br />
`monochange_schema` owns durable JSON wire contracts for monochange artifacts that are embedded in git history or written to disk for later monochange commands.
Reach for this crate when you need to render, validate, or migrate public artifact versions without depending on the higher-level release planner.
## Why use it?
- keep durable wire schemas separate from internal Rust structs
- parse schema versions in the public `major.minor` format written as `schemaVersion`
- validate commit-embedded release records before the CLI deserializes them into domain types
- migrate older durable release-record shapes through explicit Rust migration edges
## Version policy
The crate package version and durable artifact schema version are intentionally independent.
- The crate starts at `0.0.0` on development branches so release planning can explicitly publish the first crate release.
- Durable release records already use public schema version `0.1` because `0.1` is the first supported wire contract.
- Patch releases of this crate do not change a durable `schemaVersion` value.
- Future breaking durable schema changes add a new `major.minor` value plus Rust migration edges.
## Public schema assets
Current moving aliases are published with the documentation site:
- <https://monochange.github.io/monochange/schemas/release-record.schema.json>
- <https://monochange.github.io/monochange/schemas/monochange.schema.json>
Stable versioned copies are also generated for durable/editor integrations that need a non-moving URL, starting with `release-record.v0.1.schema.json` and `monochange.v0.1.schema.json`.
Run the repository scripts when changing schema templates or public constants:
```bash
schema:update
schema:check
```
`schema:update` regenerates committed schema assets from the templates and Rust wire constants. `schema:check` compares the generated output against the committed files and is part of `lint:all`.
## Example
```rust
use monochange_schema::CURRENT_SCHEMA_VERSION_TEXT;
use monochange_schema::release_record;
use serde_json::json;
let durable = release_record::render_current_value(json!({
"schemaVersion": 1,
"kind": release_record::KIND,
"createdAt": "2026-04-06T12:00:00Z",
"command": "release-pr",
"releaseTargets": [],
"releasedPackages": [],
"changedFiles": []
}))?;
assert_eq!(durable["schemaVersion"], CURRENT_SCHEMA_VERSION_TEXT);
assert!(durable.get("v").is_none());
# Ok::<(), monochange_schema::SchemaError>(())
```
## Scope
- `SchemaVersion` parsing and rendering
- `release_record` durable wire validation, rendering, and migration helpers
- committed JSON Schema assets under `schemas/`