1
Fork 0
mirror of https://github.com/thegeneralist01/twitter-openapi synced 2026-01-11 23:50:26 +01:00

update build config

Signed-off-by: ふぁ <yuki@yuki0311.com>
This commit is contained in:
ふぁ 2023-05-11 11:53:04 +09:00
parent d37eea2e94
commit a384b69c2a
No known key found for this signature in database
GPG key ID: 83A8A5E74872A8AA
4 changed files with 15 additions and 8 deletions

View file

@ -6,6 +6,7 @@ import shutil
import copy
import re
from build_config import Config
from hooks import OpenapiHookBase, RequestHookBase
print("=== Build Start ===")
@ -37,6 +38,7 @@ for lang in config.main().keys():
for tag in list(load["paths"][path][method].get("tags", ["default"])):
key, value = path, load["paths"][path][method]
for hook in config.main()[lang]["request"][tag]:
hook: RequestHookBase
key, value = hook.hook(key, value)
load["paths"][path][method] = value
load["paths"][key] = load["paths"].pop(path)
@ -53,6 +55,9 @@ for lang in config.main().keys():
openapi = yaml.safe_load(f)
for path in paths:
openapi["paths"] = paths
for hook in config.main()[lang]["openapi"]:
hook: OpenapiHookBase
openapi = hook.hook(openapi)
with open(dist_replace(file), mode="w+", encoding="utf-8") as f:
f.write(yaml.dump(openapi))