From e2aef015bd342724f771ec3623f4cde4c2fea2b7 Mon Sep 17 00:00:00 2001 From: Liran Cohen Date: Wed, 4 Sep 2024 09:39:47 -0400 Subject: [PATCH] Add detailed description for $tags property with constraints in protocol definition --- spec/spec.md | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/spec/spec.md b/spec/spec.md index a37aef4..84216b0 100644 --- a/spec/spec.md +++ b/spec/spec.md @@ -1203,6 +1203,8 @@ Retained messages in the Records interface are those that may be stored against DWeb Nodes are designed to act the substrate upon which a wide variety of decentralized applications and services can be written. With an interface like [Records](#records) alone, a DWeb Node owner and those they permission can write isolated records, but that alone is not enough to support and facilitate decentralized apps. Protocols introduces a mechanism for declaratively encoding an app or service's underlying protocol rules, including segmentation of records, relationships between records, data-level requirements, and constraints on how participants interact with a protocol. With the DWeb Node Protocols mechanism, one can model the underpinning protocols for a vast array of use cases in a way that enables interop-by-default between app implementations that ride on top of them. + + #### `ProtocolsConfigure` `ProtocolsConfigure` messages are JSON objects that include general [Message Descriptor](#message-descriptors) properties and the following additional properties, which ****must**** be composed as follows: @@ -1293,7 +1295,13 @@ Protocol Definition objects are declarative rules within `ProtocolConfigure` mes - The _Protocols Definition_ object ****MUST**** contain a `structure` property, and its value ****MUST**** be a _Record Rules_ object whose keys match the labels defined in the _Protocols Definition_ object. This object is recursive, allowing subsequent record relationships to be defined within. Labeled members of the object are composed as follows: - The keys of the object ****MUST**** be a string that matches one of the `types` - The values representing those keys within the object ****MUST**** be an object composed as follows: - - The object ****MAY**** contain an `$actions` property and its value ****MUST**** be an array of rule set objects described as follows: + - The object ****MAY**** contain a `$tags` property; if present, its value ****MUST**** be an object with defined constraints: + - `$requiredTags` (optional) is an array that lists required tag names. + - `$allowUndefinedTags` (optional) is a boolean that defaults to false, and if set to false, undefined tags are not allowed. + - The constraints are a subset of JSON Schema that may include properties such as `type`, `enum`, `minimum`, `maximum`, `minLength`, `maxLength`, and others. + - Protocols can define these constraints for each tag, ensuring adherence to the expected formats and usage guidelines specified within the protocol definition. + +- The object ****MAY**** contain an `$actions` property and its value ****MUST**** be an array of rule set objects described as follows: - The object ****MUST**** contain a `who` property and it ****MUST**** have one of the following values: - `anyone` - `author`