File tree 1 file changed +32
-0
lines changed
src/ServerlessWorkflow.Sdk/Services/Validation
1 file changed +32
-0
lines changed Original file line number Diff line number Diff line change
1
+ using FluentValidation ;
2
+ using ServerlessWorkflow . Sdk . Models ;
3
+
4
+ namespace ServerlessWorkflow . Sdk . Services . Validation
5
+ {
6
+ /// <summary>
7
+ /// Represents the service used to validate <see cref="SubflowReference"/>s
8
+ /// </summary>
9
+ public class SubflowReferenceValidator
10
+ : AbstractValidator < SubflowReference >
11
+ {
12
+
13
+ /// <summary>
14
+ /// Initializes a new <see cref="SubflowReferenceValidator"/>
15
+ /// </summary>
16
+ /// <param name="workflow">The <see cref="WorkflowDefinition"/> the <see cref="SubflowReference"/>s to validate belong to</param>
17
+ public SubflowReferenceValidator ( WorkflowDefinition workflow )
18
+ {
19
+ this . Workflow = workflow ;
20
+ this . RuleFor ( w => w . WorkflowId )
21
+ . NotEmpty ( )
22
+ . WithErrorCode ( $ "{ nameof ( SubflowReference ) } .{ nameof ( SubflowReference . WorkflowId ) } ") ;
23
+ }
24
+
25
+ /// <summary>
26
+ /// Gets the <see cref="WorkflowDefinition"/> the <see cref="FunctionReference"/>s to validate belong to
27
+ /// </summary>
28
+ protected WorkflowDefinition Workflow { get ; }
29
+
30
+ }
31
+
32
+ }
You can’t perform that action at this time.
0 commit comments