Changelog History
Page 20
-
v1.1.0 Changes
November 01, 2016๐ฅ Breaking changes
- Two-character
"\\u"
is no longer treated as the Unicode escape character, only the Unicode escape character"\u"
is treated that way. (This behavior was a bug, the migration path is to use the Unicode escape character.) #366 - ๐
GraphQL::Language::ParserTests
was removed, useGraphQL::Compatibility
instead. #366 - 0๏ธโฃ Non-null arguments can't be defined with default values, because those values would never be used #361
๐ New features
Schema.from_definition(definition_string)
builds aGraphQL::Schema
out of a schema definition. #346- Schema members (types, fields, arguments, enum values) can be hidden on a per-query basis with the
except:
option #300 - ๐
GraphQL::Compatibility
contains.build_suite
functions for testing user-provided parsers and execution strategies with GraphQL internals. #366 - Schema members respond to
#redefine { ... }
for making shallow copies with extended definitions. #357 Schema#instrument
provides an avenue for observing query and field resolution with no overhead.- ๐ Some
SerialExecution
objects were converted to functions, resulting in a modest performance improvement for query resolution.
๐ Bug fixes
NonNullType
andListType
have no name (nil
), as per the spec #355- 0๏ธโฃ Non-null arguments can't be defined with default values, because those values would never be used #361
- Two-character
-
v1.0.0 Changes
October 25, 2016๐ฅ Breaking changes
- ๐
validate: false
option removed fromSchema.execute
(it didn't work anyways) #338 - ๐ Some deprecated methods were removed: #349
BaseConnection#object
was removed, useBaseConnection#nodes
BaseConnection.connection_for_items
was removed, useBaseConnection#connection_for_nodes
- Two-argument resolve functions for
Relay::Mutation
s are not supported, use three arguments instead:(root_obj, input, ctx)
Schema.new
no longer accepts initialization options, useSchema.define
insteadGraphQL::ObjectType::UnresolvedTypeError
was removed, useGraphQL::UnresolvedTypeError
instead
- โก๏ธ Fragment type conditions should be parsed as
TypeName
nodes, not strings. (Users ofgraphql-libgraphqlparser
should update to1.0.0
of that gem.) #342
๐ New Features
- Set
ast_node
andirep_node
on query context before sending it to middleware #348 - Enum values can be extended with
.define
#341
๐ Bug Fixes
- ๐
Use
RelationConnection
for Rails 3 relations (which also extendArray
) #343 - ๐ Fix schema printout when arguments have comments #335
- ๐
-
v0.19.4 Changes
October 18, 2016๐ฅ Breaking changes
- ๐
Relay::BaseConnection#order
was removed (it always returnednil
) #313 - ๐ In the IDL, Interface names & Union members are parsed as
TypeName
nodes instead of Strings #322
๐ New features
- ๐จ Print and parse descriptions in the IDL #305
- Schema roots from IDL are omitted when their names match convention #320
- Don't add
rescue_middleware
to a schema if it's not usingrescue_from
#328 Query::Arguments#each_value
yieldsQuery::Argument::ArgumentValue
instances which contain key, value and argument definition #331
๐ Bug fixes
- ๐ Use
JSON.generate(val, quirks_mode: true)
for compatibility with other JSON implementations #316 - ๐ Improvements for compatibility with 1.9.3 branch #315 #314 #313
- Raise a descriptive error when calculating a
cursor
for a node which isn't present in the connection's members #327
- ๐
-
v0.19.3 Changes
October 13, 2016๐ฅ Breaking Changes
GraphQL::Query::Arguments.new
requiresargument_definitions:
of type{String => GraphQL::Argument }
#304
๐ Deprecations
Relay::Mutation#resolve
has a new signature. #301
Previously, it was called with two arguments:
resolve ->(inputs, ctx) { ... }
Now, it's called with three inputs:
resolve ->(obj, inputs, ctx) { ... }
obj
is the value ofroot_value:
given toSchema#execute
, as with other root-level fields.Two-argument resolvers are still supported, but they are deprecated and will be removed in a future version.
๐ New features
Relay::Mutation
accepts a user-definedreturn_type
#310Relay::Mutation#resolve
receives theroot_value
passed toSchema#execute
#301- Derived
Relay
objects have descriptions #303
๐ Bug fixes
- Introspection query is 7 levels deep instead of 3 #308
- Unknown variable types cause validation errors, not runtime errors #310
- ๐
Query::Arguments
doesn't wrap hashes from parsed scalars (fix for user-defined "JSONScalar") #304
-
v0.19.2 Changes
October 06, 2016๐ New features
- If a list entry has a
GraphQL::ExecutionError
, replace the entry withnil
and return the error #295
๐ Bug fixes
- ๐ Support graphql-batch rescuing
InvalidNullError
s #296 - ๐จ Schema printer prints Enum names, not Ruby values for enums #297
- If a list entry has a
-
v0.19.1 Changes
October 04, 2016๐ฅ Breaking changes
- ๐ Previously-deprecated
InterfaceType#resolve_type
hook has been removed, useSchema#resolve_type
instead #290
๐ New features
- Eager-load schemas at definition time, validating types & schema-level hooks #289
InvalidNullError
s contain the type & field name that returned null #293- If an object is resolved with
Schema#resolve_type
and the resulting type is not a member of the expected possible types, raise an error #291
๐ Bug fixes
- ๐ Allow
directive
as field or argument name #288
- ๐ Previously-deprecated
-
v0.19.0 Changes
September 30, 2016๐ฅ Breaking changes
๐
GraphQL::Relay::GlobalNodeIdentification
was removed. Its features were moved toGraphQL::Schema
orGraphQL::Relay::Node
. The new hooks support more robust & flexible global IDs. #243- Relay's
"Node"
interface andnode(id: "...")
field were both moved toGraphQL::Relay::Node
. To use them in your schema, call.field
and.interface
. For example:
# Adding a Relay-compliant `node` field: field :node, GraphQL::Relay::Node.field
# This object type implements Relay's `Node` interface: interfaces [GraphQL::Relay::Node.interface]
- UUID hooks were renamed and moved to
GraphQL::Schema
. You should defineid_from_object
andobject_from_id
in yourSchema.define { ... }
block. For example:
MySchema = GraphQL::Schema.define do # Fetch an object by UUID object_from_id ->(id, ctx) { MyApp::RelayLookup.find(id) } # Generate a UUID for this object id_from_object ->(obj, type_defn, ctx) { MyApp::RelayLookup.to_id(obj) } end
- The new hooks have no default implementation. To use the previous default, use
GraphQL::Schema::UniqueWithinType
, for example:
MySchema = GraphQL::Schema.define do object_from_id ->(id, ctx) { # Break the id into its parts: type_name, object_id = GraphQL::Schema::UniqueWithinType.decode(id) # Fetch the identified object # ... } id_from_object ->(obj, type_defn, ctx) { # Provide the the type name & the object's `id`: GraphQL::Schema::UniqueWithinType.encode(type_defn.name, obj.id) } end
If you were using a custom
id_separator
, it's now accepted as an input toUniqueWithinType
's methods, asseparator:
. For example:# use "---" as a ID separator GraphQL::Schema::UniqueWithinType.encode(type_name, object_id, separator: "---") GraphQL::Schema::UniqueWithinType.decode(relay_id, separator: "---")
type_from_object
was previously deprecated and has been replaced bySchema#resolve_type
. You should define this hook in your schema to return a type definition for a given object:
MySchema = GraphQL::Schema.define do # ... resolve_type ->(obj, ctx) { # based on `obj` and `ctx`, # figure out which GraphQL type to use # and return the type } end
Schema#node_identification
has been removed.
- Relay's
0๏ธโฃ
Argument
default values have been changed to be consistent withInputObjectType
default values. #267
Previously, arguments expected GraphQL values as
default_value
s. Now, they expect application values. (InputObjectType
s always worked this way.)Consider an enum like this one, where custom values are provided:
PowerStateEnum = GraphQL::EnumType.define do name "PowerState" value("ON", value: 1) value("OFF", value: 0) end
Previously, enum names were provided as default values, for example:
field :setPowerState, PowerStateEnum do # Previously, the string name went here: argument :newValue, default_value: "ON" end
Now, enum values are provided as default values, for example:
field :setPowerState, PowerStateEnum do # Now, use the application value as `default_value`: argument :newValue, default_value: 1 end
Note that if you don't have custom values, then there's no change, because the name and value are the same.
Here are types that are affected by this change:
- Custom scalars (previously, the
default_value
was a string, now it should be the application value, egDate
orBigDecimal
) - Enums with custom
value:
s (previously, thedefault_value
was the name, now it's the value)
If you can't replace
default_value
s, you can also use a type's#coerce_input
method to translate a GraphQL value into an application value. For example:# Using a custom scalar, "Date" # PREVIOUSLY, provide a string: argument :starts_on, DateType, default_value: "2016-01-01" # NOW, transform the string into a Date: argument :starts_on, DateType, default_value: DateType.coerce_input("2016-01-01")
๐ New features
- ๐ Support
@deprecated
in the Schema language #275 - ๐ Support
directive
definitions in the Schema language #280 - ๐ Use the same introspection field descriptions as
graphql-js
#284
๐ Bug fixes
- Operation name is no longer present in execution error
"path"
values #276 - 0๏ธโฃ Default values are correctly dumped & reloaded in the Schema language #267
-
v0.18.15 Changes
September 20, 2016๐ฅ Breaking changes
- Validation errors no longer have a
"path"
key in their JSON. It was renamed to"fields"
#264 @skip
and@include
over multiple selections are handled according to the spec: if the same field is selected multiple times and one or more of them would be included, the field will be present in the response. Previously, if one or more of them would be skipped, it was absent from the response. #256
๐ New features
- Execution errors include a
"path"
key which points to the field in the response where the error occurred. #259 - ๐ Parsing directives from the Schema language is now supported #273
๐ Bug fixes
@skip
and@include
over multiple selections are now handled according to the spec #256
- Validation errors no longer have a
-
v0.18.14 Changes
September 20, 2016๐ฅ Breaking changes
- ๐ Directives are no longer considered as "conflicts" in query validation. This is in conformity with the spec, but a change for graphql-ruby #263
๐ Features
- Query analyzers may emit errors by raising
GraphQL::AnalysisError
s during#call
or returning a single error or an array of errors from#final_value
#262
๐ Bug fixes
- ๐ Merge fields even when
@skip
/@include
are not identical #263 - ๐ Fix possible infinite loop in
FieldsWillMerge
validation #261
-
v0.18.13 Changes
September 19, 2016๐ Bug fixes
- Find infinite loops in nested contexts, too #258