star-openapi-rapidoc 9.3.8__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.
- star_openapi_rapidoc-9.3.8/.gitignore +141 -0
- star_openapi_rapidoc-9.3.8/PKG-INFO +22 -0
- star_openapi_rapidoc-9.3.8/pyproject.toml +45 -0
- star_openapi_rapidoc-9.3.8/star_openapi_rapidoc/__init__.py +0 -0
- star_openapi_rapidoc-9.3.8/star_openapi_rapidoc/__version__.py +3 -0
- star_openapi_rapidoc-9.3.8/star_openapi_rapidoc/plugins.py +41 -0
- star_openapi_rapidoc-9.3.8/star_openapi_rapidoc/templates/__init__.py +24 -0
- star_openapi_rapidoc-9.3.8/star_openapi_rapidoc/templates/rapidoc/images/rapidoc.svg +11 -0
- star_openapi_rapidoc-9.3.8/star_openapi_rapidoc/templates/rapidoc/js/rapidoc-min.js +3915 -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: star-openapi-rapidoc
|
|
3
|
+
Version: 9.3.8
|
|
4
|
+
Summary: Provide RapiDoc UI for star-openapi.
|
|
5
|
+
Project-URL: Homepage, https://github.com/luolingchun/star-openapi-plugins/tree/master/star-openapi-rapidoc
|
|
6
|
+
Project-URL: Documentation, https://luolingchun.github.io/star-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: star-openapi
|
|
20
|
+
Description-Content-Type: text/markdown
|
|
21
|
+
|
|
22
|
+
Provide RapiDoc UI for [star-openapi](https://github.com/luolingchun/star-openapi).
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "star-openapi-rapidoc"
|
|
3
|
+
description = "Provide RapiDoc UI for star-openapi."
|
|
4
|
+
readme = { text = "Provide RapiDoc UI for [star-openapi](https://github.com/luolingchun/star-openapi).", content-type = "text/markdown" }
|
|
5
|
+
license = { text = "MIT" }
|
|
6
|
+
maintainers = [{ name = "llc", email = "luolingchun@outlook.com" }]
|
|
7
|
+
classifiers = [
|
|
8
|
+
# "Development Status :: 1 - Planning",
|
|
9
|
+
# "Development Status :: 2 - Pre-Alpha",
|
|
10
|
+
# "Development Status :: 3 - Alpha",
|
|
11
|
+
# "Development Status :: 4 - Beta",
|
|
12
|
+
"Development Status :: 5 - Production/Stable",
|
|
13
|
+
# "Development Status :: 6 - Mature",
|
|
14
|
+
# "Development Status :: 7 - Inactive",
|
|
15
|
+
"Environment :: Web Environment",
|
|
16
|
+
"Framework :: Flask",
|
|
17
|
+
"Intended Audience :: Developers",
|
|
18
|
+
"License :: OSI Approved :: MIT License",
|
|
19
|
+
"Operating System :: OS Independent",
|
|
20
|
+
"Programming Language :: Python",
|
|
21
|
+
"Programming Language :: Python :: 3",
|
|
22
|
+
"Programming Language :: Python :: 3 :: Only"
|
|
23
|
+
]
|
|
24
|
+
requires-python = ">=3.8"
|
|
25
|
+
dependencies = ["star-openapi"]
|
|
26
|
+
dynamic = ["version"]
|
|
27
|
+
|
|
28
|
+
[project.urls]
|
|
29
|
+
Homepage = "https://github.com/luolingchun/star-openapi-plugins/tree/master/star-openapi-rapidoc"
|
|
30
|
+
Documentation = "https://luolingchun.github.io/star-openapi/latest/Usage/UI_Templates/"
|
|
31
|
+
|
|
32
|
+
[project.entry-points."star_openapi.plugins"]
|
|
33
|
+
register = "star_openapi_rapidoc.plugins.RegisterPlugin"
|
|
34
|
+
|
|
35
|
+
[build-system]
|
|
36
|
+
requires = ["hatchling"]
|
|
37
|
+
build-backend = "hatchling.build"
|
|
38
|
+
|
|
39
|
+
[tool.hatch.version]
|
|
40
|
+
path = "star_openapi_rapidoc/__version__.py"
|
|
41
|
+
|
|
42
|
+
[tool.hatch.build.targets.sdist]
|
|
43
|
+
include = [
|
|
44
|
+
"/star_openapi_rapidoc"
|
|
45
|
+
]
|
|
File without changes
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import os.path
|
|
2
|
+
|
|
3
|
+
from jinja2 import Template
|
|
4
|
+
from star_openapi.plugins import BasePlugin
|
|
5
|
+
from starlette.responses import HTMLResponse
|
|
6
|
+
from starlette.routing import Route, Mount
|
|
7
|
+
from starlette.staticfiles import StaticFiles
|
|
8
|
+
|
|
9
|
+
from .templates import rapidoc_html_string
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
class RegisterPlugin(BasePlugin):
|
|
13
|
+
def __init__(self):
|
|
14
|
+
self.name = "rapidoc"
|
|
15
|
+
self.display_name = "RapiDoc"
|
|
16
|
+
self.doc_url = "/openapi.json"
|
|
17
|
+
|
|
18
|
+
def rapidoc_endpoint(self, request):
|
|
19
|
+
template = Template(request.app.config.get("RAPIDOC_HTML_STRING") or rapidoc_html_string)
|
|
20
|
+
return HTMLResponse(
|
|
21
|
+
content=template.render(
|
|
22
|
+
{
|
|
23
|
+
"doc_url": self.doc_url,
|
|
24
|
+
"rapidoc_config": request.app.config.get("RAPIDOC_CONFIG")
|
|
25
|
+
}
|
|
26
|
+
)
|
|
27
|
+
)
|
|
28
|
+
|
|
29
|
+
def register(self, doc_url: str) -> list[Route]:
|
|
30
|
+
self.doc_url = doc_url
|
|
31
|
+
static_folder = os.path.join(os.path.dirname(__file__), "templates", "rapidoc")
|
|
32
|
+
|
|
33
|
+
routes = [
|
|
34
|
+
Route(
|
|
35
|
+
f"/{self.name}",
|
|
36
|
+
endpoint=self.rapidoc_endpoint
|
|
37
|
+
),
|
|
38
|
+
Mount("/rapidoc", app=StaticFiles(directory=static_folder), name="static"),
|
|
39
|
+
]
|
|
40
|
+
|
|
41
|
+
return routes
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
rapidoc_html_string = """
|
|
2
|
+
<!DOCTYPE html>
|
|
3
|
+
<html lang="en">
|
|
4
|
+
<head>
|
|
5
|
+
<meta charset="UTF-8">
|
|
6
|
+
<meta name="viewport" content="width=device-width,minimum-scale=1,initial-scale=1,user-scalable=yes">
|
|
7
|
+
<title>RapiDoc</title>
|
|
8
|
+
<link rel="shortcut icon" href="rapidoc/images/rapidoc.svg">
|
|
9
|
+
</head>
|
|
10
|
+
<body>
|
|
11
|
+
<rapi-doc spec-url='{{ doc_url }}'></rapi-doc>
|
|
12
|
+
<script>
|
|
13
|
+
const rapidoc_config = JSON.parse(`{{ rapidoc_config|default('{}')|tojson }}`);
|
|
14
|
+
var rapiDoc = document.querySelector("rapi-doc");
|
|
15
|
+
var specUrl = new URL("{{ doc_url }}", window.location.href).href;
|
|
16
|
+
rapiDoc.setAttribute("spec-url", specUrl);
|
|
17
|
+
for(var k in rapidoc_config) {
|
|
18
|
+
rapiDoc.setAttribute(k, rapidoc_config[k]);
|
|
19
|
+
}
|
|
20
|
+
</script>
|
|
21
|
+
<script src="rapidoc/js/rapidoc-min.js"></script>
|
|
22
|
+
</body>
|
|
23
|
+
</html>
|
|
24
|
+
"""
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="64px" height="64px" viewBox="0 0 64 64" version="1.1">
|
|
3
|
+
<g id="surface1">
|
|
4
|
+
<path style=" stroke:none;fill-rule:nonzero;fill:rgb(67.843137%,75.686275%,39.607843%);fill-opacity:1;" d="M 43.875 51.375 C 39.367188 59.195312 31.027344 64.011719 22 64.011719 C 12.972656 64.011719 4.632812 59.195312 0.125 51.375 C 4.359375 44.203125 11.84375 39.566406 20.152344 38.96875 C 28.457031 38.367188 36.53125 41.882812 41.75 48.375 C 42.53125 49.324219 43.238281 50.324219 43.875 51.375 Z M 43.875 51.375 "/>
|
|
5
|
+
<path style=" stroke:none;fill-rule:nonzero;fill:rgb(60%,66.666667%,32.156863%);fill-opacity:1;" d="M 41.75 48.375 C 31.832031 51.300781 21.136719 47.882812 14.75 39.75 C 24.667969 36.824219 35.363281 40.242188 41.75 48.375 Z M 51.5 52.375 L 10.625 52.375 C 10.074219 52.375 9.625 51.925781 9.625 51.375 C 9.625 50.824219 10.074219 50.375 10.625 50.375 L 51.5 50.375 C 52.003906 50.4375 52.378906 50.867188 52.375 51.375 C 52.378906 51.882812 52.003906 52.3125 51.5 52.375 Z M 51.5 52.375 "/>
|
|
6
|
+
<path style=" stroke:none;fill-rule:nonzero;fill:rgb(100%,78.039216%,23.137255%);fill-opacity:1;" d="M 46.75 42.25 L 46.125 46 C 37.382812 48.382812 28.039062 45.898438 21.632812 39.492188 C 15.226562 33.085938 12.742188 23.742188 15.125 15 C 23.1875 12.902344 31.769531 14.894531 38.082031 20.332031 C 44.394531 25.773438 47.632812 33.964844 46.75 42.25 Z M 46.75 42.25 "/>
|
|
7
|
+
<path style=" stroke:none;fill-rule:nonzero;fill:rgb(93.72549%,69.019608%,14.509804%);fill-opacity:1;" d="M 46.75 42.25 C 38.066406 37.25 33.160156 27.585938 34.25 17.625 C 42.910156 22.648438 47.804688 32.292969 46.75 42.25 Z M 51.5 52.375 L 50.75 52.125 L 21.875 23.25 C 21.632812 22.855469 21.695312 22.347656 22.019531 22.019531 C 22.347656 21.695312 22.855469 21.632812 23.25 21.875 L 52.125 50.625 C 52.433594 50.894531 52.542969 51.328125 52.40625 51.710938 C 52.269531 52.097656 51.910156 52.359375 51.5 52.375 Z M 51.5 52.375 "/>
|
|
8
|
+
<path style=" stroke:none;fill-rule:nonzero;fill:rgb(100%,56.470588%,24.313725%);fill-opacity:1;" d="M 38.875 21.875 C 38.875 31.25 43.875 39.375 51.5 43.75 C 59.320312 39.242188 64.136719 30.902344 64.136719 21.875 C 64.136719 12.847656 59.320312 4.507812 51.5 0 C 43.683594 4.511719 38.871094 12.851562 38.875 21.875 Z M 38.875 21.875 "/>
|
|
9
|
+
<path style=" stroke:none;fill-rule:nonzero;fill:rgb(90.980392%,45.490196%,14.509804%);fill-opacity:1;" d="M 51.5 52.375 C 50.949219 52.375 50.5 51.925781 50.5 51.375 L 50.5 10.625 C 50.644531 10.234375 51.019531 9.972656 51.4375 9.972656 C 51.855469 9.972656 52.230469 10.234375 52.375 10.625 L 52.375 51.375 C 52.378906 51.882812 52.003906 52.3125 51.5 52.375 Z M 51.5 52.375 "/>
|
|
10
|
+
</g>
|
|
11
|
+
</svg>
|