File tree Expand file tree Collapse file tree 1 file changed +22
-1
lines changed Expand file tree Collapse file tree 1 file changed +22
-1
lines changed Original file line number Diff line number Diff line change @@ -6,7 +6,7 @@ Provides the Typescript API/SPI for the [Serverless Workflow Specification](http
6
6
With the SDK you can:
7
7
* Parse workflow JSON and YAML definitions
8
8
* (_ WIP_ ) Programmatically build workflow definitions
9
-
9
+ * ( _ WIP _ ) Validate workflow definitions
10
10
11
11
## Getting Started
12
12
@@ -107,5 +107,26 @@ by using the static methods `toJSON` or `toYAML` respectively:
107
107
const workflowAsYAML = BaseWorkflow .toYAML (workflow );
108
108
```
109
109
110
+ #### Validate workflow definitions
111
+
112
+ The sdk provides a way to validate if a workflow object is compliant with the serverlessworkflow specification.
113
+
114
+ ` WorkflowValidator ` class provides two methods:
115
+
116
+ - ` isValid(): boolean `
117
+
118
+ ``` typescript
119
+
120
+ const isValid = new WorkflowValidator (workflow ).isValid ();
121
+
122
+ ```
123
+
124
+ - ` validate(): ValidationErrors `
110
125
126
+ ``` typescript
111
127
128
+ const validationErrors = new WorkflowValidator (workflow ).validate ();
129
+ validationErrors .errors ().forEach (error => console .error (error .message ()))
130
+
131
+
132
+ ```
You can’t perform that action at this time.
0 commit comments