Closed rgant closed 8 years ago
I agree @rgant i think if the Id is not set it should not be serialized. I'll look into fixing this thanks
@BlairAllegroTech Thanks! That was a bunch of effort on your part and I really appreciate it.
@rgant Well i appreciate the feedback. Its easy to miss some of the finer details the more of these we can identify and fix the better!!
According to my understanding of the JSON API spec, the
id
member of a resource object must be a string that when combined with thetype
member is a unique identity for the resource.Additionally when creating a resource the
id
is not a required member. But may be included to to create a resource using Client Generated IDs. However in that case theid
should be a "properly generated and formatted UUID".This library defaults to an empty string for a missing
id
member. I don't think that that conforms to the standard because it is neither a unique identity nor a UUID.I think this is the function in the code that causes an empty string id to be added to the posts. The comment for that line "JsonApi id is always a string,it can be empty for a new unstored object!" but I think that is not a correct reading of the JSON API spec.
In my opinion if the
id
is missing then it should not be serialized into the request data.