Open Golyo88 opened 3 years ago
to_dict not handled correctly where the field is a List with Nullable values
to_dict
@dataclass(frozen=True) class Range(JsonSchemaMixin): range: List[Nullable[float]] not_range: Nullable[float] r = Range.from_dict({'range': [1.0, 2.0, None, 3.0], 'not_range': None}) r.to_dict() {'range': [1.0, 2.0, <dataclasses_jsonschema.type_defs._NULL_TYPE object at 0x10c002e50>, 3.0], 'not_range': None}
As you can see Nullable field's value will convert to None in the to_dict() function, but the Nullable items of a List is not
Nullable
None
to_dict()
to_dict
not handled correctly where the field is a List with Nullable valuesAs you can see
Nullable
field's value will convert toNone
in theto_dict()
function, but theNullable
items of a List is not