Sha256: 870691fffc1bda683f1c3a93dd247bd3e4a16863435a5eb6df527fbea9576499
Contents?: true
Size: 1.08 KB
Versions: 93
Compression:
Stored size: 1.08 KB
Contents
# frozen_string_literal: true module GraphQL class Schema # @api private module TypeExpression # Fetch a type from a type map by its AST specification. # Return `nil` if not found. # @param types [GraphQL::Schema::TypeMap] # @param ast_node [GraphQL::Language::Nodes::AbstractNode] # @return [GraphQL::BaseType, nil] def self.build_type(types, ast_node) case ast_node when GraphQL::Language::Nodes::TypeName types.fetch(ast_node.name, nil) when GraphQL::Language::Nodes::NonNullType ast_inner_type = ast_node.of_type inner_type = build_type(types, ast_inner_type) wrap_type(inner_type, GraphQL::NonNullType) when GraphQL::Language::Nodes::ListType ast_inner_type = ast_node.of_type inner_type = build_type(types, ast_inner_type) wrap_type(inner_type, GraphQL::ListType) end end def self.wrap_type(type, wrapper) if type.nil? nil else wrapper.new(of_type: type) end end end end end
Version data entries
93 entries across 93 versions & 1 rubygems