Sha256: bd18527bb2f6c262385492ef9cf8688a3678ff2ac22a62976abdbcf10269909f

Contents?: true

Size: 319 Bytes

Versions: 111

Compression:

Stored size: 319 Bytes

Contents

# frozen_string_literal: true
module GraphQL
  class NameValidator
    VALID_NAME_REGEX = /^[_a-zA-Z][_a-zA-Z0-9]*$/

    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
  end
end

Version data entries

111 entries across 111 versions & 2 rubygems

Version Path
graphql-1.13.16 lib/graphql/name_validator.rb
graphql-2.0.13 lib/graphql/name_validator.rb
graphql-2.0.12 lib/graphql/name_validator.rb
graphql-1.13.15 lib/graphql/name_validator.rb
graphql-2.0.11 lib/graphql/name_validator.rb
graphql-1.13.14 lib/graphql/name_validator.rb
graphql-1.13.13 lib/graphql/name_validator.rb
graphql-2.0.9 lib/graphql/name_validator.rb
graphql-2.0.8 lib/graphql/name_validator.rb
graphql-2.0.7 lib/graphql/name_validator.rb
graphql_cody-1.13.0 lib/graphql/name_validator.rb
graphql-1.13.12 lib/graphql/name_validator.rb
graphql-2.0.6 lib/graphql/name_validator.rb
graphql-2.0.5 lib/graphql/name_validator.rb
graphql-2.0.4 lib/graphql/name_validator.rb
graphql-2.0.3 lib/graphql/name_validator.rb
graphql-1.13.11 lib/graphql/name_validator.rb
graphql-2.0.2 lib/graphql/name_validator.rb
graphql-2.0.1 lib/graphql/name_validator.rb
graphql-1.13.10 lib/graphql/name_validator.rb