Class: GraphQL::NameValidator

Inherits:
Object
  • Object
show all
Defined in:
lib/graphql/name_validator.rb

Constant Summary collapse

VALID_NAME_REGEX =
/^[_a-zA-Z][_a-zA-Z0-9]*$/

Class Method Summary collapse

Class Method Details

.validate!(name) ⇒ Object


6
7
8
# File 'lib/graphql/name_validator.rb', line 6

def self.validate!(name)
  raise GraphQL::InvalidNameError.new(name, VALID_NAME_REGEX) unless valid?(name)
end