flask-openapi3
flask-openapi3 copied to clipboard
should doc strings render as markdown?
Environment:
- Python version: 3.7
- Operating system: windows or ubuntu 18.04
- Flask version: 1.1.4
- flask-openapi3 version:
Should get_operation
add </br>
to doc strings? If the description has line feeds \n
vs </br>
the description renders as markdown.
https://github.com/luolingchun/flask-openapi3/blob/6ca0f2c6a5b90a5ae439c432b0a3e6f8cf9c4d21/flask_openapi3/utils.py#L27-L29
code diff
index fd194d8..c5f0db9 100644
--- a/flask_openapi3/utils.py
+++ b/flask_openapi3/utils.py
@@ -24,9 +24,9 @@ def get_operation(func: Callable, *, summary: Optional[str] = None, description:
lines = doc.split("\n")
doc_summary = lines[0] or None
if summary is None:
- doc_description = lines[0] if len(lines) == 0 else "</br>".join(lines[1:]) or None
+ doc_description = lines[0] if len(lines) == 0 else "\n".join(lines[1:]) or None
else:
- doc_description = "</br>".join(lines) or None
+ doc_description = "\n".join(lines) or None
operation = Operation(
summary=summary or doc_summary,
description=description or doc_description
example endpoint:
@blueprint.post('/test', responses={...})
def test(body: ....):
"""
my summary
Examples:
test with `some param`
...
"""
return {}
With \n
vs </br>
the above example will render the markdown from the docstring into HTML. This is useful when providing some additional usage/example to the endpoint's documentation.
I don't understand what you want to express. Is there anything wrong with this?
This issue has been automatically closed because we haven't heard back for more than 365 days, please reopen this issue if necessary.