Closed dgeb closed 4 years ago
@dgeb I just checked. It is an issue with orbit sources. But not only orbit-sql
every source based on record-cache
have the issue.
I am actually not sure. Do you expect a source.update(t => t.updateRecord({ id: 'not-a-valid-id', type: 'planet' }))
to be a success?
@tchak The default record-cache
behavior is based upon the assumption that the caches contain a sparsely populated set of records that is non-authoritative. I think we can assume that orbit-sql
is not sparse, but rather the authoritative source for records.
Do you expect a source.update(t => t.updateRecord({ id: 'not-a-valid-id', type: 'planet' })) to be a success?
For a sparse cache, not-a-valid-id
is probably impossible to recognize as invalid, and won't be rejected until it's sent to an authoritative source. On the other hand, an authoritative source should reject what it knows to be invalid (and that rule is written into the JSON:API spec).
Maybe the concept of "authoritative" should be encoded into @orbit/record-cache
, so that both scenarios could be handled?
@tchak thanks for implementing this <3
Currently, PATCH and DELETE requests are treated as successful, even if a resource does not exist on the server. To be JSON:API compliant, these requests should respond with a 404.