File tree Expand file tree Collapse file tree 1 file changed +16
-1
lines changed Expand file tree Collapse file tree 1 file changed +16
-1
lines changed Original file line number Diff line number Diff line change 3
3
from typing import TYPE_CHECKING , Generator , List , Union
4
4
5
5
import oyaml as yaml
6
- from pydantic import BaseModel , Field
6
+ from pydantic import BaseModel , Field , model_serializer
7
7
8
8
from dsms .core .session import Session
9
9
@@ -41,6 +41,21 @@ def __repr__(self):
41
41
"""Pretty print the KItemSearchResult"""
42
42
return str (self )
43
43
44
+ @model_serializer ()
45
+ def serialze_results (self ):
46
+ """
47
+ Custom model serializer.
48
+
49
+ Needs to be added since the `model_dump` was only
50
+ serializing the compact model, not the full representation.
51
+ """
52
+ return {
53
+ key : (
54
+ value .model_dump () if isinstance (value , BaseModel ) else value
55
+ )
56
+ for key , value in self
57
+ }
58
+
44
59
45
60
class SearchResult (BaseModel ):
46
61
"""DSMS search result"""
You can’t perform that action at this time.
0 commit comments