check-schemas: Add list of deprecated events in OpenAPI documentation.

In commit 268f858f3, we removed the "realm_filters" event from the
schemas that we test in `zerver/lib/event_schemas.py`, but the event
is still documented (as deprecated) in the api/get-events doc.

Updates `tools/check_schemas` to not print a warning for an event
schema in the OpenAPI documentation if it's include in the list of
deprecated events list.
This commit is contained in:
Lauryn Menard 2023-10-03 16:56:30 +02:00 committed by Tim Abbott
parent 3b56e0f5ca
commit 6ad3ec0891
1 changed files with 8 additions and 2 deletions

View File

@ -74,7 +74,6 @@ EXEMPT_OPENAPI_NAMES = [
"message_event",
# tuple handling
"muted_topics_event",
"realm_filters_event",
# bots, delivery_email, profile_data
"realm_user_add_event",
# OpenAPI is incomplete
@ -84,6 +83,12 @@ EXEMPT_OPENAPI_NAMES = [
"reaction_remove_event",
]
# This is a list of events still documented in the OpenAPI that
# are deprecated and no longer checked in event_schema.py.
DEPRECATED_EVENTS = [
"realm_filters_event",
]
def get_event_checker(event: Dict[str, Any]) -> Optional[Callable[[str, Dict[str, Any]], None]]:
name = event["type"]
@ -192,7 +197,8 @@ def validate_openapi_against_event_schema() -> None:
name += "_event"
if not hasattr(event_schema, name):
print("WARNING - NEED SCHEMA to match OpenAPI", name)
if name not in DEPRECATED_EVENTS:
print("WARNING - NEED SCHEMA to match OpenAPI", name)
continue
openapi_type = from_openapi(sub_node)