Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

event_schema: Add comments to top of the file.

Steve Howelldef3dac6aedc
diff --git a/zerver/lib/event_schema.py b/zerver/lib/event_schema.py
index 3a377ef412c..aea61f25f69 100644
--- a/zerver/lib/event_schema.py
+++ b/zerver/lib/event_schema.py
@@ -8,6 +8,24 @@
# frontend).
#
# See https://zulip.readthedocs.io/en/latest/subsystems/events-system.html
+#
+# The general paradigm here is that if you have an event with type foo_bar
+# then you declare foo_bar_event to be an instance of event_dict_type. And
+# then you make a checker function by saying:
+#
+# check_foo_bar = make_checker(foo_bar_event)
+#
+# And then the caller can use the checker as follows:
+#
+# check_foo_bar(var_name, event)
+#
+# For more complicated events, you may write custom checkers that check
+# aspects of the data that go beyond simply validating that the data
+# matches an event_dict_type based schema. This typically happens with
+# events where you either have a Union type or optional_keys.
+#
+# See check_delete_message and check_presence for examples of this
+# paradigm.
from typing import Dict, List, Sequence, Tuple, Union