4. GRAPHQL UNION

If you want to return different types on different queries, you can use **union**.

```
union AgendaItem = StudyGroup | Workout
```

```
query schedule {
  agneda {
    ...on Workout {
      name
      reps
    }
    ...on StudyGroup {
      name
      subject
      students
    }
  }
}
```

```
...on Workout
```
is an inline fragment with the name "Workout"
you can also use named fragments (from previous post).

댓글

이 블로그의 인기 게시물

[Django 공식문서 번역] REST Framework - Viewset and Router

[Django REST Framework] create() vs perform_create()

Intel Open WebRTC Toolkit(OWT) Media server 설치하는법