Skip to content

Commit 8d21356

Browse files
committed
Add some sample GraphQL files.
1 parent 402a4b7 commit 8d21356

File tree

3 files changed

+112
-0
lines changed

3 files changed

+112
-0
lines changed

samples/README.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# GraphQL Samples
2+
3+
These sample files are borrowed from Facebook's [graphql-js][] project.
4+
5+
[graphql-js]: https://github.com/graphql/graphql-js

samples/kitchen-sink.graphql

+57
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
# Copyright (c) 2015, Facebook, Inc.
2+
# All rights reserved.
3+
#
4+
# This source code is licensed under the BSD-style license found in the
5+
# LICENSE file in the root directory of this source tree. An additional grant
6+
# of patent rights can be found in the PATENTS file in the same directory.
7+
8+
query queryName($foo: ComplexType, $site: Site = MOBILE) {
9+
whoever123is: node(id: [123, 456]) {
10+
id ,
11+
... on User @defer {
12+
field2 {
13+
id ,
14+
alias: field1(first:10, after:$foo,) @include(if: $foo) {
15+
id,
16+
...frag
17+
}
18+
}
19+
}
20+
... @skip(unless: $foo) {
21+
id
22+
}
23+
... {
24+
id
25+
}
26+
}
27+
}
28+
29+
mutation likeStory {
30+
like(story: 123) @defer {
31+
story {
32+
id
33+
}
34+
}
35+
}
36+
37+
subscription StoryLikeSubscription($input: StoryLikeSubscribeInput) {
38+
storyLikeSubscribe(input: $input) {
39+
story {
40+
likers {
41+
count
42+
}
43+
likeSentence {
44+
text
45+
}
46+
}
47+
}
48+
}
49+
50+
fragment frag on Friend {
51+
foo(size: $size, bar: $b, obj: {key: "value"})
52+
}
53+
54+
{
55+
unnamed(truthy: true, falsey: false),
56+
query
57+
}

samples/schema-kitchen-sink.graphql

+50
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
# Copyright (c) 2015, Facebook, Inc.
2+
# All rights reserved.
3+
#
4+
# This source code is licensed under the BSD-style license found in the
5+
# LICENSE file in the root directory of this source tree. An additional grant
6+
# of patent rights can be found in the PATENTS file in the same directory.
7+
8+
schema {
9+
query: QueryType
10+
mutation: MutationType
11+
}
12+
13+
type Foo implements Bar {
14+
one: Type
15+
two(argument: InputType!): Type
16+
three(argument: InputType, other: String): Int
17+
four(argument: String = "string"): String
18+
five(argument: [String] = ["string", "string"]): String
19+
six(argument: InputType = {key: "value"}): Type
20+
}
21+
22+
interface Bar {
23+
one: Type
24+
four(argument: String = "string"): String
25+
}
26+
27+
union Feed = Story | Article | Advert
28+
29+
scalar CustomScalar
30+
31+
enum Site {
32+
DESKTOP
33+
MOBILE
34+
}
35+
36+
input InputType {
37+
key: String!
38+
answer: Int = 42
39+
}
40+
41+
extend type Foo {
42+
seven(argument: [String]): Type
43+
}
44+
45+
directive @skip(if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT
46+
47+
directive @include(if: Boolean!)
48+
on FIELD
49+
| FRAGMENT_SPREAD
50+
| INLINE_FRAGMENT

0 commit comments

Comments
 (0)