I think this should be preferred over https://github.com/pydantic/pydantic/pull/6915, mostly because the implementation there involves duplicating the list of types in the union, and generally seems more fragile.

I've opened as draft until docs/tests are added, hoping @sydney-runkle can help get this across the line tomorrow.
Add CallableDiscriminator and Tag. I think this should be preferred over https://github.com/pydantic/pydantic/pull/6915, mostly because the implementation there involves duplicating the list of types in the union, and generally seems more fragile.

I've opened as draft until docs/tests are added, hoping @sydney-runkle can help get this across the line tomorrow.
"""
Test mypy failure with invalid types.
"""
from typing import Generic, List, TypeVar

from pydantic import BaseModel

T = TypeVar('T')


class Model(BaseModel):
    list_of_ints: List[int]


class WrapperModel(BaseModel, Generic[T]):
    payload: T


model_instance = Model(list_of_ints=[1])
wrapper_instance = WrapperModel[Model](payload=model_instance)
wrapper_instance.payload.list_of_ints.append('1')
# MYPY: error: Argument 1 to "append" of "list" has incompatible type "str"; expected "int"  [arg-type]

"""
Test mypy failure with invalid types.
"""
from typing import Generic, List, TypeVar

from pydantic import BaseModel

T = TypeVar('T')


class Model(BaseModel):
    list_of_ints: List[int]


class WrapperModel(BaseModel, Generic[T]):
    payload: T


model_instance = Model(list_of_ints=[1])
wrapper_instance = WrapperModel[Model](payload=model_instance)
wrapper_instance.payload.list_of_ints.append('1')
# MYPY: error: Argument 1 to "append" of "list" has incompatible type "str"; expected "int"  [arg-type]
