Sha256: 51fd0e06aa51addb316311a71add0cc53cff363ee70a2efe60008f8fa3d15512
Contents?: true
Size: 867 Bytes
Versions: 3
Compression:
Stored size: 867 Bytes
Contents
# frozen_string_literal: true module GraphQL module Types module Relay # This can be used for implementing `Query.nodes(ids: ...)`, # or use it for inspiration for your own field definition. # @see GraphQL::Types::Relay::NodeField NodesField = GraphQL::Schema::Field.new( name: "nodes", owner: nil, type: [GraphQL::Types::Relay::Node, null: true], null: false, description: "Fetches a list of objects given a list of IDs.", relay_nodes_field: true, ) do argument :ids, "[ID!]!", required: true, description: "IDs of the objects." def resolve(obj, args, ctx) args[:ids].map { |id| ctx.schema.object_from_id(id, ctx) } end def resolve_field(obj, args, ctx) resolve(obj, args, ctx) end end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
graphql-1.9.0.pre3 | lib/graphql/types/relay/nodes_field.rb |
graphql-1.9.0.pre2 | lib/graphql/types/relay/nodes_field.rb |
graphql-1.9.0.pre1 | lib/graphql/types/relay/nodes_field.rb |