benchmark/api_example.json

112 lines
3.0 KiB
JSON
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

"""
1、整体结构说明
{
"project": "project_name",
"file": "file_path",
"functions": [
{
"id": "function_id",
"methodname": "function_name",
"description": "function_description",
"methodbody": "function_body",
"deepth": overall_depth,
"difficulty": "function_difficulty",
"apis": [ list_of_apis_used_in_function ]
}
]
}
2、API结构说明
{
"apiname": "api_name",
"library": "library_name",
"id": "api_id",
"apisource": "api_source_type", // "custome" or "third_party"
"parameters": [
{
"name": "parameter_name",
"type": "parameter_type"
}
],
"returns": {
"name": "return_value_name",
"type": "return_value_type"
},
"deepth": api_depth,
"para_depend": [ list_of_parameter_dependencies ],
"chain_depend": [ list_of_chain_dependencies ],
"apis": [ list_of_nested_apis ]
}
3、思考
a.id应该从深度只有1的自定义函数开始编号三方包是否需要id待定
b.deepth的定义对于整体deepth个人认为基于max deepth来定义更合理对于api的deepth就是这个api调用链的深度
4、方法
a、仍然使用jdt解析java代码
b、筛选无对应的测试用例
"""
{
"project": "projectA",
"file": "src/com/example/Example.java",
"functions": [
{
"id": "*****1",
"methodname": "FunctionA",
"description": "This function does A",
"methodbody": "public void FunctionA() { /* ... */ }",
"deepth": 3, //对于apic来说是3 对于apib是2maxdeepth来定义整体deepth更合理
"difficulty": "medium",
"apis": [
{
"apiname": "apiA",
"library": "",
"id": "*****2",
"apisource": "custome",
"parameters": [
{
"name": "param1",
"type": "String"
}
],
"returns": {
"name": "returnValue1",
"type": ""
},
"deepth": 2,
"para_depend": [],
"chain_depend": [],
"apis": [
{
"apiname": "apiC",
"library": "org.example",
"id": "*****4", //三方包是否需要id
"apisource": "third_party",
"parameters": [],
"returns": {
"name": "returnValue2",
"type": ""
},
"deepth": 1,
"para_depend": [],
"chain_depend": [],
"apis": []
}
]
},
{
"apiname": "apiB",
"library": "org.example",
"id": "*****3", //三方包是否需要id
"apisource": "third_party",
"parameters": [],
"returns": {
"name": "returnValue3",
"type": ""
},
"deepth": 1,
"para_depend": [],
"chain_depend": [],
"apis": []
}
]
}
]
}