offapi 0.1.0__py3-none-any.whl
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.
- .gitignore +1 -0
- offapi/__init__.py +30 -0
- offapi/__version__.py +1 -0
- offapi/py.typed +0 -0
- offapi/redoc.js +1782 -0
- offapi/scalar.js +45 -0
- offapi/swagger_bundle.js +3 -0
- offapi/swagger_preset.js +3 -0
- offapi/swagger_style.css +3 -0
- offapi/templates.py +100 -0
- offapi/url.json +7 -0
- offapi-0.1.0.dist-info/METADATA +37 -0
- offapi-0.1.0.dist-info/RECORD +16 -0
- offapi-0.1.0.dist-info/WHEEL +4 -0
- offapi-0.1.0.dist-info/entry_points.txt +4 -0
- offapi-0.1.0.dist-info/licenses/LICENSE +201 -0
.gitignore
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
*
|
offapi/__init__.py
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import json
|
|
2
|
+
from enum import Enum
|
|
3
|
+
from importlib import resources
|
|
4
|
+
from pathlib import PurePath
|
|
5
|
+
|
|
6
|
+
from offapi.templates import ReDocTemplate, ScalarTemplate, SwaggerTemplate
|
|
7
|
+
|
|
8
|
+
__all__ = ["OpenAPITemplate"]
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
with resources.open_text("offapi", "url.json") as f:
|
|
12
|
+
urls = json.load(f)
|
|
13
|
+
|
|
14
|
+
def load_resource_file(filename: str) -> str:
|
|
15
|
+
with resources.open_text("offapi", filename) as f:
|
|
16
|
+
content = f.read()
|
|
17
|
+
# escape curly braces
|
|
18
|
+
return content.replace("{", "{{").replace("}", "}}")
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
class OpenAPITemplate(Enum):
|
|
22
|
+
SWAGGER = SwaggerTemplate.safe_substitute(
|
|
23
|
+
{PurePath(key).stem: load_resource_file(key) for key in urls if key.startswith("swagger")}
|
|
24
|
+
)
|
|
25
|
+
REDOC = ReDocTemplate.safe_substitute(
|
|
26
|
+
{PurePath(key).stem: load_resource_file(key) for key in urls if key.startswith("redoc")}
|
|
27
|
+
)
|
|
28
|
+
SCALAR = ScalarTemplate.safe_substitute(
|
|
29
|
+
{PurePath(key).stem: load_resource_file(key) for key in urls if key.startswith("scalar")}
|
|
30
|
+
)
|
offapi/__version__.py
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = '0.1.0'
|
offapi/py.typed
ADDED
|
File without changes
|