code: def get_client():
      from pydantic import BaseModel, ValidationInfo, field_validator
  
      app = FastAPI()
  
      class ModelB(BaseModel):
          username: str
  
      class ModelC(ModelB):
          password: str
  
      class ModelA(BaseModel):
          name: str
          description: Optional[str] = None
          foo: ModelB
  
          @field_validator("name")
          def lower_username(cls, name: str, info: ValidationInfo):
              if not name.endswith("A"):
                  raise ValueError("name must end in A")
              return name
  
      async def get_model_c() -> ModelC:
          return ModelC(username="test-user", password="test-password")
  
      @app.get("/model/{name}", response_model=ModelA)
      async def get_model_a(name: str, model_c=Depends(get_model_c)):
          return {
              "name": name,
              "description": "model-a-desc",
              "foo": model_c,
          }
  
      client = TestClient(app)
      return client
  
file_path: fastapi/tests/test_filter_pydantic_sub_model_pv2.py
imports: from typing import Optional
  import pytest
  from dirty_equals import HasRepr, IsDict, IsOneOf
  from fastapi import Depends, FastAPI
  from fastapi.exceptions import ResponseValidationError
  from fastapi.testclient import TestClient
  from fastapi.utils import match_pydantic_error_url
  from .utils import needs_pydanticv2
label_desc: Use image node_id 1 for calling a global function with example usage: get_client() and returns: client, ModelC, dict, name