1
0
Fork 0
mirror of https://github.com/gocsaf/csaf.git synced 2025-12-22 05:40:11 +01:00

Fix: Allow unknown fields: They are not forbidden

This commit is contained in:
JanHoefelmeyer 2025-07-07 11:41:49 +02:00
parent c81f55a752
commit 7935818600

View file

@ -18,8 +18,6 @@ import (
// while not allowing unknown fields nor trailing data // while not allowing unknown fields nor trailing data
func StrictJSONParse(jsonData io.Reader, target any) error { func StrictJSONParse(jsonData io.Reader, target any) error {
decoder := json.NewDecoder(jsonData) decoder := json.NewDecoder(jsonData)
// Don't allow unknown fields
decoder.DisallowUnknownFields()
if err := decoder.Decode(target); err != nil { if err := decoder.Decode(target); err != nil {
return fmt.Errorf("JSON decoding error: %w", err) return fmt.Errorf("JSON decoding error: %w", err)