We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Bug: openapi schema generation fails for Union of/in msgspec.Struct models
### Description

Hello!

In the latest versions(s) (I think this originates from the changes regarding nested models in openapi generation) we cannot use Unions of `msgspec.Struct`s anymore. Neither as direct return types for routes nor nested within return types. 

The result is a 500 Error. The MCVE below raises `'types.UnionType' object has no attribute '__qualname__'` internally. In our production app I get `typing.Union is not a module, class, method, or function.` instead.

Cheers

### URL to code causing the issue

_No response_

### MCVE

```python
import msgspec
import uvicorn
from litestar import Litestar, get


class SubStructA(msgspec.Struct):
    a: int


class SubStructB(msgspec.Struct):
    a: int


class StructyStruct(msgspec.Struct):
    sub: SubStructA | SubStructB


@get("/subunion")
async def testSubUnion() -> StructyStruct:
    return StructyStruct(SubStructA(0))


@get("/union")
async def testUnion() -> SubStructA | SubStructB:
    return SubStructA(0)


app = Litestar(route_handlers=[test2]) # or test
uvicorn.run(app)
```


### Steps to reproduce

```bash
Run the example and browse to `localhost:8000/schema`
```


### Screenshots

_No response_

### Logs

_No response_

### Litestar Version

2.5.0

### Platform

- [X] Linux
- [ ] Mac
- [ ] 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 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/2971">
<picture>
  <source media="(prefers-color-scheme: dark)" srcset="https://polar.sh/api/github/litestar-org/litestar/issues/2971/pledge.svg?darkmode=1">
  <img alt="Fund with Polar" src="https://polar.sh/api/github/litestar-org/litestar/issues/2971/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/schema_generation/plugins/struct.py`
Content:
```
1 from __future__ import annotations
2 
3 from typing import TYPE_CHECKING
4 
5 from msgspec import Struct
6 from msgspec.structs import fields
7 
8 from litestar.plugins import OpenAPISchemaPlugin
9 from litestar.types.empty import Empty
10 from litestar.typing import FieldDefinition
11 from litestar.utils.predicates import is_optional_union
12 
13 if TYPE_CHECKING:
14     from msgspec.structs import FieldInfo
15 
16     from litestar._openapi.schema_generation import SchemaCreator
17     from litestar.openapi.spec import Schema
18 
19 
20 class StructSchemaPlugin(OpenAPISchemaPlugin):
21     def is_plugin_supported_field(self, field_definition: FieldDefinition) -> bool:
22         return field_definition.is_subclass_of(Struct)
23 
24     def to_openapi_schema(self, field_definition: FieldDefinition, schema_creator: SchemaCreator) -> Schema:
25         def is_field_required(field: FieldInfo) -> bool:
26             return field.required or field.default_factory is Empty
27 
28         type_hints = field_definition.get_type_hints(include_extras=True, resolve_generics=True)
29         struct_fields = fields(field_definition.type_)
30 
31         return schema_creator.create_component_schema(
32             field_definition,
33             required=sorted(
34                 [
35                     field.encode_name
36                     for field in struct_fields
37                     if is_field_required(field=field) and not is_optional_union(type_hints[field.name])
38                 ]
39             ),
40             property_fields={
41                 field.encode_name: FieldDefinition.from_kwarg(type_hints[field.name], field.encode_name)
42                 for field in struct_fields
43             },
44         )
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()

```

diff --git a/litestar/_openapi/schema_generation/plugins/struct.py b/litestar/_openapi/schema_generation/plugins/struct.py
--- a/litestar/_openapi/schema_generation/plugins/struct.py
+++ b/litestar/_openapi/schema_generation/plugins/struct.py
@@ -19,7 +19,7 @@
 
 class StructSchemaPlugin(OpenAPISchemaPlugin):
     def is_plugin_supported_field(self, field_definition: FieldDefinition) -> bool:
-        return field_definition.is_subclass_of(Struct)
+        return not field_definition.is_union and field_definition.is_subclass_of(Struct)
 
     def to_openapi_schema(self, field_definition: FieldDefinition, schema_creator: SchemaCreator) -> Schema:
         def is_field_required(field: FieldInfo) -> bool:

