Skip to content

Commit

Permalink
add annotations
Browse files Browse the repository at this point in the history
  • Loading branch information
pmmgithub committed May 16, 2023
1 parent e2b3df8 commit fd3ac59
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions xml2json/xml2json.py
Original file line number Diff line number Diff line change
Expand Up @@ -1153,19 +1153,20 @@ def create_json_from_xml(working_dir, file_dir, android_path, cpp_path, rust_pat
data = {}

data['id'] = api_id
# 处理 name 字段
# save name, remove "\n"
data['name'] = api_name.replace("\n", "") if isinstance(api_name, str) else api_name
# 处理 description 字段
# save description, remove "\n"
data['description'] = api_desc.replace("\n", "") if isinstance(api_desc, str) else api_desc
# 处理 parameters 字段
# save parameters, remove "\n"
data['parameters'] = [
{key.replace("\n", "") if isinstance(key, str) and key is not None else key:
value.replace("\n", "") if isinstance(value, str) and value is not None else value}
for param in json_array
for key, value in param.items()
]
# 处理 returns 字段
# save returns, remove "\n"
data['returns'] = return_values.replace("\n", "") if isinstance(return_values, str) and return_values is not None else return_values
# for the resource-only apis whose names are left blank, hide them
data['is_hide'] = True if api_id in json_hide_id_list or data['name'] == "" else False

print(data)
Expand Down

0 comments on commit fd3ac59

Please sign in to comment.