mst-gql
mst-gql copied to clipboard
Support Multiple fields with type `ID`
right now we only expect a single ID field. However, in the case a user has more than one ID field on an object mst-gql will not know which one is the ID for the object.
This issue covers updating the config or similar to support letting mst-gql know which is the canonical ID for any model that has more than one ID.
We should provide a clear error during scaffold that we ran into this and give the users steps to fix it.
Something additional to consider: not all schemas use ID as the type for ID (Hasura, for example, could have a uuid as the ID type).
I'm confused, they use something other than ID in the graphQL schema? what is the logic behind this?
@mwarger oh, is that why I always get
Uncaught Error: Failed to resolve reference 43e8a390-9447-11ea-8ccb-19e3a3dddd88 to late(function () {
return _gartenModel__WEBPACK_IMPORTED_MODULE_11__["gartenModel"];
})
when trying to select fields in referenced tables?
My project uses hasura. And yes, id fields are declared as uuid!.
So far I thought I was still doing something wrong but after trying for hours I have still not succeeded to solve this issue.
I guess this will become a blocker for me soon.
related issue: https://github.com/mobxjs/mst-gql/issues/215. Well, actually, that on is about the field name, not type.
Actually there is an issue just about hasura not using type ID: https://github.com/mobxjs/mst-gql/issues/92
good point, I feel like we could fix both these issues with a single fix of optimally specifying an ID via config.
/cc @beepsoft
@chrisdrackett I am interested in implementing this if it's a feature we feel is still needed.
How do you feel about the proposal in this comment? https://github.com/mobxjs/mst-gql/issues/92#issue-493537797
@Metevier I'm all for this! We don't run into this ourselves, so I don't have a lot of ideas around the best way to handle it, but seems like a place where we can add some optional flexibility!