ModelTypeValidator.serialize

ModelTypeValidator.serialize(attr, obj, accessor=None, **kwargs)

Pulls the value for the given key from the object, applies the field’s formatting and returns the result.

Parameters
  • attr (str) – The attribute/key to get from the object.

  • obj (Any) – The object to access the attribute/key from.

  • accessor (Optional[Callable[[Any, str, Any], Any]]) – Function used to access values from obj.

  • kwargs – Field-specific keyword arguments.