Skip to content

Commit

Permalink
Allow for docstring in path params (#51)
Browse files Browse the repository at this point in the history
  • Loading branch information
ahopkins authored Jan 19, 2022
1 parent c70768a commit edf9fed
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion sanic_ext/extensions/openapi/blueprint.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,21 @@ def build_spec(app, loop):
)
):
continue

kwargs = {}
if operation._autodoc and (
parameters := operation._autodoc.get("parameters")
):
description = None
for param in parameters:
if param["name"] == _parameter.name:
description = param["description"]
break
if description:
kwargs["description"] = description

operation.parameter(
_parameter.name, _parameter.cast, "path"
_parameter.name, _parameter.cast, "path", **kwargs
)

specification.operation(uri, method, operation)
Expand Down

0 comments on commit edf9fed

Please sign in to comment.