Skip to content

Commit 5c5d80a

Browse files
committed
Merge pull request #66 from facebook/readmeupdates
Improve README explanation of Query type Based on feedback and explanations in https://keywordbrain.com/blog/understanding-graphql-server/
2 parents b1cfe12 + 424bdcd commit 5c5d80a

File tree

1 file changed

+18
-9
lines changed

1 file changed

+18
-9
lines changed

README.md

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -214,8 +214,12 @@ type Droid : Character {
214214
}
215215
```
216216

217-
We're missing one last piece: an entry point into the type system. So we'll
218-
define one more type that allows us to get to these objects:
217+
We're missing one last piece: an entry point into the type system.
218+
219+
When we define a schema, we define an object type that is the basis for all
220+
queries. The name of this type is `Query` by convention, and it describes
221+
our public, top-level API. Our `Query` type for this example will look like
222+
this:
219223

220224
```
221225
type Query {
@@ -225,13 +229,18 @@ type Query {
225229
}
226230
```
227231

228-
This type will be the entry point for the queries described below; it has
229-
two fields. `hero` returns the `Character` who is the hero of the
230-
Star Wars trilogy; it takes an optional parameter that allows us to fetch the
231-
hero of a specific episode instead. `human` has a new feature in the type
232-
system, a query argument. This field accepts a non-null string as a query
233-
argument, a human's ID, and returns the human with that ID; `droid` does the
234-
same for droids.
232+
In this example, there are three top-level operations
233+
that can be done on our schema:
234+
235+
- `hero` returns the `Character` who is the hero of the Star Wars trilogy; it
236+
takes an optional argument that allows us to fetch the hero of a specific
237+
episode instead.
238+
- `human` accepts a non-null string as a query argument, a human's ID, and
239+
returns the human with that ID.
240+
- `droid` does the same for droids.
241+
242+
These fields demonstrate another feature of the type system, the ability
243+
for a field to specify arguments that configure their behavior.
235244

236245
When we package the whole type system together, defining the `Query` type
237246
above as our entry point for queries, this creates a GraphQL Schema.

0 commit comments

Comments
 (0)