graphql-ruby-client
Advanced tools
Changelog
1.7.0 (18 Sept 2017)
GraphQL::Result
is the returned from GraphQL execution. #898 Schema#execute
and Query#result
both return a GraphQL::Result
. It implements Hash-like methods to preserve compatibility.puts ctx.backtrace
prints out a GraphQL backtrace table #946
GraphQL::Backtrace.enable
wraps unhandled errors with GraphQL backtraces #946
GraphQL::Relay::ConnectionType.bidrectional_pagination = true
turns on true bi-directional pagination checks for hasNextPage
/hasPreviousPage
fields. This will become the default behavior in a future version. #960
Field arguments may be accessed as methods on the args
object. This is an alternative to #[]
syntax which provides did-you-mean behavior instead of returning nil
on a typo. #924 For example:
# using hash syntax:
args[:limit] # => 10
args[:limittt] # => nil
# using method syntax:
args.limit # => 10
args.limittt # => NoMethodError
The old syntax is not deprecated.
Improvements to schema filters #919
GraphQL::Argument.define
builds re-usable arguments #948
GraphQL::Subscriptions
provides hooks for subscription platforms #672
GraphQL::Subscriptions::ActionCableSubscriptions
implements subscriptions over ActionCable #672
More runtime values are accessible from a ctx
object #923 :
ctx.parent
returns the ctx
from the parent fieldctx.object
returns the current obj
for that fieldctx.value
returns the resolved GraphQL value for that fieldThese can be used together, for example, ctx.parent.object
to get the parent object.
GraphQL::Tracing
provides more hooks into gem internals for performance monitoring #917
GraphQL::Result
provides access to the original query
and context
after executing a query #898
Schema#execute
#957Changelog
1.6.8 (8 Sept 2017)
/^[_a-zA-Z][_a-zA-Z0-9]*$/
#915forwardable
when it's not Ruby 2.4.0 #926UnresolvedTypeError
message #928#connection?
when building a schema from IDL #941@edge_class
to nil
#942Query#selected_operation_name
when no selections are present #899COUNT
query for hasNextPage
#906last
argument #907ArgumentsAreDefined
validation #8900
#892Changelog
1.6.7 (11 Aug 2017)
GraphQL.parse_file
and AbstractNode#filename
#873.graphql
filepaths with Schema.from_definition
#872FieldsWillMerge
handling of equivalent input objectsprepare:
on nested input typesChangelog
1.6.6 (14 Jul 2017)
graphql-pro
downloads with rake graphql:pro:validate[$VERSION]
#846Array.wrap
#840RelationConnection
to count properly when relation contains an alias #838Changelog
1.6.5 (13 Jul 2017)
Schema#types[](type_name)
returns nil
when there's no type named type_name
(it used to raise RuntimeError
). To get an error for missing types, use .fetch
instead, for example:
# Old way:
MySchema.types[type_name] # => may raise RuntimeError
# New way:
MySchema.types.fetch(type_name) # => may raise KeyError
Schema build steps happen in one pass instead of two passes #819 . This means that instrument(:field)
hooks may not access Schema#types
, Schema#possible_types
or Schema#get_field
, since the underlying data hasn't been prepared yet. There's not really a clear upgrade path here. It's a bit of a mess. If you're affected by this, feel free to open an issue and we'll try to find something that works!
Schema#resolve_type
is now called with (abstract_type, obj, ctx)
instead of (obj, ctx)
#834 . To update, add an unused parameter to the beginning of your resolve_type
hook:
MySchema = GraphQL::Schema.define do
# Old way:
resolve_type ->(obj, ctx) { ... }
# New way:
resolve_type ->(type, obj, ctx) { ... }
end
rails g graphql:mutation
will add Mutation boilerplate if it wasn't added already #812InterfaceType
and UnionType
both accept resolve_type ->(obj, ctx) { ... }
functions for type-specific resolution. This function takes precedence over Schema#resolve_type
#829 #834Schema#resolve_type
is called with three arguments, (abstract_type, obj, ctx)
, so you can distinguish object type based on interface or union.Query#operation_name=
may be assigned during query instrumentation #833query.context.add_error(err)
may be used to add query-level errors #833argument(...)
DSL accepts custom keywords #809max_complexity
overrides #812InputObjectType
receives an array as input #803prepare
functions #805as
and prepare
in argument do ... end
blocks #817instrument(:field, ...)
, make sure they're in Schema#types
#819EnumValue
is created #831lazy_resolve
#835ArgumentError
#833Changelog
1.6.4 (20 Jun 2017)
Schema.to_definition
sorts fields and arguments alphabetically #775validate: false
skips static validations in query execution #790graphql:install
adds operation_name: params[:operationName]
#786graphql:install
skips graphiql-rails
for API-only apps #772SerialExecution
calls .is_a?(Skip)
to avoid user-defined #==
methods #794prepare:
functions which return ExecutionError
are properly handled when default values are present #801Changelog
1.6.3 (7 Jun 2017)
Method
s with BackwardsCompatibility #763#==(other)
on user-provided objects (use .is_a?
instead) #761#edge_nodes
#762Changelog
1.6.2 (2 Jun 2017)
Schema.define { default_max_page_size(...) }
provides a Connection max_page_size
when no other is provided #752Schema#get_field(type, field)
accepts a string type name #756Schema.define { rescue_from(...) }
accepts multiple error classes for the handler #758*_execution_strategy
when executing a single query (doesn't support Schema#multiplex
) #755ActiveRecord
isn't loaded #747Query#mutation?
etc to support lazily-loaded AST #754