prompt: We are currently solving the following issue within our repository. Here is the issue text:
  --- BEGIN ISSUE ---
  Docs: DTO Factory exclude fields in nested complex types
  ### Summary
  
  Need to document procedure for excluding fields from nested complex types, e.g.,
  
  ```py
  class Model1:
      a: int
      b: str
  
  class Model2:
      c: int
      d: str
  
  class Model3:
      e: Union[Model1, Model2]
  
  config = DTOConfig(exclude={"e.0.a", "e.1.c"})
  ...
  ```
  
  --- END ISSUE ---
  
  Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
  --- BEGIN FILES ---
  Path: `docs/examples/data_transfer_objects/factory/excluding_fields.py`
  Content:
  ```
  1 from datetime import datetime
  2 from uuid import UUID
  3 
  4 from sqlalchemy import ForeignKey
  5 from sqlalchemy.orm import Mapped, mapped_column, relationship
  6 from typing_extensions import Annotated
  7 
  8 from litestar import Litestar, post
  9 from litestar.contrib.sqlalchemy.dto import SQLAlchemyDTO
  10 from litestar.dto.factory import DTOConfig, dto_field
  11 
  12 from .my_lib import Base
  13 
  14 
  15 class Address(Base):
  16     street: Mapped[str]
  17     city: Mapped[str]
  18     state: Mapped[str]
  19     zip: Mapped[str]
  20 
  21 
  22 class User(Base):
  23     name: Mapped[str]
  24     password: Mapped[str] = mapped_column(info=dto_field("private"))
  25     created_at: Mapped[datetime] = mapped_column(info=dto_field("read-only"))
  26     address_id: Mapped[UUID] = mapped_column(ForeignKey("address.id"), info=dto_field("private"))
  27     address: Mapped[Address] = relationship(info=dto_field("read-only"))
  28 
  29 
  30 UserDTO = SQLAlchemyDTO[User]
  31 config = DTOConfig(exclude={"id", "address.id", "address.street"})
  32 ReadUserDTO = SQLAlchemyDTO[Annotated[User, config]]
  33 
  34 
  35 @post("/users", dto=UserDTO, return_dto=ReadUserDTO, sync_to_thread=False)
  36 def create_user(data: User) -> User:
  37     data.created_at = datetime.min
  38     data.address = Address(street="123 Main St", city="Anytown", state="NY", zip="12345")
  39     return data
  40 
  41 
  42 app = Litestar(route_handlers=[create_user])
  43 
  44 # run: /users -H "Content-Type: application/json" -d '{"name":"Litestar User","password":"xyz","created_at":"2023-04-24T00:00:00Z"}'
  45
  ```
  --- END FILES ---
  
  Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.
  
  Here is an example:
  
  ```diff
  diff --git a/examples/server_async.py b/examples/server_async.py
  --- a/examples/server_async.py
  +++ b/examples/server_async.py
  @@ -313,4 +313,4 @@
   
   
   if __name__ == "__main__":
  -    asyncio.run(run_async_server("."), debug=True)
  +    asyncio.run(run_async_server(), debug=True)
  diff --git a/examples/server_sync.py b/examples/server_sync.py
  --- a/examples/server_sync.py
  +++ b/examples/server_sync.py
  @@ -313,5 +313,5 @@
   
   
   if __name__ == "__main__":
  -    server = run_sync_server(".")
  +    server = run_sync_server()
       server.shutdown()
  
  ```
  
