Skip to content

Commit

Permalink
Validate workflow definitions
Browse files Browse the repository at this point in the history
Signed-off-by: Antonio Mendoza Pérez <[email protected]>
  • Loading branch information
antmendoza committed Apr 17, 2021
1 parent ef6071a commit 292b2df
Showing 1 changed file with 22 additions and 1 deletion.
23 changes: 22 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Provides the Typescript API/SPI for the [Serverless Workflow Specification](http
With the SDK you can:
* Parse workflow JSON and YAML definitions
* (_WIP_) Programmatically build workflow definitions

* (_WIP_) Validate workflow definitions

## Getting Started

Expand Down Expand Up @@ -107,5 +107,26 @@ by using the static methods `toJSON` or `toYAML` respectively:
const workflowAsYAML = BaseWorkflow.toYAML(workflow);
```

#### Validate workflow definitions

The sdk provides a way to validate if a workflow object is compliant with the serverlessworkflow specification.

`WorkflowValidator` class provides two methods:

- `isValid(): boolean`

```typescript

const isValid = new WorkflowValidator(workflow).isValid();

```

- `validate(): ValidationErrors`

```typescript

const validationErrors = new WorkflowValidator(workflow).validate();
validationErrors.errors().forEach(error => console.error(error.message()))


```

0 comments on commit 292b2df

Please sign in to comment.