Skip to content

Commit

Permalink
fix type errors
Browse files Browse the repository at this point in the history
  • Loading branch information
minenwerfer committed Sep 10, 2024
1 parent 720520f commit ea08b15
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/normalize_json/normalize.py
Original file line number Diff line number Diff line change
Expand Up @@ -265,12 +265,14 @@ def translate(

if node.get('enum') and value != None:
if node.get('array'):
if not isinstance(value, list):
raise TypeError()
value = [
node['enum'].get(v)
for v in value
node.get('enum', {}).get(v)
for v in typing.cast(list[str], value)
]
else:
value = node['enum'].get(value)
value = node.get('enum', {}).get(str(typing.cast(typing.Any, value)))

ret[original_name] = value

Expand Down

0 comments on commit ea08b15

Please sign in to comment.