Skip to content

Commit 6cc42e6

Browse files
authored
Fix type inference for fields with intermediate pipe filters (#103)
Add word boundaries to all context patterns to prevent substring matches (e.g. preparedStatements matching preparedStatementsLimit). Broaden the quote pattern to allow intermediate filters like \`| default "foo" | quote\`.
1 parent ca49a78 commit 6cc42e6

2 files changed

Lines changed: 19 additions & 21 deletions

File tree

scripts/generate-schema.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -40,18 +40,18 @@
4040
# Template `if .Values.X` is a truthiness check, not a type indicator.
4141
CONTEXT_PATTERNS = [
4242
# pgdog.intval → integer (accepts int or underscore-separated string)
43-
(re.compile(r'include\s+"pgdog\.intval".*\.Values\.{path}'), "integer"),
44-
(re.compile(r'\.Values\.{path}.*\|\s*int'), "integer"),
43+
(re.compile(r'include\s+"pgdog\.intval".*\.Values\.{path}\b'), "integer"),
44+
(re.compile(r'\.Values\.{path}\b.*\|\s*int\b'), "integer"),
4545
# | toYaml / with .Values.X → object
46-
(re.compile(r"\.Values\.{path}\s*\|\s*toYaml"), "object"),
47-
(re.compile(r"toYaml\s+\.Values\.{path}"), "object"),
48-
(re.compile(r"with\s+\.Values\.{path}\s"), "object"),
46+
(re.compile(r"\.Values\.{path}\b\s*\|\s*toYaml"), "object"),
47+
(re.compile(r"toYaml\s+\.Values\.{path}\b"), "object"),
48+
(re.compile(r"with\s+\.Values\.{path}\b\s"), "object"),
4949
# | toToml → array
50-
(re.compile(r"\.Values\.{path}\s*\|\s*toToml"), "array"),
50+
(re.compile(r"\.Values\.{path}\b\s*\|\s*toToml"), "array"),
5151
# range .Values.X → array
52-
(re.compile(r"range\s+\.Values\.{path}"), "array"),
53-
# | quote → string
54-
(re.compile(r"\.Values\.{path}\s*\|\s*quote"), "string"),
52+
(re.compile(r"range\s+\.Values\.{path}\b"), "array"),
53+
# | quote → string (allow intermediate filters like `| default "foo" | quote`)
54+
(re.compile(r"\.Values\.{path}\b[^}]*\|\s*quote"), "string"),
5555
]
5656

5757

values.schema.json

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -650,6 +650,14 @@
650650
"off"
651651
]
652652
},
653+
"logMinDurationParse": {
654+
"type": "integer",
655+
"minimum": 0
656+
},
657+
"logQuerySampleLength": {
658+
"type": "integer",
659+
"minimum": 0
660+
},
653661
"lsnCheckDelay": {
654662
"type": "integer",
655663
"minimum": 0
@@ -901,8 +909,7 @@
901909
"description": "Delay before stopping container to allow endpoint updates"
902910
},
903911
"preparedStatements": {
904-
"type": "integer",
905-
"minimum": 0
912+
"type": "string"
906913
},
907914
"preparedStatementsLimit": {
908915
"type": "integer",
@@ -1168,14 +1175,6 @@
11681175
"type": "object",
11691176
"description": "Container readiness probe configuration"
11701177
},
1171-
"logMinDurationParse": {
1172-
"type": "integer",
1173-
"minimum": 0
1174-
},
1175-
"logQuerySampleLength": {
1176-
"type": "integer",
1177-
"minimum": 0
1178-
},
11791178
"regexParserLimit": {
11801179
"type": "integer",
11811180
"minimum": 0
@@ -1491,8 +1490,7 @@
14911490
}
14921491
},
14931492
"twoPhaseCommit": {
1494-
"type": "boolean",
1495-
"minimum": 0
1493+
"type": "boolean"
14961494
},
14971495
"twoPhaseCommitAuto": {
14981496
"type": "boolean"

0 commit comments

Comments
 (0)