Class: Chemicalml::Convention::Cascade::Constraints::ReactionStepMustHaveReactionOrLists

Inherits:
Chemicalml::Convention::Constraint::NodeConstraint show all
Defined in:
lib/chemicalml/convention/cascade/constraints/reaction_step_must_have_reaction_or_lists.rb

Overview

A <reactionStep> MUST contain either a <reaction> child or explicit <reactantList> + <productList> children. An empty step is a dead-end in the cascade.

Instance Method Summary collapse

Methods inherited from Chemicalml::Convention::Constraint::NodeConstraint

#check

Instance Method Details

#check_node(node, _path) ⇒ Object



14
15
16
17
18
19
20
21
# File 'lib/chemicalml/convention/cascade/constraints/reaction_step_must_have_reaction_or_lists.rb', line 14

def check_node(node, _path)
  return [] if node.reaction
  return [] if node.reactant_list && node.product_list

  [violation(path: yield_path(node),
             message: "reactionStep #{node.id.inspect} must contain a reaction " \
                      'or both reactantList and productList')]
end