{"golden_diff": "diff --git a/litestar/_openapi/schema_generation/plugins/struct.py b/litestar/_openapi/schema_generation/plugins/struct.py\n--- a/litestar/_openapi/schema_generation/plugins/struct.py\n+++ b/litestar/_openapi/schema_generation/plugins/struct.py\n@@ -19,7 +19,7 @@\n \n class StructSchemaPlugin(OpenAPISchemaPlugin):\n     def is_plugin_supported_field(self, field_definition: FieldDefinition) -> bool:\n-        return field_definition.is_subclass_of(Struct)\n+        return not field_definition.is_union and field_definition.is_subclass_of(Struct)\n \n     def to_openapi_schema(self, field_definition: FieldDefinition, schema_creator: SchemaCreator) -> Schema:\n         def is_field_required(field: FieldInfo) -> bool:\n", "issue": "Bug: openapi schema generation fails for Union of/in msgspec.Struct models\n### Description\r\n\r\nHello!\r\n\r\nIn the latest versions(s) (I think this originates from the changes regarding nested models in openapi generation) we cannot use Unions of `msgspec.Struct`s anymore. Neither as direct return types for routes nor nested within return types. \r\n\r\nThe result is a 500 Error. The MCVE below raises `'types.UnionType' object has no attribute '__qualname__'` internally. In our production app I get `typing.Union is not a module, class, method, or function.` instead.\r\n\r\nCheers\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\nimport msgspec\r\nimport uvicorn\r\nfrom litestar import Litestar, get\r\n\r\n\r\nclass SubStructA(msgspec.Struct):\r\n    a: int\r\n\r\n\r\nclass SubStructB(msgspec.Struct):\r\n    a: int\r\n\r\n\r\nclass StructyStruct(msgspec.Struct):\r\n    sub: SubStructA | SubStructB\r\n\r\n\r\n@get(\"/subunion\")\r\nasync def testSubUnion() -> StructyStruct:\r\n    return StructyStruct(SubStructA(0))\r\n\r\n\r\n@get(\"/union\")\r\nasync def testUnion() -> SubStructA | SubStructB:\r\n    return SubStructA(0)\r\n\r\n\r\napp = Litestar(route_handlers=[test2]) # or test\r\nuvicorn.run(app)\r\n```\r\n\r\n\r\n### Steps to reproduce\r\n\r\n```bash\r\nRun the example and browse to `localhost:8000/schema`\r\n```\r\n\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.5.0\r\n\r\n### Platform\r\n\r\n- [X] Linux\r\n- [ ] Mac\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 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/2971\">\r\n<picture>\r\n  <source media=\"(prefers-color-scheme: dark)\" srcset=\"https://polar.sh/api/github/litestar-org/litestar/issues/2971/pledge.svg?darkmode=1\">\r\n  <img alt=\"Fund with Polar\" src=\"https://polar.sh/api/github/litestar-org/litestar/issues/2971/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 typing import TYPE_CHECKING\n\nfrom msgspec import Struct\nfrom msgspec.structs import fields\n\nfrom litestar.plugins import OpenAPISchemaPlugin\nfrom litestar.types.empty import Empty\nfrom litestar.typing import FieldDefinition\nfrom litestar.utils.predicates import is_optional_union\n\nif TYPE_CHECKING:\n    from msgspec.structs import FieldInfo\n\n    from litestar._openapi.schema_generation import SchemaCreator\n    from litestar.openapi.spec import Schema\n\n\nclass StructSchemaPlugin(OpenAPISchemaPlugin):\n    def is_plugin_supported_field(self, field_definition: FieldDefinition) -> bool:\n        return field_definition.is_subclass_of(Struct)\n\n    def to_openapi_schema(self, field_definition: FieldDefinition, schema_creator: SchemaCreator) -> Schema:\n        def is_field_required(field: FieldInfo) -> bool:\n            return field.required or field.default_factory is Empty\n\n        type_hints = field_definition.get_type_hints(include_extras=True, resolve_generics=True)\n        struct_fields = fields(field_definition.type_)\n\n        return schema_creator.create_component_schema(\n            field_definition,\n            required=sorted(\n                [\n                    field.encode_name\n                    for field in struct_fields\n                    if is_field_required(field=field) and not is_optional_union(type_hints[field.name])\n                ]\n            ),\n            property_fields={\n                field.encode_name: FieldDefinition.from_kwarg(type_hints[field.name], field.encode_name)\n                for field in struct_fields\n            },\n        )\n", "path": "litestar/_openapi/schema_generation/plugins/struct.py"}], "after_files": [{"content": "from __future__ import annotations\n\nfrom typing import TYPE_CHECKING\n\nfrom msgspec import Struct\nfrom msgspec.structs import fields\n\nfrom litestar.plugins import OpenAPISchemaPlugin\nfrom litestar.types.empty import Empty\nfrom litestar.typing import FieldDefinition\nfrom litestar.utils.predicates import is_optional_union\n\nif TYPE_CHECKING:\n    from msgspec.structs import FieldInfo\n\n    from litestar._openapi.schema_generation import SchemaCreator\n    from litestar.openapi.spec import Schema\n\n\nclass StructSchemaPlugin(OpenAPISchemaPlugin):\n    def is_plugin_supported_field(self, field_definition: FieldDefinition) -> bool:\n        return not field_definition.is_union and field_definition.is_subclass_of(Struct)\n\n    def to_openapi_schema(self, field_definition: FieldDefinition, schema_creator: SchemaCreator) -> Schema:\n        def is_field_required(field: FieldInfo) -> bool:\n            return field.required or field.default_factory is Empty\n\n        type_hints = field_definition.get_type_hints(include_extras=True, resolve_generics=True)\n        struct_fields = fields(field_definition.type_)\n\n        return schema_creator.create_component_schema(\n            field_definition,\n            required=sorted(\n                [\n                    field.encode_name\n                    for field in struct_fields\n                    if is_field_required(field=field) and not is_optional_union(type_hints[field.name])\n                ]\n            ),\n            property_fields={\n                field.encode_name: FieldDefinition.from_kwarg(type_hints[field.name], field.encode_name)\n                for field in struct_fields\n            },\n        )\n", "path": "litestar/_openapi/schema_generation/plugins/struct.py"}]}