Module: ElasticGraph::SchemaDefinition::Mixins::VerifiesGraphQLName
- Included in:
- SchemaElements::Argument, SchemaElements::Directive, SchemaElements::EnumType, SchemaElements::EnumValue, SchemaElements::Field, SchemaElements::ScalarType, SchemaElements::TypeWithSubfields, SchemaElements::UnionType
- Defined in:
- elasticgraph-schema_definition/lib/elastic_graph/schema_definition/mixins/verifies_graphql_name.rb
Overview
Note:
This mixin is designed to be used via prepend
, so it can add a constructor override that enforces
Used to verify the validity of the name of GraphQL schema elements.
the GraphQL name pattern as the object is built.
Class Method Summary collapse
-
.verify_name!(name) ⇒ void
Raises if the provided name is invalid.
Class Method Details
.verify_name!(name) ⇒ void
This method returns an undefined value.
Raises if the provided name is invalid.
31 32 33 34 |
# File 'elasticgraph-schema_definition/lib/elastic_graph/schema_definition/mixins/verifies_graphql_name.rb', line 31 def self.verify_name!(name) return if GRAPHQL_NAME_PATTERN.match?(name) raise Errors::InvalidGraphQLNameError, "Not a valid GraphQL name: `#{name}`. #{GRAPHQL_NAME_VALIDITY_DESCRIPTION}" end |