You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When the api spec in use specifies variables in the server url and the values are being passed when instantiating the connexion.FlaskApp, interpolation is not executed. See simple example below.
pytest test_app.py
============================================================================ test session starts ============================================================================
platform linux -- Python 3.11.8, pytest-8.1.1, pluggy-1.5.0
rootdir: /home/jvasik/dev/connexion-dummy
configfile: pyproject.toml
plugins: anyio-4.3.0
collected 1 item
test_app.py F [100%]
================================================================================= FAILURES ==================================================================================
________________________________________________________________________________ test_route _________________________________________________________________________________
def test_route():
app_client = create_app((Path(os.getcwd()) / "api.yml").as_posix())
response = app_client.get("test/v1/")
> assert response.status_code == 200
E assert 404 == 200
E + where 404 = <Response [404 Not Found]>.status_code
test_app.py:23: AssertionError
----------------------------------------------------------------------------- Captured log call -----------------------------------------------------------------------------
ERROR connexion.middleware.exceptions:exceptions.py:84 HTTPException(status_code=404, detail='The requested URL was not found on the server. If you entered the URL manually please check your spelling and try again.')
========================================================================== short test summary info ==========================================================================
FAILED test_app.py::test_route - assert 404 == 200
======================================================================= 1 failed, 7 warnings in 0.79s =======================================================================
Full log
pytest test_app.py
============================================================================ test session starts ============================================================================
platform linux -- Python 3.11.8, pytest-8.1.1, pluggy-1.5.0
rootdir: /home/jvasik/dev/connexion-dummy
configfile: pyproject.toml
plugins: anyio-4.3.0
collected 1 item
test_app.py F [100%]
================================================================================= FAILURES ==================================================================================
________________________________________________________________________________ test_route _________________________________________________________________________________
def test_route():
app_client = create_app((Path(os.getcwd()) / "api.yml").as_posix())
response = app_client.get("test/v1/")
> assert response.status_code == 200
E assert 404 == 200
E + where 404 = <Response [404 Not Found]>.status_code
test_app.py:23: AssertionError
----------------------------------------------------------------------------- Captured log call -----------------------------------------------------------------------------
ERROR connexion.middleware.exceptions:exceptions.py:84 HTTPException(status_code=404, detail='The requested URL was not found on the server. If you entered the URL manually please check your spelling and try again.')
============================================================================= warnings summary ==============================================================================
../../.local/share/virtualenvs/connexion-dummy-LMhlc2UK/lib64/python3.11/site-packages/connexion/json_schema.py:16
../../.local/share/virtualenvs/connexion-dummy-LMhlc2UK/lib64/python3.11/site-packages/connexion/json_schema.py:16
/home/jvasik/.local/share/virtualenvs/connexion-dummy-LMhlc2UK/lib64/python3.11/site-packages/connexion/json_schema.py:16: DeprecationWarning: jsonschema.RefResolver is deprecated as of v4.18.0, in favor of the https://github.com/python-jsonschema/referencing library, which provides more compliant referencing behavior as well as more flexible APIs for customization. A future release will remove RefResolver. Please file a feature request (on referencing) if you are missing an API for the kind of customization you need.
from jsonschema import Draft4Validator, RefResolver
../../.local/share/virtualenvs/connexion-dummy-LMhlc2UK/lib64/python3.11/site-packages/connexion/json_schema.py:17
/home/jvasik/.local/share/virtualenvs/connexion-dummy-LMhlc2UK/lib64/python3.11/site-packages/connexion/json_schema.py:17: DeprecationWarning: jsonschema.exceptions.RefResolutionError is deprecated as of version 4.18.0. If you wish to catch potential reference resolution errors, directly catch referencing.exceptions.Unresolvable.
from jsonschema.exceptions import RefResolutionError, ValidationError # noqa
../../.local/share/virtualenvs/connexion-dummy-LMhlc2UK/lib64/python3.11/site-packages/connexion/validators/form_data.py:4
../../.local/share/virtualenvs/connexion-dummy-LMhlc2UK/lib64/python3.11/site-packages/connexion/validators/form_data.py:4
/home/jvasik/.local/share/virtualenvs/connexion-dummy-LMhlc2UK/lib64/python3.11/site-packages/connexion/validators/form_data.py:4: DeprecationWarning: Accessing jsonschema.draft4_format_checker is deprecated and will be removed in a future release. Instead, use the FORMAT_CHECKER attribute on the corresponding Validator.
from jsonschema import ValidationError, draft4_format_checker
../../.local/share/virtualenvs/connexion-dummy-LMhlc2UK/lib64/python3.11/site-packages/connexion/validators/json.py:6
../../.local/share/virtualenvs/connexion-dummy-LMhlc2UK/lib64/python3.11/site-packages/connexion/validators/json.py:6
/home/jvasik/.local/share/virtualenvs/connexion-dummy-LMhlc2UK/lib64/python3.11/site-packages/connexion/validators/json.py:6: DeprecationWarning: Accessing jsonschema.draft4_format_checker is deprecated and will be removed in a future release. Instead, use the FORMAT_CHECKER attribute on the corresponding Validator.
from jsonschema import Draft4Validator, ValidationError, draft4_format_checker
-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
========================================================================== short test summary info ==========================================================================
FAILED test_app.py::test_route - assert 404 == 200
======================================================================= 1 failed, 7 warnings in 0.79s =======================================================================
Steps to reproduce
Worked with: pip install connexion==2.14.2 flask==2.2.5
Does not work: pip install connexion==3.0.6 flask==3.0.3
Description
When the api spec in use specifies variables in the server url and the values are being passed when instantiating the connexion.FlaskApp, interpolation is not executed. See simple example below.
Expected behaviour
Actual behaviour
Full log
Steps to reproduce
Worked with:
pip install connexion==2.14.2 flask==2.2.5
Does not work:
pip install connexion==3.0.6 flask==3.0.3
Execute the test: pytest test_app.py
api.yml:
route.py:
test_app.py:
To prove the failure of interpolation, change:
response = app_client.get("test/v1/")
to:
response = app_client.get("{path_prefix}/v1/")
The test will now pass.
Additional info:
Output of the commands:
python --version
:Python 3.11.8
pip show connexion | grep "^Version\:"
:Version: 3.0.6
The text was updated successfully, but these errors were encountered: