Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
#0.6.0 / 2016-05-11
This improves the overlapping fields validation performance and improves error reporting quality by separating the concepts of checking fields "within" a single collection of fields from checking fields "between" two different collections of fields. This ensures for deeply overlapping fields that nested fields are not checked against each other repeatedly. Extending this concept further, fragment spreads are no longer expanded inline before looking for conflicts, instead the fields within a fragment are compared to the fields with the selection set which contained the referencing fragment spread.
e.g.
graphql { same: a same: b ...X } fragment X on T { same: c same: d }
In the above example, the initial query body is checked "within" so
a
is compared tob
. Also, the fragmentX
is checked "within" soc
is compared tod
. Because of the fragment spread, the query body and fragmentX
are checked "between" so thata
andb
are each compared toc
andd
. In this trivial example, no fewer checks are performed, but in the case where fragments are referenced multiple times, this reduces the overall number of checks (regardless of memoization).BREAKING: This can change the order of fields reported when a conflict arises when fragment spreads are involved. If you are checking the precise output of errors (e.g. for unit tests), you may find existing errors change from
"a" and "c" are different fields
to"c" and "a" are different fields
.From a perf point of view, this is fairly minor as the memoization "PairSet" was already keeping these repeated checks from consuming time, however this will reduce the number of memoized hits because of the algorithm improvement.
From an error reporting point of view, this reports nearest-common-ancestor issues when found in a fragment that comes later in the validation process. I've added a test which fails with the existing impl and now passes, as well as changed a comment.
This also fixes an error where validation issues could be missed because of an over-eager memoization. I've also modified the
PairSet
to be aware of both forms of memoization, also represented by a previously failing test.Two more functions from the overlapping-fields validator which now accept arguments rather than closing over them locally.
The functions within this validator did not need to close over any state, which allows them to be pure functions.
This adds a new directive as part of the experimental schema language:
directive @deprecated(reason: String = "No longer supported") on FIELD_DEFINITION | ENUM_VALUE
It also adds support for this directive in the schemaPrinter and buildASTSchema.
Additionally exports a new helper
specifiedDirectives
which is encoured to be used when addressing the collection of all directives defined by the spec. The@deprecated
directive is optimistically added to this collection. While it's currently experimental, it will become part of the schema definition language RFC.This allows directives to be defined on schema definitions.
This implements adding directives to the experimental schema language by extending the locations a directive can be used.
Notice that this provides no semantic meaning to these directives - they are purely a mechanism for annotating an AST - however future directives which contain semantic meaning may be introduced in the future (the first will be
@deprecated
).This exports the ability to define new directives as well as access the built-in @Skip and @include definitions.
buildASTSchema
used to not regard directives in 0.4.x, just always including only@skip
and@include
. Since 0.5.0 included the ability to use directives in the experimental schema language, existing use of this tool found no defined directives and therefore excluded these two built-ins.This fixes the issue by implicitly adding these built-in directives if they were not explicitly defined.
This fixes a bug where an empty "block" list could be skipped by the printer.
FieldsOnCorrectType