Code Monkey home page Code Monkey logo

Comments (10)

Subaku avatar Subaku commented on May 27, 2024 1

Thanks for getting back to me.

  1. 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.

  2. 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.

samselikoff avatar samselikoff commented on May 27, 2024

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.

Subaku avatar Subaku commented on May 27, 2024

Just switched my Mirage Serializers to not use ES6 classes. Get the same results as before unfortunately.

from discuss.

samselikoff avatar samselikoff commented on May 27, 2024

@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.

samselikoff avatar samselikoff commented on May 27, 2024

Even better would be to share a reproduction of the issues – that's usually the fastest way to get help!

from discuss.

Subaku avatar Subaku commented on May 27, 2024

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.

samselikoff avatar samselikoff commented on May 27, 2024

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.

Subaku avatar Subaku commented on May 27, 2024

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.

samselikoff avatar samselikoff commented on May 27, 2024

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.

samselikoff avatar samselikoff commented on May 27, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.