From ad7dcc7d83d6d3cb24561edc7ad7c9730d26aa65 Mon Sep 17 00:00:00 2001 From: Chris Bobbe Date: Mon, 2 Oct 2023 12:45:11 -0700 Subject: [PATCH] api docs: Use enum for reaction_type. It's not currently rendered in the docs, but good to have this in place anyway: https://github.com/zulip/zulip/pull/21005#discussion_r797823366 --- zerver/lib/event_schema.py | 6 +++--- zerver/openapi/zulip.yaml | 12 ++++++++++++ 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/zerver/lib/event_schema.py b/zerver/lib/event_schema.py index bb5bb1756e..32920c03e8 100644 --- a/zerver/lib/event_schema.py +++ b/zerver/lib/event_schema.py @@ -468,7 +468,7 @@ reaction_add_event = event_dict_type( ("message_id", int), ("emoji_name", str), ("emoji_code", str), - ("reaction_type", str), + ("reaction_type", EnumType(["unicode_emoji", "realm_emoji", "zulip_extra_emoji"])), ("user_id", int), ("user", reaction_legacy_user_type), ] @@ -483,7 +483,7 @@ reaction_remove_event = event_dict_type( ("message_id", int), ("emoji_name", str), ("emoji_code", str), - ("reaction_type", str), + ("reaction_type", EnumType(["unicode_emoji", "realm_emoji", "zulip_extra_emoji"])), ("user_id", int), ("user", reaction_legacy_user_type), ] @@ -1767,7 +1767,7 @@ user_status_event = event_dict_type( ("status_text", str), ("emoji_name", str), ("emoji_code", str), - ("reaction_type", str), + ("reaction_type", EnumType(["unicode_emoji", "realm_emoji", "zulip_extra_emoji"])), ], ) _check_user_status = make_checker(user_status_event) diff --git a/zerver/openapi/zulip.yaml b/zerver/openapi/zulip.yaml index 62619c3058..318b1c5c95 100644 --- a/zerver/openapi/zulip.yaml +++ b/zerver/openapi/zulip.yaml @@ -1695,6 +1695,10 @@ paths: **Changes**: New in Zulip 5.0 (feature level 86). reaction_type: type: string + enum: + - unicode_emoji + - realm_emoji + - zulip_extra_emoji description: | The [emoji type](/api/update-status#parameter-reaction_type) for the emoji the user selected for their new status. @@ -12102,6 +12106,10 @@ paths: **Changes**: New in Zulip 5.0 (feature level 86). reaction_type: type: string + enum: + - unicode_emoji + - realm_emoji + - zulip_extra_emoji description: | If present, a string indicating the type of emoji. Each emoji `reaction_type` has an independent namespace for values of `emoji_code`. @@ -18305,6 +18313,10 @@ components: within the namespace of the `reaction_type`. reaction_type: type: string + enum: + - unicode_emoji + - realm_emoji + - zulip_extra_emoji description: | A string indicating the type of emoji. Each emoji `reaction_type` has an independent namespace for values of `emoji_code`.