Fix and update API info:

- Fix generate script with missing body parameters without exported name
  - Update API info
This commit is contained in:
Desvelao 2020-10-14 17:31:47 +02:00
parent 09a05c3549
commit c7ac570f45
No known key found for this signature in database
GPG Key ID: DC70AEDF0377DBC1
2 changed files with 184 additions and 183 deletions

View File

@ -200,7 +200,7 @@ const getEndpointPathArgs = endpointPath => {
// Extend the parameter with the reference data
const extendParamReference = (parameter, jsonData) => {
if (parameter.$ref){
return { ...getNestedObject(jsonData, parameter.$ref.split('/').splice(1)) }
return { ...(parameter.name && parameter.name !== '$ref'? {name: parameter.name} : {}),...getNestedObject(jsonData, parameter.$ref.split('/').splice(1)) }
}else if(parameter.schema && parameter.schema.$ref){
return { ...parameter, schema: {...getNestedObject(jsonData, parameter.schema.$ref.split('/').splice(1))}};
}else if(parameter.schema && parameter.schema.items && parameter.schema.items.$ref){

View File

@ -28,6 +28,19 @@
"agents"
],
"query": [
{
"name": "agents_list",
"description": "List of agent IDs (separated by comma)",
"schema": {
"type": "array",
"items": {
"type": "string",
"minLength": 3,
"description": "Agent ID",
"format": "numbers"
}
}
},
{
"name": "group",
"description": "Filter by group of agents",
@ -57,19 +70,6 @@
"maximum": 500
}
},
{
"name": "agents_list",
"description": "List of agent IDs (separated by comma)",
"schema": {
"type": "array",
"items": {
"type": "string",
"minLength": 3,
"description": "Agent ID",
"format": "numbers"
}
}
},
{
"name": "manager",
"description": "Filter by manager hostname where agents are connected to",
@ -2218,6 +2218,19 @@
"experimental"
],
"query": [
{
"name": "agents_list",
"description": "List of agent IDs (separated by comma)",
"schema": {
"type": "array",
"items": {
"type": "string",
"minLength": 3,
"description": "Agent ID",
"format": "numbers"
}
}
},
{
"name": "benchmark",
"description": "Filter by benchmark type",
@ -2255,19 +2268,6 @@
"maximum": 500
}
},
{
"name": "agents_list",
"description": "List of agent IDs (separated by comma)",
"schema": {
"type": "array",
"items": {
"type": "string",
"minLength": 3,
"description": "Agent ID",
"format": "numbers"
}
}
},
{
"name": "notchecked",
"description": "Filter by not checked",
@ -2375,6 +2375,19 @@
"experimental"
],
"query": [
{
"name": "agents_list",
"description": "List of agent IDs (separated by comma)",
"schema": {
"type": "array",
"items": {
"type": "string",
"minLength": 3,
"description": "Agent ID",
"format": "numbers"
}
}
},
{
"name": "board_serial",
"description": "Filter by board_serial",
@ -2419,19 +2432,6 @@
"maximum": 500
}
},
{
"name": "agents_list",
"description": "List of agent IDs (separated by comma)",
"schema": {
"type": "array",
"items": {
"type": "string",
"minLength": 3,
"description": "Agent ID",
"format": "numbers"
}
}
},
{
"name": "offset",
"description": "First element to return in the collection",
@ -2514,6 +2514,19 @@
"experimental"
],
"query": [
{
"name": "agents_list",
"description": "List of agent IDs (separated by comma)",
"schema": {
"type": "array",
"items": {
"type": "string",
"minLength": 3,
"description": "Agent ID",
"format": "numbers"
}
}
},
{
"name": "hotfix",
"description": "Filter by hotfix",
@ -2532,19 +2545,6 @@
"maximum": 500
}
},
{
"name": "agents_list",
"description": "List of agent IDs (separated by comma)",
"schema": {
"type": "array",
"items": {
"type": "string",
"minLength": 3,
"description": "Agent ID",
"format": "numbers"
}
}
},
{
"name": "offset",
"description": "First element to return in the collection",
@ -2617,6 +2617,19 @@
"format": "alphanumeric"
}
},
{
"name": "agents_list",
"description": "List of agent IDs (separated by comma)",
"schema": {
"type": "array",
"items": {
"type": "string",
"minLength": 3,
"description": "Agent ID",
"format": "numbers"
}
}
},
{
"name": "broadcast",
"description": "Filter by broadcast direction",
@ -2636,19 +2649,6 @@
"maximum": 500
}
},
{
"name": "agents_list",
"description": "List of agent IDs (separated by comma)",
"schema": {
"type": "array",
"items": {
"type": "string",
"minLength": 3,
"description": "Agent ID",
"format": "numbers"
}
}
},
{
"name": "netmask",
"description": "Filter by netmask",
@ -2737,17 +2737,6 @@
"format": "alphanumeric"
}
},
{
"name": "limit",
"description": "Maximum number of elements to return",
"schema": {
"type": "integer",
"format": "int32",
"default": 500,
"minimum": 1,
"maximum": 500
}
},
{
"name": "agents_list",
"description": "List of agent IDs (separated by comma)",
@ -2761,6 +2750,17 @@
}
}
},
{
"name": "limit",
"description": "Maximum number of elements to return",
"schema": {
"type": "integer",
"format": "int32",
"default": 500,
"minimum": 1,
"maximum": 500
}
},
{
"name": "mtu",
"description": "Filter by mtu",
@ -2930,6 +2930,19 @@
"experimental"
],
"query": [
{
"name": "agents_list",
"description": "List of agent IDs (separated by comma)",
"schema": {
"type": "array",
"items": {
"type": "string",
"minLength": 3,
"description": "Agent ID",
"format": "numbers"
}
}
},
{
"name": "dhcp",
"description": "Filter by network dhcp (enabled or disabled)",
@ -2971,19 +2984,6 @@
"maximum": 500
}
},
{
"name": "agents_list",
"description": "List of agent IDs (separated by comma)",
"schema": {
"type": "array",
"items": {
"type": "string",
"minLength": 3,
"description": "Agent ID",
"format": "numbers"
}
}
},
{
"name": "offset",
"description": "First element to return in the collection",
@ -3056,6 +3056,19 @@
"experimental"
],
"query": [
{
"name": "agents_list",
"description": "List of agent IDs (separated by comma)",
"schema": {
"type": "array",
"items": {
"type": "string",
"minLength": 3,
"description": "Agent ID",
"format": "numbers"
}
}
},
{
"name": "architecture",
"description": "Filter by architecture",
@ -3075,19 +3088,6 @@
"maximum": 500
}
},
{
"name": "agents_list",
"description": "List of agent IDs (separated by comma)",
"schema": {
"type": "array",
"items": {
"type": "string",
"minLength": 3,
"description": "Agent ID",
"format": "numbers"
}
}
},
{
"name": "offset",
"description": "First element to return in the collection",
@ -3184,6 +3184,19 @@
"experimental"
],
"query": [
{
"name": "agents_list",
"description": "List of agent IDs (separated by comma)",
"schema": {
"type": "array",
"items": {
"type": "string",
"minLength": 3,
"description": "Agent ID",
"format": "numbers"
}
}
},
{
"name": "architecture",
"description": "Filter by architecture",
@ -3211,19 +3224,6 @@
"maximum": 500
}
},
{
"name": "agents_list",
"description": "List of agent IDs (separated by comma)",
"schema": {
"type": "array",
"items": {
"type": "string",
"minLength": 3,
"description": "Agent ID",
"format": "numbers"
}
}
},
{
"name": "name",
"description": "Filter by agent name",
@ -3310,17 +3310,6 @@
"experimental"
],
"query": [
{
"name": "limit",
"description": "Maximum number of elements to return",
"schema": {
"type": "integer",
"format": "int32",
"default": 500,
"minimum": 1,
"maximum": 500
}
},
{
"name": "agents_list",
"description": "List of agent IDs (separated by comma)",
@ -3334,6 +3323,17 @@
}
}
},
{
"name": "limit",
"description": "Maximum number of elements to return",
"schema": {
"type": "integer",
"format": "int32",
"default": 500,
"minimum": 1,
"maximum": 500
}
},
{
"name": "local.ip",
"description": "Filter by Local IP",
@ -3462,6 +3462,19 @@
"experimental"
],
"query": [
{
"name": "agents_list",
"description": "List of agent IDs (separated by comma)",
"schema": {
"type": "array",
"items": {
"type": "string",
"minLength": 3,
"description": "Agent ID",
"format": "numbers"
}
}
},
{
"name": "egroup",
"description": "Filter by process egroup",
@ -3497,19 +3510,6 @@
"maximum": 500
}
},
{
"name": "agents_list",
"description": "List of agent IDs (separated by comma)",
"schema": {
"type": "array",
"items": {
"type": "string",
"minLength": 3,
"description": "Agent ID",
"format": "numbers"
}
}
},
{
"name": "name",
"description": "Filter by process name",
@ -3662,6 +3662,19 @@
"groups"
],
"query": [
{
"name": "groups_list",
"description": "Array of group IDs",
"schema": {
"type": "array",
"items": {
"type": "string",
"minLength": 1,
"description": "Group name",
"format": "group_names"
}
}
},
{
"name": "hash",
"description": "Select algorithm to generate the returned checksums",
@ -3694,19 +3707,6 @@
"maximum": 500
}
},
{
"name": "groups_list",
"description": "Array of group IDs",
"schema": {
"type": "array",
"items": {
"type": "string",
"minLength": 1,
"description": "Group name",
"format": "group_names"
}
}
},
{
"name": "offset",
"description": "First element to return in the collection",
@ -7997,6 +7997,19 @@
"agents"
],
"query": [
{
"name": "agents_list",
"description": "List of agent IDs (separated by comma)",
"schema": {
"type": "array",
"items": {
"type": "string",
"minLength": 3,
"description": "Agent ID",
"format": "numbers"
}
}
},
{
"name": "force_single_group",
"description": "Whether to append the new group to current agent's multigroup or replace it",
@ -8015,19 +8028,6 @@
"format": "group_names"
}
},
{
"name": "agents_list",
"description": "List of agent IDs (separated by comma)",
"schema": {
"type": "array",
"items": {
"type": "string",
"minLength": 3,
"description": "Agent ID",
"format": "numbers"
}
}
},
{
"name": "pretty",
"description": "Show results in human-readable format",
@ -9085,12 +9085,6 @@
}
],
"body": [
{
"type": "string",
"minLength": 3,
"description": "Agent ID",
"format": "numbers"
},
{
"name": "force_time",
"description": "Remove the old agent with the same IP if disconnected for <force_time> seconds",
@ -9098,6 +9092,13 @@
"format": "int32",
"minimum": 0
},
{
"name": "id",
"type": "string",
"minLength": 3,
"description": "Agent ID",
"format": "numbers"
},
{
"name": "ip",
"description": "If this is not included, the API will get the IP automatically. If you are behind a proxy, you must set the option behind_proxy_server to yes at api.yaml and make sure the proxy is setting HTTP header 'X-Forwarded-For' with origin IP address. Allowed values: IP, IP/NET, ANY",
@ -9793,17 +9794,6 @@
"agents"
],
"query": [
{
"name": "group_id",
"description": "Group ID. (Name of the group)",
"required": true,
"schema": {
"type": "string",
"minLength": 1,
"description": "Group name",
"format": "group_names"
}
},
{
"name": "agents_list",
"description": "List of agent IDs (separated by comma), use the keyword 'all' to select all agents",
@ -9818,6 +9808,17 @@
}
}
},
{
"name": "group_id",
"description": "Group ID. (Name of the group)",
"required": true,
"schema": {
"type": "string",
"minLength": 1,
"description": "Group name",
"format": "group_names"
}
},
{
"name": "pretty",
"description": "Show results in human-readable format",