Repository: litestar-org/litestar

Issue:
Bug: schema generation crashes in 2.7.1
### Description

Using 2.7.0, I code view the "/schema" page of my app without problem, but with 2.7.1, I get internal server error 500 back. I ran it with debug and got this:

`'str' object has no attribute 'value'`

and a trace pointing to this line: https://github.com/litestar-org/litestar/blob/main/litestar/_openapi/schema_generation/utils.py#L114
as called from [litestar/_openapi/schema_generation/schema.py in SchemaCreator.process_schema_result at line 561](https://github.com/litestar-org/litestar/blob/main/litestar/_openapi/schema_generation/schema.py#L561)

I believe the error comes from this PR: https://github.com/litestar-org/litestar/pull/3224/files

The problem is triggered by _pydantic models with examples_ in the `json_schema_extra`. See MCVE. The examples being strings trigger this problem, but I am sure that other types would trigger similar errors.

### URL to code causing the issue

_No response_

### MCVE

```python

import litestar
import pydantic  # v2
from litestar.testing import create_test_client


class Foo(pydantic.BaseModel):
    bar: str = pydantic.Field(
        json_schema_extra={
            "examples": ["this-is-a-string"]
        }
    )


@litestar.get()
async def get_foo() -> Foo:
    ...


with create_test_client([get_foo]) as client:
    resp = client.get("/schema/openapi.json")
    print(resp.status_code)  # 500

```


### Steps to reproduce

Run the above MCVE. It prints 500. Remove the examples from `json_schema_extra` and it prints 200.


### Screenshots

```bash
"![SCREENSHOT_DESCRIPTION](SCREENSHOT_LINK.png)"
```


### Logs

_No response_

### Litestar Version

2.7.1

### 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/3277">
<picture>
  <source media="(prefers-color-scheme: dark)" srcset="https://polar.sh/api/github/litestar-org/litestar/issues/3277/pledge.svg?darkmode=1">
  <img alt="Fund with Polar" src="https://polar.sh/api/github/litestar-org/litestar/issues/3277/pledge.svg">
</picture>
</a>
<!-- POLAR PLEDGE BADGE END -->



Discussion:
I might have a fix. You can assign this to me for now.

Resolving patch:
diff --git a/litestar/typing.py b/litestar/typing.py
--- a/litestar/typing.py
+++ b/litestar/typing.py
@@ -96,7 +96,7 @@ def _parse_metadata(value: Any, is_sequence_container: bool, extra: dict[str, An
     example_list: list[Any] | None
     if example := extra.pop("example", None):
         example_list = [Example(value=example)]
-    elif examples := getattr(value, "examples", None):
+    elif examples := (extra.pop("examples", None) or getattr(value, "examples", None)):
         example_list = [Example(value=example) for example in cast("list[str]", examples)]
     else:
         example_list = None


Test patch:
diff --git a/tests/unit/test_contrib/test_pydantic/test_openapi.py b/tests/unit/test_contrib/test_pydantic/test_openapi.py
--- a/tests/unit/test_contrib/test_pydantic/test_openapi.py
+++ b/tests/unit/test_contrib/test_pydantic/test_openapi.py
@@ -553,6 +553,26 @@ class Model(pydantic_v2.BaseModel):
     assert value.examples == ["example"]
 
 
+def test_create_schema_for_field_v2__examples() -> None:
+    class Model(pydantic_v2.BaseModel):
+        value: str = pydantic_v2.Field(
+            title="title", description="description", max_length=16, json_schema_extra={"examples": ["example"]}
+        )
+
+    schema = get_schema_for_field_definition(
+        FieldDefinition.from_kwarg(name="Model", annotation=Model), plugins=[PydanticSchemaPlugin()]
+    )
+
+    assert schema.properties
+
+    value = schema.properties["value"]
+
+    assert isinstance(value, Schema)
+    assert value.description == "description"
+    assert value.title == "title"
+    assert value.examples == ["example"]
+
+
 @pytest.mark.parametrize("with_future_annotations", [True, False])
 def test_create_schema_for_pydantic_model_with_annotated_model_attribute(
     with_future_annotations: bool, create_module: "Callable[[str], ModuleType]", pydantic_version: PydanticVersion