-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Target netstandard2, Yaml support, object graph support (#328)
- Loading branch information
1 parent
d161f84
commit c182dce
Showing
40 changed files
with
475 additions
and
311 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
# Workflow Core 2.0.0 | ||
|
||
### Upgrade notes | ||
Existing JSON definitions will be loaded as follows | ||
```c# | ||
using WorkflowCore.Services.DefinitionStorage; | ||
... | ||
DefinitionLoader.LoadDefinition(json, Deserializers.Json); | ||
``` | ||
|
||
|
||
* Targets .NET Standard 2.0 | ||
|
||
The core library now targets .NET Standard 2.0, in order to leverage newer features. | ||
|
||
* Support for YAML definitions | ||
|
||
Added support for YAML workflow definitions, which can be loaded as follows | ||
```c# | ||
using WorkflowCore.Services.DefinitionStorage; | ||
... | ||
DefinitionLoader.LoadDefinition(json, Deserializers.Yaml); | ||
``` | ||
|
||
Existing JSON definitions will be loaded as follows | ||
```c# | ||
using WorkflowCore.Services.DefinitionStorage; | ||
... | ||
DefinitionLoader.LoadDefinition(json, Deserializers.Json); | ||
``` | ||
|
||
* Object graphs and inline expressions on input properties | ||
|
||
You can now pass object graphs to step inputs as opposed to just scalar values | ||
``` | ||
"inputs": | ||
{ | ||
"Body": { | ||
"Value1": 1, | ||
"Value2": 2 | ||
}, | ||
"Headers": { | ||
"Content-Type": "application/json" | ||
} | ||
}, | ||
``` | ||
If you want to evaluate an expression for a given property of your object, simply prepend and `@` and pass an expression string | ||
``` | ||
"inputs": | ||
{ | ||
"Body": { | ||
"@Value1": "data.MyValue * 2", | ||
"Value2": 5 | ||
}, | ||
"Headers": { | ||
"Content-Type": "application/json" | ||
} | ||
}, | ||
``` | ||
|
||
* Support for enum values on input properties | ||
|
||
If your step has an enum property, you can now just pass the string representation of the enum value and it will be automatically converted. | ||
|
||
* Environment variables available in input expressions | ||
|
||
You can now access environment variables from within input expressions. | ||
usage: | ||
``` | ||
environment["VARIABLE_NAME"] | ||
``` | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,11 @@ | ||
using WorkflowCore.Models; | ||
using System; | ||
using WorkflowCore.Models; | ||
using WorkflowCore.Models.DefinitionStorage.v1; | ||
|
||
namespace WorkflowCore.Interface | ||
{ | ||
public interface IDefinitionLoader | ||
{ | ||
WorkflowDefinition LoadDefinition(string json); | ||
WorkflowDefinition LoadDefinition(string source, Func<string, DefinitionSourceV1> deserializer); | ||
} | ||
} |
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
16 changes: 16 additions & 0 deletions
16
src/WorkflowCore/Services/DefinitionStorage/Deserializers.cs
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,16 @@ | ||
using System; | ||
using Newtonsoft.Json; | ||
using SharpYaml.Serialization; | ||
using WorkflowCore.Models.DefinitionStorage.v1; | ||
|
||
namespace WorkflowCore.Services.DefinitionStorage | ||
{ | ||
public static class Deserializers | ||
{ | ||
private static Serializer yamlSerializer = new Serializer(); | ||
|
||
public static Func<string, DefinitionSourceV1> Json = (source) => JsonConvert.DeserializeObject<DefinitionSourceV1>(source); | ||
|
||
public static Func<string, DefinitionSourceV1> Yaml = (source) => yamlSerializer.DeserializeInto(source, new DefinitionSourceV1()); | ||
} | ||
} |
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
Oops, something went wrong.