mirror of
https://github.com/thegeneralist01/twitter-openapi
synced 2026-01-11 23:50:26 +01:00
update hook
Signed-off-by: ふぁ <yuki@yuki0311.com>
This commit is contained in:
parent
cf65ef4e55
commit
a677f61bea
2 changed files with 25 additions and 9 deletions
|
|
@ -129,22 +129,24 @@ class AddParametersOnParameters(RequestHookBase):
|
|||
|
||||
def hook(self, path: str, value: dict):
|
||||
path, value = super().hook(path, value)
|
||||
for key in self.PLACEHOLDER[self.path_name].keys():
|
||||
example = json.dumps(self.PLACEHOLDER[self.path_name][key])
|
||||
data = self.PLACEHOLDER[self.path_name]
|
||||
for key in data.keys():
|
||||
if self.schemaType == "string":
|
||||
example = json.dumps(data[key])
|
||||
schema = {
|
||||
"type": "string",
|
||||
"default": example,
|
||||
"example": example,
|
||||
}
|
||||
elif self.schemaType == "object":
|
||||
example = json.dumps(data[key])
|
||||
schema = {
|
||||
"type": "object",
|
||||
"default": example,
|
||||
"example": example,
|
||||
}
|
||||
else:
|
||||
schema = self.placeholder_to_yaml(example)
|
||||
schema = self.placeholder_to_yaml(data[key])
|
||||
value["parameters"].append(
|
||||
{
|
||||
"name": key,
|
||||
|
|
@ -178,14 +180,14 @@ class AddParametersOnBody(RequestHookBase):
|
|||
data = self.PLACEHOLDER[self.path_name]
|
||||
|
||||
if self.schemaType == "string":
|
||||
example = json.dumps(self.PLACEHOLDER[self.path_name])
|
||||
example = json.dumps(data)
|
||||
schema = {
|
||||
"type": "string",
|
||||
"default": example,
|
||||
"example": example,
|
||||
}
|
||||
elif self.schemaType == "object":
|
||||
example = json.dumps(self.PLACEHOLDER[self.path_name])
|
||||
example = json.dumps(data)
|
||||
schema = {
|
||||
"type": "object",
|
||||
"default": example,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue