Open jneurock opened 3 years ago
@jneurock it really makes sense I think the @miragejs/graphql
should work as graphQL server works out of the box without need for any resolver or custom functions for that.
I'm planning to make this filtering functionality opt-in for version 0.2.0
To maintain compatibility with the design of
ember-cli-mirage-graphql
(the Ember-specific library that came before this), Mirage GraphQL automatically filters records by variables when auto-resolving. I think this behavior is probably surprising to most and I'm not sure if it's actually useful.Example of the behavior being useful:
The query is called with a $size variable having the value "XL" and only records that match are returned from Mirage's database.
Example of the behavior being painful (forcing a query to be manually resolved):
The query is called with a $limit variable having the value 10 and Mirage GraphQL tries to auto-resolve this by filtering for products having a "limit" field with a value of 10. Since "limit" isn't a field, no records are returned.
I'd like to gather some feedback on whether or not to change this behavior and make it off-by-default. I could add a handler creation option to enable this for anyone who does find this behavior useful.