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

add support build other method

Signed-off-by: ふぁ <yuki@yuki0311.com>
This commit is contained in:
ふぁ 2023-04-26 20:10:49 +09:00
parent 749668901f
commit 1361660774
No known key found for this signature in database
GPG key ID: 83A8A5E74872A8AA

View file

@ -40,6 +40,7 @@ class placeholder_manager:
OUTPUT_DIR = "dist/{0}"
INPUT_DIR = "src/openapi"
METHODS = ["get", "put", "post", "delete", "options", "head", "patch", "trace"]
try:
shutil.rmtree("dist")
@ -96,15 +97,18 @@ for lang in variable.keys():
for key in load["paths"].keys():
append = get_yaml(parameters, key.split("/")[-1])
req = load["paths"][key]["get"]
req["parameters"] = append["paths"]["/parameters"]["get"]["parameters"]
param = append["paths"]["/parameters"]
for method in METHODS:
if load["paths"][key].get(method, None) is not None:
req = load["paths"][key][method]
req["parameters"] = param["get"]["parameters"]
append = get_yaml(header, key.split("/")[-1])
req = load["paths"][key]["get"]
req["responses"]["200"]["headers"] = append["components"]["headers"]
append = get_yaml(header, key.split("/")[-1])
req = load["paths"][key][method]
req["responses"]["200"]["headers"] = append["components"]["headers"]
escape = key.replace("/", "~1")
paths.update({key: {"$ref": f".{relative}#/paths/{escape}"}})
escape = key.replace("/", "~1")
paths.update({key: {"$ref": f".{relative}#/paths/{escape}"}})
write(file, yaml.dump(load))
file = "src/openapi/openapi-3.0.yaml"