Skip to content

Commit e3b22d6

Browse files
author
clintwood (Office)
committed
Merge remote-tracking branch 'upstream/master' into annotations
2 parents 09a44e4 + dd02973 commit e3b22d6

13 files changed

+651
-104
lines changed

.travis.yml

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,21 @@ after_success:
3232
- if [[ "$TRAVIS_JOB_NUMBER" == *.1 ]]; then cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js; fi
3333

3434
deploy:
35-
provider: npm
36-
37-
api_key:
38-
secure: tCIGE/3CLOQlC49i/9ug42ILQjZnMOrSjyjdHkqmTVN5q9p9bljjziXQbNxYfVPYa9icICnVnI4c5psjktW+vwaz2WJAJhpWD6P3YGcpmKjjgPKKHKWOcXvq3HdIzH7DIbXyVtE0QLpV5zgbyxglD96vYScO9dvGeAhTGY/9qJaDvVkLOZ+6YpKiTwZlZcyPHlD1tbxzd4NytJgIsi7CedFdfATAmOyVsot1NRZr5q3oV0aXFjJRnhBQ3RtykGgGHtXEWYTNhAmYxcIwezYRYXLxtlkbrlwxixpKAdJr/UXHg6amplkaHtCopi+QChPQRmdndcDC6F+e2nFHut6BCi14Jnbvf7seaqWrmh0uqdopqMJFRP3OBc9lXZf3hljVKV9+iVbWNjxoUB7ezurOOEpgkXleJ5AO2o3u8oYh3OFfLYu7E1a4uSjfe4nP/zi+th+wvS4Wy2UWqErYFUMotMyStS/vllXUpK7pl+Qt59MUVHB8YzREyCVKxakQ/uvNvY+bzKf4sM8UJ/Dqnl3MaAjLG3rWZbFyzXdaJnRGdTeFK2lpz8nrfJEDzLIQX5ZC88yR30WahrRjAhLnnq0V1fYp0wLbLxs4SdN+tuMRlkzQhQEYYDYa5osgEo2C+O4D/H9F7GWHHJp9zPE+hMi5+ZwTPKHkln4/AqrABUKOk78=
39-
on:
40-
tags: true
41-
branch: master
42-
condition: "$BUILD_LEADER$BUILD_AGGREGATE_STATUS = YESothers_succeeded"
35+
- provider: script
36+
skip_cleanup: true
37+
script: ./resources/npm-git.sh
38+
on:
39+
branch: master
40+
condition: "$BUILD_LEADER$BUILD_AGGREGATE_STATUS = YESothers_succeeded"
41+
- provider: npm
42+
43+
api_key:
44+
secure: tCIGE/3CLOQlC49i/9ug42ILQjZnMOrSjyjdHkqmTVN5q9p9bljjziXQbNxYfVPYa9icICnVnI4c5psjktW+vwaz2WJAJhpWD6P3YGcpmKjjgPKKHKWOcXvq3HdIzH7DIbXyVtE0QLpV5zgbyxglD96vYScO9dvGeAhTGY/9qJaDvVkLOZ+6YpKiTwZlZcyPHlD1tbxzd4NytJgIsi7CedFdfATAmOyVsot1NRZr5q3oV0aXFjJRnhBQ3RtykGgGHtXEWYTNhAmYxcIwezYRYXLxtlkbrlwxixpKAdJr/UXHg6amplkaHtCopi+QChPQRmdndcDC6F+e2nFHut6BCi14Jnbvf7seaqWrmh0uqdopqMJFRP3OBc9lXZf3hljVKV9+iVbWNjxoUB7ezurOOEpgkXleJ5AO2o3u8oYh3OFfLYu7E1a4uSjfe4nP/zi+th+wvS4Wy2UWqErYFUMotMyStS/vllXUpK7pl+Qt59MUVHB8YzREyCVKxakQ/uvNvY+bzKf4sM8UJ/Dqnl3MaAjLG3rWZbFyzXdaJnRGdTeFK2lpz8nrfJEDzLIQX5ZC88yR30WahrRjAhLnnq0V1fYp0wLbLxs4SdN+tuMRlkzQhQEYYDYa5osgEo2C+O4D/H9F7GWHHJp9zPE+hMi5+ZwTPKHkln4/AqrABUKOk78=
45+
on:
46+
tags: true
47+
branch: master
48+
condition: "$BUILD_LEADER$BUILD_AGGREGATE_STATUS = YESothers_succeeded"
49+
50+
env:
51+
global:
52+
secure: vs/YDHDlVY3apcWOWOyi01s2457uc19gfnZMWAc9RsTwaNrealbM7y2TTuakWj1eQQRU3hXvR4TFoqdJOKMk42avv4IxmCf0Gynf/4w8BFycfyLJwWfEvmBDYr4oMjjrX6t5ycTzACBXPGyi9Bpa1RJM2QIfujNtjtgaBTdrAQs5XZ+7l3giFhPLebWPnC0/CEhzZMKqiAID3z52SrR6RpxYDpQZcVuenXknIuG0WucbWd/XlHh6+upJxlc88pJsdNoDavDpQGcJZ5AUMD1ek8wsCo761lbPybryfeCN8qmMlTFkzRIpnGU28Q0RhqHuNq7tQJBPNIuc3MjTy5rR+7snvb1dXq9M3ut6D9UmsFvx3H2mNC4Ue8H2f2nS0Oy3HWY08v58gOvGpcKItndBsHmq9hPE3gK7Ea/UFH8GAtbXABhChO6dd7AY+CM7TOwfKyEx7y1kzBQ9snRpX9uEwGmRAXwRsvWeobtls/BevUfBGrBhgicd1BPhJzxeK447NHdELikgaCwldP3gdrrh1U7xmgaKO3MeM4Tpp+gMYUKoc/j6Pvcuq4/kNaiahnhW1SPUZJQmxIAnZjKOKmhm0WzmGC1RAvqvIVyqQa55CGuBr+fhWxWE2WB2tDcX5JSmwRASz9IOMd4mCxHM/maVlNaLfVYDQ2Fl1VHJ5MIES4s=

