Skip to main content

IsSubclassValidator

No overview available.

Attributes

AttributeTypeDescription
classPy< PyType >The Python type object that input values must be a subclass of to pass validation.
class_reprStringA string representation of the target class used for generating clear error messages.
nameStringThe identifier for the validator used in tracebacks and schema definitions.

Constructor

Signature

def IsSubclassValidator(
class: Py< PyType >,
class_repr: String,
name: String
)

Parameters

NameTypeDescription
classPy< PyType >The Python type/class to check against.
class_reprStringThe string representation of the class used for error messages.
nameStringThe name of the validator instance.

Methods


validate()

def validate(
py: Python,
input: &PyAny
) - > PyResult< PyAny >

Validates that the input value is a subclass of the specified Python class.

Parameters

NameTypeDescription
pyPythonThe Python interpreter instance used for type checking and object manipulation.
input&PyAnyThe input object to be validated as a subclass.

Returns

TypeDescription
PyResult< PyAny >The input value if it is a valid subclass, otherwise raises a ValidationError.