Giter Club home page Giter Club logo

Comments (4)

drauschenbach avatar drauschenbach commented on August 20, 2024 1

Given that IsNotLoaded fixed my issue, and is the thing that drives omission of the "data":[] element, I think this is not a bug.

from api2go.

drauschenbach avatar drauschenbach commented on August 20, 2024

I've isolated this problem. I am using jsonapi.Marshal to generate JSONAPI style of JSON that I am POSTing via REST. Marshal collapses "data":[] elements.

However, on the receiving end, JSONAPI has a malfunction when these nested data elements are not present.

So back to my example above, I had to modify the POSTed json to replace "deleted-comments": {} with "deleted-comments: {"data":[]}. And that then allowed the other relations to get processed.

Another work-around a colleague of mine just found is to selectively publish a different schema (GetReferences()) if no foreign key values exist. But the client then loses the ability to see the schema, to know how to offer create options for related data, which is not exactly in the spirit of JSONAPI links.

from api2go.

drauschenbach avatar drauschenbach commented on August 20, 2024

Fixed by setting Reference IsNotLoaded: false.

from api2go.

wwwdata avatar wwwdata commented on August 20, 2024

Hm, we should definitly look further into this and at least add a test case to our unit tests to make sure this works.

Can you paste some example jsons that you also tried it out with as a reference as well? Thanks so far already!

from api2go.

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.