• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

graphql / graphql-js / 988
98%
master: 98%

Build:
Build:
LAST BUILD BRANCH: directives
DEFAULT BRANCH: master
Ran 10 May 2016 05:37AM UTC
Jobs 1
Files 137
Run time 6s
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

pending completion
988

push

travis-ci

leebyron
Validation: improving overlapping fields quality

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 to `b`. Also, the fragment `X` is checked "within" so `c` is compared to `d`. Because of the fragment spread, the query body and fragment `X` are checked "between" so that `a` and `b` are each compared to `c` and `d`. 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 ... (continued)

102 of 102 new or added lines in 2 files covered. (100.0%)

6984 of 7110 relevant lines covered (98.23%)

1367.72 hits per line

New Missed Lines in Diff

Lines Coverage ∆ File
4
100.0
src/validation/rules/OverlappingFieldsCanBeMerged.js

Uncovered Existing Lines

Lines Coverage ∆ File
1
100.0
src/validation/rules/OverlappingFieldsCanBeMerged.js
3
100.0
src/validation/__tests__/OverlappingFieldsCanBeMerged-test.js
Jobs
ID Job ID Ran Files Coverage
1 988.1 10 May 2016 05:37AM UTC 0
98.23
Travis Job 988.1
Source Files on build 988
  • Tree
  • List 0
  • Changed 1
  • Source Changed 1
  • Coverage Changed 0
Coverage ∆ File Lines Relevant Covered Missed Hits/Line
  • Back to Repo
  • Travis Build #988
  • 36f12232 on github
  • Prev Build on within-between (#986)
  • Next Build on within-between (#990)
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc