From 2f1f0a9ab591d36762f715fa38bed87f59d090ac Mon Sep 17 00:00:00 2001 From: daedalus <44623501+ComfortablyCoding@users.noreply.github.com> Date: Tue, 2 Jun 2026 10:15:59 -0400 Subject: [PATCH] fix broken formatting --- .../guides/04.connect/3.query-parameters.md | 103 +++++++++--------- 1 file changed, 51 insertions(+), 52 deletions(-) diff --git a/content/guides/04.connect/3.query-parameters.md b/content/guides/04.connect/3.query-parameters.md index 4169ab9a..0b38a201 100644 --- a/content/guides/04.connect/3.query-parameters.md +++ b/content/guides/04.connect/3.query-parameters.md @@ -54,66 +54,65 @@ As Many to Any (M2A) fields have nested data from multiple collections, you are ::callout{icon="material-symbols:info-outline"} **Example** In an `posts` collection there is a Many to Any field called `sections` that points to `headings`, `paragraphs`, and `videos`. Different fields should be fetched from each related collection. +:: - ::code-group - ```http [REST] +::code-group +```http [REST] GET /items/posts ?fields[]=title &fields[]=sections.item:headings.title &fields[]=sections.item:headings.level &fields[]=sections.item:paragraphs.body &fields[]=sections.item:videos.source +``` -````` - -````graphql [GraphQL] - # Use can use native GraphQL Union types. - - query { - posts { - sections { - item { - ... on headings { - title - level - } - ... on paragraphs { - body - } - ... on videos { - source - } - } - } - } - } - ``` - - ```js [SDK] - import { createDirectus, rest, readItems } from '@directus/sdk'; - const directus = createDirectus('https://directus.example.com').with(rest()); - - const result = await directus.request( - readItems('posts', { - fields: [ - 'title', - { - sections: [ - { - item: { - headings: ['title', 'level'], - paragraphs: ['body'], - videos: ['source'], - } - } - ] - } - ], - }) - ); - ``` - :: +```graphql [GraphQL] +# Use can use native GraphQL Union types. + +query { + posts { + sections { + item { + ... on headings { + title + level + } + ... on paragraphs { + body + } + ... on videos { + source + } + } + } + } +} +``` + +```js [SDK] +import { createDirectus, rest, readItems } from "@directus/sdk"; +const directus = createDirectus("https://directus.example.com").with(rest()); + +const result = await directus.request( + readItems("posts", { + fields: [ + "title", + { + sections: [ + { + item: { + headings: ["title", "level"], + paragraphs: ["body"], + videos: ["source"], + }, + }, + ], + }, + ], + }), +); +``` :: @@ -131,7 +130,7 @@ GET /items/posts GET /items/posts ?filter={ "title": { "_eq": "Hello" }} -````` +``` ```graphql [GraphQL] query {