Internal functions documentation¶
Core wrapper functions:
-
flask_restful_swagger.swagger.
docs
(api, **kwargs)[source]¶ This function adds endpoints for the swagger. It also handles all the model loading by replacing original add_resource with the patched one.
:version changed 1.0.0 The old docs() function before version 1.0.0 had ‘camelCase’ kwargs, which was not-PEP8, and now it is recommended to use ‘snake_case’. But for backward compatibility ‘cameCase’ is also accepted.Parameters: - api – flask-resful’s Api object
- kwargs – key-word arguments described in _docs function.
Returns: flask-resful’s Api object passed as api.
-
flask_restful_swagger.swagger.
extract_path_arguments
(path)[source]¶ Extracts a swagger path arguments from the given flask path.
Examples
This /path/<parameter> extracts [{name: ‘parameter’}]
And this /<string(length=2):lang_code>/<string:id>/<float:probability> extracts: [ {name: ‘lang_code’, dataType: ‘string’}, {name: ‘id’, dataType: ‘string’} {name: ‘probability’, dataType: ‘float’}]