Created
January 30, 2019 19:27
-
-
Save jasonrhaas/fb1a3b6303fb2953b61af84fd76710d8 to your computer and use it in GitHub Desktop.
Swagger blueprint
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
from flask import Blueprint, jsonify | |
from connexion import Api | |
class Swagger: | |
def blueprint(spec, **yaml_kwargs): | |
api = Api(spec, swagger_ui=True, strict_validation=True, validate_responses=False, arguments=yaml_kwargs) | |
bp = api.blueprint | |
@bp.errorhandler(404) | |
def endpoint_not_found(e): | |
return jsonify({'not': 'found'}), 404 | |
return bp |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment