Skip to content

Commit

Permalink
fix(*): avoid setting nil for missing fields
Browse files Browse the repository at this point in the history
upon filling defaults for the configuration, the existing logic was
setting `nil` on missing fields, but in Kong Gateway, explicit `nil`
are not treated as a synonym of "missing field".
This change removes any missing fields from the configuration instead of
explicitly setting such fields as `nil`.
  • Loading branch information
samugi committed Aug 19, 2024
1 parent 77f320b commit f2b63b4
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions kong/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -393,8 +393,8 @@ func fillConfigRecord(schema gjson.Result, config Configuration) Configuration {
if value.Exists() {
res[fname] = value.Value()
} else {
// if no default exists, set an explicit nil
res[fname] = nil
// if no default exists, remove the field
delete(res, fname)
}
return true
})
Expand Down

0 comments on commit f2b63b4

Please sign in to comment.