django-json-api/django-rest-framework-json-api

Sparse field set should not return all fields when value is empty

sliverc opened this issue · 0 comments

Description of the Bug Report

The JSON:API spec states

The value of any fields[TYPE] parameter MUST be a comma-separated (U+002C COMMA, “,”) list that refers to the name(s) of the fields to be returned. An empty value indicates that no fields should be returned.

Currently, DJA returns all fields though when value is empty, but it should return none. None meaning no attributes and relationships but id and type remaining.

Checklist

  • Certain that this is a bug (if unsure or you have a question use discussions instead)
  • Code snippet or unit test added to reproduce bug