golden_diff: diff --git a/docs/examples/data_transfer_objects/factory/excluding_fields.py b/docs/examples/data_transfer_objects/factory/excluding_fields.py
  --- a/docs/examples/data_transfer_objects/factory/excluding_fields.py
  +++ b/docs/examples/data_transfer_objects/factory/excluding_fields.py
  @@ -1,4 +1,5 @@
   from datetime import datetime
  +from typing import List
   from uuid import UUID
   
   from sqlalchemy import ForeignKey
  @@ -19,16 +20,30 @@
       zip: Mapped[str]
   
   
  +class Pets(Base):
  +    name: Mapped[str]
  +    user_id: Mapped[UUID] = mapped_column(ForeignKey("user.id"))
  +
  +
   class User(Base):
       name: Mapped[str]
       password: Mapped[str] = mapped_column(info=dto_field("private"))
       created_at: Mapped[datetime] = mapped_column(info=dto_field("read-only"))
       address_id: Mapped[UUID] = mapped_column(ForeignKey("address.id"), info=dto_field("private"))
       address: Mapped[Address] = relationship(info=dto_field("read-only"))
  +    pets: Mapped[List[Pets]] = relationship(info=dto_field("read-only"))
   
   
   UserDTO = SQLAlchemyDTO[User]
  -config = DTOConfig(exclude={"id", "address.id", "address.street"})
  +config = DTOConfig(
  +    exclude={
  +        "id",
  +        "address.id",
  +        "address.street",
  +        "pets.0.id",
  +        "pets.0.user_id",
  +    }
  +)
   ReadUserDTO = SQLAlchemyDTO[Annotated[User, config]]
   
   
  @@ -36,6 +51,7 @@
   def create_user(data: User) -> User:
       data.created_at = datetime.min
       data.address = Address(street="123 Main St", city="Anytown", state="NY", zip="12345")
  +    data.pets = [Pets(id=1, name="Fido"), Pets(id=2, name="Spot")]
       return data
  
