Commit Graph

138 Commits

Author SHA1 Message Date
Robbe Sneyders
f064fd04b7 Switch to own maintained version of swagger-ui (#1619)
Fixes #1412
Fixes #1516 

Since [swagger-ui-bundle](https://github.com/dtkav/swagger_ui_bundle) is
no longer maintained, I forked it under the spec-first organization as
[py-swagger-ui](https://github.com/spec-first/py-swagger-ui). This PR
updates connexion to use it instead.
2023-01-09 18:57:15 +01:00
Robbe Sneyders
073f0d446e Update examples for Connexion 3.0 (#1615)
This PR updates the examples for Connexion 3.0 and merges them for
OpenAPI and Swagger.

2 examples required some changes to make them work:
- The reverse proxy example required some fixes to the
SwaggerUIMiddleware to leverage the `root_path` correctly. This is
included in the PR.
- The enforced defaults example requires the json validator to adapt the
body and pass it on. We currently pass on the original body after
validation, and I'm not sure if we should change this. I'll submit a
separate PR to discuss this.
2022-12-30 20:34:19 +01:00
Robbe Sneyders
5a0c292b44 Add async app 2022-12-26 20:51:46 +01:00
Robbe Sneyders
269ea2c4fe Add form data validator for OpenAPI 3
Add python-multipart dependency to setup.py

Copy validator map so it remains unchanged
2022-11-04 00:42:59 +01:00
Robbe Sneyders
181c61bfb6 Extract boilerplate code into Routed base classes (#1590)
* Extract boilerplate code into Routed base classes

* Use typing_extensions for Python 3.7 Protocol support

* Use Mock instead of AsyncMock

* Turn properties into class attributes
2022-09-26 20:33:58 +02:00
Robbe Sneyders
024666de89 Explicitly support Flask async routes (#1592) 2022-09-26 20:04:23 +02:00
John Vandenberg
e4b7827b6d setup.py: Update url (#1586) 2022-09-13 18:57:42 +02:00
Robbe Sneyders
45468a14e6 Update json for Flask 2.3 (#1582)
* Update json for Flask 2.3

* Update docstrings
2022-09-06 22:57:13 +02:00
Ruwann
6f9117caf4 Fix async tests (#1558)
* Use pytest-asyncio for async tests

* Fix async tests
2022-06-24 18:25:15 +02:00
Jonas Boecquaert
6856482603 Removed jsonschema version check (#1540)
* Removed jsonschema version check

* Remove dependency on importlib-metadata

* Remove packaging dependency
2022-05-17 23:00:33 +02:00
Jonas Boecquaert
d2391a2898 Fix deprecation warning for Validator.iter_errors (#1536)
* Fix deprecation warning for iter_errors
Bump jsonschema version to at least v4

* Bump jsonschema to v4.0.1

* Provide schema as keyword arg to evolve

* Fix evolve statement
2022-05-12 18:23:42 +02:00
Robbe Sneyders
4603e0679d Extract security to middleware (#1514)
* Extract security to middleware

* Add MissingMiddleware exception

* Extract add_auth_on_not_found in security middleware

* Add detail kwarg to exceptions

* Return JSONResponse in ExceptionMiddleware

* Type dicts in SecurityMiddleware

* Add trailing comma in setup.py

* Rework connexion context

* Improve error handling for missing security operation

* Refactor default security operation

* Revert "Return JSONResponse in ExceptionMiddleware"

This reverts commit c1004c7500d1be7e0938eea8672325cf15355359.

* Move routing context name into constant
2022-04-27 22:20:38 +02:00
Robbe Sneyders
7f2931037e Add pre-commit hook (#1511) 2022-04-12 22:02:29 +02:00
Robbe Sneyders
895d3d475a Add empty connexion middleware (#1502)
* Add empty connexion middleware

* Address PR comments

* Bump minimum Flask version to 2

* Update tests for changed werkzeug behavior in 2.1

https://github.com/pallets/werkzeug/issues/2352
2022-03-31 19:24:44 +02:00
Robbe Sneyders
9d3155f1be Add Python 3.10 in favor of 3.6 (#1494)
* Add Python 3.10 in favor of 3.6

* Increase lower bound requests for Python 3.10 compatibility
2022-03-28 23:54:53 +02:00
Robbe Sneyders
ca70b16ff5 Drop aiohttp support (#1491) 2022-03-22 22:26:41 +01:00
Ruwann
f236c6883d Drop pkg_resources (#1499)
* Use pkgutil instead of pkg_resources

* Use importlib.metadata and packaging for getting and parsing version number
2022-03-22 19:10:15 +01:00
Jonas Boecquaert
37f729ceb5 upgrade pyYAML supported versions in setup.py (#1478)
Fix test using pyYAML
2022-03-07 18:08:38 +01:00
Robbe Sneyders
67d769d778 Drop openapi-spec-validator for custom ref handler (#1455) 2022-02-21 18:15:24 +01:00
Robbe Sneyders
e5c64bc96a Add lower bounds for itsdangerous and markupsafe (#1465)
This will enforce their lower versions to be installed in the *-min test
environments and prevent dependency conflicts with Flask and Jinja
2022-02-21 17:55:16 +01:00
Robbe Sneyders
0b916e9877 Add Python 3.9 to supported versions in setup.py (#1459) 2022-02-09 10:09:41 +01:00
Robbe Sneyders
86af42d6b9 Bump upperbound version for jsonschema to 5.0.0 (#1447)
* Drop usage of private jsonschema modules

* Bump upper boundry for jsonschema version to 5.0.0

* Create validate_defaults function by passing in the instance_validator

The instance_validator was previously set as an attribute on the
OpenApiValidator. However with the jsonschema upgrade to 4.0.0, this
attribute is no longer maintained while descending into the spec.
Presumably because jsonschema now relies on attrs.resolve.
2022-01-29 20:30:56 +01:00
Robbe Sneyders
f45ef0e5ae Bump Flask & Werkzeug major versions (#1402) 2021-07-19 18:27:18 +02:00
Robbe Sneyders
e30971c5f3 Add readthedocs config with docs requirements (#1391) 2021-07-08 14:44:38 +02:00
Robbe Sneyders
1a7d0896d6 Remove deprecated static analysis (#1376)
* Remove deprecated static analysis config

* Remove Zappr PR rules
2021-07-06 09:43:04 +02:00
Christian Clauss
6c4f99051d Upgrade syntax for Python >= 3.6 (#1383)
* pyupgrade --py36-plus **/*.py

* Fix indentation

* Fix indentation
2021-07-04 20:04:22 +02:00
Robbe Sneyders
d4657e7a15 Pin test versions (#1373) 2021-06-29 21:45:42 +02:00
Robbe Sneyders
82a0b8eb44 Add upper limits for dependency versions 2021-06-25 13:08:46 +02:00
Patrick Wang
2d03c3ce2e Add explicit werkzeug dependency (#1302)
Fixes #1149.
2021-06-24 14:06:26 +02:00
jlaba
16a896cdbf Switched from mock to unittest.mock (#1218)
* Switched from mock to unittest.mock

* Update test_validation.py

Removed mock comment

* Update test_parameter.py

Removed comment for mock

Co-authored-by: Joachim Langenbach <joachim.langenbach@engsas.de>
2020-04-23 22:59:41 +02:00
Justin Black
5666ea770a Adds Programming Language :: Python back in 2019-12-18 09:58:11 -08:00
Justin Black
4278d4efdf Adds python_requires to setup.py 2019-12-18 09:51:17 -08:00
Justin Black
44910e1dea Removes python 2 from setup.py 2019-12-18 09:44:30 -08:00
Daniel Grossmann-Kavanagh
e85960947f Merge branch 'master' into dynamic_ui_path 2019-12-17 11:42:35 +11:00
Henning Jacobs
852eca0e0f Remove six (Python 2 support) (#1102)
* remove some six uses (Py2)

* remove more six usages

* no need for "object" in Py3

* remove remaining six uses
2019-12-13 21:12:53 +01:00
Daniel Grossmann-Kavanagh
dd5f29b444 remove check for python versions less than 3.5 2019-12-11 18:27:34 -08:00
Daniel Grossmann-Kavanagh
c672c85c00 add tests for reverse proxies 2019-12-11 17:58:15 -08:00
Jyhess
db4459fa20 Datetime serialization (#851)
* Add datetime and uuid serialization for AioHttp

* Remove ujson dependency

* fix merge error

* Retry CI

* remove bad jsonifier import

* remove ujson import
2019-12-03 05:23:36 +01:00
Tomasz Trębski
a4300026ed Clean up dropping Python 3.{4,5} (#1057)
This is a follow up for c8d8973c7e
(dropping Python 3.5). There waere some leftovers in requirements for
Pythonv versions `connexion` no longer supports.
2019-10-27 23:14:56 +01:00
Tomasz Trębski
ec37d03902 Drop Python 2.7 support (#1058)
* Drop 2.7

* fixup! Drop 2.7

* fixup! Drop 2.7
2019-10-27 23:01:23 +01:00
Henning Jacobs
c8d8973c7e drop Python 3.5, add 3.8 (#1056)
* drop Python 3.5, add 3.8

* remove old pypy 2.7 (no longer available on 18.04)
2019-10-18 13:32:43 +02:00
Clemens Lang
7a1ce8d41a Support jsonschema >= 3.0.0 (#1050)
* setup.py: Support jsonschema >= 3.0.0

Other projects have started using jsonschema >= 3.0.0, and modern python
packaging tools such as poetry now fail to install projects using both
connexion and a different dependency if they depend on different
versions of jsonschema.

Allow jsonschema versions >= 3.0.0 to avoid this problem.

See: https://github.com/sdispater/poetry/issues/697

* Avoid warning when using jsonschema >= 3.0

jsonschema 3.0.0 changed the API to deprecate the types parameter of the
jsonschema.IValidator constructor and now raises a warning when using
it.

Avoid the warning by checking the jsonschema version and switching to
the new way to implement this when it is >= 3.0. Note that while
jsonschema 2.x did have jsonschema.validators.extend, it did not support
the type_checker argument, so the same code cannot be used with
jsonschema 2.x.
2019-10-18 12:38:09 +02:00
Jacob Floyd
bd2552c313 Fix aiohttp upgrade (#951)
* Revert "set max aiohttp version to 3.5.1 (until build is fixed) (#844)"

This reverts commit b2a4287405.

* Fix test_run_with_aiohttp_not_installed

Somewhere between 3.5.1 and 3.5.2, the aiohttp reimport started
succeeding (in connexion.connexion.cli.run()). It's not clear which
change caused the issue, but it's probably one of:

- aio-libs/aiohttp#3469 (Remove wildcard imports)
- aio-libs/aiohttp#3464 (Don't suppress gunicorn cleanup errors)
- aio-libs/aiohttp#3471 (Refactor workers)
- aio-libs/aiohttp#3500 (Ignore done tasks)

In any case, setting sys.modules['aiohttp'] = None should prevent
reimporting it. See: https://stackoverflow.com/a/1350574

I successfully tested locally on py37 with aiohttp 3.5.1 and 3.5.2.
2019-10-15 18:42:28 +02:00
Tomasz Trębski
123c5c9fbd Remove Python 3.4 (#990)
* EOL Python 3.4

* fixup! EOL Python 3.4

* fixup! EOL Python 3.4

* fixup! EOL Python 3.4
2019-07-09 13:53:44 +02:00
Tomasz Trębski
f99e39b780 Bump flask to be at least 1.0.4 (#995)
* Bump flask to be at least 1.0.4

Reasons:
- `flask==0.10.1` was released in 2013, which makes it quite old thus unsupported.
- On Flask webpage you can find an information pointing to `1.x` branch as latest stable
- different tools, including these used in `connexion` progressed leaving Python versions, for which `flask<1.0` has been developed.

* match instead of message
2019-07-09 13:17:48 +02:00
Jacob Floyd
890fe9a171 Respond with problems by default in aiohttp. (#952)
* Respond with problems by default in aiohttp.
2019-06-14 09:07:07 +02:00
Daniel Grossmann-Kavanagh
d3d1836c82 bump PyYAML to 5.1 for CVE-2017-18342 (#902) 2019-03-15 13:24:04 +01:00
Daniel Grossmann-Kavanagh
b2a4287405 set max aiohttp version to 3.5.1 (until build is fixed) (#844) 2019-01-10 08:51:27 +01:00
krise3k
fa9c00a191 Run travis on python3.7 (#790) 2018-11-22 08:32:36 +01:00
João Santos
44ea9336fe Connexion 2.0 (#619)
- App and Api options must be provided through the "options" argument (``old_style_options`` have been removed).
- You must specify a form content-type in 'consumes' in order to consume form data.
- The `Operation` interface has been formalized in the `AbstractOperation` class.
- The `Operation` class has been renamed to `Swagger2Operation`.
- Array parameter deserialization now follows the Swagger 2.0 spec more closely.
  In situations when a query parameter is passed multiple times, and the collectionFormat is either csv or pipes, the right-most value will be used.
  For example, `?q=1,2,3&q=4,5,6` will result in `q = [4, 5, 6]`.
  The old behavior is available by setting the collectionFormat to `multi`, or by importing `decorators.uri_parsing.AlwaysMultiURIParser` and passing `parser_class=AlwaysMultiURIParser` to your Api.
- The spec validator library has changed from `swagger-spec-validator` to `openapi-spec-validator`.
- Errors that previously raised `SwaggerValidationError` now raise the `InvalidSpecification` exception.
  All spec validation errors should be wrapped with `InvalidSpecification`.
- Support for nullable/x-nullable, readOnly and writeOnly/x-writeOnly has been added to the standard json schema validator.
- Custom validators can now be specified on api level (instead of app level).
- Added support for basic authentication and apikey authentication
- If unsupported security requirements are defined or ``x-tokenInfoFunc``/``x-tokenInfoUrl`` is missing, connexion now denies requests instead of allowing access without security-check.
- Accessing ``connexion.request.user`` / ``flask.request.user`` is no longer supported, use ``connexion.context['user']`` instead
2018-11-05 14:50:42 +01:00