Fetching with sparse fieldsets, what about invalid fields in request?


#1

As per http://jsonapi.org/format/#fetching-sparse-fieldsets a response must not contain extra fields.

What about, if the request contains fields that aren’t available? Do we respond with an empty struct? No Content Status Code? An error?


#2

I believe this depends in whether you consider it an error and want to fail the request (since they’re all or none)

See error discussion in the index page


#3

I’m pretty sure @bf4 is correct. That is, server can either ignore the unknown field names (i.e. just not output a key for them in the returned resource objects), which I think is often the best approach, or return an error (probably a 400).


#4

Thank you guys, I think we are going for an error 400. Let’s see how it works out :slight_smile: