Utils¶
-
flaskerk.utils.
abort_json
(code: int, msg: str = '')[source]¶ abort as a JSON response
- Parameters
code (int) – HTTP status code
msg (str) – description for this abort
-
flaskerk.utils.
get_converter
(converter: str, *args, **kwargs)[source]¶ Get conveter method from converter map
- Parameters
converter – str: converter type
args –
kwargs –
- Returns
return schema dict
-
flaskerk.utils.
get_summary_desc
(func)[source]¶ get summary, description from func.__doc__
Summary and description are split by ‘
- ‘. If only one is provided,
it will be used as summary.
-
flaskerk.utils.
parse_url
(path: str)[source]¶ Parsing Flask route url to get the normal url path and parameter type.
Based on Werkzeug builtin converters.
-
flaskerk.converters.
convert_any
(*args, **kwargs)[source]¶ Handle converter type “any”
- Parameters
args –
kwargs –
- Returns
return schema dict
-
flaskerk.converters.
convert_default
(*args, **kwargs)[source]¶ Handle converter type “default”
- Parameters
args –
kwargs –
- Returns
return schema dict
-
flaskerk.converters.
convert_float
(*args, **kwargs)[source]¶ Handle converter type “float”
- Parameters
args –
kwargs –
- Returns
return schema dict
-
flaskerk.converters.
convert_int
(*args, **kwargs)[source]¶ Handle converter type “int”
- Parameters
args –
kwargs –
- Returns
return schema dict
-
flaskerk.converters.
convert_path
(*args, **kwargs)[source]¶ Handle converter type “path”
- Parameters
args –
kwargs –
- Returns
return schema dict