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.

openapi: Improve deprecation error messages.

Tim Abbott97fd5b8c6f25
diff --git a/zerver/openapi/openapi.py b/zerver/openapi/openapi.py
index 51525c133f8..db549052660 100644
--- a/zerver/openapi/openapi.py
+++ b/zerver/openapi/openapi.py
@@ -521,9 +521,13 @@ def deprecated_note_in_description(description: str) -> bool:
def check_deprecated_consistency(deprecated: bool, description: str) -> None:
# Test to make sure deprecated parameters are marked so.
if deprecated_note_in_description(description):
- assert deprecated
+ assert (
+ deprecated
+ ), f"Missing `deprecated: true` despite being described as deprecated:\n\n{description}\n"
if deprecated:
- assert deprecated_note_in_description(description)
+ assert deprecated_note_in_description(
+ description
+ ), f"Marked as `deprecated: true`, but changes documentation doesn't properly explain as **Deprecated** in the standard format\n\n:{description}\n"
# Skip those JSON endpoints whose query parameters are different from