@@ -13,7 +13,6 @@ use serde::ser::{Error, Serialize, SerializeMap, SerializeSeq, Serializer};
13
13
use crate :: input:: Int ;
14
14
use crate :: serializers:: errors:: SERIALIZATION_ERR_MARKER ;
15
15
use crate :: serializers:: filter:: SchemaFilter ;
16
- use crate :: serializers:: shared:: uuid_to_dict;
17
16
use crate :: serializers:: shared:: { PydanticSerializer , TypeSerializer } ;
18
17
use crate :: serializers:: SchemaSerializer ;
19
18
use crate :: tools:: { extract_i64, py_err, safe_repr} ;
@@ -188,7 +187,11 @@ pub(crate) fn infer_to_python_known(
188
187
let py_url: PyMultiHostUrl = value. extract ( ) ?;
189
188
py_url. __str__ ( ) . into_py ( py)
190
189
}
191
- ObType :: Uuid => serialize_dict ( uuid_to_dict ( value) ?) ?,
190
+ ObType :: Uuid => {
191
+ let py_uuid: & PyAny = value. downcast ( ) ?;
192
+ let uuid = super :: type_serializers:: uuid:: uuid_to_string ( py_uuid) ?;
193
+ uuid. into_py ( py)
194
+ }
192
195
ObType :: PydanticSerializable => serialize_with_serializer ( ) ?,
193
196
ObType :: Dataclass => serialize_dict ( dataclass_to_dict ( value) ?) ?,
194
197
ObType :: Enum => {
@@ -485,7 +488,11 @@ pub(crate) fn infer_serialize_known<S: Serializer>(
485
488
pydantic_serializer. serialize ( serializer)
486
489
}
487
490
ObType :: Dataclass => serialize_dict ! ( dataclass_to_dict( value) . map_err( py_err_se_err) ?) ,
488
- ObType :: Uuid => serialize_dict ! ( uuid_to_dict( value) . map_err( py_err_se_err) ?) ,
491
+ ObType :: Uuid => {
492
+ let py_uuid: & PyAny = value. downcast ( ) . map_err ( py_err_se_err) ?;
493
+ let uuid = super :: type_serializers:: uuid:: uuid_to_string ( py_uuid) . map_err ( py_err_se_err) ?;
494
+ serializer. serialize_str ( & uuid)
495
+ }
489
496
ObType :: Enum => {
490
497
let v = value. getattr ( intern ! ( value. py( ) , "value" ) ) . map_err ( py_err_se_err) ?;
491
498
infer_serialize ( v, serializer, include, exclude, extra)
0 commit comments