verification_info: {"golden_diff": "diff --git a/docs/examples/data_transfer_objects/factory/excluding_fields.py b/docs/examples/data_transfer_objects/factory/excluding_fields.py\n--- a/docs/examples/data_transfer_objects/factory/excluding_fields.py\n+++ b/docs/examples/data_transfer_objects/factory/excluding_fields.py\n@@ -1,4 +1,5 @@\n from datetime import datetime\n+from typing import List\n from uuid import UUID\n \n from sqlalchemy import ForeignKey\n@@ -19,16 +20,30 @@\n     zip: Mapped[str]\n \n \n+class Pets(Base):\n+    name: Mapped[str]\n+    user_id: Mapped[UUID] = mapped_column(ForeignKey(\"user.id\"))\n+\n+\n class User(Base):\n     name: Mapped[str]\n     password: Mapped[str] = mapped_column(info=dto_field(\"private\"))\n     created_at: Mapped[datetime] = mapped_column(info=dto_field(\"read-only\"))\n     address_id: Mapped[UUID] = mapped_column(ForeignKey(\"address.id\"), info=dto_field(\"private\"))\n     address: Mapped[Address] = relationship(info=dto_field(\"read-only\"))\n+    pets: Mapped[List[Pets]] = relationship(info=dto_field(\"read-only\"))\n \n \n UserDTO = SQLAlchemyDTO[User]\n-config = DTOConfig(exclude={\"id\", \"address.id\", \"address.street\"})\n+config = DTOConfig(\n+    exclude={\n+        \"id\",\n+        \"address.id\",\n+        \"address.street\",\n+        \"pets.0.id\",\n+        \"pets.0.user_id\",\n+    }\n+)\n ReadUserDTO = SQLAlchemyDTO[Annotated[User, config]]\n \n \n@@ -36,6 +51,7 @@\n def create_user(data: User) -> User:\n     data.created_at = datetime.min\n     data.address = Address(street=\"123 Main St\", city=\"Anytown\", state=\"NY\", zip=\"12345\")\n+    data.pets = [Pets(id=1, name=\"Fido\"), Pets(id=2, name=\"Spot\")]\n     return data\n", "issue": "Docs: DTO Factory exclude fields in nested complex types\n### Summary\n\nNeed to document procedure for excluding fields from nested complex types, e.g.,\r\n\r\n```py\r\nclass Model1:\r\n    a: int\r\n    b: str\r\n\r\nclass Model2:\r\n    c: int\r\n    d: str\r\n\r\nclass Model3:\r\n    e: Union[Model1, Model2]\r\n\r\nconfig = DTOConfig(exclude={\"e.0.a\", \"e.1.c\"})\r\n...\r\n```\n", "before_files": [{"content": "from datetime import datetime\nfrom uuid import UUID\n\nfrom sqlalchemy import ForeignKey\nfrom sqlalchemy.orm import Mapped, mapped_column, relationship\nfrom typing_extensions import Annotated\n\nfrom litestar import Litestar, post\nfrom litestar.contrib.sqlalchemy.dto import SQLAlchemyDTO\nfrom litestar.dto.factory import DTOConfig, dto_field\n\nfrom .my_lib import Base\n\n\nclass Address(Base):\n    street: Mapped[str]\n    city: Mapped[str]\n    state: Mapped[str]\n    zip: Mapped[str]\n\n\nclass User(Base):\n    name: Mapped[str]\n    password: Mapped[str] = mapped_column(info=dto_field(\"private\"))\n    created_at: Mapped[datetime] = mapped_column(info=dto_field(\"read-only\"))\n    address_id: Mapped[UUID] = mapped_column(ForeignKey(\"address.id\"), info=dto_field(\"private\"))\n    address: Mapped[Address] = relationship(info=dto_field(\"read-only\"))\n\n\nUserDTO = SQLAlchemyDTO[User]\nconfig = DTOConfig(exclude={\"id\", \"address.id\", \"address.street\"})\nReadUserDTO = SQLAlchemyDTO[Annotated[User, config]]\n\n\n@post(\"/users\", dto=UserDTO, return_dto=ReadUserDTO, sync_to_thread=False)\ndef create_user(data: User) -> User:\n    data.created_at = datetime.min\n    data.address = Address(street=\"123 Main St\", city=\"Anytown\", state=\"NY\", zip=\"12345\")\n    return data\n\n\napp = Litestar(route_handlers=[create_user])\n\n# run: /users -H \"Content-Type: application/json\" -d '{\"name\":\"Litestar User\",\"password\":\"xyz\",\"created_at\":\"2023-04-24T00:00:00Z\"}'\n", "path": "docs/examples/data_transfer_objects/factory/excluding_fields.py"}], "after_files": [{"content": "from datetime import datetime\nfrom typing import List\nfrom uuid import UUID\n\nfrom sqlalchemy import ForeignKey\nfrom sqlalchemy.orm import Mapped, mapped_column, relationship\nfrom typing_extensions import Annotated\n\nfrom litestar import Litestar, post\nfrom litestar.contrib.sqlalchemy.dto import SQLAlchemyDTO\nfrom litestar.dto.factory import DTOConfig, dto_field\n\nfrom .my_lib import Base\n\n\nclass Address(Base):\n    street: Mapped[str]\n    city: Mapped[str]\n    state: Mapped[str]\n    zip: Mapped[str]\n\n\nclass Pets(Base):\n    name: Mapped[str]\n    user_id: Mapped[UUID] = mapped_column(ForeignKey(\"user.id\"))\n\n\nclass User(Base):\n    name: Mapped[str]\n    password: Mapped[str] = mapped_column(info=dto_field(\"private\"))\n    created_at: Mapped[datetime] = mapped_column(info=dto_field(\"read-only\"))\n    address_id: Mapped[UUID] = mapped_column(ForeignKey(\"address.id\"), info=dto_field(\"private\"))\n    address: Mapped[Address] = relationship(info=dto_field(\"read-only\"))\n    pets: Mapped[List[Pets]] = relationship(info=dto_field(\"read-only\"))\n\n\nUserDTO = SQLAlchemyDTO[User]\nconfig = DTOConfig(\n    exclude={\n        \"id\",\n        \"address.id\",\n        \"address.street\",\n        \"pets.0.id\",\n        \"pets.0.user_id\",\n    }\n)\nReadUserDTO = SQLAlchemyDTO[Annotated[User, config]]\n\n\n@post(\"/users\", dto=UserDTO, return_dto=ReadUserDTO, sync_to_thread=False)\ndef create_user(data: User) -> User:\n    data.created_at = datetime.min\n    data.address = Address(street=\"123 Main St\", city=\"Anytown\", state=\"NY\", zip=\"12345\")\n    data.pets = [Pets(id=1, name=\"Fido\"), Pets(id=2, name=\"Spot\")]\n    return data\n\n\napp = Litestar(route_handlers=[create_user])\n\n# run: /users -H \"Content-Type: application/json\" -d '{\"name\":\"Litestar User\",\"password\":\"xyz\",\"created_at\":\"2023-04-24T00:00:00Z\"}'\n", "path": "docs/examples/data_transfer_objects/factory/excluding_fields.py"}]}