mattpolzin / JSONAPI

Swift Codable JSON:API framework
MIT License
75 stars 19 forks source link

Relationship Object is too strict for requiring a `data` property according to the spec. #56

Closed mattpolzin closed 4 years ago

mattpolzin commented 4 years ago

Describe the bug The JSON:API spec requires a Relationship Object to contain at leasts one of links, meta, and data. The current implementation always requires the data to be present.

Note that entirely omitting the relationship object or setting the data property to null are both supported currently, just not omitting the data property when the links or meta properties are present.

mattpolzin commented 4 years ago

This is fixed in v4.0.0-alpha.2 with the introduction of the MetaRelationship type. The new type can be used in the same places where ToOneRelationship and ToManyRelationship can be used.