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

@ -445,7 +445,7 @@
"include_ext_verified_type": 1,
"include_ext_profile_image_shape": 1,
"skip_status": 1,
"user_id": 44196397
"user_id": "44196397"
},
"friendships/destroy.json": {
"include_profile_interstitial_type": 1,
@ -461,7 +461,7 @@
"include_ext_verified_type": 1,
"include_ext_profile_image_shape": 1,
"skip_status": 1,
"user_id": 44196397
"user_id": "44196397"
},
"friends/following/list.json": {
"include_profile_interstitial_type": 1,
@ -478,7 +478,7 @@
"include_ext_profile_image_shape": 1,
"skip_status": 1,
"cursor": -1,
"user_id": 17152334,
"user_id": "44196397",
"count": 3,
"with_total_count": true
},
@ -486,7 +486,7 @@
"include_ext_is_blue_verified": 1,
"include_ext_verified_type": 1,
"include_ext_profile_image_shape": 1,
"q": "aaa",
"q": "test",
"src": "search_box",
"result_type": "events,users,topics"
},

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))

View file

@ -68,6 +68,7 @@ class Config:
| {
key: [
SetResponsesHeader(suffix="legacy"),
AddSecuritySchemesOnHeader(split=-1),
AddParametersOnParameters(
split=2,
schemaType="string",
@ -78,9 +79,10 @@ class Config:
| {
key: [
SetResponsesHeader(suffix="legacy"),
AddSecuritySchemesOnHeader(split=-1),
AddParametersOnBody(
split=2,
schemaType="object",
schemaType=None,
contentType="application/x-www-form-urlencoded",
),
]

View file

@ -80,7 +80,7 @@ class AddSecuritySchemesOnSecuritySchemes(OpenapiHookBase):
value = super().hook(value)
component = self.load_component("security_schemes")
param = component["components"]["securitySchemes"]
value["components"]["securitySchemes"].extend(param)
value["components"]["securitySchemes"].update(param)
return value
@ -196,7 +196,7 @@ class AddParametersOnBody(RequestHookBase):
"properties": {
i: self.placeholder_to_yaml(data[i]) for i in data.keys()
},
# "required": [i for i in data.keys()],
"required": [i for i in data.keys()],
}
value["requestBody"] = {
"description": "body",
@ -232,7 +232,7 @@ class AddParametersOnContent(RequestHookBase):
"content": {
self.contentType: {
"schema": self.placeholder_to_yaml(data[key]),
# "required": [i for i in data[key]],
"required": [i for i in data[key]],
}
},
}