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
Enhance ValidationPass with bug fixes and new validations
Fix three bugs: SagaStep checked doStatements twice instead of
undoStatements for revert validation, SagaStep shape check compared
getClass of identical types (always true), and validateState called
checkMetadata twice.
Add validation for previously unvalidated definitions: Schema
(kind vs structure compatibility, data/link/index ref resolution)
and Relationship (processor ref resolution).
Add semantic validations: streamlet shape vs inlet/outlet count,
handler requirements for streamlets/adaptors/repositories, adaptor
empty handler warning, projector repository ref resolution,
epic/usecase user story user ref resolution, and function
input/output type expression validation.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
if repository.handlers.isEmpty && repository.nonEmpty then
662
+
messages.addMissing(
663
+
repository.errorLoc,
664
+
s"${repository.identify} should have at least one handler"
665
+
)
593
666
}
594
667
595
668
privatedefvalidateAdaptor(
@@ -607,6 +680,16 @@ case class ValidationPass(
607
680
messages.addError(adaptor.errorLoc, message)
608
681
}
609
682
}
683
+
if adaptor.handlers.isEmpty && adaptor.nonEmpty then
684
+
messages.addMissing(
685
+
adaptor.errorLoc,
686
+
s"${adaptor.identify} should have at least one handler"
687
+
)
688
+
elseif adaptor.handlers.nonEmpty && adaptor.handlers.forall(_.clauses.isEmpty) then
689
+
messages.addMissing(
690
+
adaptor.errorLoc,
691
+
s"${adaptor.identify} has only empty handlers"
692
+
)
610
693
checkMetadata(adaptor)
611
694
caseNone|Some(_) =>
612
695
messages.addError(adaptor.errorLoc, "Adaptor not contained within Context")
@@ -619,6 +702,33 @@ case class ValidationPass(
619
702
):Unit= {
620
703
addStreamlet(streamlet)
621
704
checkContainer(parents, streamlet)
705
+
if streamlet.nonEmpty then
706
+
valnumInlets= streamlet.inlets.size
707
+
valnumOutlets= streamlet.outlets.size
708
+
streamlet.shape match {
709
+
case_: Source=>
710
+
check(numInlets ==0, s"${streamlet.identify} is a source but has $numInlets inlets; sources must have none", Messages.Error, streamlet.errorLoc)
711
+
check(numOutlets >=1, s"${streamlet.identify} is a source but has no outlets; sources must have at least one", Messages.Error, streamlet.errorLoc)
712
+
case_: Sink=>
713
+
check(numInlets >=1, s"${streamlet.identify} is a sink but has no inlets; sinks must have at least one", Messages.Error, streamlet.errorLoc)
714
+
check(numOutlets ==0, s"${streamlet.identify} is a sink but has $numOutlets outlets; sinks must have none", Messages.Error, streamlet.errorLoc)
715
+
case_: Flow=>
716
+
check(numInlets >=1, s"${streamlet.identify} is a flow but has no inlets; flows must have at least one", Messages.Error, streamlet.errorLoc)
717
+
check(numOutlets >=1, s"${streamlet.identify} is a flow but has no outlets; flows must have at least one", Messages.Error, streamlet.errorLoc)
718
+
case_: Merge=>
719
+
check(numInlets >=2, s"${streamlet.identify} is a merge but has $numInlets inlets; merges must have at least two", Messages.Error, streamlet.errorLoc)
720
+
check(numOutlets >=1, s"${streamlet.identify} is a merge but has no outlets; merges must have at least one", Messages.Error, streamlet.errorLoc)
721
+
case_: Split=>
722
+
check(numInlets >=1, s"${streamlet.identify} is a split but has no inlets; splits must have at least one", Messages.Error, streamlet.errorLoc)
723
+
check(numOutlets >=2, s"${streamlet.identify} is a split but has $numOutlets outlets; splits must have at least two", Messages.Error, streamlet.errorLoc)
724
+
case_: Router=>
725
+
check(numInlets >=2, s"${streamlet.identify} is a router but has $numInlets inlets; routers must have at least two", Messages.Error, streamlet.errorLoc)
726
+
check(numOutlets >=2, s"${streamlet.identify} is a router but has $numOutlets outlets; routers must have at least two", Messages.Error, streamlet.errorLoc)
727
+
case_: Void=> ()
728
+
}
729
+
end if
730
+
if streamlet.handlers.isEmpty && streamlet.nonEmpty then
731
+
messages.addMissing(streamlet.errorLoc, s"${streamlet.identify} should have a handler")
0 commit comments