GithubHelp home page GithubHelp logo

Comments (11)

myabc avatar myabc commented on July 20, 2024

From @franzliedke on December 16, 2015 13:45

In addition, when no link is defined for a relationship, the :relationships key will still contain an element called :links, which is set to nil - it simply shouldn't exist. I was trying to fix this issue, when I encountered the behavior that I reported above.

from roar-jsonapi.

myabc avatar myabc commented on July 20, 2024

From @apotonick on December 17, 2015 0:2

I am seriously thinking about roar-jsonapi as a separate gem, because I personally do not want to support this convoluted format. I have worked on it for several months now and I still don't understand all it's implicit conditions, which is not appreciated and which is definitely not a good sign for a simple, easy-to-understand media format.

from roar-jsonapi.

myabc avatar myabc commented on July 20, 2024

From @apotonick on December 17, 2015 0:8

Links in has_one will be rendered in both "sections" (I don't even know the name for all their 523145 different fragment types). We either have to provide an option to say "this link is only meant for relationships or for the included thing".

Or two different property methods to indicate whether you're declaring a included or a relationship fragment.

As for the nil problem, can you please add a test?

from roar-jsonapi.

myabc avatar myabc commented on July 20, 2024

From @dvogel on December 17, 2015 2:23

I'm dealing with a very similar ambiguity. I need to be able to declare a relationship from resource A to B without the JSONAPI body for resource type A from including the represented form of resource B in the serialized relationships object. I want the much simpler:

{
  "data": {
    "relationships": {
      "Bs": {
        "links": {
          "related": "scheme://host/As/.../Bs"
        }
      }
    }
    "type": "A",
    "attributes": { ... },
  }
}

Changing Document#render_relationships to omit items if they lack type and/or id achieves my goal for the output. However, I would like to avoid having the underlying accessor method called at all because in some cases the accessor is expensive to call (fetches remote data).

from roar-jsonapi.

myabc avatar myabc commented on July 20, 2024

From @apotonick on December 17, 2015 2:46

@dvogel This is all easily solvable by maintaining two different representer implementation for the two different fragments. Internally, this is how it's implemented already, so we just have to come up with a sensitive API/DSL to tell Roar that.

The main problem is that I don't use JSON API and I have no insight on what is needed and how this ridiculous media format is supposed to work.

from roar-jsonapi.

myabc avatar myabc commented on July 20, 2024

From @franzliedke on December 18, 2015 13:12

@apotonick Submitted my test and fix in #178.

from roar-jsonapi.

myabc avatar myabc commented on July 20, 2024

From @apotonick on December 18, 2015 22:34

So this fixes the nil link, but we still need to sort out how to say "in has_one, this goes into the included, this goes into the relationships part", right?

from roar-jsonapi.

myabc avatar myabc commented on July 20, 2024

From @franzliedke on December 18, 2015 23:19

Indeed. If you don't come up with anything by then, I'll make a suggestion after the holidays. Cheers and merry christmas! :)

from roar-jsonapi.

myabc avatar myabc commented on July 20, 2024

From @apotonick on December 18, 2015 23:49

"No pressure, Nick!" 😬

from roar-jsonapi.

myabc avatar myabc commented on July 20, 2024

Reference: Reference: http://jsonapi.org/format/#document-resource-object-relationships

from roar-jsonapi.

myabc avatar myabc commented on July 20, 2024

@franzliedke not sure if this issue is still relevant for you, but if it is, I'd appreciate feedback on this fix.

from roar-jsonapi.

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.