Skip to content

Commit

Permalink
Update quickstart documentation (#1701)
Browse files Browse the repository at this point in the history
Contributes towards #1531

Updates the quickstart documentation for v3. I removed some more
detailed stuff that I don't think belongs on this page.
  • Loading branch information
RobbeSneyders authored May 9, 2023
1 parent ab54842 commit 0c0c517
Show file tree
Hide file tree
Showing 8 changed files with 262 additions and 92 deletions.
7 changes: 4 additions & 3 deletions connexion/apps/abstract.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,9 @@ def __init__(
:param import_name: The name of the package or module that this object belongs to. If you
are using a single module, __name__ is always the correct value. If you however are
using a package, it’s usually recommended to hardcode the name of your package there.
:param lifespan: A lifespan context function, which can be used to perform startup and
:param middlewares: The list of middlewares to wrap around the application. Defaults to
:obj:`middleware.main.ConnexionmMiddleware.default_middlewares`
:obj:`middleware.main.ConnexionMiddleware.default_middlewares`
:param specification_dir: The directory holding the specification(s). The provided path
should either be absolute or relative to the root path of the application. Defaults to
the root path.
Expand All @@ -71,8 +72,8 @@ def __init__(
start.
:param strict_validation: When True, extra form or query parameters not defined in the
specification result in a validation error. Defaults to False.
:param swagger_ui_options: A :class:`options.ConnexionOptions` instance with configuration
options for the swagger ui.
:param swagger_ui_options: A dict with configuration options for the swagger ui. See
:class:`options.ConnexionOptions`.
:param uri_parser_class: Class to use for uri parsing. See :mod:`uri_parsing`.
:param validate_responses: Whether to validate responses against the specification. This has
an impact on performance. Defaults to False.
Expand Down
8 changes: 5 additions & 3 deletions connexion/apps/asynchronous.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,8 +141,10 @@ def __init__(
:param import_name: The name of the package or module that this object belongs to. If you
are using a single module, __name__ is always the correct value. If you however are
using a package, it’s usually recommended to hardcode the name of your package there.
:param lifespan: A lifespan context function, which can be used to perform startup and
shutdown tasks.
:param middlewares: The list of middlewares to wrap around the application. Defaults to
:obj:`middleware.main.ConnexionmMiddleware.default_middlewares`
:obj:`middleware.main.ConnexionMiddleware.default_middlewares`
:param specification_dir: The directory holding the specification(s). The provided path
should either be absolute or relative to the root path of the application. Defaults to
the root path.
Expand All @@ -159,8 +161,8 @@ def __init__(
start.
:param strict_validation: When True, extra form or query parameters not defined in the
specification result in a validation error. Defaults to False.
:param swagger_ui_options: A :class:`options.ConnexionOptions` instance with configuration
options for the swagger ui.
:param swagger_ui_options: A dict with configuration options for the swagger ui. See
:class:`options.ConnexionOptions`.
:param uri_parser_class: Class to use for uri parsing. See :mod:`uri_parsing`.
:param validate_responses: Whether to validate responses against the specification. This has
an impact on performance. Defaults to False.
Expand Down
4 changes: 3 additions & 1 deletion connexion/apps/flask.py
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ def __init__(
:param lifespan: A lifespan context function, which can be used to perform startup and
shutdown tasks.
:param middlewares: The list of middlewares to wrap around the application. Defaults to
:obj:`middleware.main.ConnexionmMiddleware.default_middlewares`
:obj:`middleware.main.ConnexionMiddleware.default_middlewares`
:param server_args: Arguments to pass to the Flask application.
:param specification_dir: The directory holding the specification(s). The provided path
should either be absolute or relative to the root path of the application. Defaults to
Expand All @@ -221,6 +221,8 @@ def __init__(
start.
:param strict_validation: When True, extra form or query parameters not defined in the
specification result in a validation error. Defaults to False.
:param swagger_ui_options: A dict with configuration options for the swagger ui. See
:class:`options.ConnexionOptions`.
:param uri_parser_class: Class to use for uri parsing. See :mod:`uri_parsing`.
:param validate_responses: Whether to validate responses against the specification. This has
an impact on performance. Defaults to False.
Expand Down
15 changes: 11 additions & 4 deletions connexion/middleware/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,8 +160,8 @@ def __init__(
start.
:param strict_validation: When True, extra form or query parameters not defined in the
specification result in a validation error. Defaults to False.
:param swagger_ui_options: A :class:`options.ConnexionOptions` instance with configuration
options for the swagger ui.
:param swagger_ui_options: A dict with configuration options for the swagger ui. See
:class:`options.ConnexionOptions`.
:param uri_parser_class: Class to use for uri parsing. See :mod:`uri_parsing`.
:param validate_responses: Whether to validate responses against the specification. This has
an impact on performance. Defaults to False.
Expand Down Expand Up @@ -309,8 +309,8 @@ def add_api(
start.
:param strict_validation: When True, extra form or query parameters not defined in the
specification result in a validation error. Defaults to False.
:param swagger_ui_options: A :class:`options.ConnexionOptions` instance with configuration
options for the swagger ui.
:param swagger_ui_options: A dict with configuration options for the swagger ui. See
:class:`options.ConnexionOptions`.
:param uri_parser_class: Class to use for uri parsing. See :mod:`uri_parsing`.
:param validate_responses: Whether to validate responses against the specification. This has
an impact on performance. Defaults to False.
Expand Down Expand Up @@ -358,6 +358,13 @@ def add_api(
def add_error_handler(
self, code_or_exception: t.Union[int, t.Type[Exception]], function: t.Callable
) -> None:
"""
Register a callable to handle application errors.
:param code_or_exception: An exception class or the status code of HTTP exceptions to
handle.
:param function: Callable that will handle exception.
"""
if self.middleware_stack is not None:
raise RuntimeError(
"Cannot add error handler after an application has started"
Expand Down
19 changes: 6 additions & 13 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,21 +27,14 @@
# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
extensions = ['autoapi.extension']

autoapi_type = 'python'
autoapi_options = ['members',
'inherited-members',
'undoc-members',
'show-inheritance',
'show-module-summary',
'special-members',
'imported-members']
autoapi_python_class_content = 'both'
autoapi_dirs = [
'../connexion'
extensions = [
'sphinx.ext.autodoc',
'sphinx_copybutton',
'sphinx_design',
]

autoclass_content = 'both'

# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']

Expand Down
Binary file added docs/images/swagger_ui.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 0c0c517

Please sign in to comment.