diff --git a/docs/content/reference/field-collection.md b/docs/content/reference/field-collection.md index 0a065256a22..c6cd8ba9952 100644 --- a/docs/content/reference/field-collection.md +++ b/docs/content/reference/field-collection.md @@ -61,19 +61,21 @@ The type `Circle` would satisfy `Circle`, `Shape`, and `Shapes` — these values Say we have the following GraphQL query ```graphql -flowBlocks { - id - block{ - id - title - type - choices{ - id - title - description - slug - } - } +query { + flowBlocks { + id + block { + id + title + type + choices { + id + title + description + slug + } + } + } } ``` @@ -83,19 +85,17 @@ Here is an example which get's all requested field as convenient string slice, w ```golang func GetPreloads(ctx context.Context) []string { return GetNestedPreloads( - graphql.GetRequestContext(ctx), + graphql.GetOperationContext(ctx), graphql.CollectFieldsCtx(ctx, nil), "", ) } -func GetNestedPreloads(ctx *graphql.RequestContext, fields []graphql.CollectedField, prefix string) (preloads []string) { +func GetNestedPreloads(ctx *graphql.OperationContext, fields []graphql.CollectedField, prefix string) (preloads []string) { for _, column := range fields { prefixColumn := GetPreloadString(prefix, column.Name) preloads = append(preloads, prefixColumn) - preloads = append(preloads, GetNestedPreloads(ctx, graphql.CollectFields(ctx, column.SelectionSet, nil), prefixColumn)...) preloads = append(preloads, GetNestedPreloads(ctx, graphql.CollectFields(ctx, column.Selections, nil), prefixColumn)...) - } return }