Statifier.Validator.Checks.InitialElement (Statifier v2.0.0)

Copy Markdown View Source

Check 4 (spec 3.3, 3.6): a state's own <initial> element.

Two independent facts about every <initial> element in the document: {:initial_attribute_and_element, id} when the same state also carries an initial attribute (at most one form is legal), and Statifier.Validator.Checks.DefaultTransition's shared sub-check with owner: {:initial, id} - the element's content model is exactly one transition, with a target, no event, no cond.

This check does not itself resolve or check the descendancy of the <initial> transition's target - Statifier.Validator.Checks.Targets owns existence and Statifier.Validator.Checks.InitialTargets owns descendancy (check 3).

Summary

Functions

Returns an :initial_attribute_and_element error for every state whose <initial> element coexists with an initial attribute, plus the shared default-transition errors from Statifier.Validator.Checks.DefaultTransition for that element's content model (required, exactly one transition, a target, no event, no cond). Does not itself check target existence or descendancy - those belong to Statifier.Validator.Checks.Targets and Statifier.Validator.Checks.InitialTargets. Returns [] when every <initial> element in the document is well-formed.

Functions

check(document, context)

@spec check(
  document :: Statifier.Document.t(),
  context :: Statifier.Validator.Context.t()
) :: [
  Statifier.Validator.Error.t()
]

Returns an :initial_attribute_and_element error for every state whose <initial> element coexists with an initial attribute, plus the shared default-transition errors from Statifier.Validator.Checks.DefaultTransition for that element's content model (required, exactly one transition, a target, no event, no cond). Does not itself check target existence or descendancy - those belong to Statifier.Validator.Checks.Targets and Statifier.Validator.Checks.InitialTargets. Returns [] when every <initial> element in the document is well-formed.