Upgrading from 0.4
Releases 0.5 through 0.9 fixed the executor where it strayed from the GraphQL specification and added interfaces, unions and subscriptions. Most code written against 0.4 keeps compiling unchanged. What clients see did change in a few places, all of them required by the specification.
Responses
- A field whose resolver raised is
nullinstead of being left out of the response, and when that field is non-null thenullpropagates upwards, so"data"itself can benull. See Errors. - Errors on fields carry
locationswith the line and column in the query. - Request-level errors, such as a syntax error or a missing variable, no
longer carry an empty
path. - Queries that 0.4 silently accepted are now rejected: unknown arguments, unknown input fields, unknown directives, selection sets on scalars, and object fields without a selection set.
- Running a subscription through
schema.executeis answered with an error; useschema.subscribe.
Variables and arguments
- Omitting a nullable variable, passing
null, or relying on a default declared in the operation now works. In 0.4 any omitted variable failed the request. - Argument names set through the
argumentsoption are now honored when resolving; in 0.4 they only appeared in the schema. - A single value passed where a list is expected becomes a one-element list.
- Integer literals that do not fit
Int32reach custom scalars such asBigInt;Intarguments reject them.
API
GraphQL::Language.parsetakes amax_depthargument, and the unusedParser#max_nestingproperty is gone.GraphQL::Introspection::Schema.newtakes the subscription type as a fourth argument.GraphQL::Contextgainedmax_concurrency,max_complexity,complexityandmax_depth.max_complexityandcomplexityexisted before but were never read.GraphQL::Schema.newaccepts a subscription type as its third argument.
Behavior
- Fields and array elements resolve sequentially unless
max_concurrencyis set; earlier builds spawned one fiber per field. Root mutation fields always resolve one after another. - Queries nested more than 100 levels are rejected while parsing; raise
max_depthon the context if you really need deeper ones.
The changelog lists every change by release.