offapi 0.1.0__tar.gz → 0.1.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.
- {offapi-0.1.0 → offapi-0.1.2}/PKG-INFO +12 -4
- {offapi-0.1.0 → offapi-0.1.2}/README.md +8 -0
- offapi-0.1.2/offapi/__init__.py +42 -0
- offapi-0.1.2/offapi/__version__.py +1 -0
- offapi-0.1.2/offapi/redoc.js +1832 -0
- offapi-0.1.2/offapi/scalar.js +47 -0
- {offapi-0.1.0 → offapi-0.1.2}/offapi/url.json +2 -2
- {offapi-0.1.0 → offapi-0.1.2}/pdm_build.py +6 -1
- {offapi-0.1.0 → offapi-0.1.2}/pyproject.toml +13 -8
- offapi-0.1.0/offapi/__init__.py +0 -30
- offapi-0.1.0/offapi/__version__.py +0 -1
- offapi-0.1.0/offapi/redoc.js +0 -1782
- offapi-0.1.0/offapi/scalar.js +0 -45
- {offapi-0.1.0 → offapi-0.1.2}/LICENSE +0 -0
- {offapi-0.1.0 → offapi-0.1.2}/offapi/py.typed +0 -0
- {offapi-0.1.0 → offapi-0.1.2}/offapi/swagger_bundle.js +0 -0
- {offapi-0.1.0 → offapi-0.1.2}/offapi/swagger_preset.js +0 -0
- {offapi-0.1.0 → offapi-0.1.2}/offapi/swagger_style.css +0 -0
- {offapi-0.1.0 → offapi-0.1.2}/offapi/templates.py +0 -0
- {offapi-0.1.0 → offapi-0.1.2}/tests/__init__.py +0 -0
|
@@ -1,16 +1,18 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
2
|
Name: offapi
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.2
|
|
4
4
|
Summary: OpenAPI frontend render offline template.
|
|
5
5
|
Author-Email: Keming <kemingy94@gmail.com>
|
|
6
|
-
License: Apache-2.0
|
|
6
|
+
License-Expression: Apache-2.0
|
|
7
7
|
Classifier: Intended Audience :: Developers
|
|
8
8
|
Project-URL: Homepage, https://github.com/kemingy/offapi
|
|
9
|
-
Requires-Python: >=3.
|
|
9
|
+
Requires-Python: >=3.10
|
|
10
10
|
Description-Content-Type: text/markdown
|
|
11
11
|
|
|
12
12
|
# OffAPI
|
|
13
13
|
|
|
14
|
+
[](https://pypi.org/project/offapi/)
|
|
15
|
+
|
|
14
16
|
OpenAPI template files for offline usage.
|
|
15
17
|
|
|
16
18
|
This package will download the related files during the build time, and package them into the final distribution.
|
|
@@ -35,3 +37,9 @@ from offapi import OpenAPITemplate
|
|
|
35
37
|
swagger_template = OpenAPITemplate.SWAGGER.value
|
|
36
38
|
swagger_template.format(spec_url="your_path_to_the_spec.json")
|
|
37
39
|
```
|
|
40
|
+
|
|
41
|
+
## Used by
|
|
42
|
+
|
|
43
|
+
- [spectree](https://github.com/0b01001001/spectree): API spec validator and OpenAPI document generator for Python web frameworks.
|
|
44
|
+
- [defspec](https://github.com/kemingy/defspec/): Create the OpenAPI spec and document from dataclass, attrs, etc.
|
|
45
|
+
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
# OffAPI
|
|
2
2
|
|
|
3
|
+
[](https://pypi.org/project/offapi/)
|
|
4
|
+
|
|
3
5
|
OpenAPI template files for offline usage.
|
|
4
6
|
|
|
5
7
|
This package will download the related files during the build time, and package them into the final distribution.
|
|
@@ -24,3 +26,9 @@ from offapi import OpenAPITemplate
|
|
|
24
26
|
swagger_template = OpenAPITemplate.SWAGGER.value
|
|
25
27
|
swagger_template.format(spec_url="your_path_to_the_spec.json")
|
|
26
28
|
```
|
|
29
|
+
|
|
30
|
+
## Used by
|
|
31
|
+
|
|
32
|
+
- [spectree](https://github.com/0b01001001/spectree): API spec validator and OpenAPI document generator for Python web frameworks.
|
|
33
|
+
- [defspec](https://github.com/kemingy/defspec/): Create the OpenAPI spec and document from dataclass, attrs, etc.
|
|
34
|
+
|
|
@@ -0,0 +1,42 @@
|
|
|
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.files("offapi") / "url.json").open(encoding="utf-8") as f:
|
|
12
|
+
urls = json.load(f)
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
def load_resource_file(filename: str) -> str:
|
|
16
|
+
content = (resources.files("offapi") / filename).read_text(encoding="utf-8")
|
|
17
|
+
# escape curly braces
|
|
18
|
+
return content.replace("{", "{{").replace("}", "}}")
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
class OpenAPITemplate(Enum):
|
|
22
|
+
SWAGGER = SwaggerTemplate.safe_substitute(
|
|
23
|
+
{
|
|
24
|
+
PurePath(key).stem: load_resource_file(key)
|
|
25
|
+
for key in urls
|
|
26
|
+
if key.startswith("swagger")
|
|
27
|
+
}
|
|
28
|
+
)
|
|
29
|
+
REDOC = ReDocTemplate.safe_substitute(
|
|
30
|
+
{
|
|
31
|
+
PurePath(key).stem: load_resource_file(key)
|
|
32
|
+
for key in urls
|
|
33
|
+
if key.startswith("redoc")
|
|
34
|
+
}
|
|
35
|
+
)
|
|
36
|
+
SCALAR = ScalarTemplate.safe_substitute(
|
|
37
|
+
{
|
|
38
|
+
PurePath(key).stem: load_resource_file(key)
|
|
39
|
+
for key in urls
|
|
40
|
+
if key.startswith("scalar")
|
|
41
|
+
}
|
|
42
|
+
)
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "0.1.2"
|