Discriminator
Provides a way to use a custom callable as the way to extract the value of a union discriminator.
Attributes
| Attribute | Type | Description |
|---|---|---|
| discriminator | `str | Callable[[Any], Hashable]` |
| custom_error_type | `str | None` = None |
| custom_error_message | `str | None` = None |
| custom_error_context | `dict[str, int | str |
Constructor
Signature
def Discriminator(
discriminator: str | Callable[[Any], Hashable],
custom_error_type: str | None = None,
custom_error_message: str | None = None,
custom_error_context: dict[str, int | str | float]| None = None
) - > null
Parameters
| Name | Type | Description |
|---|---|---|
| discriminator | `str | Callable[[Any], Hashable]` |
| custom_error_type | `str | None` = None |
| custom_error_message | `str | None` = None |
| custom_error_context | `dict[str, int | str |