Sha256: ceafbf64e6bbba8c75dd2b4600f7817a528b944c37b16598eceee1b2c460afa9

Contents?: true

Size: 993 Bytes

Versions: 37

Compression:

Stored size: 993 Bytes

Contents

class <%= schema_name %> < GraphQL::Schema
<% if options[:relay] %>
  # Relay Object Identification:

  # Return a string UUID for `object`
  def self.id_from_object(object, type_definition, query_ctx)
    # Here's a simple implementation which:
    # - joins the type name & object.id
    # - encodes it with base64:
    # GraphQL::Schema::UniqueWithinType.encode(type_definition.name, object.id)
  end

  # Given a string UUID, find the object
  def self.object_from_id(id, query_ctx)
    # For example, to decode the UUIDs generated above:
    # type_name, item_id = GraphQL::Schema::UniqueWithinType.decode(id)
    #
    # Then, based on `type_name` and `id`
    # find an object in your application
    # ...
  end

  # Object Resolution
  def self.resolve_type(type, obj, ctx)
    # TODO: Implement this function
    # to return the correct type for `obj`
    raise(NotImplementedError)
  end
<% end %><% if options[:batch] %>
  # GraphQL::Batch setup:
  use GraphQL::Batch
<% end %>end

Version data entries

37 entries across 37 versions & 1 rubygems

Version Path
graphql-1.8.18 lib/generators/graphql/templates/schema.erb
graphql-1.9.14 lib/generators/graphql/templates/schema.erb
graphql-1.10.0.pre1 lib/generators/graphql/templates/schema.erb
graphql-1.9.13 lib/generators/graphql/templates/schema.erb
graphql-1.9.12 lib/generators/graphql/templates/schema.erb
graphql-1.9.11 lib/generators/graphql/templates/schema.erb
graphql-1.9.10 lib/generators/graphql/templates/schema.erb
graphql-1.9.9 lib/generators/graphql/templates/schema.erb
graphql-1.9.8 lib/generators/graphql/templates/schema.erb
graphql-1.9.7 lib/generators/graphql/templates/schema.erb
graphql-1.9.6 lib/generators/graphql/templates/schema.erb
graphql-1.9.5 lib/generators/graphql/templates/schema.erb
graphql-1.9.4 lib/generators/graphql/templates/schema.erb
graphql-1.9.3 lib/generators/graphql/templates/schema.erb
graphql-1.9.2 lib/generators/graphql/templates/schema.erb
graphql-1.8.17 lib/generators/graphql/templates/schema.erb
graphql-1.8.16 lib/generators/graphql/templates/schema.erb
graphql-1.9.1 lib/generators/graphql/templates/schema.erb
graphql-1.9.0 lib/generators/graphql/templates/schema.erb
graphql-1.8.15 lib/generators/graphql/templates/schema.erb