Commit Graph

1472 Commits

Author SHA1 Message Date
Robbe Sneyders
3e64fe46e9 Fix ReverseProxied middleware and add docs (#1873)
Starlette introduced some new changes to how the `root_path` is handled,
which broke our `ReverseProxied` example and test.

This PR fixes both and adds documentation on how to run behind a proxy.
2024-02-11 22:19:37 +01:00
Robert Parini
f8f461c524 Fix quickstart WSGI example typo (#1845)
Small fix to the example code in the documentation for using the
`a2wsgi` workaround. The `app` variable is not defined prior to `app =
ConnexionMiddleware(app)`
2024-01-02 12:14:19 +01:00
Ruwann
0ae9ba811a Bugfix/starlette root path (#1833)
Fixes the change in behaviour in starlette v0.33 via PR
[#2352](https://github.com/encode/starlette/pull/2352)
2023-12-29 14:52:05 +01:00
Niels Dewulf
6dc943661d Specification use raw spec on clone (#1830)
Fixes #1829.



Changes proposed in this pull request:

 - Use _raw_spec when cloning

---------

Co-authored-by: Robbe Sneyders <robbe.sneyders@gmail.com>
3.0.5
2023-12-07 14:54:40 +01:00
Robbe Sneyders
dbca0485f1 Set starlette upperbound version to <0.33 (#1828)
Temporary fix for https://github.com/spec-first/connexion/issues/1826

We should release this asap.
3.0.4
2023-12-06 11:57:06 +01:00
Niels Dewulf
0082d7ad33 Fix CORS headers not set on exceptions (#1821)
Fixes #1820.
Correct error handling in response to CORS.


Changes proposed in this pull request:

- Add a MiddlewarePosition before Exception handling so CORS is always
returned
- Add ServerError Middleware to handle unhandled errors between the
ServerError- and ExceptionMiddleware
 - Update corresponding docs

---------

Co-authored-by: Robbe Sneyders <robbe.sneyders@ml6.eu>
3.0.3
2023-12-01 00:04:46 +01:00
Robbe Sneyders
0857710147 Only instantiate specification once (#1819)
Fixes #1801 

I had to make quite a few additional changes to satisfy mypy.
2023-11-30 23:59:26 +01:00
Dan Price
bbd085bd39 Fix missing colons in request docs; rename /path to /foo for consistency with other examples (#1818) 2023-11-20 22:23:51 +01:00
Robbe Sneyders
004f12f88c Add more detailed v3 migration guide (#1815)
Fixes #1794
Fixes #1802
3.0.2
2023-11-20 11:17:52 +01:00
Robbe Sneyders
14e02fa97f Add interface to add WSGI middleware (#1814)
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.
2023-11-19 23:46:21 +01:00
MatthiasDurivet
563fbf8e77 Update the import statements for the cookbook snippets (#1805)
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>
2023-11-19 22:56:28 +01:00
Robbe Sneyders
165a91511b Fix multiple file upload (#1813)
Fixes #1806
Fixes #1811
2023-11-19 22:55:40 +01:00
Robbe Sneyders
b244d80908 Fix 'Edit on GitHub' link on docs (#1799)
Fixes #1797 

[Relevant
docs](https://docs.readthedocs.io/en/stable/guides/edit-source-links-sphinx.html#github).
2023-11-09 10:05:31 +01:00
Aurélien Joga
095ae897a5 Fix middleware doc example (#1796)
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.
2023-11-08 23:17:30 +01:00
Robbe Sneyders
70084bcc4c Fix FlaskApp exception handlers (#1788)
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.
3.0.1
2023-11-06 19:00:46 +01:00
Robbe Sneyders
55bdfbaa70 Improve ASGI server documentation (#1791)
Discussions in #1757 indicate that we should document this more clearly.
2023-11-06 18:49:43 +01:00
Robbe Sneyders
a910709606 Correctly document keys available in context (#1792)
Fixes #1780
2023-11-06 18:36:23 +01:00
Robbe Sneyders
26d1b84242 Add CORS documentation (#1790)
Fixes #1785
2023-11-06 18:35:44 +01:00
Robbe Sneyders
bcf4c63b32 Fix fern link in docs (#1782) 2023-11-03 00:28:12 +01:00
Robbe Sneyders
c69e5977d9 Add Fern sponsor (#1779) 2023-11-03 00:14:35 +01:00
Robbe Sneyders
d972eae864 Add 3.0 announcement (#1774)
Final update for the 3.0 announcement on our docs.
3.0.0
2023-11-02 11:22:30 +01:00
Robbe Sneyders
f2ee190945 Fix images on PyPI (#1773)
The images are not showing correctly on
[test.pypi](https://test.pypi.org/project/connexion/)
2023-11-01 23:45:03 +01:00
Robbe Sneyders
0772056e68 Convert README from rst to md (#1772)
rst lacks different features on both Github and PyPI, making it
difficult to build an rst README that will be rendered well on both.
[The release pipeline was failing due to
this.](https://github.com/spec-first/connexion/actions/runs/6724758517/job/18277703972)
2023-11-01 23:10:20 +01:00
Robbe Sneyders
5fcda360a9 Switch back from py-swagger-ui to swagger-ui-bundle (#1756)
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.
2023-11-01 21:26:56 +01:00
Robbe Sneyders
bd704d2aec Update v3 documentation for release (#1771) 2023-11-01 21:11:02 +01:00
Robbe Sneyders
989b5f7f2c Update readme (#1769)
Contributes to #1531

---------

Co-authored-by: Ruwan <ruwan.lambrichts@ml6.eu>
2023-11-01 20:54:28 +01:00
Tzu-ping Chung
9c02fdfa74 Improve JSON req error on disallowed empty body (#1761)
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>
2023-11-01 20:53:07 +01:00
Robbe Sneyders
e7dc56c476 Add new authors' copyright notice (#1770)
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.
2023-11-01 20:31:59 +01:00
Robbe Sneyders
a7584a6113 Import WSGIDecorator under connexion.decorators (#1768) 2023-11-01 15:27:12 +01:00
Robbe Sneyders
c1ef3f4e3a Add gunicorn with uvicorn workers to docs (#1766)
Fixes #1755
2023-10-31 20:08:17 +01:00
Robbe Sneyders
cbeac6f2c1 Update security docs (#1764)
Contributes to #1531
2023-10-31 20:08:04 +01:00
Robbe Sneyders
17aa31a7ab Remove cookbook docs and sort index better (#1765)
Contributes to #1531
2023-10-30 20:54:59 +01:00
Robbe Sneyders
99c7a13b53 Update cli docs (#1763)
Contributes towards #1531
3.0.0a8
2023-10-29 14:23:21 +01:00
Robbe Sneyders
4556779343 Fix CLI and drop click dependency (#1762) 2023-10-29 11:34:55 +01:00
Robbe Sneyders
d8ceb52822 Update Exceptions documentations (#1758)
Contributes towards #1531
2023-10-29 09:58:05 +01:00
Robbe Sneyders
452ffc7676 Add testing documentation (#1760)
Contributes towards https://github.com/spec-first/connexion/issues/1531
2023-10-29 09:40:43 +01:00
Robbe Sneyders
77a63a07ef Add lifespan documentation (#1759)
Contributes towards https://github.com/spec-first/connexion/issues/1531
2023-10-29 09:40:16 +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
1b72019b1b Create FUNDING.yml (#1753)
Add Github Sponsors to side panel.

Fixes #1573
2023-10-23 23:11:18 +02:00
Robbe Sneyders
a210917b46 Drop Python 3.7 in favor of 3.11 and 3.12 (#1752)
Python 3.7 is end of life. We should support the newer versions instead.

I also changed tox to only run against the minimum dependency versions
on the lowest Python version, since this should lead to the lowest
versions over all Python versions, and hopefully helps speed up our
pipelines :)
2023-10-23 23:11:06 +02:00
Ruwann
79fd9edfb8 Feature/get delete body (#1712)
Fixes #1689 

Changes proposed in this pull request:

 - Pass through request body in case of `GET` and `DELETE` requests

---------

Co-authored-by: Robbe Sneyders <robbe.sneyders@gmail.com>
2023-10-23 22:24:47 +02:00
Robbe Sneyders
7eb43f133d Add context documentation (#1747)
Contributes towards #1531 

Fixes #937
2023-10-22 22:51:18 +02:00
Robbe Sneyders
3ef9a76590 Remove debug argument from example (#1749)
Small fix
2023-10-22 22:41:21 +02:00
Robbe Sneyders
655ea430ed Add validation documentation (#1743)
Contributes to #1531
2023-10-17 23:57:06 +02:00
Robbe Sneyders
41c525c52c Support multiple APIs with same base path (#1736)
Fixes #1542 
Fixes #1724 

Cherry-picked some commits from #1598.

---------

Co-authored-by: Leonardo Festa <4375330+leonardofesta@users.noreply.github.com>
2023-10-17 23:40:13 +02:00
Robbe Sneyders
17fcad0c30 Update response handling documenation (#1742)
Contributes to #1531
2023-10-16 23:51:21 +02:00
Robbe Sneyders
b102ad9f6c Update request handling documentation (#1741)
Contributes to #1531
2023-10-15 12:59:58 +02:00
Robbe Sneyders
415d383740 Add swagger-ui docs and clean up swagger-ui options (#1739)
Contributes to #1531
2023-10-13 20:33:22 +02:00
Heinz-Alexander Fuetterer
8459c614fd chore: fix typos (#1740)
Changes proposed in this pull request:

 - fix some minor typos
2023-10-12 23:30:23 +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