Skip to content

Commit d06f813

Browse files
authored
Apply suggestions from code review
1 parent 6e23c01 commit d06f813

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

src/pages/learn/schema.mdx

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ Arguments can be either required or optional. When an argument is optional, we c
6767

6868
## The Query and Mutation types
6969

70-
There are two special "entry point" types that by default are named `Query` and `Mutation`. These types are the same as a regular object type, but they are special because they define the _entry point_ of every GraphQL query. So if you see a query that looks like:
70+
Every GraphQL schema must support `query` operations, the _entry point_ for these operations is a regular object type that by default is called `Query`. So if you see a query that looks like:
7171

7272
```graphql
7373
# { "graphiql": true }
@@ -90,10 +90,19 @@ type Query {
9090
}
9191
```
9292

93-
Mutations work in a similar way - you define fields on the `Mutation` type, and those are available as the root mutation fields you can call in your query.
93+
Schemas may also choose to support `mutation` operations by adding another entry point type, by default called `Mutation`. Mutations work in a similar way to queries - you define fields on the `Mutation` type, and those are available as the root mutation fields you can call in your mutation operation.
9494

9595
It's important to remember that other than the special status of being the entry points, the `Query` and `Mutation` types are the same as any other GraphQL object type, and their fields work exactly the same way.
9696

97+
You can choose to name your entry point types differently; if you choose to do so then you will need to inform GraphQL of the new names using the `schema` keyword:
98+
99+
```graphql
100+
schema {
101+
query: MyQueryType
102+
mutation: MyMutationType
103+
}
104+
```
105+
97106
## Scalar types
98107

99108
A GraphQL object type has a name and fields, but at some point those fields have to resolve to some concrete data. That's where the scalar types come in: they represent the leaves of the query.

0 commit comments

Comments
 (0)