From 491dd43c9b8f447144460840042794b732b16723 Mon Sep 17 00:00:00 2001 From: Kam Date: Thu, 24 Sep 2026 00:51:51 +1000 Subject: [PATCH] Preserve canonical schema bytes in 0.1.3 --- UPSTREAM.md | 3 +- build.mjs | 19 + dist/content-review-0.1.schema.json | 90 +- dist/contribution.schema.json | 1692 +++++++++++++-------------- dist/map-0.1.schema.json | 522 ++++----- package-lock.json | 4 +- package.json | 4 +- test/package.test.mjs | 17 +- 8 files changed, 1189 insertions(+), 1162 deletions(-) create mode 100644 build.mjs diff --git a/UPSTREAM.md b/UPSTREAM.md index 533a6c9..3d57f80 100644 --- a/UPSTREAM.md +++ b/UPSTREAM.md @@ -1,6 +1,5 @@ # Release provenance -Version `0.1.2` was prepared from [`mailschema/mailschema@ad1a909`](https://github.com/mailschema/mailschema/commit/ad1a90942416302e4249ec6949003428b5965ef1). +Version `0.1.3` was prepared from [`mailschema/mailschema@0b325fb`](https://github.com/mailschema/mailschema/commit/0b325fb27a7030f433fe62675b871b22b5523f6c). The included contribution schema has SHA-256 digest `a8a241b4837971a6251bcc135c704283536f4fb825fbbaedaf1598c6e688d564`. The canonical schemas live in the main MailSchema repository; this repository owns the JavaScript and TypeScript package surface and its release history. - diff --git a/build.mjs b/build.mjs new file mode 100644 index 0000000..321b720 --- /dev/null +++ b/build.mjs @@ -0,0 +1,19 @@ +import { execFileSync } from 'node:child_process'; +import { copyFile } from 'node:fs/promises'; +import { dirname, resolve } from 'node:path'; +import { fileURLToPath } from 'node:url'; + +const root = dirname(fileURLToPath(import.meta.url)); + +execFileSync(process.execPath, [resolve(root, 'node_modules/typescript/bin/tsc'), '-p', root], { + cwd: root, + stdio: 'inherit', +}); + +for (const name of [ + 'contribution.schema.json', + 'map-0.1.schema.json', + 'content-review-0.1.schema.json', +]) { + await copyFile(resolve(root, 'src', name), resolve(root, 'dist', name)); +} diff --git a/dist/content-review-0.1.schema.json b/dist/content-review-0.1.schema.json index 5a42b7b..1d67ac5 100644 --- a/dist/content-review-0.1.schema.json +++ b/dist/content-review-0.1.schema.json @@ -1,52 +1,52 @@ { - "$schema": "https://json-schema.org/draft/2020-12/schema", - "$id": "https://mailschema.org/schemas/content-review-0.1.schema.json", - "title": "Content Review 0.1 MAP request", - "allOf": [ - { "$ref": "https://mailschema.org/schemas/map-0.1.schema.json#/$defs/request" }, + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "https://mailschema.org/schemas/content-review-0.1.schema.json", + "title": "Content Review 0.1 MAP request", + "allOf": [ + { "$ref": "https://mailschema.org/schemas/map-0.1.schema.json#/$defs/request" }, + { + "type": "object", + "properties": { + "type": { + "type": "object", + "properties": { + "id": { "const": "https://mailschema.org/types/content-review" }, + "version": { "const": "0.1" }, + "recordDigest": { + "const": "sha-256:0e6365df1bf904f2475f972ec66a5561edc0bfaae69fd7a1b41f53b40bf8ac1c" + } + } + } + } + }, + { + "oneOf": [ { - "type": "object", - "properties": { - "type": { - "type": "object", - "properties": { - "id": { "const": "https://mailschema.org/types/content-review" }, - "version": { "const": "0.1" }, - "recordDigest": { - "const": "sha-256:0e6365df1bf904f2475f972ec66a5561edc0bfaae69fd7a1b41f53b40bf8ac1c" - } - } - } + "type": "object", + "properties": { + "operation": { "const": "request-changes" }, + "input": { + "type": "object", + "additionalProperties": false, + "properties": { + "feedback": { "type": "string", "minLength": 1, "maxLength": 12000 } + }, + "required": ["feedback"] } + } }, { - "oneOf": [ - { - "type": "object", - "properties": { - "operation": { "const": "request-changes" }, - "input": { - "type": "object", - "additionalProperties": false, - "properties": { - "feedback": { "type": "string", "minLength": 1, "maxLength": 12000 } - }, - "required": ["feedback"] - } - } - }, - { - "type": "object", - "properties": { - "operation": { "const": "approve" }, - "input": { - "type": "object", - "additionalProperties": false, - "maxProperties": 0 - } - } - } - ] + "type": "object", + "properties": { + "operation": { "const": "approve" }, + "input": { + "type": "object", + "additionalProperties": false, + "maxProperties": 0 + } + } } - ] + ] + } + ] } diff --git a/dist/contribution.schema.json b/dist/contribution.schema.json index 7e6e028..6b7742a 100644 --- a/dist/contribution.schema.json +++ b/dist/contribution.schema.json @@ -1,874 +1,874 @@ { - "$schema": "https://json-schema.org/draft/2020-12/schema", - "title": "MailSchema contribution format", - "description": "Repository contribution data. This is not a MAP message or wire representation.", - "$defs": { - "definition": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "title": "MailSchema contribution format", + "description": "Repository contribution data. This is not a MAP message or wire representation.", + "$defs": { + "definition": { + "type": "object", + "additionalProperties": false, + "properties": { + "slug": { + "type": "string", + "pattern": "^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$", + "maxLength": 100 + }, + "name": { + "type": "string", + "minLength": 1, + "maxLength": 240, + "pattern": "\\S" + }, + "summary": { + "type": "string", + "minLength": 1, + "maxLength": 500, + "pattern": "\\S" + }, + "category": { + "type": "string", + "minLength": 1, + "maxLength": 240, + "pattern": "\\S" + }, + "status": { + "enum": ["Draft", "Proposal", "Reuse assessment"] + }, + "version": { + "anyOf": [ + { + "type": "string", + "pattern": "^[0-9]+\\.[0-9]+(?:\\.[0-9]+)?(?:-[a-zA-Z0-9.-]+)?$", + "maxLength": 80 + }, + { + "type": "null" + } + ] + }, + "profile": { + "type": "string", + "minLength": 1, + "maxLength": 240, + "pattern": "\\S" + }, + "overview": { + "type": "string", + "minLength": 1, + "maxLength": 12000, + "pattern": "\\S" + }, + "target": { + "type": "string", + "minLength": 1, + "maxLength": 12000, + "pattern": "\\S" + }, + "operations": { + "type": "array", + "items": { "type": "object", "additionalProperties": false, "properties": { - "slug": { - "type": "string", - "pattern": "^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$", - "maxLength": 100 - }, - "name": { - "type": "string", - "minLength": 1, - "maxLength": 240, - "pattern": "\\S" - }, - "summary": { - "type": "string", - "minLength": 1, - "maxLength": 500, - "pattern": "\\S" - }, - "category": { - "type": "string", - "minLength": 1, - "maxLength": 240, - "pattern": "\\S" - }, - "status": { - "enum": ["Draft", "Proposal", "Reuse assessment"] - }, - "version": { - "anyOf": [ - { - "type": "string", - "pattern": "^[0-9]+\\.[0-9]+(?:\\.[0-9]+)?(?:-[a-zA-Z0-9.-]+)?$", - "maxLength": 80 - }, - { - "type": "null" - } - ] - }, - "profile": { - "type": "string", - "minLength": 1, - "maxLength": 240, - "pattern": "\\S" - }, - "overview": { - "type": "string", - "minLength": 1, - "maxLength": 12000, - "pattern": "\\S" - }, - "target": { - "type": "string", - "minLength": 1, - "maxLength": 12000, - "pattern": "\\S" - }, - "operations": { - "type": "array", - "items": { - "type": "object", - "additionalProperties": false, - "properties": { - "id": { - "type": "string", - "pattern": "^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$", - "maxLength": 100 - }, - "name": { - "type": "string", - "minLength": 1, - "maxLength": 240, - "pattern": "\\S" - }, - "description": { - "type": "string", - "minLength": 1, - "maxLength": 12000, - "pattern": "\\S" - } - }, - "required": ["id", "name", "description"] - }, - "minItems": 1, - "maxItems": 100 - }, - "inputs": { - "type": "string", - "minLength": 1, - "maxLength": 12000, - "pattern": "\\S" - }, - "results": { - "type": "string", - "minLength": 1, - "maxLength": 12000, - "pattern": "\\S" - }, - "permissions": { - "type": "string", - "minLength": 1, - "maxLength": 12000, - "pattern": "\\S" - }, - "humanRoute": { - "type": "string", - "minLength": 1, - "maxLength": 12000, - "pattern": "\\S" - }, - "example": { - "type": "object", - "additionalProperties": false, - "properties": { - "title": { - "type": "string", - "minLength": 1, - "maxLength": 240, - "pattern": "\\S" - }, - "steps": { - "type": "array", - "items": { - "type": "string", - "minLength": 1, - "maxLength": 12000, - "pattern": "\\S" - }, - "minItems": 1, - "maxItems": 100 - }, - "exception": { - "type": "string", - "minLength": 1, - "maxLength": 12000, - "pattern": "\\S" - } - }, - "required": ["title", "steps", "exception"] - }, - "references": { - "type": "array", - "items": { - "type": "object", - "additionalProperties": false, - "properties": { - "title": { - "type": "string", - "minLength": 1, - "maxLength": 240, - "pattern": "\\S" - }, - "href": { - "type": "string", - "format": "uri", - "pattern": "^https://", - "maxLength": 2048 - }, - "description": { - "type": "string", - "minLength": 1, - "maxLength": 12000, - "pattern": "\\S" - } - }, - "required": ["title", "href", "description"] - }, - "minItems": 1, - "maxItems": 100 - }, - "openQuestions": { - "type": "array", - "items": { - "type": "string", - "minLength": 1, - "maxLength": 12000, - "pattern": "\\S" - }, - "minItems": 0, - "maxItems": 100 - }, - "maintainers": { - "type": "array", - "items": { - "type": "object", - "additionalProperties": false, - "properties": { - "id": { - "type": "string", - "pattern": "^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$", - "maxLength": 100 - }, - "name": { - "type": "string", - "minLength": 1, - "maxLength": 240, - "pattern": "\\S" - }, - "url": { - "type": "string", - "format": "uri", - "pattern": "^https://", - "maxLength": 2048 - } - }, - "required": ["name"] - }, - "minItems": 1, - "maxItems": 100 - }, - "definition": { - "type": "object", - "additionalProperties": false, - "properties": { - "label": { - "type": "string", - "minLength": 1, - "maxLength": 240, - "pattern": "\\S" - }, - "href": { - "type": "string", - "pattern": "^/specification/(?:[a-z0-9-]+/)*$", - "maxLength": 300 - } - }, - "required": ["label", "href"] - } + "id": { + "type": "string", + "pattern": "^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$", + "maxLength": 100 + }, + "name": { + "type": "string", + "minLength": 1, + "maxLength": 240, + "pattern": "\\S" + }, + "description": { + "type": "string", + "minLength": 1, + "maxLength": 12000, + "pattern": "\\S" + } }, - "required": [ - "slug", - "name", - "summary", - "category", - "status", - "version", - "profile", - "overview", - "target", - "operations", - "inputs", - "results", - "permissions", - "humanRoute", - "example", - "references", - "openQuestions", - "maintainers" - ], - "allOf": [ - { - "if": { - "properties": { - "status": { - "const": "Draft" - } - }, - "required": ["status"] - }, - "then": { - "required": ["definition"], - "properties": { - "version": { - "type": "string" - } - } - } - } - ] + "required": ["id", "name", "description"] + }, + "minItems": 1, + "maxItems": 100 }, - "record": { + "inputs": { + "type": "string", + "minLength": 1, + "maxLength": 12000, + "pattern": "\\S" + }, + "results": { + "type": "string", + "minLength": 1, + "maxLength": 12000, + "pattern": "\\S" + }, + "permissions": { + "type": "string", + "minLength": 1, + "maxLength": 12000, + "pattern": "\\S" + }, + "humanRoute": { + "type": "string", + "minLength": 1, + "maxLength": 12000, + "pattern": "\\S" + }, + "example": { + "type": "object", + "additionalProperties": false, + "properties": { + "title": { + "type": "string", + "minLength": 1, + "maxLength": 240, + "pattern": "\\S" + }, + "steps": { + "type": "array", + "items": { + "type": "string", + "minLength": 1, + "maxLength": 12000, + "pattern": "\\S" + }, + "minItems": 1, + "maxItems": 100 + }, + "exception": { + "type": "string", + "minLength": 1, + "maxLength": 12000, + "pattern": "\\S" + } + }, + "required": ["title", "steps", "exception"] + }, + "references": { + "type": "array", + "items": { "type": "object", "additionalProperties": false, "properties": { - "slug": { - "type": "string", - "pattern": "^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$", - "maxLength": 100 - }, - "name": { - "type": "string", - "minLength": 1, - "maxLength": 240, - "pattern": "\\S" - }, - "summary": { - "type": "string", - "minLength": 1, - "maxLength": 500, - "pattern": "\\S" - }, - "category": { - "type": "string", - "minLength": 1, - "maxLength": 240, - "pattern": "\\S" - }, - "status": { - "enum": ["Draft", "Proposal", "Reuse assessment"] - }, - "version": { - "anyOf": [ - { - "type": "string", - "pattern": "^[0-9]+\\.[0-9]+(?:\\.[0-9]+)?(?:-[a-zA-Z0-9.-]+)?$", - "maxLength": 80 - }, - { - "type": "null" - } - ] - }, - "profile": { - "type": "string", - "minLength": 1, - "maxLength": 240, - "pattern": "\\S" - }, - "overview": { - "type": "string", - "minLength": 1, - "maxLength": 12000, - "pattern": "\\S" - }, - "target": { - "type": "string", - "minLength": 1, - "maxLength": 12000, - "pattern": "\\S" - }, - "operations": { - "type": "array", - "items": { - "type": "object", - "additionalProperties": false, - "properties": { - "id": { - "type": "string", - "pattern": "^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$", - "maxLength": 100 - }, - "name": { - "type": "string", - "minLength": 1, - "maxLength": 240, - "pattern": "\\S" - }, - "description": { - "type": "string", - "minLength": 1, - "maxLength": 12000, - "pattern": "\\S" - } - }, - "required": ["id", "name", "description"] - }, - "minItems": 1, - "maxItems": 100 - }, - "inputs": { - "type": "string", - "minLength": 1, - "maxLength": 12000, - "pattern": "\\S" - }, - "results": { - "type": "string", - "minLength": 1, - "maxLength": 12000, - "pattern": "\\S" - }, - "permissions": { - "type": "string", - "minLength": 1, - "maxLength": 12000, - "pattern": "\\S" - }, - "humanRoute": { - "type": "string", - "minLength": 1, - "maxLength": 12000, - "pattern": "\\S" - }, - "example": { - "type": "object", - "additionalProperties": false, - "properties": { - "title": { - "type": "string", - "minLength": 1, - "maxLength": 240, - "pattern": "\\S" - }, - "steps": { - "type": "array", - "items": { - "type": "string", - "minLength": 1, - "maxLength": 12000, - "pattern": "\\S" - }, - "minItems": 1, - "maxItems": 100 - }, - "exception": { - "type": "string", - "minLength": 1, - "maxLength": 12000, - "pattern": "\\S" - } - }, - "required": ["title", "steps", "exception"] - }, - "references": { - "type": "array", - "items": { - "type": "object", - "additionalProperties": false, - "properties": { - "title": { - "type": "string", - "minLength": 1, - "maxLength": 240, - "pattern": "\\S" - }, - "href": { - "type": "string", - "format": "uri", - "pattern": "^https://", - "maxLength": 2048 - }, - "description": { - "type": "string", - "minLength": 1, - "maxLength": 12000, - "pattern": "\\S" - } - }, - "required": ["title", "href", "description"] - }, - "minItems": 1, - "maxItems": 100 - }, - "openQuestions": { - "type": "array", - "items": { - "type": "string", - "minLength": 1, - "maxLength": 12000, - "pattern": "\\S" - }, - "minItems": 0, - "maxItems": 100 - }, - "maintainers": { - "type": "array", - "items": { - "type": "object", - "additionalProperties": false, - "properties": { - "name": { - "type": "string", - "minLength": 1, - "maxLength": 240, - "pattern": "\\S" - }, - "url": { - "type": "string", - "format": "uri", - "pattern": "^https://", - "maxLength": 2048 - } - }, - "required": ["name"] - }, - "minItems": 1, - "maxItems": 100 - }, - "definition": { - "type": "object", - "additionalProperties": false, - "properties": { - "label": { - "type": "string", - "minLength": 1, - "maxLength": 240, - "pattern": "\\S" - }, - "href": { - "type": "string", - "pattern": "^/specification/(?:[a-z0-9-]+/)*$", - "maxLength": 300 - } - }, - "required": ["label", "href"] - }, - "origin": { - "type": "string", - "minLength": 1, - "maxLength": 240, - "pattern": "\\S" - }, - "contributors": { - "type": "array", - "items": { - "type": "object", - "additionalProperties": false, - "properties": { - "name": { - "type": "string", - "minLength": 1, - "maxLength": 240, - "pattern": "\\S" - }, - "url": { - "type": "string", - "format": "uri", - "pattern": "^https://", - "maxLength": 2048 - } - }, - "required": ["name"] - }, - "minItems": 1, - "maxItems": 100 - }, - "history": { - "type": "array", - "items": { - "type": "object", - "additionalProperties": false, - "properties": { - "label": { - "type": "string", - "minLength": 1, - "maxLength": 240, - "pattern": "\\S" - }, - "description": { - "type": "string", - "minLength": 1, - "maxLength": 12000, - "pattern": "\\S" - }, - "contributionId": { - "type": "string", - "pattern": "^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$", - "maxLength": 100 - } - }, - "required": ["label", "description"] - }, - "minItems": 1, - "maxItems": 100 - } + "title": { + "type": "string", + "minLength": 1, + "maxLength": 240, + "pattern": "\\S" + }, + "href": { + "type": "string", + "format": "uri", + "pattern": "^https://", + "maxLength": 2048 + }, + "description": { + "type": "string", + "minLength": 1, + "maxLength": 12000, + "pattern": "\\S" + } + }, + "required": ["title", "href", "description"] + }, + "minItems": 1, + "maxItems": 100 + }, + "openQuestions": { + "type": "array", + "items": { + "type": "string", + "minLength": 1, + "maxLength": 12000, + "pattern": "\\S" + }, + "minItems": 0, + "maxItems": 100 + }, + "maintainers": { + "type": "array", + "items": { + "type": "object", + "additionalProperties": false, + "properties": { + "id": { + "type": "string", + "pattern": "^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$", + "maxLength": 100 + }, + "name": { + "type": "string", + "minLength": 1, + "maxLength": 240, + "pattern": "\\S" + }, + "url": { + "type": "string", + "format": "uri", + "pattern": "^https://", + "maxLength": 2048 + } + }, + "required": ["name"] + }, + "minItems": 1, + "maxItems": 100 + }, + "definition": { + "type": "object", + "additionalProperties": false, + "properties": { + "label": { + "type": "string", + "minLength": 1, + "maxLength": 240, + "pattern": "\\S" }, - "required": [ - "slug", - "name", - "summary", - "category", - "status", - "version", - "profile", - "overview", - "target", - "operations", - "inputs", - "results", - "permissions", - "humanRoute", - "example", - "references", - "openQuestions", - "maintainers", - "origin", - "contributors", - "history" - ], - "allOf": [ - { - "if": { - "properties": { - "status": { - "const": "Draft" - } - }, - "required": ["status"] - }, - "then": { - "required": ["definition"], - "properties": { - "version": { - "type": "string" - } - } - } - } - ] + "href": { + "type": "string", + "pattern": "^/specification/(?:[a-z0-9-]+/)*$", + "maxLength": 300 + } + }, + "required": ["label", "href"] } - }, - "oneOf": [ + }, + "required": [ + "slug", + "name", + "summary", + "category", + "status", + "version", + "profile", + "overview", + "target", + "operations", + "inputs", + "results", + "permissions", + "humanRoute", + "example", + "references", + "openQuestions", + "maintainers" + ], + "allOf": [ { + "if": { + "properties": { + "status": { + "const": "Draft" + } + }, + "required": ["status"] + }, + "then": { + "required": ["definition"], + "properties": { + "version": { + "type": "string" + } + } + } + } + ] + }, + "record": { + "type": "object", + "additionalProperties": false, + "properties": { + "slug": { + "type": "string", + "pattern": "^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$", + "maxLength": 100 + }, + "name": { + "type": "string", + "minLength": 1, + "maxLength": 240, + "pattern": "\\S" + }, + "summary": { + "type": "string", + "minLength": 1, + "maxLength": 500, + "pattern": "\\S" + }, + "category": { + "type": "string", + "minLength": 1, + "maxLength": 240, + "pattern": "\\S" + }, + "status": { + "enum": ["Draft", "Proposal", "Reuse assessment"] + }, + "version": { + "anyOf": [ + { + "type": "string", + "pattern": "^[0-9]+\\.[0-9]+(?:\\.[0-9]+)?(?:-[a-zA-Z0-9.-]+)?$", + "maxLength": 80 + }, + { + "type": "null" + } + ] + }, + "profile": { + "type": "string", + "minLength": 1, + "maxLength": 240, + "pattern": "\\S" + }, + "overview": { + "type": "string", + "minLength": 1, + "maxLength": 12000, + "pattern": "\\S" + }, + "target": { + "type": "string", + "minLength": 1, + "maxLength": 12000, + "pattern": "\\S" + }, + "operations": { + "type": "array", + "items": { "type": "object", "additionalProperties": false, "properties": { - "format": { - "const": "mailschema-contribution/1" - }, - "id": { - "type": "string", - "pattern": "^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$", - "maxLength": 100 - }, - "contributor": { - "type": "object", - "additionalProperties": false, - "properties": { - "name": { - "type": "string", - "minLength": 1, - "maxLength": 240, - "pattern": "\\S" - }, - "url": { - "type": "string", - "format": "uri", - "pattern": "^https://", - "maxLength": 2048 - } - }, - "required": ["name"] - }, - "source": { - "type": "string", - "format": "uri", - "pattern": "^https://", - "maxLength": 2048 - }, - "summary": { - "type": "string", - "minLength": 1, - "maxLength": 12000, - "pattern": "\\S" - }, - "kind": { - "const": "new-type" - }, - "record": { - "$ref": "#/$defs/definition" - } + "id": { + "type": "string", + "pattern": "^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$", + "maxLength": 100 + }, + "name": { + "type": "string", + "minLength": 1, + "maxLength": 240, + "pattern": "\\S" + }, + "description": { + "type": "string", + "minLength": 1, + "maxLength": 12000, + "pattern": "\\S" + } }, - "required": ["format", "id", "contributor", "summary", "kind", "record"] + "required": ["id", "name", "description"] + }, + "minItems": 1, + "maxItems": 100 }, - { + "inputs": { + "type": "string", + "minLength": 1, + "maxLength": 12000, + "pattern": "\\S" + }, + "results": { + "type": "string", + "minLength": 1, + "maxLength": 12000, + "pattern": "\\S" + }, + "permissions": { + "type": "string", + "minLength": 1, + "maxLength": 12000, + "pattern": "\\S" + }, + "humanRoute": { + "type": "string", + "minLength": 1, + "maxLength": 12000, + "pattern": "\\S" + }, + "example": { + "type": "object", + "additionalProperties": false, + "properties": { + "title": { + "type": "string", + "minLength": 1, + "maxLength": 240, + "pattern": "\\S" + }, + "steps": { + "type": "array", + "items": { + "type": "string", + "minLength": 1, + "maxLength": 12000, + "pattern": "\\S" + }, + "minItems": 1, + "maxItems": 100 + }, + "exception": { + "type": "string", + "minLength": 1, + "maxLength": 12000, + "pattern": "\\S" + } + }, + "required": ["title", "steps", "exception"] + }, + "references": { + "type": "array", + "items": { "type": "object", "additionalProperties": false, "properties": { - "format": { - "const": "mailschema-contribution/1" - }, - "id": { - "type": "string", - "pattern": "^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$", - "maxLength": 100 - }, - "contributor": { - "type": "object", - "additionalProperties": false, - "properties": { - "name": { - "type": "string", - "minLength": 1, - "maxLength": 240, - "pattern": "\\S" - }, - "url": { - "type": "string", - "format": "uri", - "pattern": "^https://", - "maxLength": 2048 - } - }, - "required": ["name"] - }, - "source": { - "type": "string", - "format": "uri", - "pattern": "^https://", - "maxLength": 2048 - }, - "summary": { - "type": "string", - "minLength": 1, - "maxLength": 12000, - "pattern": "\\S" - }, - "kind": { - "const": "amendment" - }, - "baseDigest": { - "type": "string", - "pattern": "^[a-f0-9]{64}$" - }, - "record": { - "$ref": "#/$defs/definition" - } + "title": { + "type": "string", + "minLength": 1, + "maxLength": 240, + "pattern": "\\S" + }, + "href": { + "type": "string", + "format": "uri", + "pattern": "^https://", + "maxLength": 2048 + }, + "description": { + "type": "string", + "minLength": 1, + "maxLength": 12000, + "pattern": "\\S" + } }, - "required": ["format", "id", "contributor", "summary", "kind", "baseDigest", "record"] + "required": ["title", "href", "description"] + }, + "minItems": 1, + "maxItems": 100 }, - { + "openQuestions": { + "type": "array", + "items": { + "type": "string", + "minLength": 1, + "maxLength": 12000, + "pattern": "\\S" + }, + "minItems": 0, + "maxItems": 100 + }, + "maintainers": { + "type": "array", + "items": { "type": "object", "additionalProperties": false, "properties": { - "format": { - "const": "mailschema-contribution/1" - }, - "id": { - "type": "string", - "pattern": "^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$", - "maxLength": 100 - }, - "contributor": { - "type": "object", - "additionalProperties": false, - "properties": { - "name": { - "type": "string", - "minLength": 1, - "maxLength": 240, - "pattern": "\\S" - }, - "url": { - "type": "string", - "format": "uri", - "pattern": "^https://", - "maxLength": 2048 - } - }, - "required": ["name"] - }, - "source": { - "type": "string", - "format": "uri", - "pattern": "^https://", - "maxLength": 2048 - }, - "summary": { - "type": "string", - "minLength": 1, - "maxLength": 12000, - "pattern": "\\S" - }, - "kind": { - "const": "implementation" - }, - "type": { - "type": "string", - "pattern": "^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$", - "maxLength": 100 - }, - "typeVersion": { - "type": "string", - "pattern": "^[0-9]+\\.[0-9]+(?:\\.[0-9]+)?(?:-[a-zA-Z0-9.-]+)?$", - "maxLength": 80 - }, - "typeDigest": { - "type": "string", - "pattern": "^[a-f0-9]{64}$" - }, - "profile": { - "type": "string", - "minLength": 1, - "maxLength": 240, - "pattern": "\\S" - }, - "product": { - "type": "object", - "additionalProperties": false, - "properties": { - "name": { - "type": "string", - "minLength": 1, - "maxLength": 240, - "pattern": "\\S" - }, - "url": { - "type": "string", - "format": "uri", - "pattern": "^https://", - "maxLength": 2048 - } - }, - "required": ["name"] - }, - "operations": { - "type": "array", - "items": { - "type": "string", - "pattern": "^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$", - "maxLength": 100 - }, - "minItems": 1, - "maxItems": 100 - }, - "evidence": { - "type": "object", - "additionalProperties": false, - "properties": { - "kind": { - "enum": ["declaration", "test-report"] - }, - "url": { - "type": "string", - "format": "uri", - "pattern": "^https://", - "maxLength": 2048 - }, - "reproduction": { - "type": "string", - "minLength": 1, - "maxLength": 12000, - "pattern": "\\S" - }, - "results": { - "type": "string", - "minLength": 1, - "maxLength": 12000, - "pattern": "\\S" - } - }, - "required": ["kind"], - "allOf": [ - { - "if": { - "properties": { - "kind": { - "const": "test-report" - } - }, - "required": ["kind"] - }, - "then": { - "required": ["url", "reproduction", "results"] - } - } - ] - } + "name": { + "type": "string", + "minLength": 1, + "maxLength": 240, + "pattern": "\\S" + }, + "url": { + "type": "string", + "format": "uri", + "pattern": "^https://", + "maxLength": 2048 + } + }, + "required": ["name"] + }, + "minItems": 1, + "maxItems": 100 + }, + "definition": { + "type": "object", + "additionalProperties": false, + "properties": { + "label": { + "type": "string", + "minLength": 1, + "maxLength": 240, + "pattern": "\\S" + }, + "href": { + "type": "string", + "pattern": "^/specification/(?:[a-z0-9-]+/)*$", + "maxLength": 300 + } + }, + "required": ["label", "href"] + }, + "origin": { + "type": "string", + "minLength": 1, + "maxLength": 240, + "pattern": "\\S" + }, + "contributors": { + "type": "array", + "items": { + "type": "object", + "additionalProperties": false, + "properties": { + "name": { + "type": "string", + "minLength": 1, + "maxLength": 240, + "pattern": "\\S" + }, + "url": { + "type": "string", + "format": "uri", + "pattern": "^https://", + "maxLength": 2048 + } + }, + "required": ["name"] + }, + "minItems": 1, + "maxItems": 100 + }, + "history": { + "type": "array", + "items": { + "type": "object", + "additionalProperties": false, + "properties": { + "label": { + "type": "string", + "minLength": 1, + "maxLength": 240, + "pattern": "\\S" + }, + "description": { + "type": "string", + "minLength": 1, + "maxLength": 12000, + "pattern": "\\S" + }, + "contributionId": { + "type": "string", + "pattern": "^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$", + "maxLength": 100 + } + }, + "required": ["label", "description"] + }, + "minItems": 1, + "maxItems": 100 + } + }, + "required": [ + "slug", + "name", + "summary", + "category", + "status", + "version", + "profile", + "overview", + "target", + "operations", + "inputs", + "results", + "permissions", + "humanRoute", + "example", + "references", + "openQuestions", + "maintainers", + "origin", + "contributors", + "history" + ], + "allOf": [ + { + "if": { + "properties": { + "status": { + "const": "Draft" + } + }, + "required": ["status"] + }, + "then": { + "required": ["definition"], + "properties": { + "version": { + "type": "string" + } + } + } + } + ] + } + }, + "oneOf": [ + { + "type": "object", + "additionalProperties": false, + "properties": { + "format": { + "const": "mailschema-contribution/1" + }, + "id": { + "type": "string", + "pattern": "^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$", + "maxLength": 100 + }, + "contributor": { + "type": "object", + "additionalProperties": false, + "properties": { + "name": { + "type": "string", + "minLength": 1, + "maxLength": 240, + "pattern": "\\S" + }, + "url": { + "type": "string", + "format": "uri", + "pattern": "^https://", + "maxLength": 2048 + } + }, + "required": ["name"] + }, + "source": { + "type": "string", + "format": "uri", + "pattern": "^https://", + "maxLength": 2048 + }, + "summary": { + "type": "string", + "minLength": 1, + "maxLength": 12000, + "pattern": "\\S" + }, + "kind": { + "const": "new-type" + }, + "record": { + "$ref": "#/$defs/definition" + } + }, + "required": ["format", "id", "contributor", "summary", "kind", "record"] + }, + { + "type": "object", + "additionalProperties": false, + "properties": { + "format": { + "const": "mailschema-contribution/1" + }, + "id": { + "type": "string", + "pattern": "^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$", + "maxLength": 100 + }, + "contributor": { + "type": "object", + "additionalProperties": false, + "properties": { + "name": { + "type": "string", + "minLength": 1, + "maxLength": 240, + "pattern": "\\S" + }, + "url": { + "type": "string", + "format": "uri", + "pattern": "^https://", + "maxLength": 2048 + } + }, + "required": ["name"] + }, + "source": { + "type": "string", + "format": "uri", + "pattern": "^https://", + "maxLength": 2048 + }, + "summary": { + "type": "string", + "minLength": 1, + "maxLength": 12000, + "pattern": "\\S" + }, + "kind": { + "const": "amendment" + }, + "baseDigest": { + "type": "string", + "pattern": "^[a-f0-9]{64}$" + }, + "record": { + "$ref": "#/$defs/definition" + } + }, + "required": ["format", "id", "contributor", "summary", "kind", "baseDigest", "record"] + }, + { + "type": "object", + "additionalProperties": false, + "properties": { + "format": { + "const": "mailschema-contribution/1" + }, + "id": { + "type": "string", + "pattern": "^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$", + "maxLength": 100 + }, + "contributor": { + "type": "object", + "additionalProperties": false, + "properties": { + "name": { + "type": "string", + "minLength": 1, + "maxLength": 240, + "pattern": "\\S" + }, + "url": { + "type": "string", + "format": "uri", + "pattern": "^https://", + "maxLength": 2048 + } + }, + "required": ["name"] + }, + "source": { + "type": "string", + "format": "uri", + "pattern": "^https://", + "maxLength": 2048 + }, + "summary": { + "type": "string", + "minLength": 1, + "maxLength": 12000, + "pattern": "\\S" + }, + "kind": { + "const": "implementation" + }, + "type": { + "type": "string", + "pattern": "^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$", + "maxLength": 100 + }, + "typeVersion": { + "type": "string", + "pattern": "^[0-9]+\\.[0-9]+(?:\\.[0-9]+)?(?:-[a-zA-Z0-9.-]+)?$", + "maxLength": 80 + }, + "typeDigest": { + "type": "string", + "pattern": "^[a-f0-9]{64}$" + }, + "profile": { + "type": "string", + "minLength": 1, + "maxLength": 240, + "pattern": "\\S" + }, + "product": { + "type": "object", + "additionalProperties": false, + "properties": { + "name": { + "type": "string", + "minLength": 1, + "maxLength": 240, + "pattern": "\\S" + }, + "url": { + "type": "string", + "format": "uri", + "pattern": "^https://", + "maxLength": 2048 + } + }, + "required": ["name"] + }, + "operations": { + "type": "array", + "items": { + "type": "string", + "pattern": "^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$", + "maxLength": 100 + }, + "minItems": 1, + "maxItems": 100 + }, + "evidence": { + "type": "object", + "additionalProperties": false, + "properties": { + "kind": { + "enum": ["declaration", "test-report"] + }, + "url": { + "type": "string", + "format": "uri", + "pattern": "^https://", + "maxLength": 2048 + }, + "reproduction": { + "type": "string", + "minLength": 1, + "maxLength": 12000, + "pattern": "\\S" }, - "required": [ - "format", - "id", - "contributor", - "summary", - "kind", - "type", - "typeVersion", - "typeDigest", - "profile", - "product", - "operations", - "evidence" - ] + "results": { + "type": "string", + "minLength": 1, + "maxLength": 12000, + "pattern": "\\S" + } + }, + "required": ["kind"], + "allOf": [ + { + "if": { + "properties": { + "kind": { + "const": "test-report" + } + }, + "required": ["kind"] + }, + "then": { + "required": ["url", "reproduction", "results"] + } + } + ] } - ] + }, + "required": [ + "format", + "id", + "contributor", + "summary", + "kind", + "type", + "typeVersion", + "typeDigest", + "profile", + "product", + "operations", + "evidence" + ] + } + ] } diff --git a/dist/map-0.1.schema.json b/dist/map-0.1.schema.json index d70acc4..2b08ace 100644 --- a/dist/map-0.1.schema.json +++ b/dist/map-0.1.schema.json @@ -1,275 +1,275 @@ { - "$schema": "https://json-schema.org/draft/2020-12/schema", - "$id": "https://mailschema.org/schemas/map-0.1.schema.json", - "title": "Mail Action Protocol 0.1", - "description": "Description, request, result and problem documents for the MAP 0.1 authenticated HTTPS profile.", - "oneOf": [ - { "$ref": "#/$defs/description" }, - { "$ref": "#/$defs/request" }, - { "$ref": "#/$defs/result" }, - { "$ref": "#/$defs/problem" } - ], - "$defs": { - "profile": { - "const": "https://mailschema.org/profiles/map/0.1" + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "https://mailschema.org/schemas/map-0.1.schema.json", + "title": "Mail Action Protocol 0.1", + "description": "Description, request, result and problem documents for the MAP 0.1 authenticated HTTPS profile.", + "oneOf": [ + { "$ref": "#/$defs/description" }, + { "$ref": "#/$defs/request" }, + { "$ref": "#/$defs/result" }, + { "$ref": "#/$defs/problem" } + ], + "$defs": { + "profile": { + "const": "https://mailschema.org/profiles/map/0.1" + }, + "identifier": { + "type": "string", + "format": "uri", + "maxLength": 2048 + }, + "uuidUrn": { + "type": "string", + "pattern": "^urn:uuid:[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$" + }, + "digest": { + "type": "string", + "pattern": "^sha-256:[a-f0-9]{64}$" + }, + "recordDigest": { + "type": "string", + "pattern": "^sha-256:[a-f0-9]{64}$" + }, + "typeReference": { + "type": "object", + "additionalProperties": false, + "properties": { + "id": { "$ref": "#/$defs/identifier" }, + "version": { + "type": "string", + "pattern": "^[0-9]+\\.[0-9]+(?:\\.[0-9]+)?(?:-[a-zA-Z0-9.-]+)?$", + "maxLength": 80 }, - "identifier": { - "type": "string", - "format": "uri", - "maxLength": 2048 + "recordDigest": { "$ref": "#/$defs/recordDigest" } + }, + "required": ["id", "version", "recordDigest"] + }, + "target": { + "type": "object", + "additionalProperties": false, + "properties": { + "id": { "$ref": "#/$defs/identifier" }, + "revision": { "type": "string", "minLength": 1, "maxLength": 240 }, + "title": { "type": "string", "minLength": 1, "maxLength": 500 }, + "digest": { "$ref": "#/$defs/digest" } + }, + "required": ["id", "revision", "digest"] + }, + "operation": { + "type": "object", + "additionalProperties": false, + "properties": { + "id": { + "type": "string", + "pattern": "^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$", + "maxLength": 100 }, - "uuidUrn": { - "type": "string", - "pattern": "^urn:uuid:[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$" + "name": { "type": "string", "minLength": 1, "maxLength": 240 }, + "description": { "type": "string", "minLength": 1, "maxLength": 2000 }, + "inputSchema": { "$ref": "#/$defs/identifier" } + }, + "required": ["id", "name", "description", "inputSchema"] + }, + "description": { + "type": "object", + "additionalProperties": false, + "properties": { + "@context": { + "const": "https://mailschema.org/contexts/map-0.1.jsonld" }, - "digest": { - "type": "string", - "pattern": "^sha-256:[a-f0-9]{64}$" - }, - "recordDigest": { - "type": "string", - "pattern": "^sha-256:[a-f0-9]{64}$" - }, - "typeReference": { - "type": "object", - "additionalProperties": false, - "properties": { - "id": { "$ref": "#/$defs/identifier" }, - "version": { - "type": "string", - "pattern": "^[0-9]+\\.[0-9]+(?:\\.[0-9]+)?(?:-[a-zA-Z0-9.-]+)?$", - "maxLength": 80 + "@type": { "const": "MailAction" }, + "@id": { "$ref": "#/$defs/uuidUrn" }, + "profile": { "$ref": "#/$defs/profile" }, + "type": { "$ref": "#/$defs/typeReference" }, + "describedAt": { "type": "string", "format": "date-time" }, + "expiresAt": { "type": "string", "format": "date-time" }, + "service": { + "type": "object", + "additionalProperties": false, + "properties": { + "id": { "$ref": "#/$defs/identifier" }, + "name": { "type": "string", "minLength": 1, "maxLength": 240 }, + "execution": { + "type": "object", + "additionalProperties": false, + "properties": { + "url": { "$ref": "#/$defs/identifier" }, + "method": { "const": "POST" }, + "requestMediaType": { "const": "application/json" }, + "resultMediaType": { "const": "application/json" }, + "resultUrlTemplate": { + "type": "string", + "format": "uri-template", + "pattern": "^https://.*\\{requestId\\}.*$", + "maxLength": 2048 }, - "recordDigest": { "$ref": "#/$defs/recordDigest" } - }, - "required": ["id", "version", "recordDigest"] - }, - "target": { - "type": "object", - "additionalProperties": false, - "properties": { - "id": { "$ref": "#/$defs/identifier" }, - "revision": { "type": "string", "minLength": 1, "maxLength": 240 }, - "title": { "type": "string", "minLength": 1, "maxLength": 500 }, - "digest": { "$ref": "#/$defs/digest" } + "resultRetentionSeconds": { + "type": "integer", + "minimum": 300, + "maximum": 31536000 + } + }, + "required": [ + "url", + "method", + "requestMediaType", + "resultMediaType", + "resultUrlTemplate", + "resultRetentionSeconds" + ] }, - "required": ["id", "revision", "digest"] + "humanUrl": { "$ref": "#/$defs/identifier" }, + "authorization": { + "type": "object", + "additionalProperties": false, + "properties": { + "kind": { "const": "service-configured" }, + "schemes": { + "type": "array", + "items": { "enum": ["oauth2", "bearer", "session"] }, + "minItems": 1, + "uniqueItems": true + }, + "audience": { "type": "string", "minLength": 1, "maxLength": 500 } + }, + "required": ["kind", "schemes"] + } + }, + "required": ["id", "name", "execution", "humanUrl", "authorization"] }, + "target": { "$ref": "#/$defs/target" }, + "operations": { + "type": "array", + "items": { "$ref": "#/$defs/operation" }, + "minItems": 1, + "maxItems": 100 + } + }, + "required": [ + "@context", + "@type", + "@id", + "profile", + "type", + "describedAt", + "expiresAt", + "service", + "target", + "operations" + ] + }, + "request": { + "type": "object", + "additionalProperties": false, + "properties": { + "kind": { "const": "MapRequest" }, + "profile": { "$ref": "#/$defs/profile" }, + "requestId": { "$ref": "#/$defs/uuidUrn" }, + "interactionId": { "$ref": "#/$defs/uuidUrn" }, + "requestedAt": { "type": "string", "format": "date-time" }, + "type": { "$ref": "#/$defs/typeReference" }, "operation": { - "type": "object", - "additionalProperties": false, - "properties": { - "id": { - "type": "string", - "pattern": "^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$", - "maxLength": 100 - }, - "name": { "type": "string", "minLength": 1, "maxLength": 240 }, - "description": { "type": "string", "minLength": 1, "maxLength": 2000 }, - "inputSchema": { "$ref": "#/$defs/identifier" } - }, - "required": ["id", "name", "description", "inputSchema"] + "type": "string", + "pattern": "^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$", + "maxLength": 100 }, - "description": { - "type": "object", - "additionalProperties": false, - "properties": { - "@context": { - "const": "https://mailschema.org/contexts/map-0.1.jsonld" - }, - "@type": { "const": "MailAction" }, - "@id": { "$ref": "#/$defs/uuidUrn" }, - "profile": { "$ref": "#/$defs/profile" }, - "type": { "$ref": "#/$defs/typeReference" }, - "describedAt": { "type": "string", "format": "date-time" }, - "expiresAt": { "type": "string", "format": "date-time" }, - "service": { - "type": "object", - "additionalProperties": false, - "properties": { - "id": { "$ref": "#/$defs/identifier" }, - "name": { "type": "string", "minLength": 1, "maxLength": 240 }, - "execution": { - "type": "object", - "additionalProperties": false, - "properties": { - "url": { "$ref": "#/$defs/identifier" }, - "method": { "const": "POST" }, - "requestMediaType": { "const": "application/json" }, - "resultMediaType": { "const": "application/json" }, - "resultUrlTemplate": { - "type": "string", - "format": "uri-template", - "pattern": "^https://.*\\{requestId\\}.*$", - "maxLength": 2048 - }, - "resultRetentionSeconds": { - "type": "integer", - "minimum": 300, - "maximum": 31536000 - } - }, - "required": [ - "url", - "method", - "requestMediaType", - "resultMediaType", - "resultUrlTemplate", - "resultRetentionSeconds" - ] - }, - "humanUrl": { "$ref": "#/$defs/identifier" }, - "authorization": { - "type": "object", - "additionalProperties": false, - "properties": { - "kind": { "const": "service-configured" }, - "schemes": { - "type": "array", - "items": { "enum": ["oauth2", "bearer", "session"] }, - "minItems": 1, - "uniqueItems": true - }, - "audience": { "type": "string", "minLength": 1, "maxLength": 500 } - }, - "required": ["kind", "schemes"] - } - }, - "required": ["id", "name", "execution", "humanUrl", "authorization"] - }, - "target": { "$ref": "#/$defs/target" }, - "operations": { - "type": "array", - "items": { "$ref": "#/$defs/operation" }, - "minItems": 1, - "maxItems": 100 - } - }, - "required": [ - "@context", - "@type", - "@id", - "profile", - "type", - "describedAt", - "expiresAt", - "service", - "target", - "operations" - ] + "target": { "$ref": "#/$defs/target" }, + "input": { "type": "object", "maxProperties": 100 } + }, + "required": [ + "kind", + "profile", + "requestId", + "interactionId", + "requestedAt", + "type", + "operation", + "target", + "input" + ] + }, + "result": { + "type": "object", + "additionalProperties": false, + "properties": { + "kind": { "const": "MapResult" }, + "profile": { "$ref": "#/$defs/profile" }, + "requestId": { "$ref": "#/$defs/uuidUrn" }, + "interactionId": { "$ref": "#/$defs/uuidUrn" }, + "operation": { + "type": "string", + "pattern": "^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$", + "maxLength": 100 }, - "request": { - "type": "object", - "additionalProperties": false, - "properties": { - "kind": { "const": "MapRequest" }, - "profile": { "$ref": "#/$defs/profile" }, - "requestId": { "$ref": "#/$defs/uuidUrn" }, - "interactionId": { "$ref": "#/$defs/uuidUrn" }, - "requestedAt": { "type": "string", "format": "date-time" }, - "type": { "$ref": "#/$defs/typeReference" }, - "operation": { - "type": "string", - "pattern": "^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$", - "maxLength": 100 - }, - "target": { "$ref": "#/$defs/target" }, - "input": { "type": "object", "maxProperties": 100 } - }, - "required": [ - "kind", - "profile", - "requestId", - "interactionId", - "requestedAt", - "type", - "operation", - "target", - "input" - ] + "state": { "enum": ["accepted", "completed", "pending", "approval-required"] }, + "target": { "$ref": "#/$defs/target" }, + "recordedAt": { "type": "string", "format": "date-time" }, + "resultUrl": { "$ref": "#/$defs/identifier" }, + "output": { "type": "object", "maxProperties": 100 } + }, + "required": [ + "kind", + "profile", + "requestId", + "interactionId", + "operation", + "state", + "target", + "recordedAt", + "resultUrl", + "output" + ] + }, + "problem": { + "type": "object", + "additionalProperties": false, + "properties": { + "type": { + "enum": [ + "https://mailschema.org/problems/refused", + "https://mailschema.org/problems/stale-target", + "https://mailschema.org/problems/expired-interaction", + "https://mailschema.org/problems/invalid-request", + "https://mailschema.org/problems/unsupported-profile", + "https://mailschema.org/problems/unsupported-type", + "https://mailschema.org/problems/unsupported-operation", + "https://mailschema.org/problems/idempotency-conflict", + "https://mailschema.org/problems/request-in-progress" + ] }, - "result": { - "type": "object", - "additionalProperties": false, - "properties": { - "kind": { "const": "MapResult" }, - "profile": { "$ref": "#/$defs/profile" }, - "requestId": { "$ref": "#/$defs/uuidUrn" }, - "interactionId": { "$ref": "#/$defs/uuidUrn" }, - "operation": { - "type": "string", - "pattern": "^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$", - "maxLength": 100 - }, - "state": { "enum": ["accepted", "completed", "pending", "approval-required"] }, - "target": { "$ref": "#/$defs/target" }, - "recordedAt": { "type": "string", "format": "date-time" }, - "resultUrl": { "$ref": "#/$defs/identifier" }, - "output": { "type": "object", "maxProperties": 100 } - }, - "required": [ - "kind", - "profile", - "requestId", - "interactionId", - "operation", - "state", - "target", - "recordedAt", - "resultUrl", - "output" - ] + "title": { "type": "string", "minLength": 1, "maxLength": 240 }, + "status": { "type": "integer", "minimum": 400, "maximum": 599 }, + "detail": { "type": "string", "minLength": 1, "maxLength": 4000 }, + "instance": { "$ref": "#/$defs/identifier" }, + "profile": { "$ref": "#/$defs/profile" }, + "requestId": { "$ref": "#/$defs/uuidUrn" }, + "interactionId": { "$ref": "#/$defs/uuidUrn" }, + "code": { + "enum": [ + "refused", + "stale-target", + "expired-interaction", + "invalid-request", + "unsupported-profile", + "unsupported-type", + "unsupported-operation", + "idempotency-conflict", + "request-in-progress" + ] }, - "problem": { - "type": "object", - "additionalProperties": false, - "properties": { - "type": { - "enum": [ - "https://mailschema.org/problems/refused", - "https://mailschema.org/problems/stale-target", - "https://mailschema.org/problems/expired-interaction", - "https://mailschema.org/problems/invalid-request", - "https://mailschema.org/problems/unsupported-profile", - "https://mailschema.org/problems/unsupported-type", - "https://mailschema.org/problems/unsupported-operation", - "https://mailschema.org/problems/idempotency-conflict", - "https://mailschema.org/problems/request-in-progress" - ] - }, - "title": { "type": "string", "minLength": 1, "maxLength": 240 }, - "status": { "type": "integer", "minimum": 400, "maximum": 599 }, - "detail": { "type": "string", "minLength": 1, "maxLength": 4000 }, - "instance": { "$ref": "#/$defs/identifier" }, - "profile": { "$ref": "#/$defs/profile" }, - "requestId": { "$ref": "#/$defs/uuidUrn" }, - "interactionId": { "$ref": "#/$defs/uuidUrn" }, - "code": { - "enum": [ - "refused", - "stale-target", - "expired-interaction", - "invalid-request", - "unsupported-profile", - "unsupported-type", - "unsupported-operation", - "idempotency-conflict", - "request-in-progress" - ] - }, - "target": { "$ref": "#/$defs/target" } - }, - "required": [ - "type", - "title", - "status", - "detail", - "instance", - "profile", - "requestId", - "interactionId", - "code" - ] - } + "target": { "$ref": "#/$defs/target" } + }, + "required": [ + "type", + "title", + "status", + "detail", + "instance", + "profile", + "requestId", + "interactionId", + "code" + ] } + } } diff --git a/package-lock.json b/package-lock.json index fb7a015..cb1b38f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "mailschema", - "version": "0.1.2", + "version": "0.1.3", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "mailschema", - "version": "0.1.2", + "version": "0.1.3", "license": "MIT", "dependencies": { "ajv": "8.20.0", diff --git a/package.json b/package.json index 339c773..dcc1bb1 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "mailschema", - "version": "0.1.2", + "version": "0.1.3", "description": "Schemas and validation tools for Mail Action Protocol and the MailSchema Registry", "type": "module", "license": "MIT", @@ -37,7 +37,7 @@ "LICENSE" ], "scripts": { - "build": "tsc -p tsconfig.json", + "build": "node build.mjs", "test": "npm run build && node --test test/*.test.mjs" }, "dependencies": { diff --git a/test/package.test.mjs b/test/package.test.mjs index 082d663..59ea028 100644 --- a/test/package.test.mjs +++ b/test/package.test.mjs @@ -13,13 +13,22 @@ const load = async (name) => JSON.parse(await readFile(new URL(name, import.meta test('exposes the canonical schema identifiers', () => { assert.equal(getMapSchema().$id, 'https://mailschema.org/schemas/map-0.1.schema.json'); - assert.equal( - getContributionSchema().$schema, - 'https://json-schema.org/draft/2020-12/schema', - ); + assert.equal(getContributionSchema().$schema, 'https://json-schema.org/draft/2020-12/schema'); }); test('validates MAP and Content Review fixtures', async () => { assertMapDocument(await load('map-description.json')); assertContentReviewRequest(await load('map-request.json')); }); + +test('preserves canonical schema bytes during the build', async () => { + for (const name of [ + 'contribution.schema.json', + 'map-0.1.schema.json', + 'content-review-0.1.schema.json', + ]) { + const source = await readFile(new URL(`../src/${name}`, import.meta.url)); + const built = await readFile(new URL(`../dist/${name}`, import.meta.url)); + assert.deepEqual(built, source); + } +});