generated from TBD54566975/tbd-project-template
-
Notifications
You must be signed in to change notification settings - Fork 104
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Enforce protocol defined RecordsWrite
tags
(#711)
This will allow protocol defined tags to adhere to schema rules by adding a $tags property under the protocolPath definition.. ```typescript const protocolDefinition: ProtocolDefinition = { protocol : 'http://example.com/protocol/withTags', published : true, types : { foo: {} }, structure: { foo: { $tags: { // tag definitions go here } } }, }; ``` Tags are defined as objects within the $tag object. Each property is the tag name, and the object is a JSON Schema definition. The following definition requires a `draft` boolean tag to be present as well as a `status` tag which can only have the value of `success` or `failure`. Additional undefined tags are allowed without any validation due to `allowUndefinedTags` set to `true`, this is set to `false` by default. ```typescript $tags: { allowUndefinedTags: true, requiredTags: ['status', 'draft'], status: { type: 'string', enum: ['success', 'failure'] }, draft: { type: 'boolean' } } ``` Types: ✅ string ✅ number ✅ array ✅ integer Value-testing props: ✅ minLength ✅ maxLength ✅ minimum ✅ exclusiveMinimum ✅ maximum ✅ exclusiveMaximum ✅ minItems ✅ maxItems ✅ minContains ✅ maxContains ✅ uniqueItems Array evaluation props: ✅ contains (bound to same restricted list value-testing props above) ✅ items (bound to same restricted list value-testing props above) --------- Co-authored-by: Henry Tsai <[email protected]>
- Loading branch information
1 parent
cf50d0a
commit 4bdd0c6
Showing
7 changed files
with
2,108 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.