We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Bug: route not recognized in schemas for specific types
### Description

Currently some parameters types don't show in the docs. It seems `int` works fine, while `str` and `uuid` don't.
This is silent, no logs are shown, running `debug` mode. Same behavior for both `/schema/elements` and `/schema/swagger`.

### URL to code causing the issue

_No response_

### MCVE

```python
(Uncomment one at a time)


class BugRoutes(Controller):
    tags = ["Bugs"]
    path = "/bugs"
    dependencies = dict(context=Provide(route_context))

    @routes.get()
    def get_bugs(self, context: AppContext) -> Response:
        return Response({})

    @routes.post()
    def create_bug(self, context: AppContext, data: Any) -> Response:
        return Response({})

    # This works
    # @routes.get("/{param:int}")
    # def get_bug(self, context: AppContext, param: int) -> Response:
    #    return Response({})

    # This doesn't work (not showing on docs)
    # @routes.get("/{param:str}")
    # def get_bug_str(self, context: AppContext, param: str) -> Response:
    #    return Response({})

    # This doesn't work (not showing on docs)
    # @routes.get("/{param:uuid}")
    # def get_bug_uuid(self, context: AppContext, param: UUID) -> Response:
    #    return Response({})

    @routes.patch("/{param:int}")
    def update_bug(self, context: AppContext, param: int) -> Response:
        return Response({})

    @routes.delete("/{param:int}")
    def delete_bug(self, context: AppContext, param: int) -> None:
        return Response({})
```


### Steps to reproduce

_No response_

### Screenshots

_No response_

### Logs

_No response_

### Litestar Version

2.3.2

### Platform

- [X] Mac
- [ ] Linux
- [ ] Windows
- [ ] Other (Please specify in the description above)

