Last active
August 1, 2018 16:57
-
-
Save tarekziade/595f003c0a9b9aa0934f21b814717441 to your computer and use it in GitHub Desktop.
connexion as an extension
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pathlib | |
from connexion.api import Api, Resolver | |
import werkzeug.exceptions | |
def swagger_blueprint(specification, specification_dir=None, validate_responses=False, | |
strict_validation=False, resolver_error=None, | |
base_path='', debug=False): | |
resolver = Resolver() | |
swagger_json = False | |
swagger_ui = False | |
swagger_path = None | |
swagger_url = None | |
auth_all_paths = False | |
arguments = dict() | |
specification_dir = pathlib.Path(specification_dir) | |
specification = specification_dir / specification | |
resolver_error_handler = None | |
validator_map = None | |
api = Api(specification=specification, | |
base_url=base_path, arguments=arguments, | |
swagger_json=swagger_json, | |
swagger_ui=swagger_ui, | |
swagger_path=swagger_path, | |
swagger_url=swagger_url, | |
resolver=resolver, | |
resolver_error_handler=resolver_error_handler, | |
validate_responses=validate_responses, | |
strict_validation=strict_validation, | |
auth_all_paths=auth_all_paths, | |
debug=debug, | |
validator_map=validator_map) | |
return api.blueprint |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Note that the way to do this as of the version 1.1.15 is
from connexion import Api