170 Commits

Author SHA1 Message Date
Mark Perryman
e6ceb1fc0a Generate examples with jsf (#1891)
Fixes https://github.com/spec-first/connexion/issues/1719 .

Builds on work of https://github.com/spec-first/connexion/pull/1718,
pulling in external library to provide the fake data from JSON schema.

Changes proposed in this pull request:

* Use JSF library to generate sample data for mocking APIs without
examples.
* Add this as a new extra dependency "mock"

See discussion on https://github.com/spec-first/connexion/pull/1870

---------

Co-authored-by: Robbe Sneyders <robbe.sneyders@gmail.com>
2024-03-20 22:27:14 +01:00
Frédéric Collonval
ee399fbfe6 Fix lifespan example (#1893)
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
2024-03-20 21:27:07 +01:00
Robbe Sneyders
b3dd9862a3 Inject current request in security handlers (#1883)
Fixes #1881
Fixes #1880
Fixes #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.
2024-03-20 21:25:15 +01:00
Mark Perryman
994f53fb04 Allow the specification to be specified as a URL. (#1871)
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>
2024-02-18 21:56:31 +01:00
Julian Berman
5d7eb0bdab Fix two broken links in the docs. (#1854)
(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.
2024-02-11 22:46:22 +01:00
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
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>
2023-12-01 00:04:46 +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
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.
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.
2023-11-02 11:22:30 +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
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
2023-10-29 14:23:21 +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
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
655ea430ed Add validation documentation (#1743)
Contributes to #1531
2023-10-17 23:57:06 +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
Robbe Sneyders
fcd4e66ec6 Add middleware documentation (#1706)
Contributes towards https://github.com/spec-first/connexion/issues/1531

This PR adds a documentation page on middleware.
2023-06-08 00:15:28 +02:00
Robbe Sneyders
0c0c517cf6 Update quickstart documentation (#1701)
Contributes towards #1531

Updates the quickstart documentation for v3. I removed some more
detailed stuff that I don't think belongs on this page.
2023-05-09 22:22:52 +02:00
Robbe Sneyders
ab54842bb2 Improve and fix docs index page (#1700)
Contributes towards #1531 

Improves the high level explanation of Connexion and fixes broken links
on the index page.
2023-05-09 21:11:49 +02:00
Andrew Chong
8cebebc3a4 Fix examples links in security doc page (#1677)
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.
2023-03-24 10:55:21 +01:00
Robbe Sneyders
291d9b0139 Update docs index page (#1665)
Contributes to https://github.com/spec-first/connexion/issues/1531

This PR updates the index page for Connexion 3. We'll need to update the
content table as we go.
2023-03-06 21:44:56 +01:00
Robbe Sneyders
db78b68062 Fix and extend v3 documentation (#1664) 2023-03-06 20:01:46 +01:00
Radhakrishna Sanka
ab94e2aaa6 Update quickstart.rst to include example of passing server arguments (#1645)
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>
2023-03-03 10:12:28 +01:00
Robbe Sneyders
c257f04806 Fix ReadTheDocs config for Poetry (#1663) 2023-03-03 09:21:54 +01:00
Robbe Sneyders
125d3089e6 Add high-level documentation for 3.0 (#1646)
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.
2023-03-02 23:17:32 +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