by sbr464 · 7y ago · 0 comments
It’s interesting how GraphQL changes the base point of the article concerning documentation/ease of api use.
In our GraphQL resolvers we typically add two fields, thing_id which resolves to the id string, and thing which resolves an object that you can drill into as desired.
I was starting to see a lot of GraphQL APIs only add “thing”, which meant you had to do a lot of queries like below just to get the id.
thing { id }Node Interface
The server must provide an interface called Node. That interface must include exactly one field, called id that returns a non‐null ID.
This id should be a globally unique identifier for this object, and given just this id, the server should be able to refetch the object.
https://facebook.github.io/relay/graphql/objectidentificatio...
So tonight we're going to regex like it's 1999.
I feel using urls as ids create more problems than it solves, especially if you use absolute urls. I have worked with cases where the same ID was used in 3 or 4 different APIs. None of them clearly the master.