<!-- POLAR PLEDGE BADGE START -->
---
> [!NOTE]  
> While we are open for sponsoring on [GitHub Sponsors](https://github.com/sponsors/litestar-org/) and 
> [OpenCollective](https://opencollective.com/litestar), we also utilize [Polar.sh](https://polar.sh/) to engage in pledge-based sponsorship.
>
> Check out all issues funded or available for funding [on our Polar.sh Litestar dashboard](https://polar.sh/litestar-org)
> * If you would like to see an issue prioritized, make a pledge towards it!
> * We receive the pledge once the issue is completed & verified
> * This, along with engagement in the community, helps us know which features are a priority to our users.

<a href="https://polar.sh/litestar-org/litestar/issues/2700">
<picture>
  <source media="(prefers-color-scheme: dark)" srcset="https://polar.sh/api/github/litestar-org/litestar/issues/2700/pledge.svg?darkmode=1">
  <img alt="Fund with Polar" src="https://polar.sh/api/github/litestar-org/litestar/issues/2700/pledge.svg">
</picture>
</a>
<!-- POLAR PLEDGE BADGE END -->


--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `litestar/_openapi/path_item.py`
Content:
```
1 from __future__ import annotations
2 
3 from inspect import cleandoc
4 from typing import TYPE_CHECKING
5 
6 from litestar._openapi.parameters import create_parameters_for_handler
7 from litestar._openapi.request_body import create_request_body
8 from litestar._openapi.responses import create_responses_for_handler
9 from litestar._openapi.utils import SEPARATORS_CLEANUP_PATTERN
10 from litestar.enums import HttpMethod
11 from litestar.openapi.spec import Operation, PathItem
12 from litestar.utils.helpers import unwrap_partial
13 
14 if TYPE_CHECKING:
15     from litestar._openapi.datastructures import OpenAPIContext
16     from litestar.handlers.http_handlers import HTTPRouteHandler
17     from litestar.routes import HTTPRoute
18 
19 __all__ = ("create_path_item_for_route",)
20 
21 
22 class PathItemFactory:
23     """Factory for creating a PathItem instance for a given route."""
24 
25     def __init__(self, openapi_context: OpenAPIContext, route: HTTPRoute) -> None:
26         self.context = openapi_context
27         self.route = route
28         self._path_item = PathItem()
29 
30     def create_path_item(self) -> PathItem:
31         """Create a PathItem for the given route parsing all http_methods into Operation Models.
32 
33         Returns:
34             A PathItem instance.
35         """
36         for http_method, handler_tuple in self.route.route_handler_map.items():
37             route_handler, _ = handler_tuple
38 
39             if not route_handler.resolve_include_in_schema():
40                 continue
41 
42             operation = self.create_operation_for_handler_method(route_handler, HttpMethod(http_method))
43 
44             setattr(self._path_item, http_method.lower(), operation)
45 
46         return self._path_item
47 
48     def create_operation_for_handler_method(
49         self, route_handler: HTTPRouteHandler, http_method: HttpMethod
50     ) -> Operation:
51         """Create an Operation instance for a given route handler and http method.
52 
53         Args:
54             route_handler: A route handler instance.
55             http_method: An HttpMethod enum value.
56 
57         Returns:
58             An Operation instance.
59         """
60         operation_id = self.create_operation_id(route_handler, http_method)
61         parameters = create_parameters_for_handler(self.context, route_handler, self.route.path_parameters)
62         signature_fields = route_handler.parsed_fn_signature.parameters
63 
64         request_body = None
65         if data_field := signature_fields.get("data"):
66             request_body = create_request_body(
67                 self.context, route_handler.handler_id, route_handler.resolve_data_dto(), data_field
68             )
69 
70         raises_validation_error = bool(data_field or self._path_item.parameters or parameters)
71         responses = create_responses_for_handler(
72             self.context, route_handler, raises_validation_error=raises_validation_error
73         )
74 
75         return route_handler.operation_class(
76             operation_id=operation_id,
77             tags=route_handler.resolve_tags() or None,
78             summary=route_handler.summary or SEPARATORS_CLEANUP_PATTERN.sub("", route_handler.handler_name.title()),
79             description=self.create_description_for_handler(route_handler),
80             deprecated=route_handler.deprecated,
81             responses=responses,
82             request_body=request_body,
83             parameters=parameters or None,  # type: ignore[arg-type]
84             security=route_handler.resolve_security() or None,
85         )
86 
87     def create_operation_id(self, route_handler: HTTPRouteHandler, http_method: HttpMethod) -> str:
88         """Create an operation id for a given route handler and http method.
89 
90         Adds the operation id to the context's operation id set, where it is checked for uniqueness.
91 
92         Args:
93             route_handler: A route handler instance.
94             http_method: An HttpMethod enum value.
95 
96         Returns:
97             An operation id string.
98         """
99         if isinstance(route_handler.operation_id, str):
100             operation_id = route_handler.operation_id
101         elif callable(route_handler.operation_id):
102             operation_id = route_handler.operation_id(route_handler, http_method, self.route.path_components)
103         else:
104             operation_id = self.context.openapi_config.operation_id_creator(
105                 route_handler, http_method, self.route.path_components
106             )
107         self.context.add_operation_id(operation_id)
108         return operation_id
109 
110     def create_description_for_handler(self, route_handler: HTTPRouteHandler) -> str | None:
111         """Produce the operation description for a route handler.
112 
113         Args:
114             route_handler: A route handler instance.
115 
116         Returns:
117             An optional description string
118         """
119         handler_description = route_handler.description
120         if handler_description is None and self.context.openapi_config.use_handler_docstrings:
121             fn = unwrap_partial(route_handler.fn)
122             return cleandoc(fn.__doc__) if fn.__doc__ else None
123         return handler_description
124 
125 
126 def create_path_item_for_route(openapi_context: OpenAPIContext, route: HTTPRoute) -> PathItem:
127     """Create a PathItem for the given route parsing all http_methods into Operation Models.
128 
129     Args:
130         openapi_context: The OpenAPIContext instance.
131         route: The route to create a PathItem for.
132 
133     Returns:
134         A PathItem instance.
135     """
136     path_item_factory = PathItemFactory(openapi_context, route)
137     return path_item_factory.create_path_item()
138
```

Path: `litestar/_openapi/plugin.py`
Content:
```
1 from __future__ import annotations
2 
3 from typing import TYPE_CHECKING
4 
5 from litestar._openapi.datastructures import OpenAPIContext
6 from litestar._openapi.path_item import create_path_item_for_route
7 from litestar.exceptions import ImproperlyConfiguredException
8 from litestar.plugins import InitPluginProtocol
9 from litestar.plugins.base import ReceiveRoutePlugin
10 from litestar.routes import HTTPRoute
11 
12 if TYPE_CHECKING:
13     from litestar.app import Litestar
14     from litestar.config.app import AppConfig
15     from litestar.openapi.config import OpenAPIConfig
16     from litestar.openapi.spec import OpenAPI
17     from litestar.routes import BaseRoute
18 
19 
20 class OpenAPIPlugin(InitPluginProtocol, ReceiveRoutePlugin):
21     __slots__ = (
22         "app",
23         "included_routes",
24         "_openapi_config",
25         "_openapi_schema",
26     )
27 
28     def __init__(self, app: Litestar) -> None:
29         self.app = app
30         self.included_routes: dict[str, HTTPRoute] = {}
31         self._openapi_config: OpenAPIConfig | None = None
32         self._openapi_schema: OpenAPI | None = None
33 
34     def _build_openapi_schema(self) -> OpenAPI:
35         openapi_config = self.openapi_config
36 
37         if openapi_config.create_examples:
38             from litestar._openapi.schema_generation.examples import ExampleFactory
39 
40             ExampleFactory.seed_random(openapi_config.random_seed)
41 
42         openapi = openapi_config.to_openapi_schema()
43         context = OpenAPIContext(openapi_config=openapi_config, plugins=self.app.plugins.openapi)
44         openapi.paths = {
45             route.path_format or "/": create_path_item_for_route(context, route)
46             for route in self.included_routes.values()
47         }
48         openapi.components.schemas = context.schema_registry.generate_components_schemas()
49         return openapi
50 
51     def provide_openapi(self) -> OpenAPI:
52         if not self._openapi_schema:
53             self._openapi_schema = self._build_openapi_schema()
54         return self._openapi_schema
55 
56     def on_app_init(self, app_config: AppConfig) -> AppConfig:
57         if app_config.openapi_config:
58             self._openapi_config = app_config.openapi_config
59             app_config.route_handlers.append(self.openapi_config.openapi_controller)
60         return app_config
61 
62     @property
63     def openapi_config(self) -> OpenAPIConfig:
64         if not self._openapi_config:
65             raise ImproperlyConfiguredException("OpenAPIConfig not initialized")
66         return self._openapi_config
67 
68     def receive_route(self, route: BaseRoute) -> None:
69         if not isinstance(route, HTTPRoute):
70             return
71 
72         if any(route_handler.resolve_include_in_schema() for route_handler, _ in route.route_handler_map.values()):
73             # Force recompute the schema if a new route is added
74             self._openapi_schema = None
75             self.included_routes[route.path] = route
76
```
--- 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/litestar/_openapi/path_item.py b/litestar/_openapi/path_item.py
--- a/litestar/_openapi/path_item.py
+++ b/litestar/_openapi/path_item.py
@@ -1,5 +1,6 @@
 from __future__ import annotations
 
+import dataclasses
 from inspect import cleandoc
 from typing import TYPE_CHECKING
 
@@ -8,6 +9,7 @@
 from litestar._openapi.responses import create_responses_for_handler
 from litestar._openapi.utils import SEPARATORS_CLEANUP_PATTERN
 from litestar.enums import HttpMethod
+from litestar.exceptions import ImproperlyConfiguredException
 from litestar.openapi.spec import Operation, PathItem
 from litestar.utils.helpers import unwrap_partial
 
@@ -16,7 +18,7 @@
     from litestar.handlers.http_handlers import HTTPRouteHandler
     from litestar.routes import HTTPRoute
 
-__all__ = ("create_path_item_for_route",)
+__all__ = ("create_path_item_for_route", "merge_path_item_operations")
 
 
 class PathItemFactory:
@@ -135,3 +137,32 @@
     """
     path_item_factory = PathItemFactory(openapi_context, route)
     return path_item_factory.create_path_item()
+
+
+def merge_path_item_operations(source: PathItem, other: PathItem, for_path: str) -> PathItem:
+    """Merge operations from path items, creating a new path item that includes
+    operations from both.
+    """
+    attrs_to_merge = {"get", "put", "post", "delete", "options", "head", "patch", "trace"}
+    fields = {f.name for f in dataclasses.fields(PathItem)} - attrs_to_merge
+    if any(getattr(source, attr) and getattr(other, attr) for attr in attrs_to_merge):
+        raise ValueError("Cannot merge operation for PathItem if operation is set on both items")
+
+    if differing_values := [
+        (value_a, value_b) for attr in fields if (value_a := getattr(source, attr)) != (value_b := getattr(other, attr))
+    ]:
+        raise ImproperlyConfiguredException(
+            f"Conflicting OpenAPI path configuration for {for_path!r}. "
+            f"{', '.join(f'{a} != {b}' for a, b in differing_values)}"
+        )
+
+    return dataclasses.replace(
+        source,
+        get=source.get or other.get,
+        post=source.post or other.post,
+        patch=source.patch or other.patch,
+        put=source.put or other.put,
+        delete=source.delete or other.delete,
+        options=source.options or other.options,
+        trace=source.trace or other.trace,
+    )
diff --git a/litestar/_openapi/plugin.py b/litestar/_openapi/plugin.py
--- a/litestar/_openapi/plugin.py
+++ b/litestar/_openapi/plugin.py
@@ -3,7 +3,7 @@
 from typing import TYPE_CHECKING
 
 from litestar._openapi.datastructures import OpenAPIContext
-from litestar._openapi.path_item import create_path_item_for_route
+from litestar._openapi.path_item import create_path_item_for_route, merge_path_item_operations
 from litestar.exceptions import ImproperlyConfiguredException
 from litestar.plugins import InitPluginProtocol
 from litestar.plugins.base import ReceiveRoutePlugin
@@ -13,7 +13,7 @@
     from litestar.app import Litestar
     from litestar.config.app import AppConfig
     from litestar.openapi.config import OpenAPIConfig
-    from litestar.openapi.spec import OpenAPI
+    from litestar.openapi.spec import OpenAPI, PathItem
     from litestar.routes import BaseRoute
 
 
@@ -41,10 +41,15 @@
 
         openapi = openapi_config.to_openapi_schema()
         context = OpenAPIContext(openapi_config=openapi_config, plugins=self.app.plugins.openapi)
-        openapi.paths = {
-            route.path_format or "/": create_path_item_for_route(context, route)
-            for route in self.included_routes.values()
-        }
+        path_items: dict[str, PathItem] = {}
+        for route in self.included_routes.values():
+            path = route.path_format or "/"
+            path_item = create_path_item_for_route(context, route)
+            if existing_path_item := path_items.get(path):
+                path_item = merge_path_item_operations(existing_path_item, path_item, for_path=path)
+            path_items[path] = path_item
+
+        openapi.paths = path_items
         openapi.components.schemas = context.schema_registry.generate_components_schemas()
         return openapi

{"golden_diff": "diff --git a/litestar/_openapi/path_item.py b/litestar/_openapi/path_item.py\n--- a/litestar/_openapi/path_item.py\n+++ b/litestar/_openapi/path_item.py\n@@ -1,5 +1,6 @@\n from __future__ import annotations\n \n+import dataclasses\n from inspect import cleandoc\n from typing import TYPE_CHECKING\n \n@@ -8,6 +9,7 @@\n from litestar._openapi.responses import create_responses_for_handler\n from litestar._openapi.utils import SEPARATORS_CLEANUP_PATTERN\n from litestar.enums import HttpMethod\n+from litestar.exceptions import ImproperlyConfiguredException\n from litestar.openapi.spec import Operation, PathItem\n from litestar.utils.helpers import unwrap_partial\n \n@@ -16,7 +18,7 @@\n     from litestar.handlers.http_handlers import HTTPRouteHandler\n     from litestar.routes import HTTPRoute\n \n-__all__ = (\"create_path_item_for_route\",)\n+__all__ = (\"create_path_item_for_route\", \"merge_path_item_operations\")\n \n \n class PathItemFactory:\n@@ -135,3 +137,32 @@\n     \"\"\"\n     path_item_factory = PathItemFactory(openapi_context, route)\n     return path_item_factory.create_path_item()\n+\n+\n+def merge_path_item_operations(source: PathItem, other: PathItem, for_path: str) -> PathItem:\n+    \"\"\"Merge operations from path items, creating a new path item that includes\n+    operations from both.\n+    \"\"\"\n+    attrs_to_merge = {\"get\", \"put\", \"post\", \"delete\", \"options\", \"head\", \"patch\", \"trace\"}\n+    fields = {f.name for f in dataclasses.fields(PathItem)} - attrs_to_merge\n+    if any(getattr(source, attr) and getattr(other, attr) for attr in attrs_to_merge):\n+        raise ValueError(\"Cannot merge operation for PathItem if operation is set on both items\")\n+\n+    if differing_values := [\n+        (value_a, value_b) for attr in fields if (value_a := getattr(source, attr)) != (value_b := getattr(other, attr))\n+    ]:\n+        raise ImproperlyConfiguredException(\n+            f\"Conflicting OpenAPI path configuration for {for_path!r}. \"\n+            f\"{', '.join(f'{a} != {b}' for a, b in differing_values)}\"\n+        )\n+\n+    return dataclasses.replace(\n+        source,\n+        get=source.get or other.get,\n+        post=source.post or other.post,\n+        patch=source.patch or other.patch,\n+        put=source.put or other.put,\n+        delete=source.delete or other.delete,\n+        options=source.options or other.options,\n+        trace=source.trace or other.trace,\n+    )\ndiff --git a/litestar/_openapi/plugin.py b/litestar/_openapi/plugin.py\n--- a/litestar/_openapi/plugin.py\n+++ b/litestar/_openapi/plugin.py\n@@ -3,7 +3,7 @@\n from typing import TYPE_CHECKING\n \n from litestar._openapi.datastructures import OpenAPIContext\n-from litestar._openapi.path_item import create_path_item_for_route\n+from litestar._openapi.path_item import create_path_item_for_route, merge_path_item_operations\n from litestar.exceptions import ImproperlyConfiguredException\n from litestar.plugins import InitPluginProtocol\n from litestar.plugins.base import ReceiveRoutePlugin\n@@ -13,7 +13,7 @@\n     from litestar.app import Litestar\n     from litestar.config.app import AppConfig\n     from litestar.openapi.config import OpenAPIConfig\n-    from litestar.openapi.spec import OpenAPI\n+    from litestar.openapi.spec import OpenAPI, PathItem\n     from litestar.routes import BaseRoute\n \n \n@@ -41,10 +41,15 @@\n \n         openapi = openapi_config.to_openapi_schema()\n         context = OpenAPIContext(openapi_config=openapi_config, plugins=self.app.plugins.openapi)\n-        openapi.paths = {\n-            route.path_format or \"/\": create_path_item_for_route(context, route)\n-            for route in self.included_routes.values()\n-        }\n+        path_items: dict[str, PathItem] = {}\n+        for route in self.included_routes.values():\n+            path = route.path_format or \"/\"\n+            path_item = create_path_item_for_route(context, route)\n+            if existing_path_item := path_items.get(path):\n+                path_item = merge_path_item_operations(existing_path_item, path_item, for_path=path)\n+            path_items[path] = path_item\n+\n+        openapi.paths = path_items\n         openapi.components.schemas = context.schema_registry.generate_components_schemas()\n         return openapi\n", "issue": "Bug: route not recognized in schemas for specific types\n### Description\r\n\r\nCurrently some parameters types don't show in the docs. It seems `int` works fine, while `str` and `uuid` don't.\r\nThis is silent, no logs are shown, running `debug` mode. Same behavior for both `/schema/elements` and `/schema/swagger`.\r\n\r\n### URL to code causing the issue\r\n\r\n_No response_\r\n\r\n### MCVE\r\n\r\n```python\r\n(Uncomment one at a time)\r\n\r\n\r\nclass BugRoutes(Controller):\r\n    tags = [\"Bugs\"]\r\n    path = \"/bugs\"\r\n    dependencies = dict(context=Provide(route_context))\r\n\r\n    @routes.get()\r\n    def get_bugs(self, context: AppContext) -> Response:\r\n        return Response({})\r\n\r\n    @routes.post()\r\n    def create_bug(self, context: AppContext, data: Any) -> Response:\r\n        return Response({})\r\n\r\n    # This works\r\n    # @routes.get(\"/{param:int}\")\r\n    # def get_bug(self, context: AppContext, param: int) -> Response:\r\n    #    return Response({})\r\n\r\n    # This doesn't work (not showing on docs)\r\n    # @routes.get(\"/{param:str}\")\r\n    # def get_bug_str(self, context: AppContext, param: str) -> Response:\r\n    #    return Response({})\r\n\r\n    # This doesn't work (not showing on docs)\r\n    # @routes.get(\"/{param:uuid}\")\r\n    # def get_bug_uuid(self, context: AppContext, param: UUID) -> Response:\r\n    #    return Response({})\r\n\r\n    @routes.patch(\"/{param:int}\")\r\n    def update_bug(self, context: AppContext, param: int) -> Response:\r\n        return Response({})\r\n\r\n    @routes.delete(\"/{param:int}\")\r\n    def delete_bug(self, context: AppContext, param: int) -> None:\r\n        return Response({})\r\n```\r\n\r\n\r\n### Steps to reproduce\r\n\r\n_No response_\r\n\r\n### Screenshots\r\n\r\n_No response_\r\n\r\n### Logs\r\n\r\n_No response_\r\n\r\n### Litestar Version\r\n\r\n2.3.2\r\n\r\n### Platform\r\n\r\n- [X] Mac\r\n- [ ] Linux\r\n- [ ] Windows\r\n- [ ] Other (Please specify in the description above)\r\n\r\n<!-- POLAR PLEDGE BADGE START -->\r\n---\r\n> [!NOTE]  \r\n> While we are open for sponsoring on [GitHub Sponsors](https://github.com/sponsors/litestar-org/) and \r\n> [OpenCollective](https://opencollective.com/litestar), we also utilize [Polar.sh](https://polar.sh/) to engage in pledge-based sponsorship.\r\n>\r\n> Check out all issues funded or available for funding [on our Polar.sh Litestar dashboard](https://polar.sh/litestar-org)\r\n> * If you would like to see an issue prioritized, make a pledge towards it!\r\n> * We receive the pledge once the issue is completed & verified\r\n> * This, along with engagement in the community, helps us know which features are a priority to our users.\r\n\r\n<a href=\"https://polar.sh/litestar-org/litestar/issues/2700\">\r\n<picture>\r\n  <source media=\"(prefers-color-scheme: dark)\" srcset=\"https://polar.sh/api/github/litestar-org/litestar/issues/2700/pledge.svg?darkmode=1\">\r\n  <img alt=\"Fund with Polar\" src=\"https://polar.sh/api/github/litestar-org/litestar/issues/2700/pledge.svg\">\r\n</picture>\r\n</a>\r\n<!-- POLAR PLEDGE BADGE END -->\r\n\n", "before_files": [{"content": "from __future__ import annotations\n\nfrom inspect import cleandoc\nfrom typing import TYPE_CHECKING\n\nfrom litestar._openapi.parameters import create_parameters_for_handler\nfrom litestar._openapi.request_body import create_request_body\nfrom litestar._openapi.responses import create_responses_for_handler\nfrom litestar._openapi.utils import SEPARATORS_CLEANUP_PATTERN\nfrom litestar.enums import HttpMethod\nfrom litestar.openapi.spec import Operation, PathItem\nfrom litestar.utils.helpers import unwrap_partial\n\nif TYPE_CHECKING:\n    from litestar._openapi.datastructures import OpenAPIContext\n    from litestar.handlers.http_handlers import HTTPRouteHandler\n    from litestar.routes import HTTPRoute\n\n__all__ = (\"create_path_item_for_route\",)\n\n\nclass PathItemFactory:\n    \"\"\"Factory for creating a PathItem instance for a given route.\"\"\"\n\n    def __init__(self, openapi_context: OpenAPIContext, route: HTTPRoute) -> None:\n        self.context = openapi_context\n        self.route = route\n        self._path_item = PathItem()\n\n    def create_path_item(self) -> PathItem:\n        \"\"\"Create a PathItem for the given route parsing all http_methods into Operation Models.\n\n        Returns:\n            A PathItem instance.\n        \"\"\"\n        for http_method, handler_tuple in self.route.route_handler_map.items():\n            route_handler, _ = handler_tuple\n\n            if not route_handler.resolve_include_in_schema():\n                continue\n\n            operation = self.create_operation_for_handler_method(route_handler, HttpMethod(http_method))\n\n            setattr(self._path_item, http_method.lower(), operation)\n\n        return self._path_item\n\n    def create_operation_for_handler_method(\n        self, route_handler: HTTPRouteHandler, http_method: HttpMethod\n    ) -> Operation:\n        \"\"\"Create an Operation instance for a given route handler and http method.\n\n        Args:\n            route_handler: A route handler instance.\n            http_method: An HttpMethod enum value.\n\n        Returns:\n            An Operation instance.\n        \"\"\"\n        operation_id = self.create_operation_id(route_handler, http_method)\n        parameters = create_parameters_for_handler(self.context, route_handler, self.route.path_parameters)\n        signature_fields = route_handler.parsed_fn_signature.parameters\n\n        request_body = None\n        if data_field := signature_fields.get(\"data\"):\n            request_body = create_request_body(\n                self.context, route_handler.handler_id, route_handler.resolve_data_dto(), data_field\n            )\n\n        raises_validation_error = bool(data_field or self._path_item.parameters or parameters)\n        responses = create_responses_for_handler(\n            self.context, route_handler, raises_validation_error=raises_validation_error\n        )\n\n        return route_handler.operation_class(\n            operation_id=operation_id,\n            tags=route_handler.resolve_tags() or None,\n            summary=route_handler.summary or SEPARATORS_CLEANUP_PATTERN.sub(\"\", route_handler.handler_name.title()),\n            description=self.create_description_for_handler(route_handler),\n            deprecated=route_handler.deprecated,\n            responses=responses,\n            request_body=request_body,\n            parameters=parameters or None,  # type: ignore[arg-type]\n            security=route_handler.resolve_security() or None,\n        )\n\n    def create_operation_id(self, route_handler: HTTPRouteHandler, http_method: HttpMethod) -> str:\n        \"\"\"Create an operation id for a given route handler and http method.\n\n        Adds the operation id to the context's operation id set, where it is checked for uniqueness.\n\n        Args:\n            route_handler: A route handler instance.\n            http_method: An HttpMethod enum value.\n\n        Returns:\n            An operation id string.\n        \"\"\"\n        if isinstance(route_handler.operation_id, str):\n            operation_id = route_handler.operation_id\n        elif callable(route_handler.operation_id):\n            operation_id = route_handler.operation_id(route_handler, http_method, self.route.path_components)\n        else:\n            operation_id = self.context.openapi_config.operation_id_creator(\n                route_handler, http_method, self.route.path_components\n            )\n        self.context.add_operation_id(operation_id)\n        return operation_id\n\n    def create_description_for_handler(self, route_handler: HTTPRouteHandler) -> str | None:\n        \"\"\"Produce the operation description for a route handler.\n\n        Args:\n            route_handler: A route handler instance.\n\n        Returns:\n            An optional description string\n        \"\"\"\n        handler_description = route_handler.description\n        if handler_description is None and self.context.openapi_config.use_handler_docstrings:\n            fn = unwrap_partial(route_handler.fn)\n            return cleandoc(fn.__doc__) if fn.__doc__ else None\n        return handler_description\n\n\ndef create_path_item_for_route(openapi_context: OpenAPIContext, route: HTTPRoute) -> PathItem:\n    \"\"\"Create a PathItem for the given route parsing all http_methods into Operation Models.\n\n    Args:\n        openapi_context: The OpenAPIContext instance.\n        route: The route to create a PathItem for.\n\n    Returns:\n        A PathItem instance.\n    \"\"\"\n    path_item_factory = PathItemFactory(openapi_context, route)\n    return path_item_factory.create_path_item()\n", "path": "litestar/_openapi/path_item.py"}, {"content": "from __future__ import annotations\n\nfrom typing import TYPE_CHECKING\n\nfrom litestar._openapi.datastructures import OpenAPIContext\nfrom litestar._openapi.path_item import create_path_item_for_route\nfrom litestar.exceptions import ImproperlyConfiguredException\nfrom litestar.plugins import InitPluginProtocol\nfrom litestar.plugins.base import ReceiveRoutePlugin\nfrom litestar.routes import HTTPRoute\n\nif TYPE_CHECKING:\n    from litestar.app import Litestar\n    from litestar.config.app import AppConfig\n    from litestar.openapi.config import OpenAPIConfig\n    from litestar.openapi.spec import OpenAPI\n    from litestar.routes import BaseRoute\n\n\nclass OpenAPIPlugin(InitPluginProtocol, ReceiveRoutePlugin):\n    __slots__ = (\n        \"app\",\n        \"included_routes\",\n        \"_openapi_config\",\n        \"_openapi_schema\",\n    )\n\n    def __init__(self, app: Litestar) -> None:\n        self.app = app\n        self.included_routes: dict[str, HTTPRoute] = {}\n        self._openapi_config: OpenAPIConfig | None = None\n        self._openapi_schema: OpenAPI | None = None\n\n    def _build_openapi_schema(self) -> OpenAPI:\n        openapi_config = self.openapi_config\n\n        if openapi_config.create_examples:\n            from litestar._openapi.schema_generation.examples import ExampleFactory\n\n            ExampleFactory.seed_random(openapi_config.random_seed)\n\n        openapi = openapi_config.to_openapi_schema()\n        context = OpenAPIContext(openapi_config=openapi_config, plugins=self.app.plugins.openapi)\n        openapi.paths = {\n            route.path_format or \"/\": create_path_item_for_route(context, route)\n            for route in self.included_routes.values()\n        }\n        openapi.components.schemas = context.schema_registry.generate_components_schemas()\n        return openapi\n\n    def provide_openapi(self) -> OpenAPI:\n        if not self._openapi_schema:\n            self._openapi_schema = self._build_openapi_schema()\n        return self._openapi_schema\n\n    def on_app_init(self, app_config: AppConfig) -> AppConfig:\n        if app_config.openapi_config:\n            self._openapi_config = app_config.openapi_config\n            app_config.route_handlers.append(self.openapi_config.openapi_controller)\n        return app_config\n\n    @property\n    def openapi_config(self) -> OpenAPIConfig:\n        if not self._openapi_config:\n            raise ImproperlyConfiguredException(\"OpenAPIConfig not initialized\")\n        return self._openapi_config\n\n    def receive_route(self, route: BaseRoute) -> None:\n        if not isinstance(route, HTTPRoute):\n            return\n\n        if any(route_handler.resolve_include_in_schema() for route_handler, _ in route.route_handler_map.values()):\n            # Force recompute the schema if a new route is added\n            self._openapi_schema = None\n            self.included_routes[route.path] = route\n", "path": "litestar/_openapi/plugin.py"}], "after_files": [{"content": "from __future__ import annotations\n\nimport dataclasses\nfrom inspect import cleandoc\nfrom typing import TYPE_CHECKING\n\nfrom litestar._openapi.parameters import create_parameters_for_handler\nfrom litestar._openapi.request_body import create_request_body\nfrom litestar._openapi.responses import create_responses_for_handler\nfrom litestar._openapi.utils import SEPARATORS_CLEANUP_PATTERN\nfrom litestar.enums import HttpMethod\nfrom litestar.exceptions import ImproperlyConfiguredException\nfrom litestar.openapi.spec import Operation, PathItem\nfrom litestar.utils.helpers import unwrap_partial\n\nif TYPE_CHECKING:\n    from litestar._openapi.datastructures import OpenAPIContext\n    from litestar.handlers.http_handlers import HTTPRouteHandler\n    from litestar.routes import HTTPRoute\n\n__all__ = (\"create_path_item_for_route\", \"merge_path_item_operations\")\n\n\nclass PathItemFactory:\n    \"\"\"Factory for creating a PathItem instance for a given route.\"\"\"\n\n    def __init__(self, openapi_context: OpenAPIContext, route: HTTPRoute) -> None:\n        self.context = openapi_context\n        self.route = route\n        self._path_item = PathItem()\n\n    def create_path_item(self) -> PathItem:\n        \"\"\"Create a PathItem for the given route parsing all http_methods into Operation Models.\n\n        Returns:\n            A PathItem instance.\n        \"\"\"\n        for http_method, handler_tuple in self.route.route_handler_map.items():\n            route_handler, _ = handler_tuple\n\n            if not route_handler.resolve_include_in_schema():\n                continue\n\n            operation = self.create_operation_for_handler_method(route_handler, HttpMethod(http_method))\n\n            setattr(self._path_item, http_method.lower(), operation)\n\n        return self._path_item\n\n    def create_operation_for_handler_method(\n        self, route_handler: HTTPRouteHandler, http_method: HttpMethod\n    ) -> Operation:\n        \"\"\"Create an Operation instance for a given route handler and http method.\n\n        Args:\n            route_handler: A route handler instance.\n            http_method: An HttpMethod enum value.\n\n        Returns:\n            An Operation instance.\n        \"\"\"\n        operation_id = self.create_operation_id(route_handler, http_method)\n        parameters = create_parameters_for_handler(self.context, route_handler, self.route.path_parameters)\n        signature_fields = route_handler.parsed_fn_signature.parameters\n\n        request_body = None\n        if data_field := signature_fields.get(\"data\"):\n            request_body = create_request_body(\n                self.context, route_handler.handler_id, route_handler.resolve_data_dto(), data_field\n            )\n\n        raises_validation_error = bool(data_field or self._path_item.parameters or parameters)\n        responses = create_responses_for_handler(\n            self.context, route_handler, raises_validation_error=raises_validation_error\n        )\n\n        return route_handler.operation_class(\n            operation_id=operation_id,\n            tags=route_handler.resolve_tags() or None,\n            summary=route_handler.summary or SEPARATORS_CLEANUP_PATTERN.sub(\"\", route_handler.handler_name.title()),\n            description=self.create_description_for_handler(route_handler),\n            deprecated=route_handler.deprecated,\n            responses=responses,\n            request_body=request_body,\n            parameters=parameters or None,  # type: ignore[arg-type]\n            security=route_handler.resolve_security() or None,\n        )\n\n    def create_operation_id(self, route_handler: HTTPRouteHandler, http_method: HttpMethod) -> str:\n        \"\"\"Create an operation id for a given route handler and http method.\n\n        Adds the operation id to the context's operation id set, where it is checked for uniqueness.\n\n        Args:\n            route_handler: A route handler instance.\n            http_method: An HttpMethod enum value.\n\n        Returns:\n            An operation id string.\n        \"\"\"\n        if isinstance(route_handler.operation_id, str):\n            operation_id = route_handler.operation_id\n        elif callable(route_handler.operation_id):\n            operation_id = route_handler.operation_id(route_handler, http_method, self.route.path_components)\n        else:\n            operation_id = self.context.openapi_config.operation_id_creator(\n                route_handler, http_method, self.route.path_components\n            )\n        self.context.add_operation_id(operation_id)\n        return operation_id\n\n    def create_description_for_handler(self, route_handler: HTTPRouteHandler) -> str | None:\n        \"\"\"Produce the operation description for a route handler.\n\n        Args:\n            route_handler: A route handler instance.\n\n        Returns:\n            An optional description string\n        \"\"\"\n        handler_description = route_handler.description\n        if handler_description is None and self.context.openapi_config.use_handler_docstrings:\n            fn = unwrap_partial(route_handler.fn)\n            return cleandoc(fn.__doc__) if fn.__doc__ else None\n        return handler_description\n\n\ndef create_path_item_for_route(openapi_context: OpenAPIContext, route: HTTPRoute) -> PathItem:\n    \"\"\"Create a PathItem for the given route parsing all http_methods into Operation Models.\n\n    Args:\n        openapi_context: The OpenAPIContext instance.\n        route: The route to create a PathItem for.\n\n    Returns:\n        A PathItem instance.\n    \"\"\"\n    path_item_factory = PathItemFactory(openapi_context, route)\n    return path_item_factory.create_path_item()\n\n\ndef merge_path_item_operations(source: PathItem, other: PathItem, for_path: str) -> PathItem:\n    \"\"\"Merge operations from path items, creating a new path item that includes\n    operations from both.\n    \"\"\"\n    attrs_to_merge = {\"get\", \"put\", \"post\", \"delete\", \"options\", \"head\", \"patch\", \"trace\"}\n    fields = {f.name for f in dataclasses.fields(PathItem)} - attrs_to_merge\n    if any(getattr(source, attr) and getattr(other, attr) for attr in attrs_to_merge):\n        raise ValueError(\"Cannot merge operation for PathItem if operation is set on both items\")\n\n    if differing_values := [\n        (value_a, value_b) for attr in fields if (value_a := getattr(source, attr)) != (value_b := getattr(other, attr))\n    ]:\n        raise ImproperlyConfiguredException(\n            f\"Conflicting OpenAPI path configuration for {for_path!r}. \"\n            f\"{', '.join(f'{a} != {b}' for a, b in differing_values)}\"\n        )\n\n    return dataclasses.replace(\n        source,\n        get=source.get or other.get,\n        post=source.post or other.post,\n        patch=source.patch or other.patch,\n        put=source.put or other.put,\n        delete=source.delete or other.delete,\n        options=source.options or other.options,\n        trace=source.trace or other.trace,\n    )\n", "path": "litestar/_openapi/path_item.py"}, {"content": "from __future__ import annotations\n\nfrom typing import TYPE_CHECKING\n\nfrom litestar._openapi.datastructures import OpenAPIContext\nfrom litestar._openapi.path_item import create_path_item_for_route, merge_path_item_operations\nfrom litestar.exceptions import ImproperlyConfiguredException\nfrom litestar.plugins import InitPluginProtocol\nfrom litestar.plugins.base import ReceiveRoutePlugin\nfrom litestar.routes import HTTPRoute\n\nif TYPE_CHECKING:\n    from litestar.app import Litestar\n    from litestar.config.app import AppConfig\n    from litestar.openapi.config import OpenAPIConfig\n    from litestar.openapi.spec import OpenAPI, PathItem\n    from litestar.routes import BaseRoute\n\n\nclass OpenAPIPlugin(InitPluginProtocol, ReceiveRoutePlugin):\n    __slots__ = (\n        \"app\",\n        \"included_routes\",\n        \"_openapi_config\",\n        \"_openapi_schema\",\n    )\n\n    def __init__(self, app: Litestar) -> None:\n        self.app = app\n        self.included_routes: dict[str, HTTPRoute] = {}\n        self._openapi_config: OpenAPIConfig | None = None\n        self._openapi_schema: OpenAPI | None = None\n\n    def _build_openapi_schema(self) -> OpenAPI:\n        openapi_config = self.openapi_config\n\n        if openapi_config.create_examples:\n            from litestar._openapi.schema_generation.examples import ExampleFactory\n\n            ExampleFactory.seed_random(openapi_config.random_seed)\n\n        openapi = openapi_config.to_openapi_schema()\n        context = OpenAPIContext(openapi_config=openapi_config, plugins=self.app.plugins.openapi)\n        path_items: dict[str, PathItem] = {}\n        for route in self.included_routes.values():\n            path = route.path_format or \"/\"\n            path_item = create_path_item_for_route(context, route)\n            if existing_path_item := path_items.get(path):\n                path_item = merge_path_item_operations(existing_path_item, path_item, for_path=path)\n            path_items[path] = path_item\n\n        openapi.paths = path_items\n        openapi.components.schemas = context.schema_registry.generate_components_schemas()\n        return openapi\n\n    def provide_openapi(self) -> OpenAPI:\n        if not self._openapi_schema:\n            self._openapi_schema = self._build_openapi_schema()\n        return self._openapi_schema\n\n    def on_app_init(self, app_config: AppConfig) -> AppConfig:\n        if app_config.openapi_config:\n            self._openapi_config = app_config.openapi_config\n            app_config.route_handlers.append(self.openapi_config.openapi_controller)\n        return app_config\n\n    @property\n    def openapi_config(self) -> OpenAPIConfig:\n        if not self._openapi_config:\n            raise ImproperlyConfiguredException(\"OpenAPIConfig not initialized\")\n        return self._openapi_config\n\n    def receive_route(self, route: BaseRoute) -> None:\n        if not isinstance(route, HTTPRoute):\n            return\n\n        if any(route_handler.resolve_include_in_schema() for route_handler, _ in route.route_handler_map.values()):\n            # Force recompute the schema if a new route is added\n            self._openapi_schema = None\n            self.included_routes[route.path] = route\n", "path": "litestar/_openapi/plugin.py"}]}