diff --git a/utils/generate-api.py b/utils/generate-api.py index adab04bf..cfe12af4 100644 --- a/utils/generate-api.py +++ b/utils/generate-api.py @@ -482,6 +482,10 @@ def read_modules(): for m in params: A = dict(type=m["schema"]["type"], description=m["description"]) + + if "default" in m["schema"]: + A.update({"default": m["schema"]["default"]}) + if "enum" in m["schema"]: A.update({"type": "enum"}) A.update({"options": m["schema"]["enum"]}) @@ -508,6 +512,9 @@ def read_modules(): if "description" in n: B.update({"description": n["description"]}) + if "x-enum-options" in n["schema"]: + B.update({"options": n["schema"]["x-enum-options"]}) + deprecated_new = {} if "deprecated" in n: B.update({"deprecated": n["deprecated"]}) diff --git a/utils/templates/base b/utils/templates/base index 971efbc9..9b58b6c2 100644 --- a/utils/templates/base +++ b/utils/templates/base @@ -21,7 +21,8 @@ {% for p, info in api.params %} {% filter wordwrap(72, wrapstring="\n ") %} - :arg {{ p }}{% if info.deprecated %} (Deprecated: {{ info['deprecation_message'][:-1] }}){% endif %}: {{ info.description }}{% if info.options %} Valid choices: {{ info.options|join(", ") }}{% endif %}{% if info.default %} Default: {{ info.default }}{% endif %} + :arg {{ p }}{% if info.deprecated %} (Deprecated: {{ info['deprecation_message'][:-1] }}){% endif %}: {{ info.description }}{% if info.options %} Valid choices: {{ info.options|join(", ") }}{% endif %} + {% if info.default is defined %}{% if info.default is not none %}{% if info.default is sameas(false) %} (default: false){% else %} (default: {{ info.default }}){% endif %}{% endif %}{% endif %} {% endfilter %} {% endfor %}