For the complete documentation index, see llms.txt. This page is also available as Markdown.

Fragments

Reuse fields for the same object type

You can also reuse chunks of your queries with GraphQL fragments:

fragment ReuseableFragment on Course {
  id
  title
  flows {
    title
  }
}

{
  course(id: "00000000-5945-95c7-65fc-a9747b20031d") {
    ...ReuseableFragment
  }
  anotherCourse: course(id: "00000000-5945-95c6-65fc-a9747b200320") {
    ...ReuseableFragment
  }
}
{
  course(id: "00000000-5945-95c7-65fc-a9747b20031d") {
    id
    title
    flows {
      title
    }
  }
  anotherCourse: course(id: "00000000-5945-95c6-65fc-a9747b200320") {
    id
    title
    flows {
      title
    }
  }
}

Another thing to point out: anotherCourse is a GraphQL alias. This is a way to make multiple queries to the same field (query.course)

Last updated

Was this helpful?