diff --git a/utils/generate-api.py b/utils/generate-api.py index cfe12af4..2cb93eb5 100644 --- a/utils/generate-api.py +++ b/utils/generate-api.py @@ -263,6 +263,7 @@ def __init__(self, namespace, name, definition, is_pyi=False): self.description = "" self.doc_url = "" self.stability = self._def.get("stability", "stable") + self.deprecation_message = self._def.get("deprecation_message") if isinstance(definition["documentation"], str): self.doc_url = definition["documentation"] @@ -560,6 +561,9 @@ def read_modules(): documentation = {"description": z["description"]} api.update({"documentation": documentation}) + if "deprecation_message" not in api and "x-deprecation-message" in z: + api.update({"deprecation_message": z["x-deprecation-message"]}) + if "params" not in api and "params" in z: api.update({"params": z["params"]}) diff --git a/utils/templates/base b/utils/templates/base index 9b58b6c2..47bb5956 100644 --- a/utils/templates/base +++ b/utils/templates/base @@ -28,6 +28,10 @@ {% endfor %} {% endif %} """ + {% if api.deprecation_message %} + from warnings import warn + warn("Deprecated: {{ api.deprecation_message }}") + {% endif %} {% include "substitutions" %} {% include "required" %} {% if api.body.serialize == "bulk" %}