Class: GraphQL::Types::JSON

Inherits:
Schema::Scalar show all
Defined in:
lib/graphql/types/json.rb

Overview

An untyped JSON scalar that maps to Ruby hashes, arrays, strings, integers, floats, booleans and nils. This should be used judiciously because it subverts the GraphQL type system.

Use it for fields or arguments as follows:

field :template_parameters, GraphQL::Types::JSON, null: false

argument :template_parameters, GraphQL::Types::JSON, null: false

Constant Summary

Constants included from Schema::Member::HasDirectives

Schema::Member::HasDirectives::NO_DIRECTIVES

Constants included from Schema::Member::GraphQLTypeNames

Schema::Member::GraphQLTypeNames::Boolean, Schema::Member::GraphQLTypeNames::ID, Schema::Member::GraphQLTypeNames::Int

Instance Attribute Summary

Attributes included from Schema::Member::BaseDSLMethods

#default_graphql_name, #graphql_name

Attributes included from Schema::Member::RelayShortcuts

#connection_type, #connection_type_class, #edge_type, #edge_type_class

Attributes included from Schema::Member::HasAstNode

#ast_node

Class Method Summary collapse

Methods inherited from Schema::Scalar

default_scalar, default_scalar?, kind, specified_by_url, validate_non_null_input

Methods included from Schema::Member::ValidatesInput

#coerce_isolated_input, #coerce_isolated_result, #valid_input?, #valid_isolated_input?, #validate_input

Methods included from Schema::Member::BaseDSLMethods

#authorized?, #default_relay, #description, #introspection, #introspection?, #mutation, #name, #visible?

Methods included from Schema::Member::BaseDSLMethods::ConfigurationExtension

#inherited

Methods included from Schema::Member::TypeSystemHelpers

#initialize, #kind, #list?, #non_null?, #to_list_type, #to_non_null_type, #to_type_signature

Methods included from Schema::Member::Scoped

#scope_items

Methods included from Schema::Member::HasPath

#path

Methods included from Schema::Member::HasAstNode

#inherited

Methods included from Schema::Member::HasDirectives

add_directive, #directive, #directives, get_directives, #inherited, #remove_directive, remove_directive

Class Method Details

.coerce_input(value, _context) ⇒ Object



16
17
18
# File 'lib/graphql/types/json.rb', line 16

def self.coerce_input(value, _context)
  value
end

.coerce_result(value, _context) ⇒ Object



20
21
22
# File 'lib/graphql/types/json.rb', line 20

def self.coerce_result(value, _context)
  value
end