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
2 changes: 1 addition & 1 deletion Cargo.lock

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

8 changes: 4 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
[package]
name = "mailschema"
version = "0.1.3"
version = "0.1.4"
edition = "2021"
rust-version = "1.70"
description = "Embedded JSON Schemas for Mail Action Protocol and the MailSchema Registry"
homepage = "https://mailschema.org/tools/"
description = "Embedded Mail Action Protocol 0.2 core artifacts and MailSchema Registry 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"]
categories = ["data-structures", "email"]
include = ["src/**", "schemas/**", "contracts/**", "Cargo.toml", "README.md", "LICENSE"]
include = ["src/**", "schemas/**", "contexts/**", "Cargo.toml", "README.md", "LICENSE"]

[dev-dependencies]
serde_json = "1"
31 changes: 8 additions & 23 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
[![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)

Embed the canonical Mail Action Protocol and MailSchema Registry schemas in a Rust application without runtime dependencies, filesystem access or network calls.
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)
[Specification](https://mailschema.org/specification) · [Registry](https://mailschema.org/registry) · [Tools](https://mailschema.org/tools) · [Source](https://github.com/mailschema/rust)

## Install

Expand All @@ -16,32 +16,17 @@ mailschema = "0.1"

Rust 1.70 or newer is required.

## Use a schema
## Use an artifact

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

assert_eq!(Schema::Map01.as_str(), MAP_0_1_SCHEMA);

let content_review = Schema::ContentReview02.as_str();
assert!(content_review.contains("Content Review"));
assert!(CONTENT_REVIEW_0_2_CONTRACT.contains("MapTypeContract"));
assert_eq!(Schema::Map.as_str(), MAP_SCHEMA);
assert!(MAP_CONTEXT.contains("MailAction"));
```

The crate exposes five Draft 2020-12 documents:

- `MAP_0_1_SCHEMA`
- `CONTENT_REVIEW_0_1_SCHEMA`
- `CONTENT_REVIEW_0_2_SCHEMA`
- `CONTRIBUTION_SCHEMA`
- `RECORD_SCHEMA`

Parse the strings with your JSON library and pass them to a Draft 2020-12 validator with format checking enabled. The crate deliberately does not select a validation engine for its consumers.

`CONTENT_REVIEW_0_1_CONTRACT` and `CONTENT_REVIEW_0_2_CONTRACT` expose the immutable canonical type contracts used by MAP wire messages. New integrations should use 0.2.
`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

A valid document is structured input. Schema validation does not authenticate a service, grant authority, approve an action, check Registry references or establish product conformance. Implementations must apply their own endpoint trust, credentials, permissions and policy before executing a request.

Package versions and MAP profile versions advance independently. MIT licensed.
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.
13 changes: 6 additions & 7 deletions UPSTREAM.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
# Release provenance

Version `0.1.3` derives from [`mailschema/mailschema@f630ec5`](https://github.com/mailschema/mailschema/commit/f630ec5569e7167114fb2a39a10548febfa6b979).
Version `0.1.4` derives from [`mailschema/mailschema@61a12c9`](https://github.com/mailschema/mailschema/commit/61a12c97663061b46707f8d996bd1f59cae9a544), in [pull request #22](https://github.com/mailschema/mailschema/pull/22).

The bundled files are exact projections of that source commit and do not independently define MAP:

- MAP 0.1 schema: `c39befeecf8643e8beda1f53a8d1411482b68ddf14974f3806cfa95776103f85`
- Content Review 0.1 schema: `10e2263c820ba3a6ef0381c377078e2c1f324c3b142a6f8caf92b298cc66c692`
- Content Review 0.1 contract: `754ab7245ddb09ff4da000fccc60d746724379d4146ea227973e5d87f105f800`
- Content Review 0.2 schema: `d2286ffe410cceae56f9caa145634fd9613f5ce51e11ba089cad67b9f62259b7`
- Content Review 0.2 contract: `3bd1cd4a86e00d00590eeb150b7b29cebece589058d6094a40aa9d497dc8efe0`
- MAP 0.2 core schema: `732d60fcb758d945dc15c57d885c9d1c0c76423a7439096d9755e8ec9830836a`
- MAP 0.2 JSON-LD context: `dfed0189524d7d16d31ed3d8af97e9a0c458200c4c034b413f9d14fa35b60257`
- Type contract format: `e030007cc034662c9d9d448a8a035aff3106cfb96fb60e6aa9f92b99b25df0b9`
- Form fields block: `3a976b93a057380e3630ca05e77e221a43a98559fb7fda8066299ec4bf2a8f9e`
- Contribution schema: `a8a241b4837971a6251bcc135c704283536f4fb825fbbaedaf1598c6e688d564`

The canonical contracts live in the main MailSchema repository. This repository owns the Rust package surface and its release history.
The canonical artifacts live in the main MailSchema repository. This repository owns the Rust crate surface and its release history.
91 changes: 91 additions & 0 deletions contexts/map-0.2.jsonld
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
{
"@context": {
"@version": 1.1,
"map": "https://mailschema.org/ns/map#",
"schema": "https://schema.org/",
"MailAction": "map:MailAction",
"profile": {
"@id": "map:profile",
"@type": "@id"
},
"type": {
"@id": "map:interactionType",
"@context": {
"id": {
"@id": "map:id",
"@type": "@id"
}
}
},
"version": "schema:version",
"contractDigest": "map:contractDigest",
"describedAt": {
"@id": "schema:dateCreated",
"@type": "http://www.w3.org/2001/XMLSchema#dateTime"
},
"expiresAt": {
"@id": "schema:expires",
"@type": "http://www.w3.org/2001/XMLSchema#dateTime"
},
"service": {
"@id": "schema:provider",
"@context": {
"id": {
"@id": "map:id",
"@type": "@id"
}
}
},
"name": "schema:name",
"authority": "map:authority",
"onBehalfOf": {
"@id": "map:onBehalfOf",
"@context": {
"id": {
"@id": "map:id",
"@type": "@id"
}
}
},
"resource": {
"@id": "map:resource",
"@type": "@id"
},
"execution": "map:execution",
"url": {
"@id": "schema:url",
"@type": "@id"
},
"resultUrlTemplate": "map:resultUrlTemplate",
"resultRetentionSeconds": "map:resultRetentionSeconds",
"humanUrl": {
"@id": "map:humanUrl",
"@type": "@id"
},
"target": {
"@id": "schema:object",
"@context": {
"id": {
"@id": "map:id",
"@type": "@id"
}
}
},
"recipient": "schema:recipient",
"details": {
"@id": "map:details",
"@type": "@json"
},
"revision": "schema:version",
"title": "schema:name",
"digest": "map:digest",
"operations": {
"@id": "schema:potentialAction",
"@container": "@set",
"@context": {
"id": "map:operationId"
}
},
"description": "schema:description"
}
}
58 changes: 0 additions & 58 deletions contracts/content-review-0.1.json

This file was deleted.

91 changes: 0 additions & 91 deletions contracts/content-review-0.2.json

This file was deleted.

Loading
Loading