As discussed in #1807.
Allowing the injection of WSGI middleware can enable easier migration
from Connexion 2 to Connexion 3. The use cases are limited though, as
this will only work for middleware that can work at the end of the
middleware stack.
Updates the import statements on
https://connexion.readthedocs.io/en/stable/cookbook.html
A few of the import statements were missing, or didn't match the example
code because they imported at the wrong depth.
This should make the code in the cookbook copy-pasteable.
---------
Co-authored-by: Robbe Sneyders <robbe.sneyders@gmail.com>
I'm starting to use the project with the newly release 3 version.
70084bcc4c/docs/middleware.rst (L115-L120)
It seems this example is not correct.
1. missing import for SecurityMiddleware
2. `ConnexionMiddleware.default_middlewares` is a list of classes, not
class instances: the filtering never happen.
Fixes#1787
In the `FlaskApp`, the error handlers were still registered on the
underlying Flask app instead of on the `ExceptionMiddleware`, which led
to them not following the documented behavior.
The documentation was also incorrect about ignoring error handlers
registered on the flask application. We are only ignoring the default
error handlers registered by Flask itself.
This is a breaking change, however, since this functionality was not
following the documented behavior, and 3.0.0 was only recently released,
I propose to release this as a patch version.
Tested with `swagger-ui-bundle==1.1.0` from Test PyPI.
Opening this as a draft PR, since I didn't publish `swagger-ui-bundle`
to the main PyPI yet, which I would like to do shortly before we release
Connexion 3.
Before Connexion 2.8, the `swagger_ui_bundle` version didn't have an
upper bound. So if anyone runs into any issues because of this update,
I'd rather have them come look for answers when Connexion 3 is out.
Fixes#1152.
Currently, when a request body is empty, the JSON request validator
would parse it into None, which is later passed down to the JSON Schema
validator. However, jsonschema's validation error message for this case
(when nullable is false) "None is not of type 'object'" is not
particularly friendly to either the API user, nor the website developer.
This change adds a specific check before the None value is passed to
jsonschema to emit a better error message directly.
I also added some drive-by improvements on function argument typing
since _validate in validators don't seem to expect receiving None, but
_parse (the result of which is passed to _validate) is totally allowed
to return None (or anything really). This does not seem to reflect the
logic well.
I’m not exactly sure if this is the best way to do this in Connexion
3.x. [We do have a patch in Connexion 2.x to achieve a similar
effect](e89a7eeea6)
so if anyone understands how the two implementations correspond please
tell me whether the two do the same thing 🙂
---------
Co-authored-by: Robbe Sneyders <robbe.sneyders@ml6.eu>
This PR adds a copyright notice for the new authors / maintainers of
connexion. It also reformats the license / notice files as prescribed by
the license.