Skip to content

Commit 36460fc

Browse files
authored
Merge pull request #115 from antmendoza/improve-readme
improve readme fromSource example
2 parents 6e6dc9d + 5b8f3ae commit 36460fc

File tree

1 file changed

+14
-4
lines changed

1 file changed

+14
-4
lines changed

README.md

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -71,16 +71,26 @@ const workflow: Specification.Workflow = workflowBuilder()
7171
.build();
7272
```
7373

74-
75-
#### Load a file JSON/YAML to a Workflow instance
74+
#### Create Workflow from JSON/YAML source
7675

7776
```typescript
7877
import { Specification, Workflow } from '@severlessworkflow/sdk-typescript';
7978

79+
const source = `id: helloworld
80+
version: '1.0'
81+
name: Hello World Workflow
82+
description: Inject Hello World
83+
start: Hello State
84+
states:
85+
- type: inject
86+
name: Hello State
87+
data:
88+
result: Hello World!
89+
end: true`
90+
8091
const workflow: Specification.Workflow = Workflow.fromSource(source);
8192
```
82-
Where `source` is a JSON or a YAML string.
83-
93+
Where `source` can be in both JSON or YAML format.
8494

8595
#### Parse a Workflow instance to JSON/YAML
8696

0 commit comments

Comments
 (0)