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

graphql / graphql-js / 2285
99%
master: 98%

Build:
Build:
LAST BUILD BRANCH: directives
DEFAULT BRANCH: master
Ran 16 Jun 2017 01:56AM UTC
Jobs 1
Files 160
Run time 11s
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
2285

push

travis-ci

leebyron
RFC: Define custom scalars in terms of built-in scalars.

This proposes an additive change which allows custom scalars to be defined in terms of the built-in scalars. The motivation is for client-side code generators to understand how to map between the GraphQL type system and a native type system. As an example, a `URL` custom type may be defined in terms of the built-in scalar `String`. It could define additional serialization and parsing logic, however client tools can know to treat `URL` values as `String`. Presently, we do this by defining these mappings manually on the client, which is difficult to scale, or by giving up and making no assumptions of how the custom types serialize.

Another real use case of giving client tools this information is GraphiQL: this change will allow GraphiQL to show more useful errors when a literal of an incorrect kind is provided to a custom scalar. Currently GraphiQL simply accepts all values.

To accomplish this, this proposes adding the following:

* A new property when defining `GraphQLScalarType` (`ofType`) which asserts that only built-in scalar types are provided.

* A second type coercion to guarantee to a client that the serialized values match the `ofType`.

* Delegating the `parseLiteral` and `parseValue` functions to those in `ofType` (this enables downstream validation / GraphiQL features)

* Exposing `ofType` in the introspection system, and consuming that introspection in `buildClientSchema`.

* Adding optional syntax to the SDL, and consuming that in `buildASTSchema` and `extendSchema` as well as in `schemaPrinter`.

* Adding a case to `findBreakingChanges` which looks for a scalar's ofType changing.

3386 of 3751 branches covered (90.27%)

40 of 40 new or added lines in 9 files covered. (100.0%)

8877 of 9067 relevant lines covered (97.9%)

1273.77 hits per line

New Missed Lines in Diff

Lines Coverage ∆ File
1
100.0
src/utilities/__tests__/schemaPrinter-test.js
1
100.0
src/utilities/findBreakingChanges.js
3
100.0
src/utilities/buildClientSchema.js
5
100.0
src/utilities/extendSchema.js
6
100.0
src/utilities/buildASTSchema.js
Jobs
ID Job ID Ran Files Coverage
1 2285.1 16 Jun 2017 01:56AM UTC 0
97.9
Travis Job 2285.1
Source Files on build 2285
Detailed source file information is not available for this build.
  • Back to Repo
  • Travis Build #2285
  • 0a2aec06 on github
  • Next Build on schema-scalar-of-type (#2292)
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

© 2026 Coveralls, Inc