Standardize use of IDs in GraphQL
Everyone can contribute. Help move this issue forward while earning points, leveling up and collecting rewards.
Whenever we use id within GraphQL we treat it as a Global ID.
It's encourage use of global IDs but we have some exceptions:
When exposing a model that had an internal ID (iid), prefer using that in combination with the namespace path as arguments in a resolver over a database ID. Otherwise use a globally unique ID. (https://docs.gitlab.com/ee/development/api_graphql_styleguide.html#resolvers)
This can end up with situations where an iid is exposed in one query, but a Global ID is required for another call (or vice-versa).
An example of this is:
- project.issues returns an
iid& does not return anid. -
addAwardEmojiexpects a global ID as an argument (because some Issuable items don't haveiids I beleive)
In this case you're left with an inconsistent API experience.
Can we improve on this somehow?
Ideas:
- Make
idmandatory for types that contain an ID. - Use
iidin conjunction with project path to generate theid, if available. i.e rather thangid://app/Issue/201111you might havegid://gitlab-org/gitlab/Issue/10. This way may be useidfor everything, without exposing internal IDs for objects that don't need to.