Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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.
- Host: GitHub
- URL: https://github.com/jesstelford/keystone-polymorphism-example
- Owner: jesstelford
- Created: 2020-05-29T01:19:35.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2023-01-09T22:58:07.000Z (almost 2 years ago)
- Last Synced: 2024-06-11T17:37:04.444Z (7 months ago)
- Language: JavaScript
- Size: 7.59 MB
- Stars: 2
- Watchers: 3
- Forks: 2
- Open Issues: 25
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
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)