From 6ad3ec0891c47ab557f10e92058f8aaba44126e4 Mon Sep 17 00:00:00 2001 From: Lauryn Menard Date: Tue, 3 Oct 2023 16:56:30 +0200 Subject: [PATCH] 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. --- tools/check-schemas | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/tools/check-schemas b/tools/check-schemas index 9e954b1912..c120243fcd 100755 --- a/tools/check-schemas +++ b/tools/check-schemas @@ -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)