I am using msgspec for serializing and validating my classes and I have such models
class Stop():
stop_code: Optional[int] = ''
and when I pass empty string, it fails saying expected null|int and got string instead. What is the way that I can accept empty string and int.
Or what is the most performant way to convert empty string to none
Currently I am using this to ignore the empty string keys
model = self._factory({k: row.pop(k).strip() for k in self._model_field_names_set if row[k].strip() != ""})
Although I understand that i am accepting empty string in int field in this example, its a bit more complex in the actual implementation but the gist is that I want the actualy validation class or empty string would do