1
Fork 0
mirror of https://github.com/thegeneralist01/twitter-openapi synced 2026-01-11 15:40: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

@ -49,17 +49,24 @@ class HookBase:
with open(f"src/config/component/{name}.yaml", mode="r", encoding="utf-8") as f:
return yaml.safe_load(f)
def load_placeholder(self) -> dict:
with open("src/config/placeholder.json", mode="r", encoding="utf-8") as f:
return yaml.safe_load(f)
# HookBase extends
class OpenapiHookBase(HookBase):
def hook(self, value: dict):
def hook(self, value: dict)->dict:
return value
class OtherHookBase(HookBase):
def hook(self)->tuple[str, dict]:
return "", {}
class SchemasHookBase(HookBase):
def hook(self, value: dict):
def hook(self, value: dict)->dict:
return value
@ -71,7 +78,7 @@ class RequestHookBase(HookBase):
super().__init__()
self.split = split
def hook(self, path: str, value: dict):
def hook(self, path: str, value: dict)->tuple[str, dict]:
value["parameters"] = value.get("parameters", [])
self.path_name = "/".join(path.split("/")[self.split :])
return path, value