Class: NxtSchema::Node::Schema
- Defined in:
- lib/nxt_schema/node/schema.rb
Instance Attribute Summary
Attributes inherited from Base
#coerced, #coerced_nodes, #context, #error_key, #errors, #index, #input, #locale, #node, #output, #parent, #root
Instance Method Summary collapse
Methods inherited from Base
#add_error, #add_schema_error, #initialize, #merge_errors, #root?, #run_validations, #up, #valid?
Constructor Details
This class inherits a constructor from NxtSchema::Node::Base
Instance Method Details
#call ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/nxt_schema/node/schema.rb', line 4 def call apply_on_evaluators child_nodes # build nodes here so we can access them even when invalid return self if maybe_evaluator_applies? coerce_input return self unless valid? flag_missing_keys apply_additional_keys_strategy child_nodes.each do |key, child| current_node = child.call if !current_node.valid? merge_errors(current_node) else output[key] = current_node.output end end transform_keys register_as_coerced_when_no_errors run_validations self end |