You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
if(correlation.Spec.Outcome.Start==null)returnnew(context.Uid,false,null,new(ProblemTypes.AdmissionFailed,ProblemTitles.ValidationFailed,ErrorStatus.Validation,$"The '/spec/outcome/start' property must be set when the correlation outcome type has been set to '{CorrelationOutcomeType.Start}'",new("/spec/outcome/start",UriKind.Relative)));
if(workflow==null)returnnew(context.Uid,false,null,new(ProblemTypes.AdmissionFailed,ProblemTitles.ValidationFailed,ErrorStatus.Validation,$"Failed to find the specified workflow '{correlation.Spec.Outcome.Start.Workflow.Name}.{correlation.Spec.Outcome.Start.Workflow.Namespace}'",new("/spec/outcome/start/workflow",UriKind.Relative)));
if(workflowDefinition==null)returnnew(context.Uid,false,null,new(ProblemTypes.AdmissionFailed,ProblemTitles.ValidationFailed,ErrorStatus.Validation,$"Failed to find version '{correlation.Spec.Outcome.Start.Workflow.Version}' of workflow '{correlation.Spec.Outcome.Start.Workflow.Name}.{correlation.Spec.Outcome.Start.Workflow.Namespace}'",new("/spec/outcome/start/workflow/version",UriKind.Relative)));
58
+
if(workflowDefinition.Input?.Schema!=null)
59
+
{
60
+
varschemaHandler=this.SchemaHandlerProvider.GetHandler(workflowDefinition.Input.Schema.Format)??thrownewArgumentNullException($"Failed to find an handler that supports the specified schema format '{workflowDefinition.Input.Schema.Format}'");
if(!validationResult.IsSuccess())returnnew(context.Uid,false,null,new(ErrorType.Validation,ErrorTitle.Validation,ErrorStatus.Validation,$"Failed to validate the correlation outcome workflow input:\n{string.Join('\n',validationResult.Errors?.FirstOrDefault()?.Errors?.Select(e =>$"- {e.Key}: {e.Value.First()}")??[])}",new("/spec/outcome/start/input",UriKind.Relative)));
63
+
}
64
+
break;
65
+
caseCorrelationOutcomeType.Correlate:
66
+
if(correlation.Spec.Outcome.Correlate==null)returnnew(context.Uid,false,null,new(ProblemTypes.AdmissionFailed,ProblemTitles.ValidationFailed,ErrorStatus.Validation,$"The '/spec/outcome/correlate' property must be set when the correlation outcome type has been set to '{CorrelationOutcomeType.Correlate}'",new("/spec/outcome/correlate",UriKind.Relative)));
if(components.Length!=2)returnnew(context.Uid,false,null,new(ProblemTypes.AdmissionFailed,ProblemTitles.ValidationFailed,ErrorStatus.Validation,$"The specified value '{correlation.Spec.Outcome.Correlate.Instance}' is not a valid workflow instance qualified name ({{name}}.{{namespace}})",new("/spec/outcome/correlate/instance",UriKind.Relative)));
if(workflowInstance==null)returnnew(context.Uid,false,null,new(ProblemTypes.AdmissionFailed,ProblemTitles.ValidationFailed,ErrorStatus.Validation,$"Failed to find the specified workflow instance '{correlation.Spec.Outcome.Correlate.Instance}'",new("/spec/outcome/correlate/instance",UriKind.Relative)));
if(task==null)returnnew(context.Uid,false,null,new(ProblemTypes.AdmissionFailed,ProblemTitles.ValidationFailed,ErrorStatus.Validation,$"Failed to find the task '{correlation.Spec.Outcome.Correlate.Task}' in workflow instance '{correlation.Spec.Outcome.Correlate.Instance}'",new("/spec/outcome/correlate/task",UriKind.Relative)));
75
+
break;
76
+
default:
77
+
returnnew(context.Uid,false,null,new(ProblemTypes.AdmissionFailed,ProblemTitles.ValidationFailed,ErrorStatus.Validation,$"The specified correlation outcome type '{correlation.Spec.Outcome.Type}' is not supported",new("/spec/outcome/type",UriKind.Relative)));
if(workflow==null)returnnew(context.Uid,false,null,new(ProblemTypes.AdmissionFailed,ProblemTitles.ValidationFailed,ErrorStatus.Validation,$"Failed to find the specified workflow '{workflowInstance.Spec.Definition.Name}.{workflowInstance.Spec.Definition.Namespace}'",new("/spec/definition",UriKind.Relative)));
if(workflowDefinition==null)returnnew(context.Uid,false,null,new(ProblemTypes.AdmissionFailed,ProblemTitles.ValidationFailed,ErrorStatus.Validation,$"Failed to find version '{workflowInstance.Spec.Definition.Version}' of workflow '{workflowInstance.Spec.Definition.Name}.{workflowInstance.Spec.Definition.Namespace}'",new("/spec/definition/version",UriKind.Relative)));
54
+
if(workflowDefinition.Input?.Schema!=null)
55
+
{
56
+
varschemaHandler=this.SchemaHandlerProvider.GetHandler(workflowDefinition.Input.Schema.Format)??thrownewArgumentNullException($"Failed to find an handler that supports the specified schema format '{workflowDefinition.Input.Schema.Format}'");
if(!validationResult.IsSuccess())returnnew(context.Uid,false,null,new(ErrorType.Validation,ErrorTitle.Validation,ErrorStatus.Validation,$"Failed to validate the workflow instance's input:\n{string.Join('\n',validationResult.Errors?.FirstOrDefault()?.Errors?.Select(e =>$"- {e.Key}: {e.Value.First()}")??[])}",new("/spec/input",UriKind.Relative)));
0 commit comments