Skip to content

Commit 88e6ce0

Browse files
authored
Fix the schema generate for array of int (#53744)
### What does this PR do? Fix the schema generate for array of int Co-authored-by: maxime.mouial <maxime.mouial@datadoghq.com>
1 parent 05d2265 commit 88e6ce0

3 files changed

Lines changed: 3 additions & 6 deletions

File tree

pkg/config/buildschema/builder.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,8 +102,7 @@ func (b *builder) addToSchema(name string, val interface{}, envVars []string, no
102102
case []int:
103103
node = map[string]interface{}{
104104
"type": "array",
105-
"tags": []string{"golang_type:[]int"},
106-
"items": map[string]string{"type": "number"},
105+
"items": map[string]string{"type": "integer"},
107106
}
108107
node["default"] = v
109108
case []interface{}:

pkg/config/schema/yaml/system-probe_schema.yaml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -558,11 +558,9 @@ properties:
558558
default:
559559
- 53
560560
items:
561-
type: number
561+
type: integer
562562
visibility: public
563563
description: A list of ports that should be monitored for DNS traffic.
564-
tags:
565-
- golang_type:[]int
566564
allow_netlink_conntracker_fallback:
567565
node_type: setting
568566
type: boolean

tasks/schema/template.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ def _get_node_types_and_default(full_name, node, os_target):
225225
yaml_type, env_type = "list of strings", "space-separated list of strings"
226226
elif node["items"]["type"] == "object":
227227
yaml_type, env_type = "list of object", "JSON list of object"
228-
elif node["items"]["type"] == "number":
228+
elif node["items"]["type"] in ["number", "integer"]:
229229
yaml_type, env_type = "list of integers", "JSON array of numbers or space-separated list of integers"
230230
else:
231231
raise Exception(f"unknown array of type: {node['items']['type']}")

0 commit comments

Comments
 (0)