Store manual IDs for a field


#1

Is it possible to have an id field provided (generated) manually for a given type, rather than having values be auto-generated?

I’ve searched, and from what I’ve seen this doesn’t seem to be possible, but I haven’t found anything definitive.


#2

Currently it is not possible to provide your own ids. We are exploring two different approaches that would open up new use cases:

  1. Allow setting the id when creating a node. This would also allow you to implement id-generation logic in a serverless function.

  2. Keep existing auto-generated ids, but make it easier to work with a separate customId field in places where we currently offer shortcuts for the primary id - for example creating relations in nested mutations.

Which one is more compelling to you?


#3

1 would be what I’d hope for, assuming I can generate the ID however I want, and just pass it over to the GraphQL mutation.


#4

I agree that, if it is possible, enabling the actual ID to be generated by the client would be the preferable approach.


#5

Just wanted to point out that this is already a documented feature request: https://github.com/graphcool/graphcool/issues/365


#6

It’d make optimistic ui easier too.