0

I am trying to conditionally hide/show an endpoint swagger doc with Flask-RESTx, I am aware of using @api.doc(False) to disable (as shown here Hide endpoints in UI of Flask restful Swagger) however, it doesn't work with @api.route("/register", doc=True) will get the error -

kwargs["route_doc"] = self._build_doc(cls, doc)
  File "python3.9/site-packages/flask_restx/namespace.py", line 115, in _build_doc
    unshortcut_params_description(doc)
  File "/python3.9/site-packages/flask_restx/namespace.py", line 355, in unshortcut_params_description
    if "params" in data:
TypeError: argument of type 'bool' is not iterable

I wonder if it's possible to hide/show endpoint's swagger doc based on condition variable

barha
  • 709
  • 1
  • 7
  • 22

1 Answers1

0

My bad, it did work with @api.doc(True), however it didn't work with @api.route("/<endpoint>", doc=True)

barha
  • 709
  • 1
  • 7
  • 22