Skip to content

Avoid returning partial results if required fields cannot be resolved #100

@jbreeden-sfx

Description

@jbreeden-sfx

This is a trimmed down copy-pasta of a comment from #99:

We're currently returning partial results for federated objects whose required fields cannot be resolved.

If you have this (psuedo-code) schema in service 1:

type Query {
  getParents() [Parent]!
}

type Parent {
  id: ID!
  child: Child!
}

type Child implements Node {
  id: ID!
}

and this in service 2:

type Child implements Node {
  id: ID!
  name: String!
}

And run this query:

{
  getParents {
    child {
      id
      name
    }
  }
}

You may get Child objects with an id but no name, if there was an error in service 2, even though it's a required field.

This seems like it breaks the schema agreement to me. The service is now returning an object without some of the required fields. I think in those failure cases we may need to bubble up the null value to the parent, and so on, until we reach a nullable parent. That would keep to the GQL spec.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions