Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FlaskAPIspec and Flask injector not working together #247

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 12 additions & 4 deletions flask_apispec/extension.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,21 @@ def get_pet(pet_id):
OPTIONS requests in the specification
"""

def __init__(self, app=None, document_options=True):
def __init__(self,
static_folder='./static',
template_folder='./templates',
static_url_path='/flask-apispec/static',
app=None,
document_options=True):
self._deferred = []
self.app = app
self.view_converter = None
self.resource_converter = None
self.spec = None
self.document_options = document_options
self.static_folder = static_folder
self.template_folder = template_folder
self.static_url_path = static_url_path

if app:
self.init_app(app)
Expand Down Expand Up @@ -74,9 +82,9 @@ def add_swagger_routes(self):
blueprint = flask.Blueprint(
'flask-apispec',
__name__,
static_folder='./static',
template_folder='./templates',
static_url_path='/flask-apispec/static',
static_folder=self.static_folder,
template_folder=self.template_folder,
static_url_path=self.static_url_path,
)

json_url = self.app.config.get('APISPEC_SWAGGER_URL', '/swagger/')
Expand Down
4 changes: 2 additions & 2 deletions flask_apispec/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
def resolve_resource(resource, **kwargs):
resource_class_args = kwargs.get('resource_class_args') or ()
resource_class_kwargs = kwargs.get('resource_class_kwargs') or {}
if isinstance(resource, type):
return resource(*resource_class_args, **resource_class_kwargs)
# if isinstance(resource, type):
# return resource(*resource_class_args, **resource_class_kwargs)
return resource


Expand Down