Tools

Tools for the Registry.

Validate a contribution locally, use the schema in your application, or add checks to your build.

Package set 0.1.0

The same contribution format,
in your own workflow.

Use the browser checker
JSON Schema
Node.js 22+npm · 0.1.0

Check a contribution.

Validate JSON, use typed definitions and check references against a supplied Registry catalogue.

Install
npm install mailschema@0.1.0
Check a file
npx mailschema@0.1.0 check contribution.json
Download an example
check-contribution.mjs
import { 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.

API reference

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.
Python 3.10+PyPI · 0.1.0

Validate in Python.

Check contribution fields and Registry record structure with the established jsonschema library.

Install
python -m pip install mailschema==0.1.0
Check a file
python -m mailschema check contribution.json
Download an example
check_contribution.py
import 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.

API reference

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.

Cargo.toml
[dependencies]
mailschema = "=0.1.0"

Enable format checking in your validator to check URI fields.

src/main.rs
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.

API reference

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.
Registry records

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:

Download Content Review
JavaScript
npx mailschema@0.1.0 check content-review.json --record
Python · after installation
python -m mailschema check content-review.json --record

In Rust, pass RECORD_SCHEMA to your validator. For amendments and implementation declarations, the Registry catalogue also provides exact record digests.

From a file to a contribution

What passing means.

Each check answers a different question. A valid file is ready for the next step.

  1. 01

    Structure

    Required fields, allowed values and URI formats. The JavaScript and Python validators check these locally against the shared schema.

  2. 02

    Registry references

    Does the target exist? Is the amendment current? Are the operations supported? Use the browser checker, or JavaScript’s referenceErrors with a supplied catalogue.

  3. 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.