Skip to content

Commit 66cc599

Browse files
mandiwisebenjie
andauthored
Apply first round of suggestions from code review.
Co-authored-by: Benjie <[email protected]>
1 parent e79de64 commit 66cc599

File tree

1 file changed

+10
-9
lines changed

1 file changed

+10
-9
lines changed

src/pages/learn/schema.mdx

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ type Query {
9696

9797
Schemas may also support `mutation` and `subscription` operations by adding additional `Mutation` and `Subscription` types and then defining fields on the corresponding root operation types.
9898

99-
It's important to remember that apart from the special status of being entry points into the schema, the `Query`, `Mutation`, and `Subscription` types are the same as any other GraphQL Object type, and their fields work exactly the same way.
99+
It's important to remember that other than the special status of being entry points into the schema, the `Query`, `Mutation`, and `Subscription` types are the same as any other GraphQL Object type, and their fields work exactly the same way.
100100

101101
You can name your root operation types differently too; if you choose to do so then you will need to inform GraphQL of the new names using the `schema` keyword:
102102

@@ -132,7 +132,7 @@ GraphQL comes with a set of [default Scalar types](https://spec.graphql.org/draf
132132
- `Float`: A signed double-precision floating-point value.
133133
- `String`: A UTF‐8 character sequence.
134134
- `Boolean`: `true` or `false`.
135-
- `ID`: This type represents a unique identifier, often used to refetch an object or as the key for a cache. The `ID` type is serialized in the same way as a `String`; however, defining it as an `ID` signifies that it is not intended to be human‐readable.
135+
- `ID`: A unique identifier, often used to refetch an object or as the key for a cache. The `ID` type is serialized in the same way as a `String`; however, defining it as an `ID` signifies that it is not intended to be human‐readable.
136136

137137
In most GraphQL service implementations, there is also a way to specify custom Scalar types. For example, we could define a `Date` type:
138138

@@ -192,7 +192,7 @@ As we saw in an example above, the Non-Null type modifier can also be used when
192192
}
193193
```
194194

195-
### Lists
195+
### List
196196

197197
Lists work in a similar way. We can use a type modifier to mark a type as a List type, which indicates that this field will return an array of that type. In SDL, this is denoted by wrapping the type in square brackets, `[` and `]`. It works the same for arguments, where the validation step will expect an array for that value. Here's an example:
198198

@@ -341,7 +341,7 @@ Note that Interface types may not implement themselves or contain any cyclic ref
341341

342342
## Union types
343343

344-
GraphQL supports a second abstract type called a [Union type](https://spec.graphql.org/draft/#sec-Unions). They share similarities with Interface types, but they cannot define any shared fields among the constituent types.
344+
GraphQL supports a second abstract type called a [Union type](https://spec.graphql.org/draft/#sec-Unions). Union types share similarities with Interface types, but they cannot define any shared fields among the constituent types.
345345

346346
A Union type is defined by indicating its member Object types:
347347

@@ -374,7 +374,7 @@ In this case, if you query a field that returns the `SearchResult` Union type, y
374374
}
375375
```
376376

377-
The `__typename` field is a special _meta-field_ that resolves to a `String` and lets you differentiate between data types on the client.
377+
The `__typename` field is a special _meta-field_ that automatically exists on every Object type and resolves to the name of that type, providing a way to differentiate between data types on the client.
378378

379379
Also, in this case, since `Human` and `Droid` share a common interface (`Character`), you can query their common fields in one place and still get the same result:
380380

@@ -406,9 +406,9 @@ Note that `name` is still specified on `Starship` because otherwise it wouldn't
406406

407407
Most of the examples we've covered on this page demonstrate how Object, Scalar, Enum, Interface, and Union types may be used as _output types_ for the fields in a schema. But we have also seen that field arguments must specify their _input types_.
408408

409-
So far, we've only talked about using scalar values (like Enums or String types) as an input type for a field argument. However, you can also easily pass complex objects as arguments using an [Input Object type](https://spec.graphql.org/draft/#sec-Input-Objects), which is the last of named types in GraphQL that we'll explore.
409+
So far, we've only talked about using scalar values (like Enums or String types) as an input type for a field argument. However, you can also pass complex objects as arguments using an [Input Object type](https://spec.graphql.org/draft/#sec-Input-Objects), which is the last kind of named types in GraphQL that we'll explore.
410410

411-
This is particularly valuable in the case of [mutations](/learn/queries/#mutations), where you might want to pass in a whole object to be created. In SDL, Input Object types look the same as regular Object types, but with the keyword `input` instead of `type`:
411+
This is particularly valuable in the case of [mutations](/learn/queries/#mutations), where you might want to pass in a whole object to be created. In SDL, Input Object types look similar to regular Object types, but with the keyword `input` instead of `type`:
412412

413413
```graphql
414414
input ReviewInput {
@@ -516,6 +516,7 @@ type Query {
516516
```
517517

518518
In addition to making a GraphQL API schema more expressive, descriptions are helpful to client developers because they are available in [introspection queries](/learn/introspection/) and visible in developer tools such as [GraphiQL](https://github.com/graphql/graphiql).
519+
519520
### Comments
520521

521522
Occasionally, you may need to add comments in a schema that do not describe types, fields, or arguments, and are not meant to be seen by clients. In those cases, you can add a single-line comment to SDL by preceding the text with a `#` character:
@@ -550,9 +551,9 @@ To recap what we've learned about schemas and types:
550551
- There are six kinds of named type definitions in GraphQL: Object, Scalar, Enum, Interface, Union, and Input Object types
551552
- Object types contain fields that specify output types, and those fields may have arguments that specify input types
552553
- The `Int``Float``String``Boolean`, and `ID` Scalar types are built into GraphQL, and you can also define your own custom scalars
553-
- Like Scalar types, Enum types represent leaf values in a GraphQL schema but they are limited to a finite list of values
554+
- Like Scalar types, Enum types represent leaf values in a GraphQL schema but they are limited to a finite set of values
554555
- Interface and Union types are abstract types that allow different concrete Object types to be output from a single field
555-
- Input Object types allow you to pass more complex values into a field argument than Scalar and Enum types allow
556+
- Input Object types allow you to pass more complex values into a field argument or directive argument than Scalar and Enum types allow
556557
- Type system directives can be applied to the types, fields, and arguments in a schema to alter how they are validated and executed during a query
557558
- GraphQL supports schema documentation using type, field, and argument descriptions, and it also supports comments that are ignored by the parser
558559

0 commit comments

Comments
 (0)