flask-openapi-redoc 2.5.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- flask_openapi_redoc-2.5.2/.gitignore +141 -0
- flask_openapi_redoc-2.5.2/PKG-INFO +22 -0
- flask_openapi_redoc-2.5.2/flask_openapi_redoc/__init__.py +3 -0
- flask_openapi_redoc-2.5.2/flask_openapi_redoc/__version__.py +3 -0
- flask_openapi_redoc-2.5.2/flask_openapi_redoc/plugins.py +38 -0
- flask_openapi_redoc-2.5.2/flask_openapi_redoc/templates/__init__.py +30 -0
- flask_openapi_redoc-2.5.2/flask_openapi_redoc/templates/redoc/images/redoc.svg +9 -0
- flask_openapi_redoc-2.5.2/flask_openapi_redoc/templates/redoc/js/redoc.standalone.js +1832 -0
- flask_openapi_redoc-2.5.2/pyproject.toml +51 -0
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
### Python template
|
|
2
|
+
# Byte-compiled / optimized / DLL files
|
|
3
|
+
__pycache__/
|
|
4
|
+
*.py[cod]
|
|
5
|
+
*$py.class
|
|
6
|
+
|
|
7
|
+
# C extensions
|
|
8
|
+
*.so
|
|
9
|
+
|
|
10
|
+
# Distribution / packaging
|
|
11
|
+
.Python
|
|
12
|
+
build/
|
|
13
|
+
develop-eggs/
|
|
14
|
+
dist/
|
|
15
|
+
downloads/
|
|
16
|
+
eggs/
|
|
17
|
+
.eggs/
|
|
18
|
+
lib/
|
|
19
|
+
lib64/
|
|
20
|
+
parts/
|
|
21
|
+
sdist/
|
|
22
|
+
var/
|
|
23
|
+
wheels/
|
|
24
|
+
share/python-wheels/
|
|
25
|
+
*.egg-info/
|
|
26
|
+
.installed.cfg
|
|
27
|
+
*.egg
|
|
28
|
+
MANIFEST
|
|
29
|
+
|
|
30
|
+
# PyInstaller
|
|
31
|
+
# Usually these files are written by a python script from a template
|
|
32
|
+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
|
33
|
+
*.manifest
|
|
34
|
+
*.spec
|
|
35
|
+
|
|
36
|
+
# Installer logs
|
|
37
|
+
pip-log.txt
|
|
38
|
+
pip-delete-this-directory.txt
|
|
39
|
+
|
|
40
|
+
# Unit test / coverage reports
|
|
41
|
+
htmlcov/
|
|
42
|
+
.tox/
|
|
43
|
+
.nox/
|
|
44
|
+
.coverage
|
|
45
|
+
.coverage.*
|
|
46
|
+
.cache
|
|
47
|
+
nosetests.xml
|
|
48
|
+
coverage.xml
|
|
49
|
+
*.cover
|
|
50
|
+
*.py,cover
|
|
51
|
+
.hypothesis/
|
|
52
|
+
.pytest_cache/
|
|
53
|
+
cover/
|
|
54
|
+
|
|
55
|
+
# Translations
|
|
56
|
+
*.mo
|
|
57
|
+
*.pot
|
|
58
|
+
|
|
59
|
+
# Django stuff:
|
|
60
|
+
*.log
|
|
61
|
+
local_settings.py
|
|
62
|
+
db.sqlite3
|
|
63
|
+
db.sqlite3-journal
|
|
64
|
+
|
|
65
|
+
# Flask stuff:
|
|
66
|
+
instance/
|
|
67
|
+
.webassets-cache
|
|
68
|
+
|
|
69
|
+
# Scrapy stuff:
|
|
70
|
+
.scrapy
|
|
71
|
+
|
|
72
|
+
# Sphinx documentation
|
|
73
|
+
docs/_build/
|
|
74
|
+
|
|
75
|
+
# PyBuilder
|
|
76
|
+
.pybuilder/
|
|
77
|
+
target/
|
|
78
|
+
|
|
79
|
+
# Jupyter Notebook
|
|
80
|
+
.ipynb_checkpoints
|
|
81
|
+
|
|
82
|
+
# IPython
|
|
83
|
+
profile_default/
|
|
84
|
+
ipython_config.py
|
|
85
|
+
|
|
86
|
+
# pyenv
|
|
87
|
+
# For a library or package, you might want to ignore these files since the code is
|
|
88
|
+
# intended to run in multiple environments; otherwise, check them in:
|
|
89
|
+
# .python-version
|
|
90
|
+
|
|
91
|
+
# pipenv
|
|
92
|
+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
|
|
93
|
+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
|
|
94
|
+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
|
|
95
|
+
# install all needed dependencies.
|
|
96
|
+
#Pipfile.lock
|
|
97
|
+
|
|
98
|
+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow
|
|
99
|
+
__pypackages__/
|
|
100
|
+
|
|
101
|
+
# Celery stuff
|
|
102
|
+
celerybeat-schedule
|
|
103
|
+
celerybeat.pid
|
|
104
|
+
|
|
105
|
+
# SageMath parsed files
|
|
106
|
+
*.sage.py
|
|
107
|
+
|
|
108
|
+
# Environments
|
|
109
|
+
.env
|
|
110
|
+
.venv
|
|
111
|
+
env/
|
|
112
|
+
venv/
|
|
113
|
+
ENV/
|
|
114
|
+
env.bak/
|
|
115
|
+
venv.bak/
|
|
116
|
+
|
|
117
|
+
# Spyder project settings
|
|
118
|
+
.spyderproject
|
|
119
|
+
.spyproject
|
|
120
|
+
|
|
121
|
+
# Rope project settings
|
|
122
|
+
.ropeproject
|
|
123
|
+
|
|
124
|
+
# mkdocs documentation
|
|
125
|
+
/site
|
|
126
|
+
|
|
127
|
+
# mypy
|
|
128
|
+
.mypy_cache/
|
|
129
|
+
.dmypy.json
|
|
130
|
+
dmypy.json
|
|
131
|
+
|
|
132
|
+
# Pyre type checker
|
|
133
|
+
.pyre/
|
|
134
|
+
|
|
135
|
+
# pytype static type analyzer
|
|
136
|
+
.pytype/
|
|
137
|
+
|
|
138
|
+
# Cython debug symbols
|
|
139
|
+
cython_debug/
|
|
140
|
+
|
|
141
|
+
.idea
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: flask-openapi-redoc
|
|
3
|
+
Version: 2.5.2
|
|
4
|
+
Summary: Provide Redoc UI for flask-openapi.
|
|
5
|
+
Project-URL: Homepage, https://github.com/luolingchun/flask-openapi-plugins/tree/master/flask-openapi-redoc
|
|
6
|
+
Project-URL: Documentation, https://luolingchun.github.io/flask-openapi/latest/Usage/UI_Templates/
|
|
7
|
+
Maintainer-email: llc <luolingchun@outlook.com>
|
|
8
|
+
License: MIT
|
|
9
|
+
Classifier: Development Status :: 5 - Production/Stable
|
|
10
|
+
Classifier: Environment :: Web Environment
|
|
11
|
+
Classifier: Framework :: Flask
|
|
12
|
+
Classifier: Intended Audience :: Developers
|
|
13
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
14
|
+
Classifier: Operating System :: OS Independent
|
|
15
|
+
Classifier: Programming Language :: Python
|
|
16
|
+
Classifier: Programming Language :: Python :: 3
|
|
17
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
18
|
+
Requires-Python: >=3.8
|
|
19
|
+
Requires-Dist: flask-openapi
|
|
20
|
+
Description-Content-Type: text/markdown
|
|
21
|
+
|
|
22
|
+
Provide Redoc UI for [flask-openapi](https://github.com/luolingchun/flask-openapi).
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
# @Author : llc
|
|
3
|
+
# @Time : 2024/4/22 16:13
|
|
4
|
+
import os
|
|
5
|
+
|
|
6
|
+
from flask import Blueprint, render_template_string, current_app
|
|
7
|
+
from flask_openapi.plugins import BasePlugin
|
|
8
|
+
|
|
9
|
+
from .templates import redoc_html_string
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
class RegisterPlugin(BasePlugin):
|
|
13
|
+
name = "redoc"
|
|
14
|
+
display_name = "Redoc"
|
|
15
|
+
|
|
16
|
+
@classmethod
|
|
17
|
+
def register(cls, doc_url: str) -> Blueprint:
|
|
18
|
+
_here = os.path.dirname(__file__)
|
|
19
|
+
template_folder = os.path.join(_here, "templates")
|
|
20
|
+
static_folder = os.path.join(template_folder, cls.name)
|
|
21
|
+
blueprint = Blueprint(
|
|
22
|
+
cls.name,
|
|
23
|
+
__name__,
|
|
24
|
+
template_folder=template_folder,
|
|
25
|
+
static_folder=static_folder
|
|
26
|
+
)
|
|
27
|
+
|
|
28
|
+
blueprint.add_url_rule(
|
|
29
|
+
rule=f"/{cls.name}",
|
|
30
|
+
endpoint=cls.name,
|
|
31
|
+
view_func=lambda: render_template_string(
|
|
32
|
+
current_app.config.get("REDOC_HTML_STRING") or redoc_html_string,
|
|
33
|
+
doc_url=doc_url,
|
|
34
|
+
redoc_config=current_app.config.get("REDOC_CONFIG")
|
|
35
|
+
)
|
|
36
|
+
)
|
|
37
|
+
|
|
38
|
+
return blueprint
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
redoc_html_string = """
|
|
2
|
+
<!DOCTYPE html>
|
|
3
|
+
<html lang="en">
|
|
4
|
+
<head>
|
|
5
|
+
<title>ReDoc</title>
|
|
6
|
+
<link rel="shortcut icon" href="redoc/images/redoc.svg">
|
|
7
|
+
<!-- needed for adaptive design -->
|
|
8
|
+
<meta charset="utf-8"/>
|
|
9
|
+
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
10
|
+
<!--link href="static/css/google-fonts.css" rel="stylesheet" -->
|
|
11
|
+
<!-- ReDoc doesn't change outer page styles -->
|
|
12
|
+
<style>
|
|
13
|
+
body {
|
|
14
|
+
margin: 0;
|
|
15
|
+
padding: 0;
|
|
16
|
+
}
|
|
17
|
+
</style>
|
|
18
|
+
</head>
|
|
19
|
+
<body>
|
|
20
|
+
<div id="redoc"></div>
|
|
21
|
+
<script src="redoc/js/redoc.standalone.js"></script>
|
|
22
|
+
<script>
|
|
23
|
+
const redoc_config = JSON.parse(`{{ redoc_config|default('{}')|tojson }}`);
|
|
24
|
+
Redoc.init(
|
|
25
|
+
"{{ doc_url }}", redoc_config,
|
|
26
|
+
document.getElementById("redoc"))
|
|
27
|
+
</script>
|
|
28
|
+
</body>
|
|
29
|
+
</html>
|
|
30
|
+
"""
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
<svg width="200" height="200" xmlns="http://www.w3.org/2000/svg" version="1.1">
|
|
2
|
+
<g>
|
|
3
|
+
<title>Layer 1</title>
|
|
4
|
+
<path id="svg_1" d="m26.08,0l101.19,0c14.2,0.92 28.19,5.61 39.81,13.87c14.38,10.07 25.14,25.19 29.8,42.12c5.12,18.27 3.15,38.44 -5.58,55.29c-7.83,15.4 -21.07,27.88 -36.78,35.04c8.04,8.03 16.09,16.04 24.09,24.1c4.34,4.2 6.18,10.74 4.58,16.58c-1.63,6.86 -7.75,12.19 -14.74,13l-142.08,0c-12.95,-1.24 -24.25,-11.61 -26.37,-24.47l0,-151.19c2.2,-12.72 13.28,-22.92 26.08,-24.34m-14.39,29.05c-0.43,9.03 7.21,17.43 16.23,17.85c8.41,0.28 16.83,-0.04 25.24,0.15c1.78,-0.03 3.23,1.14 4.43,2.32c29.22,29.22 58.44,58.45 87.67,87.67c13.32,-4.91 24.93,-14.28 32.47,-26.32c7.98,-12.56 11.32,-27.96 9.31,-42.7c-2.02,-15.73 -10.2,-30.52 -22.32,-40.72c-11.27,-9.6 -25.94,-15.14 -40.75,-15.23c-31.69,-0.01 -63.37,-0.02 -95.05,0c-9.08,-0.14 -17.2,7.93 -17.23,16.98m-0.03,24.29c0.08,39.2 -0.02,78.41 0.05,117.62c0,9.09 8.17,17.09 17.24,17c45.71,0.07 91.42,0.05 137.13,0.01c4.65,0.54 7.57,-5.98 3.95,-9.01c-38.8,-38.87 -77.68,-77.67 -116.5,-116.53c-1.18,-1.11 -2.18,-2.45 -3.57,-3.31c-7.32,-0.19 -14.65,0.08 -21.97,-0.13c-5.86,-0.17 -11.57,-2.26 -16.33,-5.65z" fill="#505a6e"/>
|
|
5
|
+
<path id="svg_7" d="m26.18,93.32c12.55,-0.74 25.24,-0.12 37.85,-0.31c3.29,-0.25 6.3,2.68 6.21,5.96c0.12,3.27 -2.86,6.24 -6.15,6.02c-12.36,-0.05 -24.73,0.14 -37.08,-0.09c-5.83,-0.82 -6.46,-9.94 -0.83,-11.58z" fill="#505a6e"/>
|
|
6
|
+
<path id="svg_8" d="m26.22,117.31c1.54,-0.48 3.19,-0.27 4.78,-0.33c18.39,0.05 36.77,-0.01 55.15,0.03c3.27,-0.19 6.21,2.78 6.09,6.03c0.08,3.27 -2.93,6.2 -6.21,5.95c-19.69,-0.06 -39.4,0.16 -59.09,-0.1c-5.8,-0.88 -6.35,-9.98 -0.72,-11.58z" fill="#505a6e"/>
|
|
7
|
+
<path id="svg_9" d="m26.19,141.32c0.44,-0.07 1.33,-0.22 1.77,-0.29c27.38,-0.06 54.77,-0.03 82.15,-0.02c3.28,-0.21 6.24,2.75 6.14,6.01c0.07,3.25 -2.89,6.19 -6.15,5.97c-27.69,-0.04 -55.39,0.14 -83.07,-0.09c-5.84,-0.79 -6.49,-9.95 -0.84,-11.58z" fill="#505a6e"/>
|
|
8
|
+
</g>
|
|
9
|
+
</svg>
|