Merge branch 'main' into fixed

# Conflicts:
#	aiohttp_pydantic/oas/__init__.py
#	aiohttp_pydantic/view.py
This commit is contained in:
Georg K
2022-03-30 17:30:15 +03:00
36 changed files with 2068 additions and 247 deletions

View File

@@ -1,5 +1,5 @@
from importlib import resources
from typing import Iterable
from typing import Iterable, Optional
import jinja2
from aiohttp import web
@@ -13,6 +13,8 @@ def setup(
apps_to_expose: Iterable[web.Application] = (),
url_prefix: str = "/oas",
enable: bool = True,
version_spec: Optional[str] = None,
title_spec: Optional[str] = None,
raise_validation_errors: bool = False,
):
if enable:
@@ -23,6 +25,9 @@ def setup(
oas_app["index template"] = jinja2.Template(
resources.read_text("aiohttp_pydantic.oas", "index.j2")
)
oas_app["version_spec"] = version_spec
oas_app["title_spec"] = title_spec
oas_app.router.add_get("/spec", get_oas, name="spec")
oas_app.router.add_static("/static", swagger_ui_path, name="static")
oas_app.router.add_get("", oas_ui, name="index")