Skip to content

compat.dump raises ValidationError when nullable Nested fields (with required subfields) without dump_only of a ResponseSchema are None #305

@fcr--

Description

@fcr--

We found this issue when observed a ValidationError being thrown when serializing the response of an endpoint. The curiosity of this issue is that it happens in the compat.dump when all of these are true:

  • There is a Nested field in a ResponseSchema with allow_none=True,
  • The None value is used for that field.
  • That field has a schema with required subfields (in this case it was an id str subfield without a default).

Then by reading the compat.dump code and the called functions, we've seen that setting dump_only=True on the Nested field served as a workaround.

More info:

This bug happens at least on version 3.2.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions