Commit Graph

26 Commits

Author SHA1 Message Date
Robbe Sneyders
600ed4ed94 Format files with black 2022-06-25 23:50:52 +02:00
Robbe Sneyders
cff1705c0a Add test for MethodViewResolver (#1559)
* Add test for MethodViewResolver

* Warn about ignoring of collection_endpoint_name in MethodViewResolver

* Add docstring on class_arguments in MethodViewResolver
2022-06-25 10:55:32 +02:00
Robbe Sneyders
e0183d3485 Clean up operation classes (#1535) 2022-05-13 15:04:51 +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
Ruwann
7c862e1ba8 Feature/relative resolver (#1419)
* Add a relative resolver

* Fix super() usage

* Apply suggestions from code review

* Allow root_path to be a Python module

* Expand documentation for RelativeResolver

* Add tests for relative resolver
2021-10-06 11:34:07 +02:00
Christian Clauss
1012721d2d Upgrade isort==5.9.1 (#1388)
* Upgrade isort==5.9.1

* isort --thirdparty connexion,aiohttp ./tests

* isort --thirdparty aiohttp,connexion --check-only --diff .

* cd tests before running isort
2021-07-07 12:43:36 +02:00
Robbe Sneyders
fb44e6acb4 Fix import order for isort 2021-06-25 13:08:46 +02:00
Drew J. Sonne
1b78f030cb Allow nesting of path resources in RestyResolver (#1265)
Fixes #206 - Handle nested paths in swagger definitions.

 - Allow nested paths to be handled in `get` and `search` handlers

An explicit decision has been made to resolve paths (with a prefix like `my.api`) like:
 - `/hello/{hello_id}/world` --> `my.api.hello.world:search(hello_id)`
 - `/hello/world/{world_id}` --> `my.api.hello.world:get(world_id)`
2020-07-20 09:07:01 +00: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
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
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
5857dd237f Uncouple all flask functions from base code.
removed test_decorators and test_parameter (this test is useless now);
removed the request/response containers and add new request response classes;
created a abstract api class and a api flask class;
derived classes will implements the get_response/get_request methods that will convert framework req/resp types to connexion req/resp types;
moved the jsonifier from produces to flask api;
created a abstract app class and a app flask class;
changed all validators to use the ConnexionRequest instead flask request;
changed the problem function to generate a ConnexionRequest;
created a new user variables container called context (this is a property of ConnexionRequest). this will be passed as kwargs to all operations functions;
this context is used on authentication;
fixed all tests to new API;
some changes that I did may not be documented in this commit.
2017-04-04 08:20:24 -03:00
Diogo Dutra
a7af62fbf0 Uncouple flask from App and Api. Created Abstract classes for theses modules. Fixed the tests 2017-04-04 08:20:23 -03:00
Yoan Blanc
be437a980b Fix isort checks 2016-10-16 11:32:11 +02:00
Elisey Zanko
927e8a0154 Fix test
Produce and consume `application/json` by default
2016-09-19 15:26:58 +05:00
Rafael Caricio
c02fad46f7 Fix import ordering 2016-09-13 11:12:45 +02:00
Jens Finkhaeuser
255e419572 Move ResolverError over to exceptions where it seems to be long. 2016-09-07 13:08:04 +02:00
Jens Finkhaeuser
bce01337d4 - Add test cases for bad and missing operationIds
- Handle bad and missing operationIds with a well-defined error
2016-09-07 09:37:39 +02:00
Rafael Caricio
6358c8c47d Adopt isort to ensure better code quality 2016-04-08 14:33:27 +02:00
João Santos
351903276f #173 Don't overload built-in functions 2016-03-08 08:14:53 +01:00
Rafael Caricio
9085ae5c4b Support parameters definitions in path 2016-02-16 18:41:57 +01:00
dfeinzeig
1b51551e3f add test to make sure restyresolver handles upper and lowercase http verbs 2016-01-12 22:02:54 -05:00
John Kleijn
9beef87d7b Handle dashes in resource names in RestyResolver 2015-12-08 15:48:36 +01:00
John Kleijn
47db7a77f7 Refactored 2015-12-08 05:22:33 +01:00
John Kleijn
1f0a12b8cb Fixed bug in collection enpoint resolution whe using x-router-controller 2015-12-07 16:54:48 +01:00
John Kleijn
a3dc54a170 Pluggable operationId resolution 2015-12-06 14:59:51 +01:00