Comments (10)
Thanks for getting back to me.
-
I'll make all the changes so my Mirage stuff isn't using ES6 classes. Make double sure that's not causing me any grief.
-
The assignedTo, location, and seenBy are all belongsTo relationships to the same model called "place". From what I can tell I've mimicked how I handled another model with a belongsTo to the same model.
Once I make the ES6 class corrections I'll let you know if that test does anything.
from discuss.
First I would not use ES6 classes because Mirage isn't designed to work with them yet.
Second, just to clarify what are you expecting assignedTo
to be in the screenshot?
from discuss.
Just switched my Mirage Serializers to not use ES6 classes. Get the same results as before unfortunately.
from discuss.
@Subaku Sorry you're still having trouble.
Could you write out the exact JSON you're expecting to be returned from GET /api/v1/asset-location/?location=3
?
from discuss.
Even better would be to share a reproduction of the issues – that's usually the fastest way to get help!
from discuss.
Here's a repo with a slimmed down version of my app that should replicate my issue.
https://github.com/Subaku/mirage-issue.git
I ultimately suspect I've just neglected to declare or configure something...
Thanks for your help!
from discuss.
So sorry for the delay! Busy holiday season.
Looks like you're just requesting all asset-location-summary
models, and those only have one association, location
, which is a Place
model. Place
only has 5 attrs, all of which are included.
So if you want the rest of the data you'll need to change your query. What data are you trying to get?
from discuss.
No worries. Hope your holiday was good :)
I was attempting to get all related fields back as embedded records. In my screenshots above both location and assignedTo are related to the Place model but are different Place records. I was expecting both to be included in the response given the configuration I had set on the Mirage AssetLocationSerializer. The embed
and include
to be precise. Given how my APIs function I may just be misunderstanding how things function here.
from discuss.
In your demo app the URL requested is for all asset-location-summary
models. And I think Mirage is returning the whole graph, which just consists of asset-location-summary
and the associated location
.
Are you saying if you were to request asset-location
model it's not including the other related models? If so could you update the app with the request you're having trouble mocking?
from discuss.
FYI: Transferred this to our Discuss repo, our new home for more open-ended conversations about Mirage!
If things become more concrete + actionable we can create a tracking issue in the main repo.
from discuss.
Related Issues (20)
- Add Middleware support to Mirage HOT 1
- Custom exception post-processing HOT 2
- Support multiple server instance. HOT 5
- Tracking issue for routing DSL / passthrough / namespace improvements
- Model hooks / default attributes HOT 5
- Passthrough external requests with wildcard HOT 4
- hasMany to hasMany (manyToMany) fixture associations not created HOT 1
- nativescript-vue with miragejs HOT 1
- Question: Expose mocked API as standalone on a specific port? HOT 3
- Be able to mock websocket calls HOT 2
- More array functions for models / collections HOT 8
- cannot use trait with afterCreate HOT 8
- routes for related resources HOT 2
- [Suggestion] Automatically parse request body based on content type HOT 2
- Feature Request: Generate API docs from test runs HOT 3
- How to only intercept request that defined in routes HOT 2
- server.createList() and server.create() creates duplicate values with dynamic factory definition
- Is it possible to use a combination of mock API's and actual API calls ? HOT 1
- Using a nested primary id for update and deletes
- Adding context object to handler to mock auth
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from discuss.