🐛 fix(utilities.py): handle field_type with "typing_extensions" prefix in UtilitiesFrontendNode class
✨ feat(utilities.py): improve handling of field_type in UtilitiesFrontendNode class to support different formats Fixes #707
This commit is contained in:
parent
2bc4420f62
commit
c8a5e0724d
1 changed files with 4 additions and 1 deletions
|
|
@ -12,8 +12,11 @@ class UtilitiesFrontendNode(FrontendNode):
|
|||
FrontendNode.format_field(field, name)
|
||||
# field.field_type could be "Literal['news', 'search', 'places', 'images']
|
||||
# we need to convert it to a list
|
||||
# It seems it could also be like "typing_extensions.['news', 'search', 'places', 'images']"
|
||||
if "Literal" in field.field_type:
|
||||
field.options = ast.literal_eval(field.field_type.replace("Literal", ""))
|
||||
field_type = field.field_type.replace("typing_extensions.", "")
|
||||
field_type = field_type.replace("Literal", "")
|
||||
field.options = ast.literal_eval(field_type)
|
||||
field.is_list = True
|
||||
field.field_type = "str"
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue