Ranging over a map puts "*" into the map's required properties
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 57/100
Research direction
Start by tracing how the Rust schema generator handles range expressions and maps field reads onto JSON Schema properties; the payload does not name implementation files or tests. Reproduce with the provided chart and helm lint repro, then check that ranged map values are represented through additionalProperties or patternProperties and no "*" is added to required, including inside conditional branches.
Written by the indexing model from the issue text.
Description
Observed
When a template ranges over a map and reads a field of each entry, helm-schema puts * (its name for "every key of this map") into the map's required list. No values can satisfy that, so Helm rejects even the chart's own defaults.
Found in opentelemetry-collector 0.178.2, templates/_config.tpl, which ranges over telemetry.resourceAttributes.default the same way.
Reproduction
Chart.yaml:
apiVersion: v2
name: repro
version: 0.1.0
values.yaml:
attributes:
first:
enabled: true
value: a
second:
value: b
templates/configmap.yaml:
apiVersion: v1
kind: ConfigMap
metadata:
name: repro
data:
{{- range $name, $attribute := .Values.attributes }}
{{- if dig "enabled" true $attribute }}
{{ $name }}: {{ $attribute.value | quote }}
{{- end }}
{{- end }}
helm-schema repro > repro/values.schema.json
helm lint repro
- at '': 'allOf' failed
- at '/attributes': missing property '*'
Error: 1 chart(s) linted, 1 chart(s) failed
The generated schema contains, among others:
"then": {
"properties": {
"attributes": { "type": "object", "required": ["*"] }
}
}
required: ["*"] also appears under /allOf/0/if/properties/attributes. Because of that, the if branch can never match, so its then is silently disabled as well.
Expected
A field read from each entry of a ranged-over map constrains the map's values (additionalProperties, or patternProperties with .*), not a property literally named *. Nothing should be added to the map's required list.
Notes
- Reproduced with helm-schema 0.0.7, the current release.
- A
--override-schemacan't reach the copy inside the conditional branch. Downstream, the romnn/cluster lint now strips"*"from everyrequiredlist after generation, as a workaround (without_wildcard_requirementsinscripts/lint_kubernetes.py).
- Dominant language
- Rust
- Stars
- 5
- Forks
- 0
- Avg merge
- 1h 31m
- Merged PRs (30d)
- 1
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from romnn/helm-schema
-
Difficulty 4/5 3-5 days Newbie friendliness 58/100
romnn/helm-schema#5 ·
-
enhancement
Difficulty 4/5 3-5 days Newbie friendliness 48/100
romnn/helm-schema#3 ·
All issues in romnn/helm-schema
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
mongodb/kingfisher#588 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
Maintainers usually reply within 1 day
-
bug rust
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 2 days
-
type: bug
Difficulty 2/5 1-3 hours Newbie friendliness 67/100
franciscoBSalgueiro/en-croissant#1111 ·
Maintainers usually reply within 2 days
-
[bug] Toolchain versions from `.prototools` are not inherited when moon runs from a subdirectoryOpen
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
Maintainers usually reply within 1 day