spec/support/star_wars/schema.rb in graphql-1.4.3 vs spec/support/star_wars/schema.rb in graphql-1.4.4
- old
+ new
@@ -6,10 +6,12 @@
Ship = GraphQL::ObjectType.define do
name "Ship"
interfaces [GraphQL::Relay::Node.interface]
global_id_field :id
field :name, types.String
+ # Test cyclical connection types:
+ connection :ships, Ship.connection_type
end
BaseType = GraphQL::ObjectType.define do
name "Base"
interfaces [GraphQL::Relay::Node.interface]
@@ -216,10 +218,16 @@
Base.order('sum(faction_id) desc').group(:faction_id)
}
end
field :node, GraphQL::Relay::Node.field
+ field :nodeWithCustomResolver, GraphQL::Relay::Node.field(
+ resolve: ->(_, _, _) { StarWars::DATA["Faction"]["1"] }
+ )
field :nodes, GraphQL::Relay::Node.plural_field
+ field :nodesWithCustomResolver, GraphQL::Relay::Node.plural_field(
+ resolve: ->(_, _, _) { [StarWars::DATA["Faction"]["1"], StarWars::DATA["Faction"]["2"]] }
+ )
end
MutationType = GraphQL::ObjectType.define do
name "Mutation"
# The mutation object exposes a field: