Open nerdyworm opened 7 years ago
According to the spec, the relationships must contain at least one of data, links or meta. That means the above is a valid JSON API document. If it's failing to parse, I'd consider it a bug.
I'm seeing a similar issue, where the relationships
object contains an object with "data": null
- which according to http://jsonapi.org/format/#document-resource-object-linkage seems to be valid (and this is generated by Django REST Framework with a JSON API module). I'm slowly working through a patch, but it's quite fundamental I think, because of https://github.com/noahzgordon/elm-jsonapi/blob/af2d14762da0f0c7b5ae54cfc4feb99617cbf8d6/src/JsonApi/Data.elm#L50
Data in a relationship can be null, so I think data : OneOrMany ResourceIdentifier
has to change to perhaps data : Maybe OneOrMany ResourceIdentifier
, which then has knock-on effects. If there is a better way to model the data (I'm very very new to Elm) please let me know.
I'm having trouble with the following jsonapi document.
Decoding fails because some of the relationships do not contain a data attribute. I'm not entirely sure that this is "valid" json-api, but it seems to work with other json-api libraries.