Skip to Content

The _join field

Published: 2022-05-24

When using WunderGraph, you might notice that there's a _join field added to all Object Types in your generated GraphQL Schemas. The _join field is a special field that allows you to embed Queries into the response of another Operation. This way, you can "join" multiple heterogeneous APIs into a single response without adding custom resolvers.

Let's look at an example to illustrate this:

query ($code: ID! $capital: String! @internal) {
# Get the country with the given code
country: countries_country(code: $code){
capital @export(as: "capital")
# "join" a new Query to the returned country to fetch the weather
weather: _join {
weather_getCityByName(name: $capital){
weather {
summary {
temperature {

First, we fetch the country with the given code. Then, we "join" a new Query to the returned country to fetch the weather.

If you look closer, you will notice that the _join simply returns a new Query Type. This way, we're able to make a second embedded Query.

You also see some more concepts in this example, namely the @export and @internal directives. If you want to learn more about them, head over to the reference section on Directives.



Subscribe to our newsletter!

Stay informed when great things happen! Get the latest news about APIs, GraphQL and more straight into your mailbox.

© 2022 WunderGraph