Commit Graph

110 Commits

Author SHA1 Message Date
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
Daniel Grossmann-Kavanagh
0b19ed489a Update to swagger-spec-validator 2.3.1 (fixes #612) (#611) 2018-07-03 08:21:43 +02:00
Diogo Dutra
afbd4789fa updated the aiohttp version 2018-02-19 17:20:50 -03:00
Diogo Dutra
8f4ff0313d Changes for aiohttp support:
- Created a metaclass for AbstractAPI (it is used to set the jsonifier for the class);
 - Created a new class method AbstractAPI._set_jsonifier;
 - Changed the code to use the new jsonifier interface;
 - Create a new module called coroutines_wrapper to put the wrapper functions with the 'yield from' statement. It is used to enable frameworks with coroutine handlers;
 - Did the AioHttpApi.get_request coroutine and add req.read() to get the request body;
 - Moved the flask jsonifier to utils and did it a generic jsonifier;
 - Created a function called 'has_coroutine' on utils module;
 - Added aiohttp_jinja2 to requirements-aiohttp;
 - Added a new python3 coreragerc file to skip only python2 lines;
 - Fixed the set of validation_response on test_aiohttp_simple_api.py;
 - Added the test to check the aiohttp body request;
 - Fixed the response for 'aiohttp_bytes_response' and 'aiohttp_non_str_non_json_response' paths on aiohttp/swagger_simple.yml file.
2018-02-05 13:35:56 -02:00
Diogo Dutra
d1565cf259 Changes requested by @prawn-cake:
- Unified the python version checking
 - Fixed the endpoint name registration on AioHttpApi
2018-01-18 14:27:08 -02:00
Diogo Dutra
8328507f88 fixed flake8 issues 2018-01-18 14:27:02 -02:00
Diogo Dutra
f24ca441dc Changes did on the base code to support aiohttp
- Added the AioHttpApi and AioHttpApp on connexion __init__;
- Created an abstract method on AbstractApi to cast the framework response to connexion response;
- Implemented the get_connexion_response on FlaskApi;
- Changed the CLI to use any kind of App class;
- Changed the ResponseValidator to always convert the response to a connexion response;
- Changed the ResponseValidator to support coroutine responses;
- Added the aiohttp as optional dependency;
- Added ujson as optional dependency;
- Skipped the aiohttp tests run on python 2.7;
- Changed the tests configs to run aiohttp tests properly on python 3.4+.
2018-01-18 12:53:58 -02:00
Henning Jacobs
7199745862 Fix tests (#560)
* isort

* no longer test dev dependencies on Travis
2018-01-13 19:48:43 +01:00
Mikko Valkonen
f4bc6dc71b FIX a typo causing an ERROR log (#523)
* FIX a typo causing an ERROR log

A small bug was introduced in #500 when sanitizing the request query
parameters. Instead of fetching the arguments from `request.query`,
the parameters were sanitized from the `request.form`. This causes an
error log to be printed, as the parameters are not expected for the
query (for example in the case of a POST request).

Fixes #504

* adds a fixture for testing query param sanitazion

Adds a simple fixture to test form and query parameter sanitazion. This
is mostly related to #522, in which the `formData` parameters were
treated as query parameters.

* add a test to validate form data params

* introduce testfixtures library
2017-11-16 13:04:06 +01:00
Bence Nagy
d51e9c8a4c setup.py: Use env markers for Python version-specific dependencies (#495)
* setup.py: Use env markers for Python version-specific dependencies

Changing package properties dynamically in setup.py means that universal
wheels will actually be built only for the builder's environment, and
might not work properly on different platforms/PYthon versions.

Closes https://github.com/zalando/connexion/issues/493

* travis: Upgrade setuptools before running tests

* reqs: Stop installing pathlib from mercurial in dev mode

The mercurial repo is at 0.8 while the latest release on PyPI is 1.0.1
2017-07-29 12:28:13 +02:00
João Santos
f7fe7f59cc Install latest typing when running on python 3.5 2017-06-07 13:56:04 +02:00
João Santos
e138c79280 Install typing only when needed 2017-06-07 13:54:20 +02:00
Rafael Carício
93c06711ed New style of passing options to Connexion (#436)
* Order classes by relevance in module

* Order definitions by relevance within module

* Swagger UI options extracted

* New style options

* Use new-style options

* Reuse code

* Sort imports

* Ignore typing imports

* Warn users about parameter name change

* Add back isort check

* Fix isort check
2017-04-11 16:47:21 +02:00
Rafael Carício
1858c9d4a0 Flask required only if necessary (#424)
* Example with Flask support

* Only show import error when trying to use Flask

* Re-organize imports

* Move flask_utils next to related module

* Code style

* Change back to incentivizes

* Includes Flask by default

* Project clean up

* Update Rafael Caricio's e-mail address

* Fix conflicts
2017-04-04 20:48:08 +02:00
Diogo Dutra
fb7f986337 did flask a optional dependency 2017-04-04 08:20:25 -03:00
Rafael Carício
711bbf08e7 Merge pull request #404 from Griffon26/master
Remove unnecessary dependency on strict-rfc3339
2017-03-21 10:56:20 +01:00
Maurice van der Pot
a6577f9912 Remove unnecessary dependency on GPL library strict-rfc3339
In order to validate date-time or uri formats jsonschema requires
strict-rfc3339 and rfc3987 to be installed, both of which are licensed
under the GPLv3. To avoid license ambiguity, it makes sense to not
depend on either of them for installation or testing of connexion.
2017-03-20 21:24:53 +01:00
Dan Ballance
702142ec48 Fixes #340 | Convert camelcased parameter names to Python style 2017-03-09 16:42:17 +00:00
Rafael Caricio
fa4604d81d Add blank line to pass flake8 check 2016-11-16 17:33:44 +01:00
Yoan Blanc
6b5107122e Using Requirements Builder for Tox setup
Requirements Builder provides a way to run tests against all interesting
versions of the requirements: minimal, latest as well as development
(from git, hg, svn).

It requires to move the requirements into the setup.py and to provide a
minimal version. requirements-devel aims at helping you working

* It detected a conflict with six version which had to be bumped up;
* building PyYAML from Subversion fails so it's commented in the
  requirement-devel.txt file.

A cool blog post on how to keep some balance between setup.py and
requirements.txt file:
https://caremad.io/posts/2013/07/setup-vs-requirement/
2016-10-18 14:45:16 +02:00
Rafael Caricio
dbe20e9a14 Remove cnx alias to CLI 2016-09-14 06:56:09 +02:00
Rafael Caricio
c74d8cdd3b Provide CLI support for runnning specifications 2016-09-12 18:28:14 +02:00
Jens Finkhaeuser
2d42fc6d95 - Not specifying tests as the test directory will lead to pytest
trying to run test code in dependencies installed in the project
  directory via `virtualenv`.
- `README.rst` is in utf-8 encoding; reading it fails on py34
2016-09-07 13:50:32 +02:00
Henning Jacobs
6fcc004369 #260 fix major/minor version comparison for non-numeric patchlevels 2016-09-01 12:34:30 +02:00
Russell Jurney
a4183dfcec Fixed setup.py to fix issue 260
See https://github.com/zalando/connexion/issues/260
2016-08-10 14:55:59 -07:00
Rafael Caricio
bf24e8fa8c Recommend usage of decorator 2016-02-15 17:33:03 +01:00
hjacobs
3d5af0c595 Swagger is now OpenAPI https://openapis.org/ 2016-01-22 22:16:03 +01:00
hjacobs
1826ddaee4 add Trove classifiers 2016-01-12 21:30:13 +01:00
João Santos
ead3c31663 #108 Use json schema for parameters 2015-12-10 15:51:37 +01:00