Aligning one-to-many relationships between graphql schemas

Imagine we’ve got a one-to-many relationship:

type Project {
  tasks: [Task!]

type Task {
  dueDate: String!

When querying this relationship, the Fauna GQL docs show one must use data to access the relations’ data. For example:

query FindProject {
  getProjectByID(id: 804140812042) {
    tasks {
      data {

In server-side JS the response might provide the tasks data like so:

const tasks =;

Is there a recommendation for how to align this data structure, with the data property inserted, when using a similar Schema on the frontend (e.g. a React app calling an Apollo server)? An error like Expected Iterable, but did not find one for field "Project.tasks". is seen if one does not parse data returned by Fauna before it’s sent to the GraphQL server and onwards to the frontend.

Options I can think of include:

  • Somehow adding a data field to relevant object types in the frontend schema
  • Parsing responses from the Fauna GraphQL API to unnest/remove the data property before sending data to the frontend (seems dodgy!)
  • Just accepting there may be extra data properties throughout the code


I’m not entirely sure whether I understand the question and probably need more insights in what is blocking you. Are you using Apollo server in front of Fauna with a remote schema? I something blocking you from using the regular Fauna schema with Apollo. Or do you just want to get rid of the ‘data’ fields for convenience?

As far as I can see, you could unnest the data property from a convenience perspective but will need to make sure there are no conflicts.

Hi Brecht. The reason for my question is to “get rid of the ‘data’ fields for convenience” so the data returned by a GraphQL request to Fauna matches the Apollo Server schema, which doesn’t define data fields. As you note, this could be done manually so my question is whether there is a best practice for this scenario. From your response, I’m guessing there is not.

I’m responding here in case this info is useful to someone else but, frankly, I migrated my personal projects away from Fauna (for context, to Google Cloud SQL with ORMs/Prisma intermediary), so there is not an onus on you to respond and I’m not blocked by this. Thank you anyway.

Hi @sir-dunxalot, I am sorry to hear that Fauna did not work out for you. As information for you and for those passing by,

The GraphQL schema that you upload is not the schema that is actually served. Fauna transforms what you provide, including turning paginated relationships into Page types.

You can get a copy of the generated schema 2 ways:

Download from the playground

In the playground, you can click on schema, and then download.


Use introspection with your favorite means.

Introspection is discussed in general on Basically, you send a request a the server sends you a copy of the schema. Fauna’s implementation supports this.

You can query the Fauna GraphQL API however you want to get the inspection query, or use a multitude of tools out there. For example, graphql-tools has a convenient introspectSchema function to do this. (Remote schemas | GraphQL Tools)

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.