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 public/connect/schemas/catalog.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"manifest_version": 1,
"schemas": {
"app_manifest": "./mdbase-app.schema.json",
"contract_extension": "./contract-extension.v1.schema.json",
"data_contract": "./data-contract.schema.json",
"connect_protocol": "./connect-protocol.v1.schema.json",
"encrypted_relay": "./encrypted-relay.v1.schema.json",
"notification_webhook": "./notification-webhook.v1.schema.json",
Expand Down
112 changes: 96 additions & 16 deletions public/connect/schemas/connect-protocol.v1.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,26 @@
"required": ["id", "version"],
"properties": {
"id": { "type": "string", "minLength": 1, "maxLength": 100, "pattern": "^[a-z0-9]+(?:[._-][a-z0-9]+)*$" },
"version": { "$ref": "#/$defs/semanticVersion" }
}
},
"runtimeContractRequirement": {
"type": "object",
"additionalProperties": false,
"required": ["id", "version"],
"properties": {
"id": { "type": "string", "minLength": 1, "maxLength": 100 },
"version": { "type": "integer", "minimum": 1 }
}
},
"semanticVersion": {
"type": "string",
"pattern": "^(0|[1-9][0-9]*)\\.(0|[1-9][0-9]*)\\.(0|[1-9][0-9]*)(?:-[0-9A-Za-z-]+(?:\\.[0-9A-Za-z-]+)*)?(?:\\+[0-9A-Za-z-]+(?:\\.[0-9A-Za-z-]+)*)?$"
},
"digest": {
"type": "string",
"pattern": "^sha256:[0-9a-f]{64}$"
},
"grantScope": {
"type": "object",
"additionalProperties": false,
Expand All @@ -38,7 +55,7 @@
"contracts": {
"type": "array",
"maxItems": 20,
"items": { "$ref": "#/$defs/contractRequirement" }
"items": { "$ref": "#/$defs/collectionContract" }
}
}
},
Expand Down Expand Up @@ -160,7 +177,7 @@
"contracts": {
"type": "array",
"maxItems": 100,
"items": { "$ref": "#/$defs/contractRequirement" }
"items": { "$ref": "#/$defs/collectionContract" }
}
}
},
Expand All @@ -177,30 +194,72 @@
"access": { "enum": ["contract", "full_collection"] }
}
},
"typeProvision": {
"typePackProvision": {
"type": "object",
"additionalProperties": false,
"required": ["name", "document", "provides"],
"required": ["manifest", "resources", "provides"],
"properties": {
"name": { "type": "string", "minLength": 1, "maxLength": 100 },
"path": { "type": "string", "minLength": 1, "maxLength": 500 },
"document": { "type": "string", "minLength": 1, "maxLength": 262144 },
"manifest": { "$ref": "#/$defs/typePackManifest" },
"resources": {
"type": "array",
"minItems": 1,
"maxItems": 100,
"items": { "$ref": "#/$defs/typePackSourceResource" }
},
"provides": {
"type": "array",
"maxItems": 20,
"items": { "$ref": "#/$defs/contractRequirement" }
}
}
},
"typePackManifest": {
"type": "object",
"required": ["kind", "id", "version", "resources"],
"properties": {
"kind": { "const": "mdbase.type-pack" },
"id": { "type": "string", "minLength": 3 },
"version": { "$ref": "#/$defs/semanticVersion" },
"name": { "type": "string", "minLength": 1 },
"description": { "type": "string" },
"resources": {
"type": "array",
"minItems": 1,
"items": { "$ref": "#/$defs/typePackManifestResource" }
}
},
"patternProperties": { "^x-[A-Za-z][A-Za-z0-9._:-]{0,127}$": true },
"additionalProperties": false
},
"typePackManifestResource": {
"type": "object",
"additionalProperties": false,
"required": ["kind", "source", "target", "digest"],
"properties": {
"kind": { "enum": ["contract", "type", "schema"] },
"source": { "type": "string", "minLength": 1, "maxLength": 500 },
"target": { "type": "string", "minLength": 1, "maxLength": 500 },
"digest": { "$ref": "#/$defs/digest" }
}
},
"typePackSourceResource": {
"type": "object",
"additionalProperties": false,
"required": ["source", "document"],
"properties": {
"source": { "type": "string", "minLength": 1, "maxLength": 500 },
"document": { "type": "string", "maxLength": 262144 }
}
},
"applicationProvisions": {
"type": "object",
"additionalProperties": false,
"required": ["types"],
"required": ["type_packs"],
"properties": {
"types": {
"type_packs": {
"type": "array",
"maxItems": 100,
"items": { "$ref": "#/$defs/typeProvision" }
"items": { "$ref": "#/$defs/typePackProvision" }
}
}
},
Expand Down Expand Up @@ -258,7 +317,7 @@
"contracts": {
"type": "array",
"maxItems": 100,
"items": { "$ref": "#/$defs/contractRequirement" }
"items": { "$ref": "#/$defs/collectionContract" }
},
"error": {
"type": "object",
Expand Down Expand Up @@ -289,7 +348,7 @@
"required": ["id", "event", "presentation"],
"properties": {
"id": { "type": "string", "minLength": 1, "maxLength": 100, "pattern": "^[a-z0-9]+(?:[._-][a-z0-9]+)*$" },
"event": { "$ref": "#/$defs/contractRequirement" },
"event": { "$ref": "#/$defs/runtimeContractRequirement" },
"if": {
"type": "object",
"additionalProperties": false,
Expand Down Expand Up @@ -370,13 +429,34 @@
"collectionContract": {
"type": "object",
"additionalProperties": false,
"required": ["id", "version", "type_name", "extension", "configuration"],
"required": ["id", "version", "digest", "schema", "implementations"],
"properties": {
"id": { "type": "string", "minLength": 1 },
"version": { "type": "integer", "minimum": 1 },
"version": { "$ref": "#/$defs/semanticVersion" },
"digest": { "$ref": "#/$defs/digest" },
"schema": { "type": "object" },
"binding_schema": { "type": "object" },
"implementations": {
"type": "array",
"minItems": 1,
"items": { "$ref": "#/$defs/collectionContractImplementation" }
}
}
},
"collectionContractImplementation": {
"type": "object",
"additionalProperties": false,
"required": ["type_name", "type_version", "digest", "fields"],
"properties": {
"type_name": { "type": "string", "minLength": 1 },
"extension": { "type": "string", "pattern": "^x-[a-z0-9]+(?:[._-][a-z0-9]+)*$" },
"configuration": { "type": "object" }
"type_version": { "type": "integer", "minimum": 1 },
"type_path": { "type": "string", "minLength": 1 },
"digest": { "$ref": "#/$defs/digest" },
"fields": {
"type": "object",
"additionalProperties": { "type": "string", "minLength": 1 }
},
"binding": { "type": "object" }
}
},
"changesPage": {
Expand Down
58 changes: 58 additions & 0 deletions public/connect/schemas/data-contract.schema.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://mdbase.dev/schemas/v0.3/data-contract.schema.json",
"title": "mdbase v0.3 data contract frontmatter",
"type": "object",
"required": ["kind", "id", "version", "schema"],
"properties": {
"kind": { "const": "mdbase.contract" },
"id": { "$ref": "#/$defs/contractId" },
"version": { "$ref": "#/$defs/semanticVersion" },
"name": { "type": "string", "minLength": 1 },
"description": { "type": "string" },
"schema": { "$ref": "#/$defs/schemaWrapper" },
"binding_schema": { "$ref": "#/$defs/schemaWrapper" }
},
"patternProperties": {
"^x-[A-Za-z][A-Za-z0-9._:-]{0,127}$": true
},
"additionalProperties": false,
"$defs": {
"contractId": {
"type": "string",
"minLength": 3,
"maxLength": 128,
"pattern": "^[a-z][a-z0-9]*(?:[._-][a-z0-9]+)+$"
},
"semanticVersion": {
"type": "string",
"pattern": "^(0|[1-9][0-9]*)\\.(0|[1-9][0-9]*)\\.(0|[1-9][0-9]*)(?:-[0-9A-Za-z-]+(?:\\.[0-9A-Za-z-]+)*)?(?:\\+[0-9A-Za-z-]+(?:\\.[0-9A-Za-z-]+)*)?$"
},
"schemaWrapper": {
"type": "object",
"required": ["dialect"],
"properties": {
"dialect": { "const": "json-schema-2020-12" },
"value": { "type": "object" },
"ref": { "type": "string", "minLength": 1 }
},
"oneOf": [
{
"required": ["value"],
"properties": {
"value": true,
"ref": false
}
},
{
"required": ["ref"],
"properties": {
"ref": true,
"value": false
}
}
],
"additionalProperties": false
}
}
}
73 changes: 64 additions & 9 deletions public/connect/schemas/mdbase-app.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,12 @@
"provisions": {
"type": "object",
"additionalProperties": false,
"required": ["types"],
"required": ["type_packs"],
"properties": {
"types": {
"type_packs": {
"type": "array",
"maxItems": 20,
"items": { "$ref": "#/$defs/typeProvision" }
"items": { "$ref": "#/$defs/typePackProvision" }
}
}
},
Expand Down Expand Up @@ -91,6 +91,18 @@
"pattern": "^[0-9]+(ms|s|m|h|d)$"
},
"contract": {
"type": "object",
"additionalProperties": false,
"required": ["id", "version"],
"properties": {
"id": { "$ref": "#/$defs/identifier" },
"version": {
"type": "string",
"pattern": "^(0|[1-9][0-9]*)\\.(0|[1-9][0-9]*)\\.(0|[1-9][0-9]*)(?:-[0-9A-Za-z-]+(?:\\.[0-9A-Za-z-]+)*)?(?:\\+[0-9A-Za-z-]+(?:\\.[0-9A-Za-z-]+)*)?$"
}
}
},
"runtimeContract": {
"type": "object",
"additionalProperties": false,
"required": ["id", "version"],
Expand Down Expand Up @@ -120,14 +132,18 @@
}
}
},
"typeProvision": {
"typePackProvision": {
"type": "object",
"additionalProperties": false,
"required": ["name", "document", "provides"],
"required": ["manifest", "resources", "provides"],
"properties": {
"name": { "type": "string", "minLength": 1, "maxLength": 100 },
"path": { "type": "string", "minLength": 1, "maxLength": 240 },
"document": { "type": "string", "minLength": 1, "maxLength": 131072 },
"manifest": { "$ref": "#/$defs/typePackManifest" },
"resources": {
"type": "array",
"minItems": 1,
"maxItems": 100,
"items": { "$ref": "#/$defs/typePackSourceResource" }
},
"provides": {
"type": "array",
"maxItems": 20,
Expand All @@ -136,13 +152,52 @@
}
}
},
"typePackManifest": {
"type": "object",
"required": ["kind", "id", "version", "resources"],
"properties": {
"kind": { "const": "mdbase.type-pack" },
"id": { "$ref": "#/$defs/identifier" },
"version": { "$ref": "#/$defs/contract/properties/version" },
"name": { "type": "string", "minLength": 1, "maxLength": 100 },
"description": { "type": "string", "maxLength": 500 },
"resources": {
"type": "array",
"minItems": 1,
"maxItems": 100,
"items": { "$ref": "#/$defs/typePackManifestResource" }
}
},
"patternProperties": { "^x-[A-Za-z][A-Za-z0-9._:-]{0,127}$": true },
"additionalProperties": false
},
"typePackManifestResource": {
"type": "object",
"additionalProperties": false,
"required": ["kind", "source", "target", "digest"],
"properties": {
"kind": { "enum": ["contract", "type", "schema"] },
"source": { "type": "string", "minLength": 1, "maxLength": 240 },
"target": { "type": "string", "minLength": 1, "maxLength": 240 },
"digest": { "type": "string", "pattern": "^sha256:[0-9a-f]{64}$" }
}
},
"typePackSourceResource": {
"type": "object",
"additionalProperties": false,
"required": ["source", "document"],
"properties": {
"source": { "type": "string", "minLength": 1, "maxLength": 240 },
"document": { "type": "string", "maxLength": 262144 }
}
},
"notificationCriterion": {
"type": "object",
"additionalProperties": false,
"required": ["id", "event", "presentation"],
"properties": {
"id": { "$ref": "#/$defs/identifier" },
"event": { "$ref": "#/$defs/contract" },
"event": { "$ref": "#/$defs/runtimeContract" },
"if": {
"type": "object",
"additionalProperties": false,
Expand Down
Loading