Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
86 changes: 85 additions & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 5 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
[package]
name = "mailschema"
version = "0.2.1"
version = "0.3.0"
edition = "2021"
rust-version = "1.70"
description = "Embedded Mail Action Protocol 0.2 core artifacts and MailSchema Registry schemas"
description = "Embedded Mail Action Protocol 0.3 artifacts: the profile record, context and schemas"
homepage = "https://mailschema.org/tools"
repository = "https://github.com/mailschema/rust"
documentation = "https://docs.rs/mailschema"
license = "MIT"
readme = "README.md"
keywords = ["email", "schema", "json-schema", "agents"]
keywords = ["email", "mail-action-protocol", "json-schema", "agents"]
categories = ["data-structures", "email"]
include = ["src/**", "schemas/**", "contexts/**", "Cargo.toml", "README.md", "LICENSE"]
include = ["src/**", "artifacts/**", "Cargo.toml", "README.md", "LICENSE"]

[dev-dependencies]
serde_json = "1"
sha2 = "0.10"
28 changes: 6 additions & 22 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,32 +1,16 @@
# MailSchema for Rust
# mailschema

[![crates.io](https://img.shields.io/crates/v/mailschema)](https://crates.io/crates/mailschema)
[![CI](https://github.com/mailschema/rust/actions/workflows/test.yml/badge.svg)](https://github.com/mailschema/rust/actions/workflows/test.yml)

The Mail Action Protocol 0.2 core artifacts and the MailSchema Registry schemas, embedded without runtime dependencies, filesystem access or network calls.

[Specification](https://mailschema.org/specification) · [Registry](https://mailschema.org/registry) · [Tools](https://mailschema.org/tools) · [Source](https://github.com/mailschema/rust)

## Install
The [Mail Action Protocol](https://mailschema.org) 0.3 artifacts for Rust, embedded byte for byte as mailschema.org publishes them: the profile record, the JSON-LD context, and the core, type contract and implementation record schemas. The profile record binds the context and the first two schemas by SHA-256. No runtime dependencies, filesystem access or network calls.

```toml
[dependencies]
mailschema = "0.2"
mailschema = "0.3"
```

Rust 1.70 or newer is required.

## Use an artifact

```rust
use mailschema::{Schema, MAP_CONTEXT, MAP_PROFILE, MAP_SCHEMA};

assert_eq!(Schema::Map.as_str(), MAP_SCHEMA);
assert!(MAP_CONTEXT.contains("MailAction"));
let schema: serde_json::Value = serde_json::from_str(mailschema::CORE_SCHEMA)?;
```

`MAP_SCHEMA`, `MAP_CONTEXT`, `CONTRACT_FORMAT_SCHEMA` and `FORMS_SCHEMA` are byte-identical to the files the [profile record](https://mailschema.org/profiles/map/0.2.json) binds by SHA-256. `CONTRIBUTION_SCHEMA` and `RECORD_SCHEMA` describe Registry files. Parse them with your JSON library and pass the schemas to a Draft 2020-12 validator; the crate does not choose a validation engine. Type contracts are not bundled: a client obtains them from the [Registry catalogue](https://mailschema.org/registry/catalog.json) by digest.

## Trust boundary
The constants are `PROFILE_RECORD`, `CONTEXT_DOCUMENT`, `CORE_SCHEMA`, `CONTRACT_SCHEMA` and `IMPLEMENTATION_SCHEMA`, with `PROFILE` and `CONTEXT` naming the profile and context. Schema validation alone does not establish a valid description; see the [specification](https://mailschema.org/specification/core).

A valid document is structured input. Schema validation does not authenticate a service, grant authority or establish product conformance. Package versions and MAP profile versions advance independently. MIT licensed.
Source: [mailschema/rust](https://github.com/mailschema/rust). License: MIT.
16 changes: 8 additions & 8 deletions UPSTREAM.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
# Release provenance

Version `0.2.1` derives from [`mailschema/mailschema@db99c15`](https://github.com/mailschema/mailschema/commit/db99c1582f68b3cd3e80d5fe6c029c8535bf470c).
Version `0.3.0` derives from [`mailschema/mailschema@2c26469`](https://github.com/mailschema/mailschema/commit/2c26469209070f04ff9f8ec29e1387b8699a46a0). Its sources, tests and bundled files are prepared from that commit by `npm run packages:prepare`.

The bundled files are exact projections of that source commit and do not independently define MAP:
The bundled MAP 0.3 artifacts are exact copies of that commit's files and do not independently define MAP:

- MAP 0.2 core schema: `732d60fcb758d945dc15c57d885c9d1c0c76423a7439096d9755e8ec9830836a`
- MAP 0.2 JSON-LD context: `dfed0189524d7d16d31ed3d8af97e9a0c458200c4c034b413f9d14fa35b60257`
- Type contract format: `e030007cc034662c9d9d448a8a035aff3106cfb96fb60e6aa9f92b99b25df0b9`
- Form fields block: `3a976b93a057380e3630ca05e77e221a43a98559fb7fda8066299ec4bf2a8f9e`
- Contribution schema: `a8a241b4837971a6251bcc135c704283536f4fb825fbbaedaf1598c6e688d564`
- profile (`artifacts/profile.json`): `d9481627f855c127a4f5d6ddb7f3b699f66f6475bc8672d609f5b499f83d1a0f`
- context (`artifacts/context.jsonld`): `a51490d1fe8af695c14ea508aad88fd0429d18564791b6b52f3ab07d5c51aab3`
- core-schema (`artifacts/core.schema.json`): `0ad09a6955a47e7a2c1c1eec0747a3e0b15c08a79860e90ce4e65da11983aeb3`
- contract-schema (`artifacts/contract.schema.json`): `86bf057529c4fd2c7f0a880825774afeed31e9f7ba1d99760858a585fe28d18d`
- implementation-schema (`artifacts/implementation.schema.json`): `c62acc3ebb9f384c8fba7be353ab1905b65883ac2b16b147fd98485eec643396`

The canonical artifacts live in the main MailSchema repository. This repository owns the Rust crate surface and its release history.
The canonical artifacts live in the main MailSchema repository. This repository owns the Rust crate and its release history.
50 changes: 50 additions & 0 deletions artifacts/context.jsonld
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
{
"@context": {
"@version": 1.1,
"@protected": true,
"@vocab": "https://mailschema.org/vocab/map/0.3#",
"MailAction": "https://mailschema.org/vocab/map/0.3#MailAction",
"profile": {
"@id": "profile",
"@type": "@id"
},
"type": {
"@id": "type",
"@type": "@json"
},
"service": {
"@id": "service",
"@type": "@json"
},
"subject": {
"@id": "subject",
"@type": "@json"
},
"terms": {
"@id": "terms",
"@type": "@json"
},
"details": {
"@id": "details",
"@type": "@json"
},
"operations": {
"@id": "operations",
"@type": "@json"
},
"human": {
"@id": "human",
"@type": "@json"
},
"recipient": "recipient",
"inLanguage": "inLanguage",
"issuedAt": {
"@id": "issuedAt",
"@type": "http://www.w3.org/2001/XMLSchema#dateTime"
},
"expiresAt": {
"@id": "expiresAt",
"@type": "http://www.w3.org/2001/XMLSchema#dateTime"
}
}
}
Loading
Loading