Skip to content

Commit d33793e

Browse files
authored
docs: update GraphQL docs for child fields (#28976)
This reverts commit 8687e2c
1 parent 39c0d00 commit d33793e

File tree

2 files changed

+2
-16
lines changed

2 files changed

+2
-16
lines changed

docs/docs/reference/graphql-data-layer/schema-customization.md

+1-15
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ The types passed in are used to determine child relations of the node.
224224

225225
#### Defining child relations
226226

227-
The `@childOf` extension can be used to explicitly define what node types or media types a node is a child of and immediately add `child[MyType]` or `children[MyType]` as a field on the parent.
227+
The `@childOf` extension can be used to explicitly define what node types or media types a node is a child of and immediately add `child[MyType]` and `children[MyType]` fields on the parent.
228228

229229
The `types` argument takes an array of strings and determines what node types the node is a child of:
230230

@@ -255,20 +255,6 @@ type Mdx implements Node
255255
}
256256
```
257257

258-
If `many: true` is set, then instead of creating a single child field on the parent, it will create multiple:
259-
260-
```graphql
261-
# Adds `childMdx1` with type `Mdx1` to `File`.
262-
type Mdx1 implements Node @childOf(types: ["File"]) {
263-
id: ID!
264-
}
265-
266-
# Adds `childrenMdx2` with type `[Mdx2]` as a field of `File`.
267-
type Mdx2 implements Node @childOf(types: ["File"], many: true) {
268-
id: ID!
269-
}
270-
```
271-
272258
#### Nested types
273259

274260
So far, the example project has only been dealing with scalar values (`String` and `Date`;

docs/docs/schema-generation.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ This allows adding GraphQL Fields to any node type. This operates on GraphQL typ
3838

3939
## 4. Parent / children relationships
4040

41-
Nodes can be connected into _child-parent_ relationships either by using [`createParentChildLink`](/docs/reference/config-files/actions/#createParentChildLink) or by adding the `parent` field to raw node data. Child types can always access parent with the `parent` field in GraphQL. Parent types also get `children` fields as well as "convenience child fields" `child[TypeName]` or `children[TypeName]`.
41+
Nodes can be connected into _child-parent_ relationships either by using [`createParentChildLink`](/docs/reference/config-files/actions/#createParentChildLink) or by adding the `parent` field to raw node data. Child types can always access parent with the `parent` field in GraphQL. Parent types also get `children` fields as well as "convenience child fields" `child[TypeName]` and `children[TypeName]`.
4242

4343
Children types are either inferred from data or created using `@childOf` directive, either by parent type name or by `mimeType` (only for File parent types).
4444

0 commit comments

Comments
 (0)