Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/jesstelford/keystone-polymorphism-example

Example of creating polymorphic results from a Keystone API by leveraging GraphQL Union types.
https://github.com/jesstelford/keystone-polymorphism-example

Last synced: 28 days ago
JSON representation

Example of creating polymorphic results from a Keystone API by leveraging GraphQL Union types.

Awesome Lists containing this project

README

        

# Polymorphic Keystone Queries

By default, Keystone does not support the ability to query in a polymorphic way. Ie; it cannot return an array of results which each element being of a different type.

GraphQL does provide the `Union` type however, so we can leverage that by extending our Keystone's GraphQL API.

Check out [`index.js`](./index.js) for the complete example.

![Example usage](./polymorphism.gif)