Skip to content
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

fix(docs): schema -> code fences, code fix #26462

Merged
merged 7 commits into from
Aug 31, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions docs/docs/schema-generation.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,9 @@ See [Schema Root Fields and Utility Types](/docs/schema-root-fields) for a more

For each type, utility types are created. Those are input object types, used for searching, sorting and filtering, and types for paginated data (Connections and Edges).

For searching and sorting, Gatsby goes through every field in the type and converts them to corresponding Input GraphQL types. Scalars are converted to objects with filter operator fields like "eq" or "ni". Object types are converted to Input Object types. For sorting, enums are created out of all fields so that one can use that to specify the sort.
For searching and sorting, Gatsby goes through every field in the type and converts them to corresponding Input GraphQL types. Scalars are converted to objects with filter operator fields like `eq` or `ni`. Object types are converted to Input Object types. For sorting, enums are created out of all fields so that one can use that to specify the sort.

Those types are used to create _root fields_ of the schema in `Query` type. For each node type a root field for querying one item and paginated items are created (for example, for type BlogPost it would be `blogPost` and `allBlogPost`).
Those types are used to create _root fields_ of the schema in `Query` type. For each node type a root field for querying one item and paginated items are created (for example, for type `BlogPost` it would be `blogPost` and `allBlogPost`).

## 6. Merging in third-party schemas

Expand All @@ -60,8 +60,8 @@ If a plugin like `gatsby-source-graphql` is used, all third-party schemas that i

[`createResolvers`](/docs/schema-customization/#createresolvers-api) API is called, allowing users to add additional customization on top of created schema. This is an "escape hatch" API, as it allows to modify any fields or types in the Schema, including Query type.

## 8. Second schema build for SitePage
## 8. Second schema build for `SitePage`

Because SitePage nodes are created after a schema is first created (at `createPages`) API call, the type of the `SitePage.context` field can change based on which context was passed to pages. Therefore, an additional schema inference pass happens and then the schema is updated.
Because `SitePage` nodes are created after a schema is first created (at `createPages`) API call, the type of the `SitePage.context` field can change based on which context was passed to pages. Therefore, an additional schema inference pass happens and then the schema is updated.

Note that this behavior will be removed in Gatsby v3 and context will become a list of key/value pairs in GraphQL.
7 changes: 5 additions & 2 deletions docs/docs/schema-root-fields.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,10 @@ Plural fields accept four arguments - `filter`, `sort`, `skip` and `limit`. `fil

```graphql
{
allBlogPost(filter: { date: { lt: "2020-01-01" }}, sort: {fields: [date], order: ASC) {
allBlogPost(
filter: { date: { lt: "2020-01-01" } }
sort: { fields: [date], order: ASC }
) {
nodes {
id
}
Expand Down Expand Up @@ -48,7 +51,7 @@ Gatsby uses a common pattern in GraphQL called [Connections](https://relay.dev/g
- `pageInfo.totalCount` - (also available as `totalCount` number of all nodes that match the filter, before pagination
- `pageInfo.currentPage` - index of the current page (based on 1)
- `pageInfo.hasNextPage`, `pageInfo.hasPreviousPage` - whether there is a next or previous page based on current pagination
- `pageInfoitemCount` - number of items on current page
- `pageInfo.itemCount` - number of items on current page
- `perPage` - requested number of items on each page
- `pageCount` - total number of pages
- `distinct(field)` - print distinct values for given field
Expand Down