From 5b8f3ae828693f50876a22d0669f7b73dbf3a156 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antonio=20Mendoza=20P=C3=A9rez?= Date: Mon, 5 Jul 2021 21:43:07 +0200 Subject: [PATCH] improve readme from source example MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Antonio Mendoza Pérez --- README.md | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index f36db9d8..130aa046 100644 --- a/README.md +++ b/README.md @@ -71,16 +71,26 @@ const workflow: Specification.Workflow = workflowBuilder() .build(); ``` - -#### Load a file JSON/YAML to a Workflow instance +#### Create Workflow from JSON/YAML source ```typescript import { Specification, Workflow } from '@severlessworkflow/sdk-typescript'; +const source = `id: helloworld +version: '1.0' +name: Hello World Workflow +description: Inject Hello World +start: Hello State +states: + - type: inject + name: Hello State + data: + result: Hello World! + end: true` + const workflow: Specification.Workflow = Workflow.fromSource(source); ``` -Where `source` is a JSON or a YAML string. - +Where `source` can be in both JSON or YAML format. #### Parse a Workflow instance to JSON/YAML