Commit Graph

25 Commits

Author SHA1 Message Date
Robbe Sneyders
cbeac6f2c1 Update security docs (#1764)
Contributes to #1531
2023-10-31 20:08:04 +01:00
Robbe Sneyders
b9ba13cde5 Centralize error handling in ExceptionMiddleware (#1754)
I was writing the documentation on exception handling, and I noticed
that it was very hard to explain our current behavior.

Error handlers can be registered either on the internal Flask app (not
the Starlette one) or on the Connexion app, which leads to some
undefined (actually just really hard to explain) behavior. Eg.
- Registering error handlers on a status code would capture
`starlette.HTTPException` errors on the Connexion app, and
`werkzeug.HTTPException` errors on the Flask App, which means that
registering an error handler on a status code doesn't catch all the
errors with that status code.
- Flask does some default error handling which leads to some exceptions
never reaching the error handlers registered on the Connexion app.

So I made the following changes:
- Replaced the default error handlers we registered on the Flask app
with a default handler on the `ExceptionMiddleware` that takes into
account other handlers registered on status codes.
- Configured Flask to propagate exceptions instead of catching them.
- Abstracted away the Starlette `Request` and `Response` types, so users
can and must now use `ConnexionRequest`
  and `ConnexionResponse` types in error handlers.
- Renamed the `ASGIRequest` class to `ConnexionRequest` since it is the
only Request class part of the high level
  Connexion interface.

We could also rename `ConnexionRequest` and `ConnexionResponse` to just
`Request` and `Response`. Wdyt?
2023-10-29 09:37:54 +01:00
Robbe Sneyders
b102ad9f6c Update request handling documentation (#1741)
Contributes to #1531
2023-10-15 12:59:58 +02:00
Robbe Sneyders
abc1da750e Update routing documentation (#1738)
Works towards #1531 

Some parts of the old outing docs will need to be included on the
`parameters` and `swagger-ui` pages which we still need to add.
2023-10-12 01:37:45 +02:00
Nico Braun
64f42547dc rename method view resolver and pass class args and kwargs to it (#1564)
Signed-off-by: Nico Braun <rainbowstack@gmail.com>
2022-07-05 00:27:05 +02:00
Nico Braun
3c6e13c1c1 call as_view in methodresolver (#1552)
* call as_view in methodresolver

Signed-off-by: Nico Braun <rainbowstack@gmail.com>

* allow to use deprecated method view resolver

Signed-off-by: Nico Braun <rainbowstack@gmail.com>

* update method view example

Signed-off-by: Nico Braun <rainbowstack@gmail.com>

* update method view docs

Signed-off-by: Nico Braun <rainbowstack@gmail.com>

* fix pre-commit issues

Signed-off-by: Nico Braun <rainbowstack@gmail.com>
2022-06-24 17:55:11 +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
Amin Alaee
3810da72b4 Add pythonic_params to routing docs (#1394) 2021-07-08 14:02:42 +02:00
Paul Bruce
3531ef2c46 Add note about x-openapi-router-controller when using OAS (#1353) 2021-06-24 14:03:39 +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
Mark Foster
4b93890606 add documentation regarding resolver_errors 2020-01-22 07:33:00 +00:00
Asbjørn Apeland
485380d54f Document how to set Swagger UI path (#1051) 2019-10-09 18:28:14 +02:00
Simon
92867452a2 Added MethodViewResolver (#847)
* Added MethodViewResolver

By subclassing RestyResolver and modifying its `resolve_function_from_operation_id` method, it is now possible to use automatic routing functionality with Flask's MethodView together with MethodViewResolver.

* Add MethodView example

* Add tests for methodview

* add documentation on how to use MethodViewResolver
2019-02-04 08:25:27 +01:00
Daniel Grossmann-Kavanagh
343643428c update documentation (#771) 2018-11-12 09:40:42 +01:00
fdemello
cbca315326 Update routing.rst (#674)
Changes proposed in #596
2018-09-14 09:12:20 +02:00
Tomer Cohen
ccd62f897f fix link to odata (#661)
Link has markdown syntax in a reStructuredText document.
2018-08-08 20:29:30 +02:00
Ishaan Kumar
9f20c5ffb7 Minor typo (#567) 2018-02-13 10:55:20 +01: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
Patrick Williams
6eb5a6e969 Support the flask url variable converter "path" 2017-01-07 10:02:44 -05:00
Matthew Farrellee
5ce9083f20 correct doc for RestyResolver PUT requests 2017-01-03 06:22:08 -05:00
Michael Wild
b638b1168e Adds parameter name sanitization in parameters_to_args()
Without sanitization e.g. OData query parameters, such as $skip, $top,
$filter cannot be passed to the controller (except by use of **kwargs).

Fixes: zalando/connexion#334
2016-10-31 15:16:03 +01:00
David Feinzeig
0c177c7539 make swagger_json optional when adding an api 2016-03-29 00:00:27 -04:00
João Santos
3fc4da7307 #167 Added extra info to routing documentation 2016-03-04 13:23:40 +01:00
João Santos
a49c9b4885 #167 Include routing information in the docs 2016-03-04 13:16:22 +01:00