Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

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

Đang mở
#33 1 bình luận 0 reaction 1 người được giao Xem trên GitHub

@shreemaan-abhishek đang làm issue này rồi.

Từ ngày 18/5/2026.

  • #44 của @shreemaan-abhishek — đã đóng, không merge

Đánh giá

Issue này chưa được đánh giá.

Mô tả

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.

Ngôn ngữ chính
Go
Star
1
Fork
0
Merge trung bình
1 giờ 3 phút
Pull request đã merge (30 ngày)
1

Chuẩn bị môi trường

  • Không có Dockerfile hay tệp Docker Compose
  • Có mẫu pull request
  • Không có hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của api7/a7

Tất cả issue của api7/a7

Issue tương tự

Thêm issue về Go

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.