Comments (4)
Hi @Garanaw,
According to JSON:API spec in api response data.relationships
should only contain reference objects. And data belongs to relationships should go inside included
https://laravel-news.com/json-api-introduction
Best,
from sarala.
@milroyfraser That's great, finally I got the right format. Thanks! Might I suggest to add this page as well as other links I've seen in other issues to a wiki page as a reference? That'd save us time trying to find some documentation, and some of the time you spend answering this kind of questions too.
Again, thank you.
P.S. Issue ready to be closed if you agree
from sarala.
@milroyfraser Again struggling with relationships, collections this time. I followed the exact format shown in the link above (literally copy/paste the example), yet the formatter complains about "data is undefined". It works fine with a single item in the relationships/included fields ( 'included' => ['includedItem' => new Resource($item)] ).
Any specific format for this use case?
Thank you
from sarala.
Hi @Garanaw, I cannot speak for the author, but I think this package assumes a familiarity with the JSON:API specification, so that kind of documentation doesn't really belong here.
That said, so you aren't repeating work that's already been done, I highly recommend you check out CloudCreativity's Laravel-JSON-API package for Laravel. It is an extensive package that implements the best practices descriped by that JSON:API spec.
from sarala.
Related Issues (20)
- Support String Based Filter Parameters
- Use self url if available before generating.
- Support to configure multiple media types
- ETag support
- Urgent! Request structure BAD when updating resource's relationships HOT 2
- Have to access relation through .data? HOT 2
- Headers HOT 1
- how to POST with relationship HOT 5
- PATCH: Way to include only modified attributes in request body.
- Can't resolve 'babel-runtime/helpers/asyncToGenerator' HOT 1
- Set a customized property in Model subclass will affect the other. HOT 1
- Support for Typescript (d.ts) HOT 1
- No Support for Persist Requests with No Content HOT 2
- Invalid Method of Updating Relationships
- Empty or invalid date passed to server
- Can't resolve 'sarala' HOT 2
- Cannot read property 'self' of undefined HOT 7
- Support Fetching Relationships
- Support Include Parameters
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 sarala.