Make Model.validate()
use castObject()
to cast, and also not modify the object in place
#12668
Closed
2 tasks done
Labels
discussion
If you have any thoughts or comments on this issue, please share them!
enhancement
This issue is a user-facing general improvement that doesn't fix a bug or add a new feature
Milestone
Prerequisites
Issue
Model.castObject(obj)
castsobj
and returns a copy if casting succeeded.Model.validate(obj)
casts and validatesobj
, but modifiesobj
in place if casting succeeded.This behavior is inconsistent, and I think we should either (1) make
validate()
not run casting, or (2) makevalidate()
return a casted copy. The major reason for returning a copy instead of modifying the object in place is to avoid only applying casting halfway if casting fails. If there's a cast error, some of the paths inobj
won't be casted.The text was updated successfully, but these errors were encountered: