Sha256: e8ff2a666446df17fc11c01c7897b98857039068eeab849552c82da0b1bd5eaf
Contents?: true
Size: 978 Bytes
Versions: 4
Compression:
Stored size: 978 Bytes
Contents
class DummySchema < GraphQL::Schema mutation(Types::MutationType) query(Types::QueryType) # 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 # GraphQL::Batch setup: use GraphQL::Batch end
Version data entries
4 entries across 4 versions & 1 rubygems