1
Fork 0
mirror of https://github.com/thegeneralist01/twitter-openapi synced 2026-01-11 23:50:26 +01:00
Signed-off-by: ふぁ <yuki@yuki0311.com>
This commit is contained in:
ふぁ 2023-05-28 02:23:22 +09:00
parent e76db523f3
commit f707403009
No known key found for this signature in database
GPG key ID: 83A8A5E74872A8AA
9 changed files with 30 additions and 21 deletions

View file

@ -6,7 +6,7 @@ import shutil
import copy
import re
from build_config import Config
from hooks import OpenapiHookBase, RequestHookBase, SchemasHookBase
from hooks import OpenapiHookBase, RequestHookBase, SchemasHookBase,OtherHookBase
from tqdm import tqdm
@ -54,6 +54,14 @@ for lang, profile in tqdm(config.main().items(), leave=False):
hook: SchemasHookBase
value = hook.hook(value)
load["components"]["schemas"][name] = value
if file == "src/openapi/paths/other.yaml":
for hook in profile["other"]:
hook: OtherHookBase
key, value = hook.hook()
load["components"]["schemas"][key] = value
load["components"]["schemas"]["OtherResponse"]["properties"][key] = {
"$ref": f"#/components/schemas/{key}"
}
with open(dist_replace(file), mode="w+", encoding="utf-8") as f:
f.write(yaml.dump(load))