Description
EmployeesEmployee.to_dict() raises an AttributeError when the API returns
null for bank_number_format.
The generated from_dict() method explicitly converts JSON null to Python
None:
bank_number_format = (
EmployeesEmployeeBankNumberFormat(_bank_number_format)
if _bank_number_format is not None
else None
)
However, to_dict() assumes every non-Unset value is an enum:
if not isinstance(self.bank_number_format, Unset):
bank_number_format = self.bank_number_format.value
Because None is not an Unset, this attempts to access None.value.
Environment
factorial-api-client==2.0.2
- Python 3.14
- Factorial API version
2026-07-01
Minimal reproduction
from factorial_api_client.generated.models.employees_employee import (
EmployeesEmployee,
)
employee = EmployeesEmployee(
id="12345",
access_id="3543",
first_name="John",
last_name="Doe",
full_name="John Doe",
company_id="999",
location_id="888",
created_at="2026-08-05T00:00:00Z",
updated_at="2026-08-05T00:00:00Z",
is_terminating=False,
attendable=True,
bank_number_format=None,
)
employee.to_dict()
Actual result
AttributeError: 'NoneType' object has no attribute 'value'
Expected result
employee.to_dict()["bank_number_format"] is None
The model should serialize a nullable bank_number_format without raising an
exception.
Suggested fix
Handle None separately in the generated serializer:
bank_number_format: str | None | Unset = UNSET
if self.bank_number_format is None:
bank_number_format = None
elif not isinstance(self.bank_number_format, Unset):
bank_number_format = self.bank_number_format.value
The generated type annotation should also include None:
bank_number_format: EmployeesEmployeeBankNumberFormat | None | Unset = UNSET
A round-trip regression test would cover the issue:
payload = {
# required employee fields...
"bank_number_format": None,
}
employee = EmployeesEmployee.from_dict(payload)
assert employee.to_dict()["bank_number_format"] is None
Description
EmployeesEmployee.to_dict()raises anAttributeErrorwhen the API returnsnullforbank_number_format.The generated
from_dict()method explicitly converts JSONnullto PythonNone:However,
to_dict()assumes every non-Unsetvalue is an enum:Because
Noneis not anUnset, this attempts to accessNone.value.Environment
factorial-api-client==2.0.22026-07-01Minimal reproduction
Actual result
Expected result
The model should serialize a nullable
bank_number_formatwithout raising anexception.
Suggested fix
Handle
Noneseparately in the generated serializer:The generated type annotation should also include
None:A round-trip regression test would cover the issue: