You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I want to remove some field validator function from my sub-class of some parent BaseModel. The parent that I want to inherit is one that implements many validator functions and has a lot of fields. I do not want to create a new one that removes the one validator function 😢.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
From the discussion: How to remove validators from subclass?.
Warning
I want to know how to implement this decorator function on Pydantic V2.
I do not get or set
f.validators
attribute from theFieldInfo
object that was generated fromModel.model_fields
. The error that was raised is:I read a lot of the Pydantic documents and blogs, and I am not an expert on Python to read all of raw source code to fix this problem.
Prerequisites
2.7.1
and Python version3.9.13
model.__fields__.values()
tomodel.model_fields.values()
Usecase
I want to remove some field validator function from my sub-class of some parent BaseModel. The parent that I want to inherit is one that implements many validator functions and has a lot of fields. I do not want to create a new one that removes the one validator function 😢.
Beta Was this translation helpful? Give feedback.
All reactions