fix: js/py build-declarations scripts (#36)

This commit is contained in:
sigoden
2024-06-08 16:46:16 +08:00
committed by GitHub
parent 8a87890df6
commit 0ac5193b8d
2 changed files with 14 additions and 6 deletions
+7 -3
View File
@@ -127,11 +127,15 @@ def parse_param(raw_param: str):
def build_declaration(
name: str, description: str, params: dict, args: OrderedDict[str, str]
) -> dict[str, dict]:
schema = {
declaration = {
"name": name,
"description": description,
"properties": {},
"parameters": {
"type": "object",
"properties": {},
},
}
schema = declaration["parameters"]
required_params = []
for arg_name, arg_type in args.items():
type_ = arg_type
@@ -153,7 +157,7 @@ def build_declaration(
required_params.append(arg_name)
if required_params:
schema["required"] = required_params
return schema
return declaration
def build_property(type_: str, description: str):