Repository: Fatal1ty/mashumaro

Issue:
Third party default is not reflected in the generated JSON Schema
* mashumaro version: 3.9
* Python version: 3.11
* Operating System: MacOS 3.13.1

### Description

```python
from dataclasses import dataclass
from mashumaro.config import BaseConfig
from mashumaro.jsonschema import build_json_schema

def as_str(value) -> str:
    return str(value)

class Bar:
    pass

@dataclass
class Foo:
    bar: Bar = Bar()

    class Config(BaseConfig):
        serialization_strategy = {
            Bar: {
                "serialize": as_str,
                "deserialize": Bar,
            }
        }


print(build_json_schema(Foo).to_json())
```

will raise an exception: `mashumaro.exceptions.UnserializableField: Field "x" of type Bar in _default.<locals>.CC is not serializable`

Expected:
```json
{
    "type": "object",
    "title": "Foo",
    "properties": {
        "bar": {
            "type": "string",
            "default": "<__main__.Bar object at 0x1006e54d0>"
        }
    },
    "additionalProperties": false
}
```

Discussion:

Patch:
diff --git a/mashumaro/jsonschema/schema.py b/mashumaro/jsonschema/schema.py
index 9dc6edc..34760e8 100644
--- a/mashumaro/jsonschema/schema.py
+++ b/mashumaro/jsonschema/schema.py
@@ -178,7 +178,7 @@ class Instance:
             if f_default is MISSING:
                 f_default = self._self_builder.namespace.get(f_name, MISSING)
             if f_default is not MISSING:
-                f_default = _default(f_type, f_default)
+                f_default = _default(f_type, f_default, self.get_self_config())
 
             has_default = (
                 f.default is not MISSING or f.default_factory is not MISSING
@@ -270,11 +270,14 @@ def _get_schema_or_none(
     return schema
 
 
-def _default(f_type: Type, f_value: Any) -> Any:
+def _default(f_type: Type, f_value: Any, config_cls: Type[BaseConfig]) -> Any:
     @dataclass
     class CC(DataClassJSONMixin):
         x: f_type = f_value  # type: ignore
 
+        class Config(config_cls):  # type: ignore
+            pass
+
     return CC(f_value).to_dict()["x"]
 
 
@@ -615,7 +618,11 @@ def on_named_tuple(instance: Instance, ctx: Context) -> JSONSchema:
         if f_default is not MISSING:
             if isinstance(f_schema, EmptyJSONSchema):
                 f_schema = JSONSchema()
-            f_schema.default = _default(f_type, f_default)  # type: ignore
+            f_schema.default = _default(
+                f_type,  # type: ignore[arg-type]
+                f_default,
+                instance.get_self_config(),
+            )
         properties[f_name] = f_schema
     if as_dict:
         return JSONObjectSchema(


Test patch:
diff --git a/tests/test_jsonschema/test_jsonschema_generation.py b/tests/test_jsonschema/test_jsonschema_generation.py
index 5e88282..6b5404d 100644
--- a/tests/test_jsonschema/test_jsonschema_generation.py
+++ b/tests/test_jsonschema/test_jsonschema_generation.py
@@ -118,6 +118,30 @@ if PY_39_MIN:
 Ts = TypeVarTuple("Ts")
 
 
+def dummy_serialize_as_str(_: Any) -> str:
+    return "dummy"  # pragma no cover
+
+
+class ThirdPartyType:
+    pass
+
+
+@dataclass
+class DataClassWithThirdPartyType:
+    a: ThirdPartyType
+    b: Optional[ThirdPartyType]
+    c: ThirdPartyType = ThirdPartyType()
+    d: Optional[ThirdPartyType] = None
+
+    class Config(BaseConfig):
+        serialization_strategy = {
+            ThirdPartyType: {
+                "deserialize": ThirdPartyType,
+                "serialize": dummy_serialize_as_str,
+            }
+        }
+
+
 def test_jsonschema_for_dataclass():
     @dataclass
     class DataClass:
@@ -1041,6 +1065,29 @@ def test_dataclass_overridden_serialization_method():
     )
 
 
+def test_third_party_overridden_serialization_method():
+    schema = build_json_schema(DataClassWithThirdPartyType)
+    assert schema.properties["a"] == JSONSchema(
+        type=JSONSchemaInstanceType.STRING
+    )
+    assert schema.properties["b"] == JSONSchema(
+        anyOf=[
+            JSONSchema(type=JSONSchemaInstanceType.STRING),
+            JSONSchema(type=JSONSchemaInstanceType.NULL),
+        ]
+    )
+    assert schema.properties["c"] == JSONSchema(
+        type=JSONSchemaInstanceType.STRING, default="dummy"
+    )
+    assert schema.properties["d"] == JSONSchema(
+        anyOf=[
+            JSONSchema(type=JSONSchemaInstanceType.STRING),
+            JSONSchema(type=JSONSchemaInstanceType.NULL),
+        ],
+        default=None,
+    )
+
+
 def test_jsonschema_with_override_for_properties():
     @dataclass
     class DataClass: