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

Cannot add swagger ui to a flask blueprint #42

Open
SpoonMeiser opened this issue Jan 30, 2024 · 0 comments
Open

Cannot add swagger ui to a flask blueprint #42

SpoonMeiser opened this issue Jan 30, 2024 · 0 comments

Comments

@SpoonMeiser
Copy link

A blueprint should, for most purposes be indistinguishable from an application, and I think it makes perfect sense to have, say, a flask blueprint for an API, and add a swagger UI to that.

However, the flask handler contains this check:

    import flask
    if isinstance(doc.app, flask.Flask):
        return handler

Which fails, because flask.Blueprint is not a subclass of flask.Flask.

Perhaps the test should be:

    import flask.scaffold import Scaffold
    if isinstance(doc.app, Scaffold):
        return handler

Or perhaps it's safer like this as scaffold doesn't appear to be a documented part of the API:

    import flask
    if isinstance(doc.app, (flask.Flask, flask.Blueprint)):
        return handler
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant