Skip to content

Commit

Permalink
chore: simplify logic and always stringify the Literal, not its value
Browse files Browse the repository at this point in the history
  • Loading branch information
ticapix committed Jan 2, 2025
1 parent 5eb1a36 commit 41fa5e0
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions linkml_runtime/utils/yamlutils.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,9 @@ def _default(self, obj, filtr: Callable[[dict], dict] = None):
rval[k] = v.code
elif isinstance(v, Literal):
if v.datatype:
# checking against v.ill_typed to not serialize the python object
# use v and not not v.value to not serialize the python object (datetime, xml, html, ...)
rval[k] = {
'@value': str(v.value) if v.ill_typed else str(v), '@type': v.datatype}
'@value': str(v), '@type': v.datatype}
elif v.language:
rval[k] = {
'@value': v.value, '@language': v.language.lower()}
Expand Down

0 comments on commit 41fa5e0

Please sign in to comment.