-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: don't overwrite fields set to empty arrays when default exists
This commit fixes a bug preventing users to set fields to emtpy arrays when a default for those fields exist. For example, imagine we have an `openid-connect` plugin configured via the UI having the `login_tokens` set to an empty array (note: this field has a default value of `["id_token"]`: ``` $ http :8001/plugins/$id | jq .config.login_tokens [] ``` If we do a `deck dump`, the configuration will be reflected into a local state file: ``` $ deck dump --yes $ cat kong.yaml | grep login_tokens login_tokens: [] ``` But, if we now run `deck diff` we see that decK will detect a difference because of the `login_tokens` field's default value: ``` $ deck diff updating plugin openid-connect (global) { "config": { "anonymous": null, ... ... "login_redirect_mode": "fragment", "login_redirect_uri": null, "login_tokens": [ + "id_token" ], "logout_methods": [ "POST", "DELETE" ], ... ... } Summary: Created: 0 Updated: 1 Deleted: 0 ``` This commit corrects this defect by allowing decK to set empty arrays when default values exist for a given field.
- Loading branch information
Showing
2 changed files
with
135 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters