Skip to content

Commit 0f48a2d

Browse files
committed
@type/@model generation now compatible with the new generation
1 parent 1b936d0 commit 0f48a2d

File tree

3 files changed

+7
-6
lines changed

3 files changed

+7
-6
lines changed

src/rune/runtime/base_data_class.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,8 +138,8 @@ def rune_serialize(
138138
raise_exc=raise_validation_errors)
139139

140140
root_meta = self.__dict__.setdefault(ROOT_CONTAINER, {})
141-
root_meta['@type'] = self.__class__.__module__
142-
root_meta['@model'] = self.__class__.__module__.split(
141+
root_meta['@type'] = self._FQRTN
142+
root_meta['@model'] = self._FQRTN.split(
143143
'.', maxsplit=1)[0]
144144
root_meta['@version'] = self.get_model_version()
145145

src/rune/runtime/metadata.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -350,7 +350,8 @@ def serialise(cls, obj) -> dict:
350350
res = obj.serialise_meta()
351351
res |= obj.model_dump(exclude_unset=True, exclude_defaults=True)
352352
if cls != obj.__class__:
353-
res = {'@type': obj.__class__.__module__} | res
353+
# pylint: disable=protected-access
354+
res = {'@type': obj._FQRTN} | res
354355
return res
355356

356357
@classmethod

test/serializer-round-trip/test_extension.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -95,11 +95,11 @@ def test_temp():
9595
{
9696
"nodeRef" : {
9797
"typeA" : {
98-
"fieldA" : "foo",
99-
"@key" : "someKey1x"
98+
"fieldA" : "foo",
99+
"@key" : "someKey1x"
100100
},
101101
"aReference" : {
102-
"@ref" : "someKey1x"
102+
"@ref" : "someKey1x"
103103
}
104104
}
105105
}

0 commit comments

Comments
 (0)