openapi: Improve deprecation error messages.

This commit is contained in:
Tim Abbott 2024-06-07 14:01:03 -07:00
parent d60150d39d
commit 97fd5b8c6f
1 changed files with 6 additions and 2 deletions

View File

@ -521,9 +521,13 @@ def deprecated_note_in_description(description: str) -> bool:
def check_deprecated_consistency(deprecated: bool, description: str) -> None: def check_deprecated_consistency(deprecated: bool, description: str) -> None:
# Test to make sure deprecated parameters are marked so. # Test to make sure deprecated parameters are marked so.
if deprecated_note_in_description(description): 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: 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 # Skip those JSON endpoints whose query parameters are different from