Comments (4)
+1 to this, I just came here to report this as an issue for when the id on a relationship is null for a create or update payload.
I am not sure if this is spec-compliant or not, however worst-case it should return an error to the client. I would prefer that a null result be interpreted as "no relationship" but I am not an expert on if the JSON spec allows this.
from json-api.
It's definitely a bug. A resource identifier (type + id) should always reference a resource, so both would need to be provided. If "no relationship", then null
should be provided instead of a resource identifier.
I.e. for an "author" relationship, the relationships should be this for no relationship:
{
"author": { "data": null }
}
And this for a relationship:
{
"author": { "data": { "type": "users", "id": "1" } }
}
Should be getting this bug fixed in the next release.
from json-api.
Just to be clear, I am talking about sending a relationship as so:
{
"author": { "data": { "type": "users", "id": null } }
}
This generates a server error, and it probably shouldn't because we can't control what API users are doing.
I THINK you are intending the same above, but I just want to make sure we're on the same page.
from json-api.
Yes, that should be rejected as a bad request because it is not allowed by the spec - the resource identifier within it is incomplete.
from json-api.
Related Issues (20)
- Authorising updates needs access to what the client sent HOT 1
- Default resource document and relationship document validators HOT 2
- Inject error repository into `AbstractAuthorizer` by default HOT 1
- Make `AbstractHydrator::methodForRelationship` non-abstract HOT 1
- Store should be backed by an Identity Map HOT 1
- Invalid resource type in relationship HOT 1
- RelatedHydratorTrait needs a hydrateRelated method HOT 1
- Allow packages to add configuration to API definitions HOT 1
- Standard object iterator HOT 1
- Search All and Search Related HOT 1
- Badges HOT 3
- Add relationship methods to HTTP client
- Detect message body in responses HOT 1
- Type error after client tries request to invalid URL
- Pagination on relationships HOT 1
- How to add custom action to resource constroller? HOT 1
- the place where I can save the result of any query HOT 2
- Deprecated Error class "CloudCreativity\LaravelJsonApi\Document\Error"
- Validation Exception HOT 3
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 json-api.