This repository has been archived by the owner on Sep 26, 2024. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f2cf3f4
commit ca928f6
Showing
3 changed files
with
20 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
[tool.poetry] | ||
name = "schema_validator" | ||
version = "0.2.0" | ||
version = "0.2.2" | ||
description = "A flask/quart extension to provide schema validation with pydantic." | ||
authors = ["hs <[email protected]>"] | ||
classifiers = [ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,21 @@ | ||
from typing import Optional | ||
|
||
from quart import render_template_string | ||
from quart import current_app, render_template_string | ||
|
||
from schema_validator.constants import SWAGGER_TEMPLATE | ||
|
||
|
||
async def openapi(app, validator, tag: Optional[str] = None) -> dict: | ||
async def openapi(validator, tag: Optional[str] = None) -> dict: | ||
from ..core import _build_openapi_schema | ||
return _build_openapi_schema(app, validator, tag) | ||
return _build_openapi_schema(current_app, validator, tag) | ||
|
||
|
||
async def swagger_ui(app, validator, tag: Optional[str] = None) -> str: | ||
async def swagger_ui(validator, tag: Optional[str] = None) -> str: | ||
path = f"/swagger/openapi-{tag}.json" if tag else validator.openapi_path | ||
return await render_template_string( | ||
SWAGGER_TEMPLATE, | ||
title=validator.title, | ||
openapi_path=path, | ||
swagger_js_url=app.config["FLASK_SCHEMA_SWAGGER_JS_URL"], | ||
swagger_css_url=app.config["FLASK_SCHEMA_SWAGGER_CSS_URL"], | ||
swagger_js_url=current_app.config["FLASK_SCHEMA_SWAGGER_JS_URL"], | ||
swagger_css_url=current_app.config["FLASK_SCHEMA_SWAGGER_CSS_URL"], | ||
) |