Skip to content

Serialization of empty field can create API validation error #99

@d0rianb

Description

@d0rianb

# override the default output from pydantic by calling `to_dict()` of email
if self.email:
_dict['email'] = self.email.to_dict()

This if checks whether self.email is None, but it does not handle the case where self.email is a UserServiceSetHumanEmail(mail=None).

As a result, the serialization produces email: {} in the request body, and the Zitadel API responds with a 400 error because it expects email to be a valid string between 1 and 200 characters, even though it is null and should remain unchanged.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions