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

Inline fragments

GraphQL's permits polymorphism through inline fragments, through objects being available as GraphQL Unions and Interfaces. Eduflow uses inline fragments across the various activity object types.

Eduflow activities all have Activity.title, so all activities inherit from ActivityInterface.

Querying

{
  course(id: "00000000-5945-95c7-65fc-a9747b200320") {
    flows {
      activities {
        ... on ActivityInterface {
          title
        }
      }
    }
  }
}
{
  "data": {
    "course": {
      "flows": [
        {
          "activities": [
            {
              "title": "Welcome to the root-level Activity"
            }
          ]
        },
        {
          "activities": [
            {
              "title": "Learn about paper"
            },
            {
              "title": "Environmental friendliness"
            },
            {
              "title": "Climate change"
            }
          ]
        },
        {
          "activities": [
            {
              "title": "Introduction to sales"
            },
            {
              "title": "CRM technology"
            },
            {
              "title": "Funnel configuration"
            }
          ]
        }
      ]
    }
  }
}

Inline fragments

Using specific activity fragments act as a way to upcast objects. Here's an example of PeerReview ran against the connection above, and via direct activity lookup.

{
  course(id: "00000000-5945-95c6-65fc-a9747b200320") {
    flows {
      activities {
        __typename
        ... on ActivityInterface {
          title
        }
        ... on PeerReviewActivity {
          reviews {
            edges {
              node {
                reviewType
                createdAt
              }
            }
          }
        }
      }
    }
  }
}

Notice the specialized fields only return for the activity type that are PeerReviews:

title exists in PeerReviewActivity as well, no need to use ActivityInterface:

title exists on PeerReviewActivity, as it inherits from ActivityInterface

See also

Last updated