Tools for the Registry.
Validate a contribution locally, use the schema in your application, or add checks to your build.
Check a contribution.
Validate JSON, use typed definitions and check references against a supplied Registry catalogue.
npm install mailschema@0.1.0npx mailschema@0.1.0 check contribution.jsonimport { readFile } from 'node:fs/promises';
import { assertContribution } from 'mailschema';
const contribution = JSON.parse(
await readFile('contribution.json', 'utf8'),
);
assertContribution(contribution);Returns normally for valid input. Throws an error with field details if the contribution needs changes.
TypeScript: Contribution, TypeDefinition, TypeRecord, Implementation, Party and CatalogView.
assertContribution(value)- Check contribution structure; throw if invalid.
contributionErrors(value)- Return field errors, or an empty array.
assertTypeRecord(value)- Check an expanded record, including attribution and history.
referenceErrors(contribution, catalog)- Check amendment bases, type names, versions, profiles and supported operations against supplied Registry data.
getContributionSchema() / getRecordSchema()- Return an independent copy of either JSON Schema.
Validate in Python.
Check contribution fields and Registry record structure with the established jsonschema library.
python -m pip install mailschema==0.1.0python -m mailschema check contribution.jsonimport json
from pathlib import Path
from mailschema import validate_contribution
contribution = json.loads(
Path("contribution.json").read_text()
)
validate_contribution(contribution)Returns None for valid input. Raises ValueError with field details if the contribution needs changes.
Structure and format checks. Registry reference checks run separately in the browser or JavaScript API.
validate_contribution(value)- Check contribution structure; raise ValueError if invalid.
contribution_errors(value)- Return field errors, or an empty list.
validate_record(value) / record_errors(value)- Validate an expanded Registry record or inspect its errors.
get_contribution_schema() / get_record_schema()- Return a fresh copy of either JSON Schema.
Bring the schema with you.
Embed the contribution and record schemas in your application. Use them with your chosen JSON Schema validator.
[dependencies]
mailschema = "=0.1.0"Enable format checking in your validator to check URI fields.
use mailschema::{CONTRIBUTION_SCHEMA, RECORD_SCHEMA};
fn main() -> std::io::Result<()> {
std::fs::write(
"contribution.schema.json", CONTRIBUTION_SCHEMA
)?;
std::fs::write("record.schema.json", RECORD_SCHEMA)?;
Ok(())
}Writes both bundled schemas to local files. No runtime dependencies or network calls.
Schemas only. Validation requires a JSON Schema Draft 2020-12 engine with format checking enabled.
CONTRIBUTION_SCHEMA- The contribution JSON Schema as a static string.
RECORD_SCHEMA- The standalone record JSON Schema as a static string.
Schema::Contribution.as_str() / Schema::Record.as_str()- Select a bundled schema through the typed enum.
Check the record, too.
A contribution proposes a change. A record is the resulting definition, with its contributors, maintainers and history.
Choose Download record on any type page, then check it with --record. Start with Content Review:
npx mailschema@0.1.0 check content-review.json --recordpython -m mailschema check content-review.json --recordIn Rust, pass RECORD_SCHEMA to your validator. For amendments and implementation declarations, the Registry catalogue also provides exact record digests.
What passing means.
Each check answers a different question. A valid file is ready for the next step.
- 01
Structure
Required fields, allowed values and URI formats. The JavaScript and Python validators check these locally against the shared schema.
- 02
Registry references
Does the target exist? Is the amendment current? Are the operations supported? Use the browser checker, or JavaScript’s
referenceErrorswith a supplied catalogue. - 03
Review
The repository checks conflicting changes. Review considers the definition, attribution and evidence. Passing validation does not establish acceptance or product compatibility.
These packages work with Registry contributions. MAP is documented in the Mail Action Protocol specification; its wire representation remains a draft. Package and specification versions are independent.