Class: GraphQL::Schema::Validator::ExclusionValidator
- Inherits:
-
GraphQL::Schema::Validator
- Object
- GraphQL::Schema::Validator
- GraphQL::Schema::Validator::ExclusionValidator
- Defined in:
- lib/graphql/schema/validator/exclusion_validator.rb
Overview
Use this to specifically reject values from an argument.
Constant Summary
Constants included from FindInheritedValue::EmptyObjects
FindInheritedValue::EmptyObjects::EMPTY_ARRAY, FindInheritedValue::EmptyObjects::EMPTY_HASH
Instance Attribute Summary
Attributes inherited from GraphQL::Schema::Validator
Instance Method Summary collapse
-
#initialize(message: "%{validated} is reserved", in:, **default_options) ⇒ ExclusionValidator
constructor
A new instance of ExclusionValidator.
-
#validate(_object, _context, value) ⇒ Object
Methods inherited from GraphQL::Schema::Validator
#apply, from_config, install, #partial_format, uninstall, validate!
Constructor Details
#initialize(message: "%{validated} is reserved", in:, **default_options) ⇒ ExclusionValidator
Returns a new instance of ExclusionValidator.
16 17 18 19 20 21 |
# File 'lib/graphql/schema/validator/exclusion_validator.rb', line 16 def initialize(message: "%{validated} is reserved", in:, **) # `in` is a reserved word, so work around that @in_list = binding.local_variable_get(:in) @message = super(**) end |
Instance Method Details
#validate(_object, _context, value) ⇒ Object
23 24 25 26 27 |
# File 'lib/graphql/schema/validator/exclusion_validator.rb', line 23 def validate(_object, _context, value) if @in_list.include?(value) @message end end |