Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master' into annotations
Browse files Browse the repository at this point in the history
  • Loading branch information
clintwood (Office) committed Apr 19, 2016
2 parents 09a44e4 + dd02973 commit e3b22d6
Show file tree
Hide file tree
Showing 13 changed files with 651 additions and 104 deletions.
26 changes: 18 additions & 8 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,21 @@ after_success:
- if [[ "$TRAVIS_JOB_NUMBER" == *.1 ]]; then cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js; fi

deploy:
provider: npm
email: "lee@leebyron.com"
api_key:
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=
on:
tags: true
branch: master
condition: "$BUILD_LEADER$BUILD_AGGREGATE_STATUS = YESothers_succeeded"
- provider: script
skip_cleanup: true
script: ./resources/npm-git.sh
on:
branch: master
condition: "$BUILD_LEADER$BUILD_AGGREGATE_STATUS = YESothers_succeeded"
- provider: npm
email: "lee@leebyron.com"
api_key:
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=
on:
tags: true
branch: master
condition: "$BUILD_LEADER$BUILD_AGGREGATE_STATUS = YESothers_succeeded"

env:
global:
secure: vs/YDHDlVY3apcWOWOyi01s2457uc19gfnZMWAc9RsTwaNrealbM7y2TTuakWj1eQQRU3hXvR4TFoqdJOKMk42avv4IxmCf0Gynf/4w8BFycfyLJwWfEvmBDYr4oMjjrX6t5ycTzACBXPGyi9Bpa1RJM2QIfujNtjtgaBTdrAQs5XZ+7l3giFhPLebWPnC0/CEhzZMKqiAID3z52SrR6RpxYDpQZcVuenXknIuG0WucbWd/XlHh6+upJxlc88pJsdNoDavDpQGcJZ5AUMD1ek8wsCo761lbPybryfeCN8qmMlTFkzRIpnGU28Q0RhqHuNq7tQJBPNIuc3MjTy5rR+7snvb1dXq9M3ut6D9UmsFvx3H2mNC4Ue8H2f2nS0Oy3HWY08v58gOvGpcKItndBsHmq9hPE3gK7Ea/UFH8GAtbXABhChO6dd7AY+CM7TOwfKyEx7y1kzBQ9snRpX9uEwGmRAXwRsvWeobtls/BevUfBGrBhgicd1BPhJzxeK447NHdELikgaCwldP3gdrrh1U7xmgaKO3MeM4Tpp+gMYUKoc/j6Pvcuq4/kNaiahnhW1SPUZJQmxIAnZjKOKmhm0WzmGC1RAvqvIVyqQa55CGuBr+fhWxWE2WB2tDcX5JSmwRASz9IOMd4mCxHM/maVlNaLfVYDQ2Fl1VHJ5MIES4s=
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,18 @@ graphql(schema, query).then(result => {
});
```

### Want to ride the bleeding edge?

The `npm` branch in this repository is automatically maintained to be the last
commit to `master` to pass all tests, in the same form found on npm. It is
recommend to use builds deployed npm for many reasons, but if you want to use
the latest not-yet-released version of graphql-js, you can do so by depending
directly on this branch:

```
npm install graphql@git://github.com/graphql/graphql-js.git#npm
```

### Contributing

We actively welcome pull requests, learn how to
Expand Down
12 changes: 6 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "graphql",
"version": "0.5.0-beta.1",
"version": "0.5.0",
"description": "A Query Language and Runtime which can target any service.",
"contributors": [
"Lee Byron <lee@leebyron.com> (http://leebyron.com/)",
Expand Down Expand Up @@ -52,7 +52,7 @@
},
"devDependencies": {
"babel-cli": "6.6.5",
"babel-eslint": "6.0.0-beta.5",
"babel-eslint": "6.0.2",
"babel-plugin-syntax-async-functions": "6.5.0",
"babel-plugin-transform-class-properties": "6.6.0",
"babel-plugin-transform-flow-strip-types": "6.7.0",
Expand All @@ -63,11 +63,11 @@
"chai": "3.5.0",
"chai-subset": "1.2.2",
"coveralls": "2.11.9",
"eslint": "2.2.0",
"eslint-plugin-babel": "3.1.0",
"flow-bin": "0.20.1",
"eslint": "2.7.0",
"eslint-plugin-babel": "3.2.0",
"flow-bin": "0.22.1",
"isparta": "4.0.0",
"mocha": "2.4.5",
"sane": "1.3.3"
"sane": "1.3.4"
}
}
27 changes: 27 additions & 0 deletions resources/npm-git.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#!/bin/sh -e

# This script maintains a git branch which mirrors master but in a form that
# what will eventually be deployed to npm, allowing npm dependencies to use:
#
# "graphql": "git://github.com/graphql/graphql-js.git#npm"
#

./node_modules/.bin/babel src --ignore __tests__ --out-dir npm

# Ensure a vanilla package.json before deploying so other tools do not interpret
# The built output as requiring any further transformation.
node -e "var package = require('./package.json'); \
delete package.babel; delete package.scripts; delete package.options; \
require('fs').writeFileSync('./npm/package.json', JSON.stringify(package, null, 2));"

cp README.md npm/
cp LICENSE npm/
cp PATENTS npm/

cd npm
git init
git config user.name "Travis CI"
git config user.email "github@fb.com"
git add .
git commit -m "Deploy master to NPM branch"
git push --force --quiet "https://${GH_TOKEN}@github.com/graphql/graphql-js.git" master:npm
18 changes: 8 additions & 10 deletions src/execution/execute.js
Original file line number Diff line number Diff line change
Expand Up @@ -820,16 +820,14 @@ function completeAbstractValue(
returnType.resolveType(result, exeContext.contextValue, info) :
defaultResolveTypeFn(result, exeContext.contextValue, info, returnType);

invariant(
runtimeType,
`Could not determine runtime type of value "${result}" for field ${
info.parentType}.${info.fieldName}.`
);
invariant(
runtimeType instanceof GraphQLObjectType,
`${returnType}.resolveType must return an instance of GraphQLObjectType ` +
`for field ${info.parentType}.${info.fieldName}, received "${runtimeType}".`
);
if (!(runtimeType instanceof GraphQLObjectType)) {
throw new GraphQLError(
`Abstract type ${returnType} must resolve to an Object type at runtime ` +
`for field ${info.parentType}.${info.fieldName} with value "${result}",` +
`received "${runtimeType}".`,
fieldASTs
);
}

if (!exeContext.schema.isPossibleType(returnType, runtimeType)) {
throw new GraphQLError(
Expand Down
10 changes: 6 additions & 4 deletions src/language/parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ import type {

Type,
NamedType,
ListType,
NonNullType,

TypeSystemDefinition,

Expand Down Expand Up @@ -683,20 +685,20 @@ export function parseType(parser: Parser): Type {
if (skip(parser, TokenKind.BRACKET_L)) {
type = parseType(parser);
expect(parser, TokenKind.BRACKET_R);
type = {
type = ({
kind: LIST_TYPE,
type,
loc: loc(parser, start)
};
}: ListType);
} else {
type = parseNamedType(parser);
}
if (skip(parser, TokenKind.BANG)) {
return {
return ({
kind: NON_NULL_TYPE,
type,
loc: loc(parser, start)
};
}: NonNullType);
}
return type;
}
Expand Down
3 changes: 1 addition & 2 deletions src/type/schema.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,14 @@
*/

import {
GraphQLAbstractType,
GraphQLObjectType,
GraphQLInputObjectType,
GraphQLInterfaceType,
GraphQLUnionType,
GraphQLList,
GraphQLNonNull
} from './definition';
import type { GraphQLType } from './definition';
import type { GraphQLType, GraphQLAbstractType } from './definition';
import {
GraphQLDirective,
GraphQLIncludeDirective,
Expand Down
62 changes: 62 additions & 0 deletions src/utilities/__tests__/buildASTSchema-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -446,6 +446,68 @@ type Hello {
.to.throw('Must provide schema definition with query type.');
});

it('Allows only a single query type', () => {
const body = `
schema {
query: Hello
query: Yellow
}
type Hello {
bar: Bar
}
type Yellow {
isColor: Boolean
}
`;
const doc = parse(body);
expect(() => buildASTSchema(doc))
.to.throw('Must provide only one query type in schema.');
});

it('Allows only a single mutation type', () => {
const body = `
schema {
query: Hello
mutation: Hello
mutation: Yellow
}
type Hello {
bar: Bar
}
type Yellow {
isColor: Boolean
}
`;
const doc = parse(body);
expect(() => buildASTSchema(doc))
.to.throw('Must provide only one mutation type in schema.');
});

it('Allows only a single subscription type', () => {
const body = `
schema {
query: Hello
subscription: Hello
subscription: Yellow
}
type Hello {
bar: Bar
}
type Yellow {
isColor: Boolean
}
`;
const doc = parse(body);
expect(() => buildASTSchema(doc))
.to.throw('Must provide only one subscription type in schema.');
});

it('Unknown type referenced', () => {
const body = `
schema {
Expand Down
Loading

0 comments on commit e3b22d6

Please sign in to comment.