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

Sparse fields set should only drop fields when rendering

Closed this issue · 0 comments

Description of the Bug Report

As discussed in #1214 there is an issue with SparseFieldsetsMixin serializer mixin. It drops fields when reading and writing, however it should only do it when reading and not when writing as per specification.

When analyzing the code, it seems the best to implement is to move the exclude logic from __init__ and overwrite _readable_fields.

Related to #1053

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