graphql-ruby-client
Advanced tools
Changelog
1.10.0 (20 Jan 2020)
.to_graphql
methods were used to generate singletons which were used at runtime.) This means:
.name
will now call Class#name
, which will give the class name. Use .graphql_name
to get the name of a GraphQL type. (Fields, arguments and directives have .graphql_name
too, so you can use it everywhere.)MySchema.types
and MyObjectType.fields
. Instead:
.get_type(type_name)
or .get_field(field_name)
instead. Those methods find a match without performing Hash merges.context.warden
(an instance of GraphQL::Schema::Warden
) at runtime. Those values reflect the types and fields which are permitted for the current query, and they're cached for life of the query. Check the API docs to see methods on the warden
.use GraphQL::Analysis::AST
to their schema (and update their custom analyzers, see https://graphql-ruby.org/queries/ast_analysis.html) #2363#authorized?
methods now accept three arguments (instead of 2). They now accept (obj, args, ctx)
, where args
is the arguments (for a field) or the argument value (for an argument). #2520!!
is disallowed by the parser #2397nil
to get the previous behavior. #2536Schema.from_definition
builds a class-based schema from the definition string #2178Int
type #2404.coerce_input
on all input values - previously this call was skipped for null
values..define
is deprecated; class-based schema definitions should be used instead. If you're having trouble or you can't find information about an upgrade path, please open an issue on GitHub!.authorized?
and .resolve_type
calls #2660Schema.from_definition
accepts using:
for installing plugins (equivalent to use ...
in class-based schemas) #2307$
to variable names in error messages #2531loads:
get the loaded object in their authorized?
hook, as arg
in authorized?(obj, args, ctx)
. #2536GraphQL::Pagination
auto-pagination system #2143Schema.from_definition
builds a class-based schema from the definition string #2178Infinity
) no longer :boom: when being reserialized #2320hasNextPage
/hasPrevious
page when max_page_size limits the items returned #2608defaultValue
of input objects containing enum values #2439!!
. #2397loads:
assign the value to argument @loads
#2364Int
type #2404Changelog
1.9.4 (5 Apr 2019)
GraphQL::Schema::Resolver::LoadApplicationObjectFailedError
was renamed to GraphQL::LoadApplicationObjectFailedError
. (This will only break if you're referencing the class by name and running Ruby 2.5+) #2080Types::BigInt
#2150Query#execute
when no explicit query string is passed in #2142node
by threading owner:
through field tracing #2156Changelog
1.9.3 (20 Feb 2019)
Schema::Subscription
when it has no arguments #2135nil
, just skip scoping altogether #2134.authorized?
returns false
and there's no root_value
#2136Subscription
#2102Changelog
1.9.2 (15 Feb 2019)
Changelog
1.9.1 (14 Feb 2019)
load_application_object_failed
methods #2110Changelog
1.9.0 (13 Feb 2019)
AST nodes are immutable. To modify a parsed GraphQL query, see GraphQL::Language::Visitor
for its mutation API, which builds a new AST with the specified mutations applied. #1338, #1740
Cursors use urlsafe Base64. This won't break your clients (it's backwards-compatible), but it might break your tests, so it's listed here. #1698
Add field(..., resolver_method:)
for when GraphQL-Ruby should call a method other than the one whose name matches the field name (#1961). This means that if you're using method:
to call a different method on the Schema::Object subclass, you should update that configuration to resolver_method:
. (method:
is still used to call a different method on the underlying application object.)
Int
type now applies boundaries as described in the spec #2101. To preserve the previous, unbounded behavior, handle the error in your schema's .type_error(err, ctx)
hook, for example:
class MySchema < GraphQL::Schema
def self.type_error(err, ctx)
if err.is_a?(GraphQL::IntegerEncodingError)
# Preserve the previous unbounded behavior
# by returning the out-of-bounds value
err.integer_value
else
super
end
end
end
field(...)
configurations don't create implicit method definitions (#1961). If one resolver method depended on the implicitly-created method from another field, you'll have to refactor that call or manually add a def ...
for that field.
Calling super
in a field method doesn't work anymore (#1961)
Error "problems"
are now in "extensions" : { "problems": ... }
#2077
Change schema default to error_bubbling false
#2069
GraphQL::Schema::Subscription
#1930GraphQL::Execution::Interpreter
(#1394) and GraphQL::Analysis::AST
(#1824) which together cut GraphQL overhead by half (time and memory)Schema.unauthorized_field(err)
for when Field#authorized?
checks fail (#1994)Schema::FieldExtension
for customizing field execution with class-based fields #1795Query#lookahead
for root-level selection info #1931"extensions": { ... }
which includes metadata about that error #1970false
as an Enum value #2050hash_key:
fields when the key isn't a valid Ruby method name #2016Changelog
1.8.2 (6 June 2018)
Schema::InputObject#to_h
recursively transforms hashes to underscorized, symbolized keys. #1555Schema::InputObject#to_h
returns a underscorized, symbolized hash #1555default_mask
in class-based schemas #1563RelayClassicMutation
s with no arguments #1543Changelog
1.8.1 (1 June 2018)
GraphQL::ExecutionError.new
accepts an extensions:
option which will be merged into the "extensions"
key in that error's JSON #1552introspection?
#1535object
/context
in the upgrader instead of @object
/@context
#1529Changelog
1.8.0 (17 May 2018)
1.8.0
has been in prerelease for 6 months. See the prerelease changelog for change-by-change details. Here's a high-level changelog, followed by a detailed list of changes since the last prerelease.
GraphQL::Delegate
, a duplicate of Ruby's Forwardable
, was removed. Use Forwardable
instead, and update your Ruby if you're on 2.4.0
, due to a performance regression in Forwardable
in that version.MySchema.subscriptions.trigger
asserts that its inputs are valid arguments #1400. So if you were previously passing invalid options there, you'll get an error. Remove those options..execute(variables: ...)
and subscriptions.trigger
both accept Symbol-keyed hashes