You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I spent a few hours to figure out how to write my own resolver for query / filter involving Union types.
The solution that works for me was something like
let foos = context.mirageSchema.all('foo').models;
for (let foo of foos) {
foo.__typename = 'Foo';
}
let bars = context.mirageSchema.all('bar').models;
for (let bar of bars) {
bar.__typename = 'Bar';
}
return [].concat(foos, bars);
Did I miss something in the documentation?
Should I send a pull request adding this use case to the list of examples?
The text was updated successfully, but these errors were encountered:
I’m glad you found a solution and I think it’s so nice that you’ve offered to add an example!
I have 2 thoughts:
There aren’t actually any docs; just the README, which is very limited (on purpose). I’d like to publish some real documentation, and an example like yours would be perfect for that. It’s on my TODO list (maybe I should publish something sooner rather than later).
Your approach doesn’t take advantage of one of the functions built into the library, and I’d prefer to expose the documentation for that function instead since it’s designed to make this easier.
I spent a few hours to figure out how to write my own resolver for query / filter involving Union types.
The solution that works for me was something like
Did I miss something in the documentation?
Should I send a pull request adding this use case to the list of examples?
The text was updated successfully, but these errors were encountered: