def test_serialize_as_any_annotation_with_inner_models() -> None:
    """The SerializeAsAny annotation does not affect nested models."""

    class Inner(BaseModel):
        x: int

    class Outer(BaseModel):
        inner: Inner

    class InnerChild(Inner):
        y: int

    ta = TypeAdapter(SerializeAsAny[Outer])
    inner_child = InnerChild(x=1, y=2)
    outer = Outer(inner=inner_child)
    assert ta.dump_python(outer) == {'inner': {'x': 1}}
The SerializeAsAny annotation does not affect nested models.
tests/test_serialize_as_any.py