Closed vieyahn2017 closed 6 years ago
http://127.0.0.1:3000/api/v1/m/api/param POST接口处理的demo:
[
{
"name": "id",
"default": "1",
"required": "false",
"type_": "int",
"description": "id."
},
{
"name": "name",
"default": "",
"required": "true",
"type_": "string",
"description": "the name"
},
{
"name": "json_param",
"default": "",
"required": "true",
"type_": "json",
"description": "the name",
"children": [
{
"name": "json_param_id",
"default": "1",
"required": "false",
"type_": "int",
"description": "the json param id."
},
{
"name": "json_param_name",
"default": "",
"required": "true",
"type_": "string",
"description": "the json param name."
}]
}
]
前端的json参数的子项也写好了,但是样式不好处理。 只好重新辅助实现。 上面的数据demo,目前需要传成这样:
[
{
"name":"id",
"default":"1",
"required":"false",
"type_":"int",
"description":"id.",
"children":[],
"valid":true
},
{
"name":"name",
"default":"",
"required":"true",
"type_":"string",
"description":"the name",
"children":[],
"valid":true
},
{
"name":"json_param",
"default":"",
"required":"true",
"type_":"json",
"description":"the name",
"children":[
{
"name":"json_param_id",
"default":"1",
"required":"false",
"type_":"int",
"description":"the json param id.",
"children":[],
"valid":true
},
{
"name":"json_param_name",
"default":"",
"required":"true",
"type_":"string",
"description":"the json param name.",
"children":[],
"valid":true
}
]
},
{
"name":"json_param_id",
"default":"1",
"required":"false",
"type_":"int",
"description":"the json param id.",
"children":[],
"valid":false
},
{
"name":"json_param_name",
"default":"",
"required":"true",
"type_":"string",
"description":"the json param name.",
"children":[],
"valid":false
}
]
把json-param的子param也作为外层的param("valid":false)
responseList demo
[
{
"name": "msg",
"default": "",
"required": "false",
"type_": "string",
"description": "",
"uuid": "29f9e9b4-d463-4ca6-9385-dc9c4f604da1",
"children": [],
"parent_id": null
},
{
"name": "code",
"default": "",
"required": "false",
"type_": "int",
"description": "",
"uuid": "97bd3208-ac0f-46e9-bb87-3cba1a8a16d0",
"children": [],
"parent_id": null
},
{
"name": "result",
"default": "",
"required": "false",
"type_": "json",
"description": "",
"uuid": "fc0ee070-58a6-4834-93b4-c74606cb6110",
"children": [
{
"name": "ip",
"default": "",
"required": "false",
"type_": "string",
"description": "",
"uuid": "a7172c3b-c487-47ec-95e5-122365e9dbb3",
"children": [],
"parent_id": "fc0ee070-58a6-4834-93b4-c74606cb6110"
},
{
"name": "port",
"default": "",
"required": "false",
"type_": "string",
"description": "",
"uuid": "1f6e1d0c-c1df-44c7-b5b6-ebc39811b1c0",
"children": [],
"parent_id": "fc0ee070-58a6-4834-93b4-c74606cb6110"
}
],
"parent_id": null
},
{
"name": "ip",
"default": "",
"required": "false",
"type_": "string",
"description": "",
"uuid": "a7172c3b-c487-47ec-95e5-122365e9dbb3",
"children": [],
"parent_id": "fc0ee070-58a6-4834-93b4-c74606cb6110"
},
{
"name": "port",
"default": "",
"required": "false",
"type_": "string",
"description": "",
"uuid": "1f6e1d0c-c1df-44c7-b5b6-ebc39811b1c0",
"children": [],
"parent_id": "fc0ee070-58a6-4834-93b4-c74606cb6110"
}
]
== over 改动很大。
目前的POST:
[
{
"name": "parama",
"default": "",
"required": "false",
"type_": "string",
"description": "a",
"_id": "9135a7dd-d9ba-420b-989a-0ace559e0c62",
"children": [],
"parent_id": null,
"category_href": "compute"
},
{
"name": "paramaa",
"default": "",
"required": "false",
"type_": "string",
"description": "aa",
"_id": "4336c551-ec5f-40c5-9ada-4b26c920b21c",
"children": [],
"parent_id": null,
"category_href": "compute"
},
{
"name": "paramaaa",
"default": "",
"required": "false",
"type_": "json",
"description": "aaa",
"_id": "3f1ca745-2e18-44ed-ac83-0c61155593ca",
"children": [
{
"name": "json_paramb",
"default": "",
"required": "false",
"type_": "string",
"description": "b",
"_id": "d71cbf11-4060-4d47-b566-8f7689ae1784",
"children": [],
"parent_id": "3f1ca745-2e18-44ed-ac83-0c61155593ca",
"category_href": "compute"
},
{
"name": "json_parambb",
"default": "",
"required": "false",
"type_": "string",
"description": "bb",
"_id": "bcc97bfc-c7e2-4f90-bbcf-60bcd50cca36",
"children": [],
"parent_id": "3f1ca745-2e18-44ed-ac83-0c61155593ca",
"category_href": "compute"
},
{
"name": "json_parambbb",
"default": "",
"required": "false",
"type_": "string",
"description": "bbb",
"_id": "f8a32e8e-9791-4e0c-90d7-14cc5659a634",
"children": [],
"parent_id": "3f1ca745-2e18-44ed-ac83-0c61155593ca",
"category_href": "compute"
}
],
"parent_id": null,
"category_href": "compute"
},
{
"name": "json_paramb",
"default": "",
"required": "false",
"type_": "string",
"description": "b",
"_id": "d71cbf11-4060-4d47-b566-8f7689ae1784",
"children": [],
"parent_id": "3f1ca745-2e18-44ed-ac83-0c61155593ca",
"category_href": "compute"
},
{
"name": "json_parambb",
"default": "",
"required": "false",
"type_": "string",
"description": "bb",
"_id": "bcc97bfc-c7e2-4f90-bbcf-60bcd50cca36",
"children": [],
"parent_id": "3f1ca745-2e18-44ed-ac83-0c61155593ca",
"category_href": "compute"
},
{
"name": "json_parambbb",
"default": "",
"required": "false",
"type_": "string",
"description": "bbb",
"_id": "f8a32e8e-9791-4e0c-90d7-14cc5659a634",
"children": [],
"parent_id": "3f1ca745-2e18-44ed-ac83-0c61155593ca",
"category_href": "compute"
}
]
目前的PUT:
{
"api_id": "5abcfa7bb5d9c809d0473826",
"rows": [
{
"description": "param1",
"default": "",
"required": false,
"api_id": "5abcfa7bb5d9c809d0473826",
"parent_id": null,
"type_": "string",
"category_href": "compute",
"_id": "9135a7dd-d9ba-420b-989a-0ace559e0c62",
"children": [],
"name": "param1"
},
{
"description": "paramjson1",
"default": "",
"required": false,
"api_id": "5abcfa7bb5d9c809d0473826",
"parent_id": null,
"type_": "json",
"category_href": "compute",
"_id": "cafa4b14-a5bc-48d9-8ab2-0b904ea2161f",
"children": [
{
"description": "json1_param1_qq2",
"default": "",
"required": false,
"api_id": "5abcfa7bb5d9c809d0473826",
"parent_id": "cafa4b14-a5bc-48d9-8ab2-0b904ea2161f",
"type_": "string",
"category_href": "compute",
"_id": "011f8c0f-3817-434e-8211-56035efca58c",
"children": [],
"name": "json1_param1_qq22"
},
{
"description": "json1_param2_qq_qq",
"default": "",
"required": false,
"api_id": "5abcfa7bb5d9c809d0473826",
"parent_id": "cafa4b14-a5bc-48d9-8ab2-0b904ea2161f",
"type_": "string",
"category_href": "compute",
"_id": "e3346ae3-e888-44ba-a093-f5cb7ee11fb9",
"children": [],
"name": "json1_param2_qq_qq"
},
{
"name": "json_param_qq33",
"default": "",
"required": "false",
"type_": "string",
"description": "_qq33333",
"_id": "ac8db65f-339f-4c27-b7b8-3f903ebcdd3a",
"children": [],
"parent_id": "cafa4b14-a5bc-48d9-8ab2-0b904ea2161f",
"category_href": "compute"
}
],
"name": "paramjson1"
},
{
"description": "json1_param2_qq_qq",
"default": "",
"required": false,
"api_id": "5abcfa7bb5d9c809d0473826",
"parent_id": "cafa4b14-a5bc-48d9-8ab2-0b904ea2161f",
"type_": "string",
"category_href": "compute",
"_id": "e3346ae3-e888-44ba-a093-f5cb7ee11fb9",
"children": [],
"name": "json1_param2_qq_qq"
},
{
"description": "json1_param1_qq2",
"default": "",
"required": false,
"api_id": "5abcfa7bb5d9c809d0473826",
"parent_id": "cafa4b14-a5bc-48d9-8ab2-0b904ea2161f",
"type_": "string",
"category_href": "compute",
"_id": "011f8c0f-3817-434e-8211-56035efca58c",
"children": [],
"name": "json1_param1_qq22"
},
{
"name": "json_param_qq33",
"default": "",
"required": "false",
"type_": "string",
"description": "_qq33333",
"_id": "ac8db65f-339f-4c27-b7b8-3f903ebcdd3a",
"children": [],
"parent_id": "cafa4b14-a5bc-48d9-8ab2-0b904ea2161f",
"category_href": "compute"
}
]
}
== finished at: commit 77: dae7950e35e385cbdfcc8255c7cd1d7c62fd2d35
参数支持层级。json格式的参数产生子项