Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

config validate: detect bare/null unsupported sections (true key-presence)

Aperta
#33 1 commento 0 reazioni 1 assegnatario Vedi su GitHub

@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 to nil
  • upstreams: null — unmarshals to nil

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: null
  • consumer_groups: / consumer_groups: null
  • service_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

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di api7/a7

Tutte le issue di api7/a7

Issue simili

Altre issue su Go

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.