Thanks a lot for this amazing tool.
When adding a `lifespan_handler` to my server, it only works if the
handler is asynchronously. That is consistent with the
[tests](994f53fb04/tests/test_lifespan.py (L13))
but not the documentation. So this PR aims to correct the documentation
Fixes#1881Fixes#1880Fixes#1876
Alternative to #1750
This PR makes the current request available to the security handlers by
injecting it as a keyword. I think this is a proper alternative to
#1750, since this is the only place in the default middleware stack
where I expect this to be needed.
Changes proposed in this pull request:
- Allow a specification to be specified as a URL that is downloaded when
the App runs. In combination with the existing mock features, this makes
it a single command to run a mock server for any published API.
---------
Co-authored-by: Robbe Sneyders <robbe.sneyders@gmail.com>
(One was enountered manually, the other found via Sphinx's builtin
linkcheck builder, which also confirms there aren't really any others.)
I often suggest using Sphinx's
[`default_role`](https://www.sphinx-doc.org/en/master/usage/configuration.html#confval-default_role)
setting to make writing docs quite a bit less noisy in a fairly
uncontroversial way. A toxenv / docs setup in CI also seems like a
decent idea. As is, there is a small part of the docs which isn't being
rendered because it contains errors (in the output below it's the one
`CRITICAL`), and there are some other interlinks which are broken.
Essentially, IMHO, running Sphinx without `-n -T -W` is a recipe for
brokenness unfortunately. This is what one sees when doing so, even
after this PR:
<details>
```
/Users/julian/Development/connexion/docs/request.rst:194: CRITICAL: Unexpected section title.
Form data
/Users/julian/Development/connexion/connexion/lifecycle.py:docstring of connexion.lifecycle.ConnexionRequest.from_starlette_request:1: WARNING: py:class reference target not found: starlette.requests.Request
/Users/julian/Development/connexion/connexion/operations/openapi.py:docstring of connexion.operations.openapi.OpenAPIOperation:1: WARNING: py:class reference target not found: integer
/Users/julian/Development/connexion/connexion/operations/openapi.py:docstring of connexion.operations.openapi.OpenAPIOperation:1: WARNING: py:class reference target not found: AbstractURIParser
/Users/julian/Development/connexion/connexion/operations/openapi.py:docstring of connexion.operations.OpenAPIOperation.function:1: WARNING: py:class reference target not found: types.FunctionType
/Users/julian/Development/connexion/connexion/operations/swagger2.py:docstring of connexion.operations.swagger2.Swagger2Operation:1: WARNING: py:class reference target not found: integer
/Users/julian/Development/connexion/connexion/operations/swagger2.py:docstring of connexion.operations.swagger2.Swagger2Operation:1: WARNING: py:class reference target not found: AbstractURIParser
/Users/julian/Development/connexion/connexion/operations/swagger2.py:docstring of connexion.operations.Swagger2Operation.function:1: WARNING: py:class reference target not found: types.FunctionType
/Users/julian/Development/connexion/connexion/apps/asynchronous.py:docstring of connexion.apps.asynchronous.AsyncApp.add_error_handler:1: WARNING: py:class reference target not found: connexion.lifecycle.ConnexionResponse
/Users/julian/Development/connexion/connexion/apps/asynchronous.py:docstring of connexion.apps.asynchronous.AsyncApp.add_error_handler:1: WARNING: py:class reference target not found: connexion.lifecycle.ConnexionResponse
/Users/julian/Development/connexion/connexion/apps/flask.py:docstring of connexion.apps.flask.FlaskApp.add_error_handler:1: WARNING: py:class reference target not found: connexion.lifecycle.ConnexionResponse
/Users/julian/Development/connexion/connexion/apps/flask.py:docstring of connexion.apps.flask.FlaskApp.add_error_handler:1: WARNING: py:class reference target not found: connexion.lifecycle.ConnexionResponse
/Users/julian/Development/connexion/connexion/middleware/main.py:docstring of connexion.middleware.main.ConnexionMiddleware.add_error_handler:1: WARNING: py:class reference target not found: connexion.lifecycle.ConnexionResponse
/Users/julian/Development/connexion/connexion/middleware/main.py:docstring of connexion.middleware.main.ConnexionMiddleware.add_error_handler:1: WARNING: py:class reference target not found: connexion.lifecycle.ConnexionResponse
/Users/julian/Development/connexion/connexion/problem.py:docstring of connexion.problem.problem:14: WARNING: py:class reference target not found: type: str
/Users/julian/Development/connexion/connexion/problem.py:docstring of connexion.problem.problem:1: WARNING: py:class reference target not found: ConnexionResponse
/Users/julian/Development/connexion/connexion/exceptions.py:docstring of connexion.exceptions:1: WARNING: py:class reference target not found: jsonschema.exceptions.ValidationError
/Users/julian/Development/connexion/connexion/exceptions.py:docstring of connexion.exceptions:1: WARNING: py:class reference target not found: starlette.exceptions.HTTPException
/Users/julian/Development/connexion/connexion/exceptions.py:docstring of connexion.exceptions:1: WARNING: py:class reference target not found: starlette.exceptions.HTTPException
/Users/julian/Development/connexion/connexion/apps/flask.py:docstring of connexion.apps.flask.FlaskApp.add_wsgi_middleware:1: WARNING: py:class reference target not found: types.TracebackType
/Users/julian/Development/connexion/connexion/middleware/main.py:docstring of connexion.middleware.main.MiddlewarePosition:1: WARNING: py:class reference target not found: ExceptionMiddleware
/Users/julian/Development/connexion/connexion/middleware/main.py:docstring of connexion.middleware.main.MiddlewarePosition:1: WARNING: py:class reference target not found: SwaggerUIMiddleware
/Users/julian/Development/connexion/connexion/middleware/main.py:docstring of connexion.middleware.main.MiddlewarePosition:1: WARNING: py:class reference target not found: RoutingMiddleware
/Users/julian/Development/connexion/connexion/middleware/main.py:docstring of connexion.middleware.main.MiddlewarePosition:1: WARNING: py:class reference target not found: SecurityMiddleware
/Users/julian/Development/connexion/connexion/middleware/main.py:docstring of connexion.middleware.main.MiddlewarePosition:1: WARNING: py:class reference target not found: RequestValidationMiddleware
/Users/julian/Development/connexion/connexion/middleware/main.py:docstring of connexion.middleware.main.MiddlewarePosition:1: WARNING: py:class reference target not found: ContextMiddleware
/Users/julian/Development/connexion/docs/middleware.rst:121: WARNING: py:class reference target not found: SecurityMiddleware
/Users/julian/Development/connexion/connexion/apps/asynchronous.py:docstring of connexion.apps.asynchronous.AsyncApp:1: WARNING: py:class reference target not found: pathlib.Path
/Users/julian/Development/connexion/connexion/apps/asynchronous.py:docstring of connexion.apps.asynchronous.AsyncApp:1: WARNING: py:class reference target not found: connexion.jsonifier.Jsonifier
/Users/julian/Development/connexion/connexion/apps/asynchronous.py:docstring of connexion.apps.asynchronous.AsyncApp:1: WARNING: py:class reference target not found: connexion.uri_parsing.AbstractURIParser
/Users/julian/Development/connexion/connexion/apps/asynchronous.py:docstring of connexion.apps.asynchronous.AsyncApp:3: WARNING: py:obj reference target not found: middleware.main.ConnexionMiddleware.default_middlewares
/Users/julian/Development/connexion/connexion/apps/asynchronous.py:docstring of connexion.apps.asynchronous.AsyncApp:21: WARNING: py:class reference target not found: options.ConnexionOptions
/Users/julian/Development/connexion/connexion/apps/asynchronous.py:docstring of connexion.apps.asynchronous.AsyncApp:23: WARNING: py:mod reference target not found: uri_parsing
/Users/julian/Development/connexion/connexion/apps/asynchronous.py:docstring of connexion.apps.asynchronous.AsyncApp:26: WARNING: py:obj reference target not found: validators.VALIDATOR_MAP
/Users/julian/Development/connexion/connexion/apps/asynchronous.py:docstring of connexion.apps.asynchronous.AsyncApp:28: WARNING: py:obj reference target not found: security.SECURITY_HANDLERS
/Users/julian/Development/connexion/connexion/apps/flask.py:docstring of connexion.apps.flask.FlaskApp:1: WARNING: py:class reference target not found: pathlib.Path
/Users/julian/Development/connexion/connexion/apps/flask.py:docstring of connexion.apps.flask.FlaskApp:1: WARNING: py:class reference target not found: connexion.jsonifier.Jsonifier
/Users/julian/Development/connexion/connexion/apps/flask.py:docstring of connexion.apps.flask.FlaskApp:1: WARNING: py:class reference target not found: connexion.uri_parsing.AbstractURIParser
/Users/julian/Development/connexion/connexion/apps/flask.py:docstring of connexion.apps.flask.FlaskApp:2: WARNING: py:obj reference target not found: middleware.main.ConnexionMiddleware.default_middlewares
/Users/julian/Development/connexion/connexion/apps/flask.py:docstring of connexion.apps.flask.FlaskApp:12: WARNING: py:class reference target not found: options.ConnexionOptions
/Users/julian/Development/connexion/connexion/apps/flask.py:docstring of connexion.apps.flask.FlaskApp:23: WARNING: py:class reference target not found: options.ConnexionOptions
/Users/julian/Development/connexion/connexion/apps/flask.py:docstring of connexion.apps.flask.FlaskApp:25: WARNING: py:mod reference target not found: uri_parsing
/Users/julian/Development/connexion/connexion/apps/flask.py:docstring of connexion.apps.flask.FlaskApp:28: WARNING: py:obj reference target not found: validators.VALIDATOR_MAP
/Users/julian/Development/connexion/connexion/apps/flask.py:docstring of connexion.apps.flask.FlaskApp:30: WARNING: py:obj reference target not found: security.SECURITY_HANDLERS
/Users/julian/Development/connexion/connexion/middleware/main.py:docstring of connexion.middleware.main.ConnexionMiddleware:1: WARNING: py:class reference target not found: pathlib.Path
/Users/julian/Development/connexion/connexion/middleware/main.py:docstring of connexion.middleware.main.ConnexionMiddleware:1: WARNING: py:class reference target not found: connexion.jsonifier.Jsonifier
/Users/julian/Development/connexion/connexion/middleware/main.py:docstring of connexion.middleware.main.ConnexionMiddleware:1: WARNING: py:class reference target not found: connexion.uri_parsing.AbstractURIParser
/Users/julian/Development/connexion/connexion/middleware/main.py:docstring of connexion.middleware.main.ConnexionMiddleware:1: WARNING: py:obj reference target not found: middleware.main.ConnexionmMiddleware.default_middlewares
/Users/julian/Development/connexion/connexion/middleware/main.py:docstring of connexion.middleware.main.ConnexionMiddleware:19: WARNING: py:class reference target not found: options.ConnexionOptions
/Users/julian/Development/connexion/connexion/middleware/main.py:docstring of connexion.middleware.main.ConnexionMiddleware:21: WARNING: py:mod reference target not found: uri_parsing
/Users/julian/Development/connexion/connexion/middleware/main.py:docstring of connexion.middleware.main.ConnexionMiddleware:24: WARNING: py:obj reference target not found: validators.VALIDATOR_MAP
/Users/julian/Development/connexion/connexion/middleware/main.py:docstring of connexion.middleware.main.ConnexionMiddleware:26: WARNING: py:obj reference target not found: security.SECURITY_HANDLERS
/Users/julian/Development/connexion/connexion/apps/asynchronous.py:docstring of connexion.apps.asynchronous.AsyncApp:1: WARNING: py:class reference target not found: pathlib.Path
/Users/julian/Development/connexion/connexion/apps/asynchronous.py:docstring of connexion.apps.asynchronous.AsyncApp:1: WARNING: py:class reference target not found: connexion.jsonifier.Jsonifier
/Users/julian/Development/connexion/connexion/apps/asynchronous.py:docstring of connexion.apps.asynchronous.AsyncApp:1: WARNING: py:class reference target not found: connexion.uri_parsing.AbstractURIParser
/Users/julian/Development/connexion/connexion/apps/asynchronous.py:docstring of connexion.apps.asynchronous.AsyncApp:3: WARNING: py:obj reference target not found: middleware.main.ConnexionMiddleware.default_middlewares
/Users/julian/Development/connexion/connexion/apps/asynchronous.py:docstring of connexion.apps.asynchronous.AsyncApp:21: WARNING: py:class reference target not found: options.ConnexionOptions
/Users/julian/Development/connexion/connexion/apps/asynchronous.py:docstring of connexion.apps.asynchronous.AsyncApp:23: WARNING: py:mod reference target not found: uri_parsing
/Users/julian/Development/connexion/connexion/apps/asynchronous.py:docstring of connexion.apps.asynchronous.AsyncApp:26: WARNING: py:obj reference target not found: validators.VALIDATOR_MAP
/Users/julian/Development/connexion/connexion/apps/asynchronous.py:docstring of connexion.apps.asynchronous.AsyncApp:28: WARNING: py:obj reference target not found: security.SECURITY_HANDLERS
/Users/julian/Development/connexion/connexion/apps/flask.py:docstring of connexion.apps.flask.FlaskApp:1: WARNING: py:class reference target not found: pathlib.Path
/Users/julian/Development/connexion/connexion/apps/flask.py:docstring of connexion.apps.flask.FlaskApp:1: WARNING: py:class reference target not found: connexion.jsonifier.Jsonifier
/Users/julian/Development/connexion/connexion/apps/flask.py:docstring of connexion.apps.flask.FlaskApp:1: WARNING: py:class reference target not found: connexion.uri_parsing.AbstractURIParser
/Users/julian/Development/connexion/connexion/apps/flask.py:docstring of connexion.apps.flask.FlaskApp:2: WARNING: py:obj reference target not found: middleware.main.ConnexionMiddleware.default_middlewares
/Users/julian/Development/connexion/connexion/apps/flask.py:docstring of connexion.apps.flask.FlaskApp:12: WARNING: py:class reference target not found: options.ConnexionOptions
/Users/julian/Development/connexion/connexion/apps/flask.py:docstring of connexion.apps.flask.FlaskApp:23: WARNING: py:class reference target not found: options.ConnexionOptions
/Users/julian/Development/connexion/connexion/apps/flask.py:docstring of connexion.apps.flask.FlaskApp:25: WARNING: py:mod reference target not found: uri_parsing
/Users/julian/Development/connexion/connexion/apps/flask.py:docstring of connexion.apps.flask.FlaskApp:28: WARNING: py:obj reference target not found: validators.VALIDATOR_MAP
/Users/julian/Development/connexion/connexion/apps/flask.py:docstring of connexion.apps.flask.FlaskApp:30: WARNING: py:obj reference target not found: security.SECURITY_HANDLERS
/Users/julian/Development/connexion/connexion/middleware/main.py:docstring of connexion.middleware.main.ConnexionMiddleware:1: WARNING: py:class reference target not found: pathlib.Path
/Users/julian/Development/connexion/connexion/middleware/main.py:docstring of connexion.middleware.main.ConnexionMiddleware:1: WARNING: py:class reference target not found: connexion.jsonifier.Jsonifier
/Users/julian/Development/connexion/connexion/middleware/main.py:docstring of connexion.middleware.main.ConnexionMiddleware:1: WARNING: py:class reference target not found: connexion.uri_parsing.AbstractURIParser
/Users/julian/Development/connexion/connexion/middleware/main.py:docstring of connexion.middleware.main.ConnexionMiddleware:1: WARNING: py:obj reference target not found: middleware.main.ConnexionmMiddleware.default_middlewares
/Users/julian/Development/connexion/connexion/middleware/main.py:docstring of connexion.middleware.main.ConnexionMiddleware:19: WARNING: py:class reference target not found: options.ConnexionOptions
/Users/julian/Development/connexion/connexion/middleware/main.py:docstring of connexion.middleware.main.ConnexionMiddleware:21: WARNING: py:mod reference target not found: uri_parsing
/Users/julian/Development/connexion/connexion/middleware/main.py:docstring of connexion.middleware.main.ConnexionMiddleware:24: WARNING: py:obj reference target not found: validators.VALIDATOR_MAP
/Users/julian/Development/connexion/connexion/middleware/main.py:docstring of connexion.middleware.main.ConnexionMiddleware:26: WARNING: py:obj reference target not found: security.SECURITY_HANDLERS
/Users/julian/Development/connexion/connexion/apps/abstract.py:docstring of connexion.apps.abstract.AbstractApp.add_api:1: WARNING: py:class reference target not found: pathlib.Path
/Users/julian/Development/connexion/connexion/apps/abstract.py:docstring of connexion.apps.abstract.AbstractApp.add_api:1: WARNING: py:class reference target not found: connexion.jsonifier.Jsonifier
/Users/julian/Development/connexion/connexion/apps/abstract.py:docstring of connexion.apps.abstract.AbstractApp.add_api:1: WARNING: py:class reference target not found: connexion.uri_parsing.AbstractURIParser
/Users/julian/Development/connexion/connexion/apps/abstract.py:docstring of connexion.apps.abstract.AbstractApp.add_api:11: WARNING: py:class reference target not found: resolver.Resolver
/Users/julian/Development/connexion/connexion/apps/abstract.py:docstring of connexion.apps.abstract.AbstractApp.add_api:18: WARNING: py:class reference target not found: options.ConnexionOptions
/Users/julian/Development/connexion/connexion/apps/abstract.py:docstring of connexion.apps.abstract.AbstractApp.add_api:20: WARNING: py:mod reference target not found: uri_parsing
/Users/julian/Development/connexion/connexion/apps/abstract.py:docstring of connexion.apps.abstract.AbstractApp.add_api:23: WARNING: py:obj reference target not found: validators.VALIDATOR_MAP
/Users/julian/Development/connexion/connexion/apps/abstract.py:docstring of connexion.apps.abstract.AbstractApp.add_api:25: WARNING: py:obj reference target not found: security.SECURITY_HANDLERS
/Users/julian/Development/connexion/connexion/apps/abstract.py:docstring of connexion.apps.abstract.AbstractApp.add_api:1: WARNING: py:class reference target not found: pathlib.Path
/Users/julian/Development/connexion/connexion/apps/abstract.py:docstring of connexion.apps.abstract.AbstractApp.add_api:1: WARNING: py:class reference target not found: connexion.jsonifier.Jsonifier
/Users/julian/Development/connexion/connexion/apps/abstract.py:docstring of connexion.apps.abstract.AbstractApp.add_api:1: WARNING: py:class reference target not found: connexion.uri_parsing.AbstractURIParser
/Users/julian/Development/connexion/connexion/apps/abstract.py:docstring of connexion.apps.abstract.AbstractApp.add_api:11: WARNING: py:class reference target not found: resolver.Resolver
/Users/julian/Development/connexion/connexion/apps/abstract.py:docstring of connexion.apps.abstract.AbstractApp.add_api:18: WARNING: py:class reference target not found: options.ConnexionOptions
/Users/julian/Development/connexion/connexion/apps/abstract.py:docstring of connexion.apps.abstract.AbstractApp.add_api:20: WARNING: py:mod reference target not found: uri_parsing
/Users/julian/Development/connexion/connexion/apps/abstract.py:docstring of connexion.apps.abstract.AbstractApp.add_api:23: WARNING: py:obj reference target not found: validators.VALIDATOR_MAP
/Users/julian/Development/connexion/connexion/apps/abstract.py:docstring of connexion.apps.abstract.AbstractApp.add_api:25: WARNING: py:obj reference target not found: security.SECURITY_HANDLERS
/Users/julian/Development/connexion/connexion/middleware/main.py:docstring of connexion.middleware.main.ConnexionMiddleware.add_api:1: WARNING: py:class reference target not found: pathlib.Path
/Users/julian/Development/connexion/connexion/middleware/main.py:docstring of connexion.middleware.main.ConnexionMiddleware.add_api:1: WARNING: py:class reference target not found: connexion.jsonifier.Jsonifier
/Users/julian/Development/connexion/connexion/middleware/main.py:docstring of connexion.middleware.main.ConnexionMiddleware.add_api:1: WARNING: py:class reference target not found: connexion.uri_parsing.AbstractURIParser
/Users/julian/Development/connexion/connexion/middleware/main.py:docstring of connexion.middleware.main.ConnexionMiddleware.add_api:11: WARNING: py:class reference target not found: resolver.Resolver
/Users/julian/Development/connexion/connexion/middleware/main.py:docstring of connexion.middleware.main.ConnexionMiddleware.add_api:18: WARNING: py:class reference target not found: options.ConnexionOptions
/Users/julian/Development/connexion/connexion/middleware/main.py:docstring of connexion.middleware.main.ConnexionMiddleware.add_api:20: WARNING: py:mod reference target not found: uri_parsing
/Users/julian/Development/connexion/connexion/middleware/main.py:docstring of connexion.middleware.main.ConnexionMiddleware.add_api:23: WARNING: py:obj reference target not found: validators.VALIDATOR_MAP
/Users/julian/Development/connexion/connexion/middleware/main.py:docstring of connexion.middleware.main.ConnexionMiddleware.add_api:25: WARNING: py:obj reference target not found: security.SECURITY_HANDLERS
/Users/julian/Development/connexion/connexion/apps/asynchronous.py:docstring of connexion.apps.asynchronous.AsyncApp:1: WARNING: py:class reference target not found: pathlib.Path
/Users/julian/Development/connexion/connexion/apps/asynchronous.py:docstring of connexion.apps.asynchronous.AsyncApp:1: WARNING: py:class reference target not found: connexion.jsonifier.Jsonifier
/Users/julian/Development/connexion/connexion/apps/asynchronous.py:docstring of connexion.apps.asynchronous.AsyncApp:1: WARNING: py:class reference target not found: connexion.uri_parsing.AbstractURIParser
/Users/julian/Development/connexion/connexion/apps/asynchronous.py:docstring of connexion.apps.asynchronous.AsyncApp:4: WARNING: py:obj reference target not found: middleware.main.ConnexionMiddleware.default_middlewares
/Users/julian/Development/connexion/connexion/apps/asynchronous.py:docstring of connexion.apps.asynchronous.AsyncApp:22: WARNING: py:class reference target not found: options.ConnexionOptions
/Users/julian/Development/connexion/connexion/apps/asynchronous.py:docstring of connexion.apps.asynchronous.AsyncApp:24: WARNING: py:mod reference target not found: uri_parsing
/Users/julian/Development/connexion/connexion/apps/asynchronous.py:docstring of connexion.apps.asynchronous.AsyncApp:27: WARNING: py:obj reference target not found: validators.VALIDATOR_MAP
/Users/julian/Development/connexion/connexion/apps/asynchronous.py:docstring of connexion.apps.asynchronous.AsyncApp:29: WARNING: py:obj reference target not found: security.SECURITY_HANDLERS
/Users/julian/Development/connexion/connexion/apps/asynchronous.py:docstring of connexion.apps.abstract.AbstractApp.add_api:1: WARNING: py:class reference target not found: pathlib.Path
/Users/julian/Development/connexion/connexion/apps/asynchronous.py:docstring of connexion.apps.abstract.AbstractApp.add_api:1: WARNING: py:class reference target not found: connexion.jsonifier.Jsonifier
/Users/julian/Development/connexion/connexion/apps/asynchronous.py:docstring of connexion.apps.abstract.AbstractApp.add_api:1: WARNING: py:class reference target not found: connexion.uri_parsing.AbstractURIParser
/Users/julian/Development/connexion/connexion/apps/asynchronous.py:docstring of connexion.apps.asynchronous.AsyncApp:18: WARNING: py:class reference target not found: options.ConnexionOptions
/Users/julian/Development/connexion/connexion/apps/asynchronous.py:docstring of connexion.apps.asynchronous.AsyncApp:20: WARNING: py:mod reference target not found: uri_parsing
/Users/julian/Development/connexion/connexion/apps/asynchronous.py:docstring of connexion.apps.asynchronous.AsyncApp:23: WARNING: py:obj reference target not found: validators.VALIDATOR_MAP
/Users/julian/Development/connexion/connexion/apps/asynchronous.py:docstring of connexion.apps.asynchronous.AsyncApp:25: WARNING: py:obj reference target not found: security.SECURITY_HANDLERS
/Users/julian/Development/connexion/connexion/apps/asynchronous.py:docstring of connexion.apps.asynchronous.AsyncApp.add_error_handler:1: WARNING: py:class reference target not found: connexion.lifecycle.ConnexionResponse
/Users/julian/Development/connexion/connexion/apps/asynchronous.py:docstring of connexion.apps.asynchronous.AsyncApp.add_error_handler:1: WARNING: py:class reference target not found: connexion.lifecycle.ConnexionResponse
/Users/julian/Development/connexion/connexion/apps/flask.py:docstring of connexion.apps.flask.FlaskApp:1: WARNING: py:class reference target not found: pathlib.Path
/Users/julian/Development/connexion/connexion/apps/flask.py:docstring of connexion.apps.flask.FlaskApp:1: WARNING: py:class reference target not found: connexion.jsonifier.Jsonifier
/Users/julian/Development/connexion/connexion/apps/flask.py:docstring of connexion.apps.flask.FlaskApp:1: WARNING: py:class reference target not found: connexion.uri_parsing.AbstractURIParser
/Users/julian/Development/connexion/connexion/apps/flask.py:docstring of connexion.apps.flask.FlaskApp:3: WARNING: py:obj reference target not found: middleware.main.ConnexionMiddleware.default_middlewares
/Users/julian/Development/connexion/connexion/apps/flask.py:docstring of connexion.apps.flask.FlaskApp:13: WARNING: py:class reference target not found: options.ConnexionOptions
/Users/julian/Development/connexion/connexion/apps/flask.py:docstring of connexion.apps.flask.FlaskApp:24: WARNING: py:class reference target not found: options.ConnexionOptions
/Users/julian/Development/connexion/connexion/apps/flask.py:docstring of connexion.apps.flask.FlaskApp:26: WARNING: py:mod reference target not found: uri_parsing
/Users/julian/Development/connexion/connexion/apps/flask.py:docstring of connexion.apps.flask.FlaskApp:29: WARNING: py:obj reference target not found: validators.VALIDATOR_MAP
/Users/julian/Development/connexion/connexion/apps/flask.py:docstring of connexion.apps.flask.FlaskApp:31: WARNING: py:obj reference target not found: security.SECURITY_HANDLERS
/Users/julian/Development/connexion/connexion/apps/flask.py:docstring of connexion.apps.abstract.AbstractApp.add_api:1: WARNING: py:class reference target not found: pathlib.Path
/Users/julian/Development/connexion/connexion/apps/flask.py:docstring of connexion.apps.abstract.AbstractApp.add_api:1: WARNING: py:class reference target not found: connexion.jsonifier.Jsonifier
/Users/julian/Development/connexion/connexion/apps/flask.py:docstring of connexion.apps.abstract.AbstractApp.add_api:1: WARNING: py:class reference target not found: connexion.uri_parsing.AbstractURIParser
/Users/julian/Development/connexion/connexion/apps/flask.py:docstring of connexion.apps.flask.FlaskApp:18: WARNING: py:class reference target not found: options.ConnexionOptions
/Users/julian/Development/connexion/connexion/apps/flask.py:docstring of connexion.apps.flask.FlaskApp:20: WARNING: py:mod reference target not found: uri_parsing
/Users/julian/Development/connexion/connexion/apps/flask.py:docstring of connexion.apps.flask.FlaskApp:23: WARNING: py:obj reference target not found: validators.VALIDATOR_MAP
/Users/julian/Development/connexion/connexion/apps/flask.py:docstring of connexion.apps.flask.FlaskApp:25: WARNING: py:obj reference target not found: security.SECURITY_HANDLERS
/Users/julian/Development/connexion/connexion/apps/flask.py:docstring of connexion.apps.flask.FlaskApp.add_error_handler:1: WARNING: py:class reference target not found: connexion.lifecycle.ConnexionResponse
/Users/julian/Development/connexion/connexion/apps/flask.py:docstring of connexion.apps.flask.FlaskApp.add_error_handler:1: WARNING: py:class reference target not found: connexion.lifecycle.ConnexionResponse
/Users/julian/Development/connexion/connexion/apps/flask.py:docstring of connexion.apps.flask.FlaskApp.add_wsgi_middleware:1: WARNING: py:class reference target not found: types.TracebackType
/Users/julian/Development/connexion/connexion/middleware/main.py:docstring of connexion.middleware.main.ConnexionMiddleware:1: WARNING: py:class reference target not found: pathlib.Path
/Users/julian/Development/connexion/connexion/middleware/main.py:docstring of connexion.middleware.main.ConnexionMiddleware:1: WARNING: py:class reference target not found: connexion.jsonifier.Jsonifier
/Users/julian/Development/connexion/connexion/middleware/main.py:docstring of connexion.middleware.main.ConnexionMiddleware:1: WARNING: py:class reference target not found: connexion.uri_parsing.AbstractURIParser
/Users/julian/Development/connexion/connexion/middleware/main.py:docstring of connexion.middleware.main.ConnexionMiddleware:2: WARNING: py:obj reference target not found: middleware.main.ConnexionmMiddleware.default_middlewares
/Users/julian/Development/connexion/connexion/middleware/main.py:docstring of connexion.middleware.main.ConnexionMiddleware:20: WARNING: py:class reference target not found: options.ConnexionOptions
/Users/julian/Development/connexion/connexion/middleware/main.py:docstring of connexion.middleware.main.ConnexionMiddleware:22: WARNING: py:mod reference target not found: uri_parsing
/Users/julian/Development/connexion/connexion/middleware/main.py:docstring of connexion.middleware.main.ConnexionMiddleware:25: WARNING: py:obj reference target not found: validators.VALIDATOR_MAP
/Users/julian/Development/connexion/connexion/middleware/main.py:docstring of connexion.middleware.main.ConnexionMiddleware:27: WARNING: py:obj reference target not found: security.SECURITY_HANDLERS
/Users/julian/Development/connexion/connexion/middleware/main.py:docstring of connexion.middleware.main.ConnexionMiddleware.add_api:1: WARNING: py:class reference target not found: pathlib.Path
/Users/julian/Development/connexion/connexion/middleware/main.py:docstring of connexion.middleware.main.ConnexionMiddleware.add_api:1: WARNING: py:class reference target not found: connexion.jsonifier.Jsonifier
/Users/julian/Development/connexion/connexion/middleware/main.py:docstring of connexion.middleware.main.ConnexionMiddleware.add_api:1: WARNING: py:class reference target not found: connexion.uri_parsing.AbstractURIParser
/Users/julian/Development/connexion/connexion/middleware/main.py:docstring of connexion.middleware.main.ConnexionMiddleware:18: WARNING: py:class reference target not found: options.ConnexionOptions
/Users/julian/Development/connexion/connexion/middleware/main.py:docstring of connexion.middleware.main.ConnexionMiddleware:20: WARNING: py:mod reference target not found: uri_parsing
/Users/julian/Development/connexion/connexion/middleware/main.py:docstring of connexion.middleware.main.ConnexionMiddleware:23: WARNING: py:obj reference target not found: validators.VALIDATOR_MAP
/Users/julian/Development/connexion/connexion/middleware/main.py:docstring of connexion.middleware.main.ConnexionMiddleware:25: WARNING: py:obj reference target not found: security.SECURITY_HANDLERS
/Users/julian/Development/connexion/connexion/middleware/main.py:docstring of connexion.middleware.main.ConnexionMiddleware.add_error_handler:1: WARNING: py:class reference target not found: connexion.lifecycle.ConnexionResponse
/Users/julian/Development/connexion/connexion/middleware/main.py:docstring of connexion.middleware.main.ConnexionMiddleware.add_error_handler:1: WARNING: py:class reference target not found: connexion.lifecycle.ConnexionResponse
/Users/julian/Development/connexion/connexion/lifecycle.py:docstring of connexion.lifecycle.ConnexionRequest.from_starlette_request:1: WARNING: py:class reference target not found: starlette.requests.Request
/Users/julian/Development/connexion/connexion/resolver.py:docstring of connexion.resolver.RelativeResolver:1: WARNING: py:class reference target not found: types.ModuleType
/Users/julian/Development/connexion/connexion/resolver.py:docstring of connexion.resolver.RelativeResolver:1: WARNING: py:class reference target not found: types.FunctionType
/Users/julian/Development/connexion/docs/testing.rst:29: WARNING: py:class reference target not found: TestContext
/Users/julian/Development/connexion/connexion/problem.py:docstring of connexion.problem.problem:14: WARNING: py:class reference target not found: type: str
/Users/julian/Development/connexion/connexion/problem.py:docstring of connexion.problem.problem:1: WARNING: py:class reference target not found: ConnexionResponse
/Users/julian/Development/connexion/docs/exceptions.rst:1: WARNING: broken link: about:blank ()
/Users/julian/Development/connexion/docs/context.rst:1: WARNING: broken link: https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.1.md#componentsObject (Anchor 'componentsObject' not found)
/Users/julian/Development/connexion/docs/v3.rst:105: WARNING: broken link: https://github.com/abersheeran/a2wsgi#convert-asgi-app-to-wsgi-app (Anchor 'convert-asgi-app-to-wsgi-app' not found)
/Users/julian/Development/connexion/docs/context.rst:1: WARNING: broken link: https://github.com/swagger-api/swagger-spec/blob/master/versions/2.0.md#security-definitions-object (Anchor 'security-definitions-object' not found)
/Users/julian/Development/connexion/docs/context.rst:1: WARNING: broken link: https://github.com/swagger-api/swagger-spec/blob/master/versions/2.0.md#definitionsObject (Anchor 'definitionsObject' not found)
docs: exit 1 (5.40 seconds) /Users/julian/Development/connexion> .tox/docs/bin/python -m sphinx -n -T -q -b linkcheck docs /Users/julian/Development/connexion/.tox/docs/tmp/build pid=35935
.pkg: _exit> python /Users/julian/.dotfiles/.local/share/virtualenvs/tox/lib/python3.12/site-packages/pyproject_api/_backend.py True poetry.core.masonry.api
docs: FAIL code 1 (7.91=setup[1.96]+cmd[0.55,5.40] seconds)
evaluation failed :( (7.95 seconds)
```
</details>
I'm trying to actually use connexion for the first time, but if the
above sounds reasonable to y'all maintainers I can try to come back to
it and send a PR later.
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.
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)`
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>
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.
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?
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>
Contributes to #1531
The links in security doc were pointing at an old repo and folders.
These links could be changed down the road to use relative paths since
they point to the repo internally.
Changes proposed in this pull request:
- Updated the docs such that it comes with an example for passing server
arguments and serving static files
---------
Co-authored-by: Ruwann <ruwan.lambrichts@ml6.eu>
I'd like to cut an alpha release for 3.0 while we further polish the
code base and update the documentation. This way users can already test
3.0 and provide feedback.
This PR adds some very high-level documentation to serve as a starting
point for users to test the alpha version.
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.