feat(eventsub): handle multi enum constant keys (#6078)
This commit is contained in:
@@ -16,6 +16,10 @@ class CommentCommands:
|
||||
# If set, `name_transform` will do nothing
|
||||
name_change: Optional[str] = None
|
||||
|
||||
# Whether the enum constant should look for additional keys
|
||||
# `name_transform` is not applied to these
|
||||
extra_enum_constant_names: list[str] = []
|
||||
|
||||
# Don't fail when an optional object exists and its data is bad
|
||||
dont_fail_on_deserialization: bool = False
|
||||
|
||||
@@ -31,6 +35,7 @@ class CommentCommands:
|
||||
if parent is not None:
|
||||
self.name_transform = parent.name_transform
|
||||
self.name_change = parent.name_change
|
||||
self.extra_enum_constant_names = parent.extra_enum_constant_names
|
||||
self.dont_fail_on_deserialization = parent.dont_fail_on_deserialization
|
||||
self.tag = parent.tag
|
||||
self.inner_root = parent.inner_root
|
||||
@@ -52,6 +57,8 @@ class CommentCommands:
|
||||
match command:
|
||||
case "json_rename":
|
||||
self.name_change = value
|
||||
case "json_extra_enum_constant_names":
|
||||
self.extra_enum_constant_names = [v.strip() for v in value.split(",")]
|
||||
case "json_dont_fail_on_deserialization":
|
||||
self.dont_fail_on_deserialization = bool(value.lower() == "true")
|
||||
case "json_transform":
|
||||
|
||||
Reference in New Issue
Block a user