Commit Graph

14 Commits

Author SHA1 Message Date
Robbe Sneyders
c1ff7641f6 Change deprecated httpx data usage in tests to content 2023-02-16 09:35:35 +01:00
Robbe Sneyders
65bc8b9138 Leverage Starlette TestClient for both FlaskApp and AsyncApp tests 2023-02-15 00:48:40 +01:00
Robbe Sneyders
515e324c80 Make tests framework agnostic 2023-02-13 20:01:25 +01:00
Robbe Sneyders
edb0381af3 Implement user facing interface for ConnexionMiddleware (#1621)
This PR adds an interface for the ConnexionMiddleware, similar to the
interface of the Connexion Apps.

The Connexion Apps are now a simple wrapper around the
ConnexionMiddleware and framework app, delegating the work to the
middleware. This enables a similar interface and behavior for users when
using either the middleware or apps.

The arguments are repeated everywhere there is a user interface, but are
parsed in a central place. Repeating the arguments is not DRY, but
needed to provide users with IDE autocomplete, typing, etc. They are
parsed in a single `_Options` class, which also provides a mechanism to
set default options on an App level, and override them on the more
granular API level.

This makes the long list of provided parameters a lot more manageable,
so I would like to use it for the `Jsonifier` as well, and re-add the
`debug` and `extra_files` arguments which I have dropped in previous
PRs. I'll submit a separate PR for this.

I renamed the `options` parameter to `swagger_ui_options` since it only
contains swagger UI options. This is a breaking change though, and we'll
need to highlight this upon release.

We still have quite a lot of `App`, `MiddlewareApp`, and abstract
classes. It would be great if we could find a way to reduce those
further, or at least find better naming to make it more clear what each
one does 🙂 .

Finally, I added examples on how the middleware can be used with third
party frameworks under `examples/frameworks`. Currently there's an
example for Starlette and Quart, but this should be easy to extend. They
also show how the `ASGIDecorator` and `StarletteDecorator` from my
previous PR can be used.
2023-01-26 14:40:29 +01:00
Robbe Sneyders
9d7258c25d Create MediaTypeDict class for range matching (#1603) 2022-11-04 11:07:03 +01:00
Robbe Sneyders
1ab5400c0b Move JSON response body validation to middleware (#1591)
* Extract boilerplate code into Routed base classes

* Use typing_extensions for Python 3.7 Protocol support

* Use Mock instead of AsyncMock

* Extract response validation to middleware

* Refactor Request validation to match Response validation

* Factor out shared functionality

* Fix typo in TextResponseBodyValidator class name

* Fix string formatting

* Use correct schema to check nullability in response validation
2022-10-03 23:01:21 +02:00
Robbe Sneyders
600ed4ed94 Format files with black 2022-06-25 23:50:52 +02:00
Svendegroote91
e06ec6da82 #594 & #816 - Add error path to schema validation error in RequestBodyValidator (#1063)
* Add error path to schema validation error in RequestBodyValidator

* Add unit test for error path in schema validation
2019-10-27 12:07:12 +01:00
Daniel Grossmann-Kavanagh
53dffc0b78 Only pass body on PATCH/POST/PUT request (#761)
Fixes #757
2018-11-09 08:27:08 +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
Leena Bhegade
f7b3d9a0bb add parameter to decode 2017-02-08 23:48:04 +00:00
Leena Bhegade
c1020bf0f6 Fix tests 2017-02-08 21:31:35 +00:00
Rafael Caricio
d355d8ae5d Response definitions can be defined globally in spec 2016-03-18 15:38:51 +01:00
Rafael Caricio
a7aec5d53c Split tests in isolated modules 2016-02-25 14:49:19 +01:00