-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat(schemas): WIP sequence syntax * feat: conditional validation for sequence wait * feat: conditional validation for sequence assert * release(application-schema): 1-2-0 * fix typos and revise logic
- Loading branch information
Showing
8 changed files
with
269 additions
and
13 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
7 changes: 7 additions & 0 deletions
7
schemas/applications/schema/events/identifiers/condition.schema.json
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"$schema": "https://json-schema.org/draft/2020-12/schema", | ||
"title": "Condition Name", | ||
"description": "The name of a condition", | ||
"type": "string", | ||
"pattern": "(^[a-zA-Z][a-zA-Z0-9_]*[a-zA-Z0-9]$)|(^[a-zA-Z]$)" | ||
} |
7 changes: 7 additions & 0 deletions
7
schemas/applications/schema/events/identifiers/predicate.schema.json
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"$schema": "https://json-schema.org/draft/2020-12/schema", | ||
"title": "Predicate Name", | ||
"description": "The name of a predicate", | ||
"type": "string", | ||
"pattern": "^[a-zA-Z][a-zA-Z0-9_]*[a-zA-Z0-9]$" | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
{ | ||
"$schema": "https://json-schema.org/draft/2020-12/schema", | ||
"title": "Manage a sequence", | ||
"description": "Start, restart or abort a sequence", | ||
"oneOf": [ | ||
{ | ||
"type": "array", | ||
"minItems": 1, | ||
"items": { | ||
"$ref": "#/$defs/sequence_object" | ||
} | ||
}, | ||
{ | ||
"$ref": "#/$defs/sequence_object" | ||
} | ||
], | ||
"$defs": { | ||
"sequence_object": { | ||
"title": "Sequence event", | ||
"type": "object", | ||
"additionalProperties": false, | ||
"properties": { | ||
"start": { | ||
"description": "Name of the sequence to start", | ||
"type": "string" | ||
}, | ||
"restart": { | ||
"description": "Name of the sequence to restart", | ||
"type": "string" | ||
}, | ||
"abort": { | ||
"description": "Name of the sequence to abort", | ||
"type": "string" | ||
} | ||
}, | ||
"oneOf": [ | ||
{ | ||
"required": [ | ||
"start" | ||
] | ||
}, | ||
{ | ||
"required": [ | ||
"restart" | ||
] | ||
}, | ||
{ | ||
"required": [ | ||
"abort" | ||
] | ||
} | ||
] | ||
} | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,177 @@ | ||
{ | ||
"$schema": "https://json-schema.org/draft/2020-12/schema", | ||
"title": "Sequences", | ||
"description": "A description of sequences used to trigger events events in a specific order", | ||
"type": "object", | ||
"additionalProperties": false, | ||
"patternProperties": { | ||
"(^[a-zA-Z][a-zA-Z0-9_]*[a-zA-Z0-9]$)|(^[a-zA-Z]$)": { | ||
"title": "Sequence", | ||
"description": "A named event sequence", | ||
"type": "array", | ||
"items": { | ||
"oneOf": [ | ||
{ | ||
"$ref": "events.schema.json" | ||
}, | ||
{ | ||
"title": "Wait", | ||
"additionalProperties": false, | ||
"properties": { | ||
"wait": { | ||
"oneOf": [ | ||
{ | ||
"$ref": "#/$defs/wait_for_condition" | ||
}, | ||
{ | ||
"$ref": "#/$defs/wait_for_predicate" | ||
}, | ||
{ | ||
"$ref": "#/$defs/wait_for_time" | ||
} | ||
] | ||
} | ||
}, | ||
"required": [ | ||
"wait" | ||
] | ||
}, | ||
{ | ||
"title": "Assert", | ||
"additionalProperties": false, | ||
"properties": { | ||
"assert": { | ||
"oneOf": [ | ||
{ | ||
"$ref": "#/$defs/assert_condition" | ||
}, | ||
{ | ||
"$ref": "#/$defs/assert_predicate" | ||
} | ||
] | ||
} | ||
}, | ||
"required": [ | ||
"assert" | ||
] | ||
} | ||
] | ||
} | ||
} | ||
}, | ||
"$defs": { | ||
"seconds": { | ||
"title": "Seconds to wait", | ||
"description": "The duration to wait in seconds", | ||
"type": "number" | ||
}, | ||
"timeout": { | ||
"type": "object", | ||
"additionalProperties": false, | ||
"properties": { | ||
"seconds": { | ||
"$ref": "#/$defs/seconds" | ||
}, | ||
"events": { | ||
"$ref": "events.schema.json" | ||
} | ||
}, | ||
"required": [ | ||
"seconds", | ||
"events" | ||
] | ||
}, | ||
"wait_for_condition": { | ||
"title": "Wait for Condition", | ||
"description": "Wait until a condition is true with an optional timeout to abort the sequence and handle breakout events", | ||
"type": "object", | ||
"additionalProperties": false, | ||
"properties": { | ||
"condition": { | ||
"$ref": "events/identifiers/condition.schema.json" | ||
}, | ||
"timeout": { | ||
"$ref": "#/$defs/timeout" | ||
} | ||
}, | ||
"required": [ | ||
"condition" | ||
] | ||
}, | ||
"wait_for_predicate": { | ||
"title": "Wait for Predicate", | ||
"description": "Wait until a component predicate is true with an optional timeout to abort the sequence and handle breakout events", | ||
"type": "object", | ||
"additionalProperties": false, | ||
"properties": { | ||
"component": { | ||
"$ref": "events/identifiers/component.schema.json" | ||
}, | ||
"predicate": { | ||
"$ref": "events/identifiers/predicate.schema.json" | ||
}, | ||
"timeout": { | ||
"$ref": "#/$defs/timeout" | ||
} | ||
}, | ||
"required": [ | ||
"component", | ||
"predicate" | ||
] | ||
}, | ||
"wait_for_time": { | ||
"title": "Wait", | ||
"description": "Wait for a defined time", | ||
"type": "object", | ||
"additionalProperties": false, | ||
"properties": { | ||
"seconds": { | ||
"$ref": "#/$defs/seconds" | ||
} | ||
}, | ||
"required": [ | ||
"seconds" | ||
] | ||
}, | ||
"assert_condition": { | ||
"title": "Assert Condition", | ||
"description": "Assert that a condition is true or else abort the sequence and handle breakout events", | ||
"type": "object", | ||
"additionalProperties": false, | ||
"properties": { | ||
"condition": { | ||
"$ref": "events/identifiers/condition.schema.json" | ||
}, | ||
"else": { | ||
"description": "A description of application events to be triggered if the assertion fails", | ||
"$ref": "events.schema.json" | ||
} | ||
}, | ||
"required": [ | ||
"condition" | ||
] | ||
}, | ||
"assert_predicate": { | ||
"title": "Assert Predicate", | ||
"description": "Assert that a component predicate is true or else abort the sequence and handle breakout events", | ||
"type": "object", | ||
"additionalProperties": false, | ||
"properties": { | ||
"component": { | ||
"$ref": "events/identifiers/component.schema.json" | ||
}, | ||
"predicate": { | ||
"$ref": "events/identifiers/predicate.schema.json" | ||
}, | ||
"else": { | ||
"description": "A description of application events to be triggered if the assertion fails", | ||
"$ref": "events.schema.json" | ||
} | ||
}, | ||
"required": [ | ||
"component", | ||
"predicate" | ||
] | ||
} | ||
} | ||
} |