dgs.utils.validation.validate_value

dgs.utils.validation.validate_value(value: any, data: any, validation: str) bool[source]

Check a single value against a given predefined validation, possibly given some additional data.

Parameters:
  • value – The value to validate.

  • data – Possibly additional data needed for validation, is ignored otherwise.

  • validation – The name of the validation to perform.

Returns:

Whether the given value is valid given the validation and possibly more data.

Return type:

bool

Raises:

KeyError – If the given validation does not exist.