forked from justoneapi/justoneapi-python
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgenerate_sdk.py
More file actions
executable file
·30 lines (22 loc) · 818 Bytes
/
generate_sdk.py
File metadata and controls
executable file
·30 lines (22 loc) · 818 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#!/usr/bin/env python3
from __future__ import annotations
import argparse
import sys
from pathlib import Path
ROOT = Path(__file__).resolve().parents[1]
if str(ROOT) not in sys.path:
sys.path.insert(0, str(ROOT))
from tools.sdk_codegen import DEFAULT_NORMALIZED_SPEC_PATH, generate_sdk
def main() -> int:
parser = argparse.ArgumentParser(
description="Generate the JustOneAPI SDK surface from a normalized OpenAPI spec."
)
parser.add_argument("--input", type=Path, default=DEFAULT_NORMALIZED_SPEC_PATH)
args = parser.parse_args()
resources = generate_sdk(args.input)
print(
f"Generated {sum(len(resource.operations) for resource in resources)} operations across {len(resources)} resources."
)
return 0
if __name__ == "__main__":
raise SystemExit(main())