spec/support/star_wars/schema.rb in graphql-1.6.1 vs spec/support/star_wars/schema.rb in graphql-1.6.2
- old
+ new
@@ -94,11 +94,11 @@
name "Faction"
interfaces [GraphQL::Relay::Node.interface]
field :id, !types.ID, resolve: GraphQL::Relay::GlobalIdResolve.new(type: Faction)
field :name, types.String
- connection :ships, ShipConnectionWithParentType do
+ connection :ships, ShipConnectionWithParentType, max_page_size: 1000 do
resolve ->(obj, args, ctx) {
all_ships = obj.ships.map {|ship_id| StarWars::DATA["Ship"][ship_id] }
if args[:nameIncludes]
case args[:nameIncludes]
when "error"
@@ -157,11 +157,19 @@
connection :basesWithMaxLimitArray, BaseType.connection_type, max_page_size: 2 do
resolve ->(object, args, context) { Base.all.to_a }
end
- connection :basesAsSequelDataset, BaseConnectionWithTotalCountType do
+ connection :basesWithDefaultMaxLimitRelation, BaseType.connection_type do
+ resolve ->(object, args, context) { Base.all }
+ end
+
+ connection :basesWithDefaultMaxLimitArray, BaseType.connection_type do
+ resolve ->(object, args, context) { Base.all.to_a }
+ end
+
+ connection :basesAsSequelDataset, BaseConnectionWithTotalCountType, max_page_size: 1000 do
argument :nameIncludes, types.String
resolve ->(obj, args, ctx) {
all_bases = SequelBase.where(faction_id: obj.id)
if args[:nameIncludes]
all_bases = all_bases.where(Sequel.like(:name, "%#{args[:nameIncludes]}%"))
@@ -330,9 +338,10 @@
end
Schema = GraphQL::Schema.define do
query(QueryType)
mutation(MutationType)
+ default_max_page_size 3
resolve_type ->(object, ctx) {
if object == :test_error
:not_a_type
elsif object.is_a?(Base)