README.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,18 @@ graphql(schema, query).then(result => {
130130
});
131131
```
132132

133+
### Want to ride the bleeding edge?
134+
135+
The `npm` branch in this repository is automatically maintained to be the last
136+
commit to `master` to pass all tests, in the same form found on npm. It is
137+
recommend to use builds deployed npm for many reasons, but if you want to use
138+
the latest not-yet-released version of graphql-js, you can do so by depending
139+
directly on this branch:
140+
141+
```
142+
npm install graphql@git://github.com/graphql/graphql-js.git#npm
143+
```
144+
133145
### Contributing
134146

135147
We actively welcome pull requests, learn how to

package.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "graphql",
3-
"version": "0.5.0-beta.1",
3+
"version": "0.5.0",
44
"description": "A Query Language and Runtime which can target any service.",
55
"contributors": [
66
"Lee Byron <[email protected]> (http://leebyron.com/)",
@@ -52,7 +52,7 @@
5252
},
5353
"devDependencies": {
5454
"babel-cli": "6.6.5",
55-
"babel-eslint": "6.0.0-beta.5",
55+
"babel-eslint": "6.0.2",
5656
"babel-plugin-syntax-async-functions": "6.5.0",
5757
"babel-plugin-transform-class-properties": "6.6.0",
5858
"babel-plugin-transform-flow-strip-types": "6.7.0",
@@ -63,11 +63,11 @@
6363
"chai": "3.5.0",
6464
"chai-subset": "1.2.2",
6565
"coveralls": "2.11.9",
66-
"eslint": "2.2.0",
67-
"eslint-plugin-babel": "3.1.0",
68-
"flow-bin": "0.20.1",
66+
"eslint": "2.7.0",
67+
"eslint-plugin-babel": "3.2.0",
68+
"flow-bin": "0.22.1",
6969
"isparta": "4.0.0",
7070
"mocha": "2.4.5",
71-
"sane": "1.3.3"
71+
"sane": "1.3.4"
7272
}
7373
}

resources/npm-git.sh

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
#!/bin/sh -e
2+
3+
# This script maintains a git branch which mirrors master but in a form that
4+
# what will eventually be deployed to npm, allowing npm dependencies to use:
5+
#
6+
# "graphql": "git://github.com/graphql/graphql-js.git#npm"
7+
#
8+
9+
./node_modules/.bin/babel src --ignore __tests__ --out-dir npm
10+
11+
# Ensure a vanilla package.json before deploying so other tools do not interpret
12+
# The built output as requiring any further transformation.
13+
node -e "var package = require('./package.json'); \
14+
delete package.babel; delete package.scripts; delete package.options; \
15+
require('fs').writeFileSync('./npm/package.json', JSON.stringify(package, null, 2));"
16+
17+
cp README.md npm/
18+
cp LICENSE npm/
19+
cp PATENTS npm/
20+
21+
cd npm
22+
git init
23+
git config user.name "Travis CI"
24+
git config user.email "[email protected]"
25+
git add .
26+
git commit -m "Deploy master to NPM branch"
27+
git push --force --quiet "https://${GH_TOKEN}@github.com/graphql/graphql-js.git" master:npm

src/execution/execute.js

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -820,16 +820,14 @@ function completeAbstractValue(
820820
returnType.resolveType(result, exeContext.contextValue, info) :
821821
defaultResolveTypeFn(result, exeContext.contextValue, info, returnType);
822822

823-
invariant(
824-
runtimeType,
825-
`Could not determine runtime type of value "${result}" for field ${
826-
info.parentType}.${info.fieldName}.`
827-
);
828-
invariant(
829-
runtimeType instanceof GraphQLObjectType,
830-
`${returnType}.resolveType must return an instance of GraphQLObjectType ` +
831-
`for field ${info.parentType}.${info.fieldName}, received "${runtimeType}".`
832-
);
823+
if (!(runtimeType instanceof GraphQLObjectType)) {
824+
throw new GraphQLError(
825+
`Abstract type ${returnType} must resolve to an Object type at runtime ` +
826+
`for field ${info.parentType}.${info.fieldName} with value "${result}",` +
827+
`received "${runtimeType}".`,
828+
fieldASTs
829+
);
830+
}
833831

834832
if (!exeContext.schema.isPossibleType(returnType, runtimeType)) {
835833
throw new GraphQLError(

src/language/parser.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@ import type {
4040

4141
Type,
4242
NamedType,
43+
ListType,
44+
NonNullType,
4345

4446
TypeSystemDefinition,
4547

@@ -683,20 +685,20 @@ export function parseType(parser: Parser): Type {
683685
if (skip(parser, TokenKind.BRACKET_L)) {
684686
type = parseType(parser);
685687
expect(parser, TokenKind.BRACKET_R);
686-
type = {
688+
type = ({
687689
kind: LIST_TYPE,
688690
type,
689691
loc: loc(parser, start)
690-
};
692+
}: ListType);
691693
} else {
692694
type = parseNamedType(parser);
693695
}
694696
if (skip(parser, TokenKind.BANG)) {
695-
return {
697+
return ({
696698
kind: NON_NULL_TYPE,
697699
type,
698700
loc: loc(parser, start)
699-
};
701+
}: NonNullType);
700702
}
701703
return type;
702704
}

src/type/schema.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,14 @@
99
*/
1010

1111
import {
12-
GraphQLAbstractType,
1312
GraphQLObjectType,
1413
GraphQLInputObjectType,
1514
GraphQLInterfaceType,
1615
GraphQLUnionType,
1716
GraphQLList,
1817
GraphQLNonNull
1918
} from './definition';
20-
import type { GraphQLType } from './definition';
19+
import type { GraphQLType, GraphQLAbstractType } from './definition';
2120
import {
2221
GraphQLDirective,
2322
GraphQLIncludeDirective,

src/utilities/__tests__/buildASTSchema-test.js

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -446,6 +446,68 @@ type Hello {
446446
.to.throw('Must provide schema definition with query type.');
447447
});
448448

449+
it('Allows only a single query type', () => {
450+
const body = `
451+
schema {
452+
query: Hello
453+
query: Yellow
454+
}
455+
456+
type Hello {
457+
bar: Bar
458+
}
459+
460+
type Yellow {
461+
isColor: Boolean
462+
}
463+
`;
464+
const doc = parse(body);
465+
expect(() => buildASTSchema(doc))
466+
.to.throw('Must provide only one query type in schema.');
467+
});
468+
469+
it('Allows only a single mutation type', () => {
470+
const body = `
471+
schema {
472+
query: Hello
473+
mutation: Hello
474+
mutation: Yellow
475+
}
476+
477+
type Hello {
478+
bar: Bar
479+
}
480+
481+
type Yellow {
482+
isColor: Boolean
483+
}
484+
`;
485+
const doc = parse(body);
486+
expect(() => buildASTSchema(doc))
487+
.to.throw('Must provide only one mutation type in schema.');
488+
});
489+
490+
it('Allows only a single subscription type', () => {
491+
const body = `
492+
schema {
493+
query: Hello
494+
subscription: Hello
495+
subscription: Yellow
496+
}
497+
498+
type Hello {
499+
bar: Bar
500+
}
501+
502+
type Yellow {
503+
isColor: Boolean
504+
}
505+
`;
506+
const doc = parse(body);
507+
expect(() => buildASTSchema(doc))
508+
.to.throw('Must provide only one subscription type in schema.');
509+
});
510+
449511
it('Unknown type referenced', () => {
450512
const body = `
451513
schema {

0 commit comments

Comments
 (0)