class GraphQL::Schema::Validator::NumericalityValidator

Use this to assert numerical comparisons hold true for inputs.

Examples

Example: Require a number between 0 and 1

argument :batting_average, Float, required: true, validates: { numericality: { within: 0..1 } }

Example: Require the number 42

argument :the_answer, Integer, required: true, validates: { numericality: { equal_to: 42 } }

Example: Require a real number

argument :items_count, Integer, required: true, validates: { numericality: { greater_than_or_equal_to: 0 } }