-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Mirage models and relationships #26
Comments
My first thought is that the issue is related to #18, as you mentioned. There are some related records in the tests but I think the add-on currently expects them to be associated in a certain way, which isn't very flexible. Here is an example: https://github.com/kloeckner-i/ember-cli-mirage-graphql/blob/master/tests/acceptance/customer-test.js#L11. Are you able to relate your records like this for the time being? |
@jneurock OK, looks like that example uses the customer and order factories to create a relationship, rather than Mirage |
I watched the same video guide. I’ve been trying to get @skarger Have you been able to get a I’m thinking of adding a default Scenario to the dummy app to see if it works in development. |
@dmzza no, but I haven't tried yet. |
If you'd like, feel free to fork and add a failing test, or add an example to the dummy app that doesn't work, so I can see where the addon is breaking down. |
After a lot of exploration, I found the most significant cause of the problem for me. I'm transitioning from ember-data to GraphQL, and I didn't want to delete my ember-data models yet. So Mirage was reading my models and that broke all of my To fix that, I added this to ENV['ember-cli-mirage'] = {
discoverEmberDataModels: false
}; Now I can keep all of my models so that my typescript still compiles while I make the transition from ember-data to GraphQL. However, I also found some inconsistent behavior with the way I construct my relationships using factories. I'm still investigating this, and if I can produce the same problem in the sample app, I might open a PR. |
Ah, very interesting. Thanks for the info. Feel free to open a PR. If you think something should be added to the README to help others with the same situation, feel free to add something there, too. |
This addon will be deprecated in favor of https://github.com/miragejs/graphql which does use Mirage models. |
I'm using the currently released
ember-cli-mirage-graphql
version,0.1.1
.This video guide about
ember-cli-mirage-graphql
uses Mirage factories, and so does this repo's dummy app.Mirage also provides the concepts of models and relationships. Specifically, you can define
belongsTo
andhasMany
relationships between models.I tried using Mirage models in my app, but when handling the GraphQL query it seemed to have trouble loading the related models. I'm not sure if I was lacking some necessary configuration or it's just not supported.
By the way, this may be tangentially related to #18.
The text was updated successfully, but these errors were encountered: