Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
jbreeden-sfx opened this issue Mar 27, 2020 · 0 comments
Open

Comments

@jbreeden-sfx
Copy link
Contributor

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant