Skip to content

Commit bed2ede

Browse files
committed
fix(Sdk): Fixed the ScheduleDefinition to expose a new 'Type' property
1 parent 720550d commit bed2ede

File tree

3 files changed

+50
-3
lines changed

3 files changed

+50
-3
lines changed

src/ServerlessWorkflow.Sdk/Models/ScheduleDefinition.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,14 @@ namespace ServerlessWorkflow.Sdk.Models
2929
public class ScheduleDefinition
3030
{
3131

32+
/// <summary>
33+
/// Gets the <see cref="ScheduleDefinition"/>'s type
34+
/// </summary>
35+
[Newtonsoft.Json.JsonIgnore]
36+
[System.Text.Json.Serialization.JsonIgnore]
37+
[YamlIgnore]
38+
public virtual ScheduleDefinitionType Type => this.Cron == null ? ScheduleDefinitionType.Interval : ScheduleDefinitionType.Cron;
39+
3240
/// <summary>
3341
/// Gets/sets the time interval (ISO 8601 format) describing when workflow instances can be created.
3442
/// </summary>
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
/*
2+
* Copyright 2021-Present The Serverless Workflow Specification Authors
3+
* <p>
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
* <p>
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
* <p>
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*
16+
*/
17+
18+
namespace ServerlessWorkflow.Sdk
19+
{
20+
/// <summary>
21+
/// Enumerates all types of schedule definitions
22+
/// </summary>
23+
[Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.StringEnumConverter))]
24+
[System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Serialization.StringEnumConverterFactory))]
25+
public enum ScheduleDefinitionType
26+
{
27+
/// <summary>
28+
/// Indicates the definition of a CRON expression based schedule
29+
/// </summary>
30+
[EnumMember(Value = "cron")]
31+
Cron = 1,
32+
/// <summary>
33+
/// Indicates the definition of an interval based schedule
34+
/// </summary>
35+
[EnumMember(Value = "interval")]
36+
Interval = 2
37+
}
38+
39+
}

src/ServerlessWorkflow.Sdk/ServerlessWorkflow.Sdk.csproj

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44
<TargetFramework>net6.0</TargetFramework>
55
<Nullable>enable</Nullable>
66
<NeutralLanguage>en</NeutralLanguage>
7-
<AssemblyVersion>0.8.3</AssemblyVersion>
8-
<FileVersion>0.8.3</FileVersion>
9-
<Version>0.8.3</Version>
7+
<AssemblyVersion>0.8.4</AssemblyVersion>
8+
<FileVersion>0.8.4</FileVersion>
9+
<Version>0.8.4</Version>
1010
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
1111
<PackageRequireLicenseAcceptance>true</PackageRequireLicenseAcceptance>
1212
<PackageLicenseFile>LICENSE</PackageLicenseFile>

0 commit comments

Comments
 (0)