The problem is in resource headerstrip_empty_items since it only takes care about the dict representation of the model, which is not executed in case of the construction via Objects. A similar functionality needs to be implemented on a Pydantic object level without the pre parameter in the validator. This should then cover the json variant as well.
ATM the validation of empty object is only working in dict form.
Example:
does not raise an validation error. But it actually should.
Does.
The problem is in resource header
strip_empty_items
since it only takes care about the dict representation of the model, which is not executed in case of the construction via Objects. A similar functionality needs to be implemented on a Pydantic object level without thepre
parameter in the validator. This should then cover the json variant as well.