Is it valid for a GraphQL server to return an empty object (i.e. {}) as a field's value?
For example, given a GraphQL schema like
type Query {
person: Person
}
type Person {
name: String
}
and a query like
query {
person {
name
}
}
would it be spec-compliant to receive a response like
{
"data": {
"person": {}
}
}
?
Based on my understanding of how the October 2021 GraphQL spec defines value completion for Object types, this seems to not be a spec-compliant response since the query requested the subfield name but the response did not return null for either it or its parent fields. There's also a section under Execution which says "Each field requested in the grouped field set that is defined on the selected objectType will result in an entry in the response map.", which leads me to believe that each selected field (e.g. name in our example) must have an entry in the response object (e.g. "name": null in our example).
To me it seems there is still some ambiguity here. Maybe this is up to interpretation since the spec doesn't specify detailed JSON serialization requirements, but I'd appreciate any guidance on if I'm misinterpreting the spec or if there are other conventions I should consider. Thanks.
Note: I'm specifically asking about responses for Object types and not Interfaces or Unions (like this question).