Mutation Documentation Does Not Adequately Cover Ref Types

There is a single example in the graphql mutation documentation section that covers the usage of ref types, and it appears to be wrong. This is in addition to the generated mutations and their associated types not being covered in any detail whatsoever.

Questions this has caused that I haven’t been able to figure out the answers to after several hours of whacking at it:

  • Why are non-id fields required to create a reference to an item?
  • Why does submitting a reference to an object with an id create an item with that id, such that using upsert to add actual data to that item is required?
  • What are the actual definitions of the ref types?

Thank you.

Are you referring to this page:

That is not the case. Do you mind sharing your schema snippets? The only fields that should be required on a ref are any fields that have the @id directive.

First we have to correctly understand what you mean by id, do you mean a field with the type ID (equivalent to a Dgraph uid) or do you mean fields with @id directive? Yes, they behave differently.

Not sure what you are asking for? Like what is the generated type definitions? If so, then you can inspect your GraphQL endpoint and see the type definitions.