Module: GraphQL::Schema::BuildFromDefinition

Defined in:
lib/graphql/schema/build_from_definition.rb,
lib/graphql/schema/build_from_definition/resolve_map.rb,
lib/graphql/schema/build_from_definition/resolve_map/default_resolve.rb

Defined Under Namespace

Classes: ResolveMap

Class Method Summary collapse

Class Method Details

.from_definition(schema_superclass, definition_string, parser: GraphQL.default_parser, **kwargs) ⇒ Object

See Also:

  • {Schema{Schema.from_definition}


9
10
11
12
13
14
# File 'lib/graphql/schema/build_from_definition.rb', line 9

def from_definition(schema_superclass, definition_string, parser: GraphQL.default_parser, **kwargs)
  if defined?(parser::SchemaParser)
    parser = parser::SchemaParser
  end
  from_document(schema_superclass, parser.parse(definition_string), **kwargs)
end

.from_definition_path(schema_superclass, definition_path, parser: GraphQL.default_parser, **kwargs) ⇒ Object



16
17
18
19
20
21
# File 'lib/graphql/schema/build_from_definition.rb', line 16

def from_definition_path(schema_superclass, definition_path, parser: GraphQL.default_parser, **kwargs)
  if defined?(parser::SchemaParser)
    parser = parser::SchemaParser
  end
  from_document(schema_superclass, parser.parse_file(definition_path), **kwargs)
end

.from_document(schema_superclass, document, default_resolve:, using: {}, relay: false) ⇒ Object



23
24
25
# File 'lib/graphql/schema/build_from_definition.rb', line 23

def from_document(schema_superclass, document, default_resolve:, using: {}, relay: false)
  Builder.build(schema_superclass, document, default_resolve: default_resolve || {}, relay: relay, using: using)
end