diff --git a/logfire/_internal/json_schema.py b/logfire/_internal/json_schema.py index fb424c24..f08739bf 100644 --- a/logfire/_internal/json_schema.py +++ b/logfire/_internal/json_schema.py @@ -118,7 +118,7 @@ def create_json_schema(obj: Any, seen: set[int]) -> JsonDict: return _mapping_schema(obj, seen) elif is_sqlalchemy(obj): return _sqlalchemy_schema(obj, seen) - elif dataclasses.is_dataclass(obj): + elif dataclasses.is_dataclass(obj) and not isinstance(obj, type): return _dataclass_schema(obj, seen) elif is_attrs(obj): return _attrs_schema(obj, seen) diff --git a/tests/test_json_args.py b/tests/test_json_args.py index c83b2a4c..7c9a58e5 100644 --- a/tests/test_json_args.py +++ b/tests/test_json_args.py @@ -809,6 +809,19 @@ class StrSubclass(str): }, id='dict_of_types_in_list', ), + pytest.param( + [MyDataclass], + "[]", + '[""]', + { + 'items': { + 'type': 'object', + 'x-python-datatype': 'unknown', + }, + 'type': 'array', + }, + id='list_of_dataclass_type', + ), ], ) def test_log_non_scalar_args(