Comments (4)
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.
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.
Fixed by setting Reference IsNotLoaded: false
.
from api2go.
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)
- How to marshal an attribute with variable content? HOT 2
- Model routes should be dasherized, not camelized HOT 5
- Annotations need their own namespace HOT 5
- Accessing gin Context from api2go resource handler HOT 1
- Gorilla router not working HOT 1
- Map Merging Preventing Updates HOT 6
- Is it possible to setup a redirect under the FindAll method HOT 1
- jsonapi: Add option to unmarshal from an io.Reader and marshal to an io.Writer
- Errors from SetToOneReferenceID and SetToManyReferenceIDs are ignored HOT 3
- Is this project still being maintained? HOT 6
- Ability to pretty print json output
- MarshalWithUrl merging custom link inside data HOT 2
- Cannot Marshal with top-level Meta HOT 1
- Custom Resource endpoints? HOT 1
- Returning to One Relationships
- Unmarshaling does not correctly parse the "included" part
- Update labstack/echo HOT 2
- Supporting AddResource with a factory function
- relationships links ignoring GetCustomLinks HOT 1
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 api2go.