Commit Graph

27 Commits

Author SHA1 Message Date
Daniel Grossmann-Kavanagh
667ceba45c use non-sanitized path param name when getting the path definition from the spec 2020-01-14 18:26:31 -08:00
Daniel Grossmann-Kavanagh
f575f0e54d update tests to allow new datetime behavior in PyYAML 5.3 2020-01-14 17:37:00 -08:00
pando85
917956cc2f Fix: aiohttp access_log duplicated if passed as argument
- Pop access_log option from aiohttp options
  - Add test to access_log options in aiohttp run
2019-12-24 14:24:14 +01:00
Daniel Grossmann-Kavanagh
e85960947f Merge branch 'master' into dynamic_ui_path 2019-12-17 11:42:35 +11:00
Daniel Grossmann-Kavanagh
5abdcbb859 Fix test that relies on the repo folder being named Connexion 2019-12-12 08:02:42 +00:00
Daniel Grossmann-Kavanagh
c672c85c00 add tests for reverse proxies 2019-12-11 17:58:15 -08:00
Jyhess
d18c387d94 Return tuple for aiohttp (#849)
* Support aiohttp handlers to return tuples

* Minor update from #828 review

* Factorize more code between Flask and AioHttp response

* Fix CI

* Drop six string types

* Standardize response logging

* Handle one-tuples that only contain data

* clean up a couple of type hint comments

* Add a few more get_response tests

* Adjust _prepare_body interface to simplify improving _serialize_data

Rename _jsonify_data to _serialize_data to make its purpose easier to
understand (this was also known as _cast_body in aiohttp_api).

In exploring how to harmonize json serialization between aiothttp and
flask, we needed to be able to adjust the mimetype from within
_serialize_data. Harmonizing the actual serialization has to wait until
backwards incompatible changes can be made, but we can keep the new
interface, as these functions were introduced in this PR (#849).

* Add deprecation warnings about implicit serialization
2019-12-11 12:54:44 +01: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
drewdogg
16ef766b89 Fix unit tests on Windows (#1071) 2019-12-03 00:05:45 +01:00
Christian Siegel
67f48ae24d Add swagger_ui_config option to pass config to the Swagger UI (#948)
* Add swagger_ui_config option to configure the Swagger UI

There was no possibility to configure the Swagger UI. Through
this new option a config object can be passed to the UI via
a `swagger-ui-config.json` file.

* Add tests for swagger_ui_config option
2019-11-05 10:12:59 +01:00
Brian Price
b0b83c4879 Converting response to raise a ProblemException (#955)
* Converting response to raise a ProblemException

* Centralizing around ProblemException for errors in the app.

* Adding the ability to skip error handlers, allow for defining exception payload.

* Fixing flake8

* Fixed some bugs found through unit testing.

* Unit tests are now passing.

* Added problem back to __init__

* Updating based on the feedback from the PR.
2019-10-24 10:59:05 +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
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
1e6aead70a Fix swagger console backslash redirect for aiohttp (thanks @pando85) (#843)
Fixes #831 

Changes proposed in this pull request:
 - redirect ui -> ui/ for aiohttp
2019-03-25 12:29:55 +01:00
Daniel Grossmann-Kavanagh
08e4536e5e bump and pin isort, apply all automatic fixes (#903)
Fixes the build.

Changes proposed in this pull request:
 - apply all of the isort changes that resulted from the latest version
 - pin to the latest version (4.3.15) so this doesn't happen again, unless we bump the version on purpose
2019-03-15 13:04:33 +01:00
Roberto Polli
b18d8b9528 Serve yaml spec. (#842)
* Fix: #772. Serving yaml spec.

Serve yaml spec with a yaml prettifier. Uses a separate method for
doing the job and does not modify the openapi_json one.
2019-01-24 08:31:02 +01:00
lynxknight
fda2b18b38 AioHttpApi oauth middleware should catch all OAuth problems (#830)
Fixes #829

* aiohttp openapi basic auth testing

* let oauth_problem_middleware recognize all OAuth exceptions

* scope problem should return 403

* excepting two classes makes more sense than subclassing hacks
2019-01-14 08:44:54 +01:00
Jyhess
78bea62279 Fix case sensitive headers (#825) 2018-12-18 08:24:59 +01:00
Diogo Dutra
03a0febbf9 Fixed aiohttp test client deprecation messages. (#810) 2018-12-11 08:50:46 +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
Tomasz Trębski
2b6169aade Fix bad parsing of query params for AioHttp (#697)
* Fix bad parsing of query params for AioHttp
2018-09-27 09:04:55 +02:00
Diogo Dutra
b02023ce1c fix on utils.has_coroutine function (#600)
Fixed coroutinefunction verification when has async def.
   It is necessary because there's no @asyncio.coroutine decorator to validate
2018-09-13 11:57:39 +02:00
Stephen Kwong
ee07865b78 Add capability to pass framework's request context to handler functions 2018-07-13 08:41:01 +02: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
Maksim Ekimovskii
2841697b9e aiohttp tests: simplify folder layout; naming refactoring. Small aiohttp_api refactoring + tests; Extend aiohttp swagger files and fake apis. Problem with request body for aiohttp handlers remains; 2018-02-03 17:40:03 +02:00
Diogo
fdaaa28d9b Changes:
- Added a note to create aiohttp handlers;
 - Added a new parameter on AioHttpApp.__init__ to choose create only one api. With this parameter we can create an api with a empty base_path;
 - Added exceptions messages on AioHttpApp.add_api method;
 - Created new tests for AioHttpApp.add_api.
2018-01-18 18:25:50 -02:00
Diogo Dutra
5ce51450fe Addded aiohttp support 2018-01-18 12:53:57 -02:00