Skip to content
This repository has been archived by the owner on Oct 9, 2023. It is now read-only.

Fix zeroFields setting when merging slices into maps #83

Merged
merged 2 commits into from
May 4, 2021

Conversation

EngHabu
Copy link
Contributor

@EngHabu EngHabu commented May 4, 2021

Signed-off-by: Haytham Abuelfutuh [email protected]

TL;DR

viper, by design, doesn't support case sensitive keys and that ends up lower casing all keys regardless of whether the target field is a map. Flyte config has been using a workaround where we set the config values (e.g. in yaml files) for maps as yaml arrays instead to preserve their case sensitivity. After this change that sets ZeroFields to true, the logic in mapstructure package breaks when doing the slice to map conversion. This PR adds an additional hook that does the conversion.

Type

  • Bug Fix
  • Feature
  • Plugin

Are all requirements met?

  • Code completed
  • Smoke tested
  • Unit tests added
  • Code documentation added
  • Any pending items have an associated Issue

Tracking Issue

flyteorg/flyte#948

@codecov
Copy link

codecov bot commented May 4, 2021

Codecov Report

Merging #83 (8c9791c) into master (9681e7a) will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master      #83   +/-   ##
=======================================
  Coverage   72.10%   72.10%           
=======================================
  Files          57       57           
  Lines        1975     1975           
=======================================
  Hits         1424     1424           
  Misses        412      412           
  Partials      139      139           
Flag Coverage Δ
unittests 72.10% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.


Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 9681e7a...8c9791c. Read the comment docs.

@EngHabu EngHabu requested a review from jeevb May 4, 2021 15:42
katrogan
katrogan previously approved these changes May 4, 2021
config/viper/viper.go Outdated Show resolved Hide resolved
Signed-off-by: Haytham Abuelfutuh <[email protected]>
@EngHabu EngHabu merged commit 99f4b20 into master May 4, 2021
eapolinario pushed a commit that referenced this pull request Sep 6, 2023
* Fix zeroFields setting when merging slices into maps

Signed-off-by: Haytham Abuelfutuh <[email protected]>

* PR Feedback

Signed-off-by: Haytham Abuelfutuh <[email protected]>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants