We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
eta on pydantic update to 0.28
really need your latest PR 
it shoud solve recurring issues with sqlalchemy to pydantic mapping
thank you !

--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `fastapi/utils.py`
Content:
```
1 import re
2 from typing import Any, Dict, List, Sequence, Set, Type
3 
4 from fastapi import routing
5 from fastapi.openapi.constants import REF_PREFIX
6 from pydantic import BaseModel
7 from pydantic.fields import Field
8 from pydantic.schema import get_flat_models_from_fields, model_process_schema
9 from starlette.routing import BaseRoute
10 
11 
12 def get_flat_models_from_routes(
13     routes: Sequence[Type[BaseRoute]]
14 ) -> Set[Type[BaseModel]]:
15     body_fields_from_routes: List[Field] = []
16     responses_from_routes: List[Field] = []
17     for route in routes:
18         if getattr(route, "include_in_schema", None) and isinstance(
19             route, routing.APIRoute
20         ):
21             if route.body_field:
22                 assert isinstance(
23                     route.body_field, Field
24                 ), "A request body must be a Pydantic Field"
25                 body_fields_from_routes.append(route.body_field)
26             if route.response_field:
27                 responses_from_routes.append(route.response_field)
28             if route.response_fields:
29                 responses_from_routes.extend(route.response_fields.values())
30     flat_models = get_flat_models_from_fields(
31         body_fields_from_routes + responses_from_routes
32     )
33     return flat_models
34 
35 
36 def get_model_definitions(
37     *, flat_models: Set[Type[BaseModel]], model_name_map: Dict[Type[BaseModel], str]
38 ) -> Dict[str, Any]:
39     definitions: Dict[str, Dict] = {}
40     for model in flat_models:
41         m_schema, m_definitions = model_process_schema(
42             model, model_name_map=model_name_map, ref_prefix=REF_PREFIX
43         )
44         definitions.update(m_definitions)
45         model_name = model_name_map[model]
46         definitions[model_name] = m_schema
47     return definitions
48 
49 
50 def get_path_param_names(path: str) -> Set[str]:
51     return {item.strip("{}") for item in re.findall("{[^}]*}", path)}
52
```
--- 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()

```

diff --git a/fastapi/utils.py b/fastapi/utils.py
--- a/fastapi/utils.py
+++ b/fastapi/utils.py
@@ -28,7 +28,7 @@
             if route.response_fields:
                 responses_from_routes.extend(route.response_fields.values())
     flat_models = get_flat_models_from_fields(
-        body_fields_from_routes + responses_from_routes
+        body_fields_from_routes + responses_from_routes, known_models=set()
     )
     return flat_models

{"golden_diff": "diff --git a/fastapi/utils.py b/fastapi/utils.py\n--- a/fastapi/utils.py\n+++ b/fastapi/utils.py\n@@ -28,7 +28,7 @@\n             if route.response_fields:\n                 responses_from_routes.extend(route.response_fields.values())\n     flat_models = get_flat_models_from_fields(\n-        body_fields_from_routes + responses_from_routes\n+        body_fields_from_routes + responses_from_routes, known_models=set()\n     )\n     return flat_models\n", "issue": "eta on pydantic update to 0.28\nreally need your latest PR \r\nit shoud solve recurring issues with sqlalchemy to pydantic mapping\r\nthank you !\n", "before_files": [{"content": "import re\nfrom typing import Any, Dict, List, Sequence, Set, Type\n\nfrom fastapi import routing\nfrom fastapi.openapi.constants import REF_PREFIX\nfrom pydantic import BaseModel\nfrom pydantic.fields import Field\nfrom pydantic.schema import get_flat_models_from_fields, model_process_schema\nfrom starlette.routing import BaseRoute\n\n\ndef get_flat_models_from_routes(\n    routes: Sequence[Type[BaseRoute]]\n) -> Set[Type[BaseModel]]:\n    body_fields_from_routes: List[Field] = []\n    responses_from_routes: List[Field] = []\n    for route in routes:\n        if getattr(route, \"include_in_schema\", None) and isinstance(\n            route, routing.APIRoute\n        ):\n            if route.body_field:\n                assert isinstance(\n                    route.body_field, Field\n                ), \"A request body must be a Pydantic Field\"\n                body_fields_from_routes.append(route.body_field)\n            if route.response_field:\n                responses_from_routes.append(route.response_field)\n            if route.response_fields:\n                responses_from_routes.extend(route.response_fields.values())\n    flat_models = get_flat_models_from_fields(\n        body_fields_from_routes + responses_from_routes\n    )\n    return flat_models\n\n\ndef get_model_definitions(\n    *, flat_models: Set[Type[BaseModel]], model_name_map: Dict[Type[BaseModel], str]\n) -> Dict[str, Any]:\n    definitions: Dict[str, Dict] = {}\n    for model in flat_models:\n        m_schema, m_definitions = model_process_schema(\n            model, model_name_map=model_name_map, ref_prefix=REF_PREFIX\n        )\n        definitions.update(m_definitions)\n        model_name = model_name_map[model]\n        definitions[model_name] = m_schema\n    return definitions\n\n\ndef get_path_param_names(path: str) -> Set[str]:\n    return {item.strip(\"{}\") for item in re.findall(\"{[^}]*}\", path)}\n", "path": "fastapi/utils.py"}], "after_files": [{"content": "import re\nfrom typing import Any, Dict, List, Sequence, Set, Type\n\nfrom fastapi import routing\nfrom fastapi.openapi.constants import REF_PREFIX\nfrom pydantic import BaseModel\nfrom pydantic.fields import Field\nfrom pydantic.schema import get_flat_models_from_fields, model_process_schema\nfrom starlette.routing import BaseRoute\n\n\ndef get_flat_models_from_routes(\n    routes: Sequence[Type[BaseRoute]]\n) -> Set[Type[BaseModel]]:\n    body_fields_from_routes: List[Field] = []\n    responses_from_routes: List[Field] = []\n    for route in routes:\n        if getattr(route, \"include_in_schema\", None) and isinstance(\n            route, routing.APIRoute\n        ):\n            if route.body_field:\n                assert isinstance(\n                    route.body_field, Field\n                ), \"A request body must be a Pydantic Field\"\n                body_fields_from_routes.append(route.body_field)\n            if route.response_field:\n                responses_from_routes.append(route.response_field)\n            if route.response_fields:\n                responses_from_routes.extend(route.response_fields.values())\n    flat_models = get_flat_models_from_fields(\n        body_fields_from_routes + responses_from_routes, known_models=set()\n    )\n    return flat_models\n\n\ndef get_model_definitions(\n    *, flat_models: Set[Type[BaseModel]], model_name_map: Dict[Type[BaseModel], str]\n) -> Dict[str, Any]:\n    definitions: Dict[str, Dict] = {}\n    for model in flat_models:\n        m_schema, m_definitions = model_process_schema(\n            model, model_name_map=model_name_map, ref_prefix=REF_PREFIX\n        )\n        definitions.update(m_definitions)\n        model_name = model_name_map[model]\n        definitions[model_name] = m_schema\n    return definitions\n\n\ndef get_path_param_names(path: str) -> Set[str]:\n    return {item.strip(\"{}\") for item in re.findall(\"{[^}]*}\", path)}\n", "path": "fastapi/utils.py"}]}