config validate: detect bare/null unsupported sections (true key-presence)
@shreemaan-abhishek is already working on this.
Since May 18, 2026.
- Dominant language
- Go
- Stars
- 1
- Forks
- 0
- Avg merge
- 1h 3m
- Merged PRs (30d)
- 1
Description
Part of #22. Follow-up to review feedback on #31.
Problem
The current cfg.<Section> != nil check in pkg/cmd/config/validate/validate.go and pkg/cmd/config/configutil/configutil.go only rejects explicitly-empty unsupported sections (e.g. upstreams: []). It does not reject:
upstreams:(bare key, no value) — unmarshals tonilupstreams: null— unmarshals tonil
Same for consumer_groups and service_templates. A user who declares any of these forms gets silent acceptance.
Fix
Two-pass parse: first into map[string]yaml.Node (or map[string]json.RawMessage for JSON), check whether the key is present at all, then decode into the typed api.ConfigFile. If a key for an unsupported section is present, reject regardless of value.
Tests
Extend TestConfigValidate_EmptyUnsupportedSections (or add a sibling table) with cases:
upstreams:(no value)upstreams: nullconsumer_groups:/consumer_groups: nullservice_templates:/service_templates: null
All should produce the same "X are not supported" error as the existing [] cases.
Contributor guide
No contributing guide indexed for this repository
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.
Assessment
This issue has not been assessed yet.