-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Make "Schemas and Types" page more approachable to newcomers #1794
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -67,16 +67,7 @@ Arguments can be either required or optional. When an argument is optional, we c | |||||||||||||||||||||||
|
||||||||||||||||||||||||
## The Query and Mutation types | ||||||||||||||||||||||||
|
||||||||||||||||||||||||
Most types in your schema will just be normal object types, but there are two types that are special within a schema: | ||||||||||||||||||||||||
|
||||||||||||||||||||||||
```graphql | ||||||||||||||||||||||||
schema { | ||||||||||||||||||||||||
query: Query | ||||||||||||||||||||||||
mutation: Mutation | ||||||||||||||||||||||||
} | ||||||||||||||||||||||||
``` | ||||||||||||||||||||||||
|
||||||||||||||||||||||||
Every GraphQL service has a `query` type and may or may not have a `mutation` type. 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: | ||||||||||||||||||||||||
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: | ||||||||||||||||||||||||
|
||||||||||||||||||||||||
```graphql | ||||||||||||||||||||||||
# { "graphiql": true } | ||||||||||||||||||||||||
|
@@ -101,7 +92,7 @@ type Query { | |||||||||||||||||||||||
|
||||||||||||||||||||||||
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. | ||||||||||||||||||||||||
benjie marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||||||||||||||||||||||||
|
||||||||||||||||||||||||
It's important to remember that other than the special status of being the "entry point" into the schema, the `Query` and `Mutation` types are the same as any other GraphQL object type, and their fields work exactly the same way. | ||||||||||||||||||||||||
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. | ||||||||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
I see what you mean; it's introduced a little to early. But since we talk about naming things by default maybe it's best to reintroduce the
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What percent of users would you estimate rename their entry points? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hard to say; but our very own |
||||||||||||||||||||||||
|
||||||||||||||||||||||||
## Scalar types | ||||||||||||||||||||||||
|
||||||||||||||||||||||||
|
Uh oh!
There was an error while loading. Please reload this page.