Merge pull request #11778 from jmchilton/pydantic_18

Fix workflow refactor schema parsing for pydantic 1.8.
This commit is contained in:
John Chilton
2021-04-03 13:38:25 -04:00
committed by GitHub
+8 -1
View File
@@ -241,7 +241,14 @@ union_action_classes = Union[
ACTION_CLASSES_BY_TYPE = {}
for action_class in union_action_classes.__args__: # type: ignore
action_type = action_class.schema()["properties"]["action_type"]["const"]
action_type_def = action_class.schema()["properties"]["action_type"]
try:
# pydantic 1.8
action_type = action_type_def["enum"][0]
except KeyError:
# pydantic 1.7
action_type = action_type_def["const"]
ACTION_CLASSES_BY_TYPE[action_type] = action_class