I am assuming this should be under graphql?
Because if you know the id field, it would be an update, not an add - upsert. There is no getPost by @id, and there is no addPost-upsert by ID.
This also has to do with the fact that you can add multiple fields at once, but you can only edit one field at a time. The backend code would have to differentiate between what is a new Post, and what is an update Post. Is there a unique ID or @id? etc…
While this makes sense, I agree that it would be much easier to have one update function that allows you to create, or modify nodes and would automatically match the existing nodes that have an @id or an ID field input.
A lot of the problems Dgraph has not yet solved have already been solved by SQL databases. In this case, we should add an AUTO_INCREMENT @directive.
id: Int! @auto_increment(start: 565)
If you needed to change the start value, just change it in the schema.
Just a thought.
Update: So the start would not work here as every time you update the schema, you would have to think about the start number. However, there could be an internal variable you could set somewhere in dgraph, a globals section maybe, that stores that number to change it.