Code Monkey home page Code Monkey logo

Comments (11)

danivek avatar danivek commented on August 17, 2024

Hi,

Dynamic relationships are not currently possible. But I don't see any particular problems of implementing it.

from json-api-serializer.

jamesdixon avatar jamesdixon commented on August 17, 2024

@danivek thanks. I'll submit a PR for this as soon as I get some time. Cheers

from json-api-serializer.

jamesdixon avatar jamesdixon commented on August 17, 2024

@danivek oh wow, just saw that you had submitted a PR for this. Thanks!

from json-api-serializer.

danivek avatar danivek commented on August 17, 2024

@jamesdixon πŸ˜‰. Can you give it a try and give me a feedback ? Thanks

from json-api-serializer.

jamesdixon avatar jamesdixon commented on August 17, 2024

from json-api-serializer.

jamesdixon avatar jamesdixon commented on August 17, 2024

@danivek sorry for the delay on testing this!

Is it possible to allow the function access to the entire record? Unfortunately, the id doesn't give me enough information to set the type dynamically.

For example, my campaign record has a type field, which can be either staff or customer. That field is what I'd like to use in order to set the type property on the response.

Thanks!

from json-api-serializer.

jamesdixon avatar jamesdixon commented on August 17, 2024

@danivek wanted to see if you had any thoughts on the above? Thank you!

from json-api-serializer.

danivek avatar danivek commented on August 17, 2024

@jamesdixon you’re right ! I will change this to allow the entire record to be passed to the type resolver function.

Thank you for your feedback !

from json-api-serializer.

jamesdixon avatar jamesdixon commented on August 17, 2024

Thanks, @danivek! Much appreciated πŸ‘

from json-api-serializer.

danivek avatar danivek commented on August 17, 2024

Now the type resolver function has 2 arguments function(relationshipData, data) { ... }
Can you give it a try ?

Thanks @jamesdixon

from json-api-serializer.

jamesdixon avatar jamesdixon commented on August 17, 2024

works beautifully! thx @danivek

from json-api-serializer.

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.