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

Modifications to work with Flask 3.0.0 #1746

Closed
wants to merge 1 commit into from
Closed
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
4 changes: 4 additions & 0 deletions connexion/apps/flask.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,10 @@ def _set_base_path(self, base_path: t.Optional[str] = None) -> None:

def _set_blueprint(self):
endpoint = flask_utils.flaskify_endpoint(self.base_path)
if endpoint == "" and self.base_path != "":
endpoint = self.base_path
elif endpoint == "":
endpoint = "/"
self.blueprint = flask.Blueprint(
endpoint,
__name__,
Expand Down
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ classifiers = [
connexion = 'connexion.cli:main'

[tool.poetry.dependencies]
python = '^3.7'
python = '>=3.8,<4.0'
asgiref = ">= 3.4"
clickclick = ">= 1.2"
httpx = ">= 0.23"
Expand All @@ -60,9 +60,9 @@ typing-extensions = ">= 4"
werkzeug = ">= 2.2.1"

a2wsgi = { version = ">= 1.7", optional = true }
flask = { version = ">= 2.2", extras = ["async"], optional = true }
py-swagger-ui = { version = ">= 1.1.0", optional = true }
uvicorn = { version = ">= 0.17.6", extras = ["standard"], optional = true }
flask = {version = "3.0.0", extras = ["async"]}

[tool.poetry.extras]
flask = ["a2wsgi", "flask"]
Expand Down
5 changes: 4 additions & 1 deletion tests/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
from connexion.spec import Specification, canonical_base_path
from yaml import YAMLError

# import pytest

TEST_FOLDER = pathlib.Path(__file__).parent


Expand Down Expand Up @@ -37,9 +39,10 @@ def test_api():
assert api4.blueprint.url_prefix == "/v1.0"


# @pytest.mark.cheers
def test_api_base_path_slash():
api = FlaskApi(TEST_FOLDER / "fixtures/simple/basepath-slash.yaml")
assert api.blueprint.name == ""
assert api.blueprint.name == "/"
assert api.blueprint.url_prefix == ""


Expand Down