Skip to content

Add a 'as_enum' on Scalar nodes to help with constraining inputs

Benjamin Schubert requested to merge bschubert/node-enum into master

Description

This adds helper methods on Nodes to allow getting a variable as an enum member.

This will ensure consistent error reporting for users when plugin authors want to constrain some inputs.

Changes proposed in this merge request:

  • Mark as enums some types that weren't marked
  • Add as_enum on ScalarNode
  • Add get_enum on MappingNode as a shortcut for `mapping.get_scalar(value).as_enum(...)
  • Change core to use this when custom reporting was done

Edited by Benjamin Schubert

Merge request reports