Skip to content

Example of own resolvers for query / filter involving Union types #75

Open
@rgaiacs

Description

@rgaiacs

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions