Skip to content

Commit 50f05b5

Browse files
committed
Updated the Readme file
1 parent 2599b00 commit 50f05b5

File tree

7 files changed

+52
-12
lines changed

7 files changed

+52
-12
lines changed

README.md

Lines changed: 42 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ With the SDK, you can:
1515

1616
| Latest Releases | Conformance to spec version |
1717
| :---: | :---: |
18-
| [0.8.0.10](https://github.com/serverlessworkflow/sdk-net/releases/) | [0.8](https://github.com/serverlessworkflow/specification/tree/0.8.x) |
18+
| [0.8.7](https://github.com/serverlessworkflow/sdk-net/releases/) | [0.8](https://github.com/serverlessworkflow/specification/tree/0.8.x) |
1919

2020
### Getting Started
2121

@@ -107,6 +107,7 @@ which is a dynamic name/value mapping of properties used to enrich the serverles
107107
It has the advantage of being an easy, cross-compatible way of declaring additional data, but lacks well-defined, well-documented schema of the data, thus loosing the ability to validate it
108108
without custom implementation.
109109

110+
*Adding metadata to a workflow:*
110111
```csharp
111112
var workflow = new WorkflowBuilder()
112113
...
@@ -115,6 +116,18 @@ var workflow = new WorkflowBuilder()
115116
.Build();
116117
```
117118

119+
*Resulting workflow:*
120+
121+
```yaml
122+
id: sample-workflow
123+
version: 1.0.0
124+
specVersion: 0.8
125+
metadata:
126+
metadataPropertyName: metadataPropertyValue #added to the metadata property of supporting components
127+
...
128+
```
129+
130+
118131
#### Extension
119132

120133
Users have the ability to define extensions, providing the ability to extend, override or replace parts of the Serverless Workflow schema.
@@ -203,8 +216,35 @@ A [Json Merge Patch](https://datatracker.ietf.org/doc/html/rfc7386) is performed
203216
*Extending a workflow:*
204217
```csharp
205218
var workflow = new WorkflowBuilder()
206-
...
219+
.WithId("sample-extended")
220+
.WithName("Sample Extended Workflow")
221+
.WithVersion("1.0.0")
222+
.UseSpecVersion(ServerlessWorkflowSpecVersion.V08)
207223
.UseExtension("extensionId", new Uri("file://.../extensions/greet-function-type.json"))
224+
.StartsWith("do-work", flow => flow.Execute("greet", action => action
225+
.Invoke(function => function
226+
.OfType("greet")
227+
.WithName("greet")
228+
.ForOperation("#"))))
229+
.End()
230+
.Build();
231+
```
232+
233+
*Adding extension properties:*
234+
```csharp
235+
var workflow = new WorkflowBuilder()
236+
...
237+
.WithExtensionProperty("extensionPropertyName", propertyValue } })
208238
...
209239
.Build();
240+
```
241+
242+
*Resulting workflow:*
243+
244+
```yaml
245+
id: sample-workflow
246+
version: 1.0.0
247+
specVersion: 0.8
248+
extensionPropertyName: propertyValue #added as top level property of extended component, as opposed to metadata
249+
...
210250
```

src/ServerlessWorkflow.Sdk/ServerlessWorkflowSpecVersion.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,11 @@ public static class ServerlessWorkflowSpecVersion
2222
/// <summary>
2323
/// Gets the v0.8 version
2424
/// </summary>
25-
public const string VZero8 = "0.8";
25+
public const string V08 = "0.8";
2626

2727
/// <summary>
2828
/// Gets the latest version
2929
/// </summary>
30-
public const string Latest = VZero8;
30+
public const string Latest = V08;
3131

3232
}

src/ServerlessWorkflow.Sdk/Services/FluentBuilders/Interfaces/IWorkflowBuilder.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ public interface IWorkflowBuilder
6060
/// </summary>
6161
/// <param name="specVersion">The Serverless Workflow specification version</param>
6262
/// <returns>The configured <see cref="IWorkflowBuilder"/></returns>
63-
IWorkflowBuilder WithSpecVersion(string specVersion);
63+
IWorkflowBuilder UseSpecVersion(string specVersion);
6464

6565
/// <summary>
6666
/// Sets the workflow definition's data input <see cref="JSchema"/> uri

src/ServerlessWorkflow.Sdk/Services/FluentBuilders/WorkflowBuilder.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ public virtual IWorkflowBuilder WithVersion(string version)
9191
}
9292

9393
/// <inheritdoc/>
94-
public virtual IWorkflowBuilder WithSpecVersion(string specVersion)
94+
public virtual IWorkflowBuilder UseSpecVersion(string specVersion)
9595
{
9696
if (string.IsNullOrWhiteSpace(specVersion))
9797
throw new ArgumentNullException(nameof(specVersion));

tests/ServerlessWorkflow.Sdk.UnitTests/Cases/Validation/WorkflowValidationTests.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public async Task Validate_WorkflowDefinition_WithStateTypeExtensions_Should_Wor
4141
.WithId("fake")
4242
.WithName("Fake Workflow")
4343
.WithDescription("Fake Workflow Description")
44-
.WithSpecVersion(ServerlessWorkflowSpecVersion.Latest)
44+
.UseSpecVersion(ServerlessWorkflowSpecVersion.Latest)
4545
.WithVersion("1.0.0")
4646
.UseExtension("fake-extension", new($"file://{Path.Combine(AppContext.BaseDirectory, "Assets", "WorkflowExtensions", "condition-state-type.json")}"))
4747
.StartsWith("fake-state", flow => flow
@@ -68,7 +68,7 @@ public async Task Validate_WorkflowDefinition_WithFunctionTypeExtension_Should_W
6868
.WithId("fake")
6969
.WithName("Fake Workflow")
7070
.WithDescription("Fake Workflow Description")
71-
.WithSpecVersion(ServerlessWorkflowSpecVersion.Latest)
71+
.UseSpecVersion(ServerlessWorkflowSpecVersion.Latest)
7272
.WithVersion("1.0.0")
7373
.UseExtension("fake-extension", new($"file://{Path.Combine(AppContext.BaseDirectory, "Assets", "WorkflowExtensions", "greet-function-type.json")}"))
7474
.StartsWith("fake-state", flow => flow

tests/ServerlessWorkflow.Sdk.UnitTests/ServerlessWorkflow.Sdk.UnitTests.csproj

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,14 @@
99
</PropertyGroup>
1010

1111
<ItemGroup>
12-
<PackageReference Include="FluentAssertions" Version="6.9.0" />
13-
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.3.2" />
12+
<PackageReference Include="FluentAssertions" Version="6.11.0" />
13+
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.6.3" />
1414
<PackageReference Include="xunit" Version="2.4.2" />
1515
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.5">
1616
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
1717
<PrivateAssets>all</PrivateAssets>
1818
</PackageReference>
19-
<PackageReference Include="coverlet.collector" Version="3.1.2">
19+
<PackageReference Include="coverlet.collector" Version="6.0.0">
2020
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
2121
<PrivateAssets>all</PrivateAssets>
2222
</PackageReference>

tests/ServerlessWorkflow.Sdk.UnitTests/Services/WorkflowDefinitionFactory.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ public static WorkflowDefinition Create()
2222
.WithId("fake")
2323
.WithName("Fake Workflow")
2424
.WithDescription("Fake Workflow Description")
25-
.WithSpecVersion(ServerlessWorkflowSpecVersion.Latest)
25+
.UseSpecVersion(ServerlessWorkflowSpecVersion.Latest)
2626
.WithVersion("1.0.0")
2727
.WithAnnotation("fake-annotation: Fake value")
2828
.WithDataInputSchema(new Uri("https://tests.serverlessworkflow.io"))

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy