Skip to content

Commit

Permalink
Add detailed description for $tags property with constraints in proto…
Browse files Browse the repository at this point in the history
…col definition
  • Loading branch information
LiranCohen committed Sep 4, 2024
1 parent 6a7372c commit e2aef01
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion spec/spec.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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`
Expand Down

0 comments on commit e2aef01

Please sign in to comment.