[python-flask] Fix return type too strict (#12190)

Flask (and connexion by extension) allows the return type to be either
just the body, or the body & status code, or the body & status code &
headers.

This commit fixes the stated `rtype` to allow the latter two cases.
This commit is contained in:
Oliver Ford
2022-04-24 07:31:09 +00:00
committed by GitHub
parent 1602942292
commit 2769726584

View File

@@ -1,5 +1,8 @@
import connexion
import six
from typing import Dict
from typing import Tuple
from typing import Union
{{#imports}}{{import}} # noqa: E501
{{/imports}}
@@ -55,7 +58,7 @@ def {{operationId}}({{#allParams}}{{paramName}}{{^required}}=None{{/required}}{{
{{/isMap}}
{{/allParams}}
:rtype: {{returnType}}{{^returnType}}None{{/returnType}}
:rtype: Union[{{returnType}}{{^returnType}}None{{/returnType}}, Tuple[{{returnType}}{{^returnType}}None{{/returnType}}, int], Tuple[{{returnType}}{{^returnType}}None{{/returnType}}, int, Dict[str, str]]
"""
{{#allParams}}
{{^isContainer}}