Class: GraphQL::NameValidator
- Inherits:
-
Object
- Object
- GraphQL::NameValidator
- 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
10 11 12 13 |
# File 'lib/graphql/name_validator.rb', line 10 def self.validate!(name) name = name.is_a?(String) ? name : name.to_s raise GraphQL::InvalidNameError.new(name, VALID_NAME_REGEX) unless name.match?(VALID_NAME_REGEX) end |