config validate: detect bare/null unsupported sections (true key-presence)
@shreemaan-abhishek ci sta già lavorando.
Dal 18/5/2026.
Valutazione
Questa issue non è ancora stata valutata.
Descrizione
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.
- Lingua principale
- Go
- Stelle
- 1
- Fork
- 0
- Merge medio
- 1h 3m
- PR unite (30g)
- 1
Guida per i contributori
Nessuna guida per i contributori indicizzata per questo repository
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di api7/a7
-
Difficoltà 5/5 Più di una settimana Idoneità per principianti 25/100
-
Difficoltà 5/5 Più di una settimana Idoneità per principianti 35/100
Issue simili
-
nix: vendorHash is outdated Aperta
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 90/100
-
Bob Shell support Apertaenhancement
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
santhosh-tekuri/jsonschema#276 ·