harborapi
harborapi copied to clipboard
Trigger bool validator for assignments
Currently, the bool_converter validator is configured as a @root_validator, meaning it does not trigger on field assignments, only on model instantiation.
https://github.com/pederhan/harborapi/blob/27900ab5e98c6dc2b7dbb04212414f4edc8d988e/harborapi/models/base.py#L69-L78
Even if we add validate_assignments = True to the model config, it will not run the root validator again. We either need to manually override all fields that are quasi-bools (Optional[str] field that accepts "true" and "false".), or we need to find out if we can add a custom validator for a specific type (in this case Optional[str]), but I am not sure how to do that, or if it's even possible.