Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: correctly ingest entity defaults with maps values #244

Merged
merged 1 commit into from
Dec 7, 2022

Conversation

GGabriele
Copy link
Collaborator

The current implementation of the fillConfigRecord function works as follows:

  • navigate the entity structure
  • for each field, check whether it's set or not
  • if it's already set, move onto the next field
  • if it's not set, check the entity schema and set a default if that's defined

This works well in most cases, except for plugins fields being maps. For such fields, this simple check may not be enough since the field may be composed of several sub-fields possibly having their own default values. This means that moving onto the next field when the current map field is set may results into its inner sub-fields not being set with default values.

In decK, where this function is heavily used, this issue results in misleading deployment diffs.

This commit expands the check logic to also verify that all default values are set, even those of maps fields.

The current implementation of the `fillConfigRecord` function
works as follows:
- navigate the entity structure
- for each field, check whether it's set or not
- if it's already set, move onto the next field
- if it's not set, check the entity schema and set a default
  if that's defined

This works well in most cases, except for plugins fields being
maps. For such fields, this simple check may not be enough since
the field may be composed of several sub-fields possibly
having their own default values. This means that moving onto the
next field when the current map field is set may results into
its inner sub-fields not being set with default values.

In decK, where this function is heavily used, this issue results
in misleading deployment diffs.

This commit expands the check logic to also verify that all
default values are set, even those of maps fields.
@GGabriele GGabriele requested a review from a team as a code owner December 7, 2022 14:13
@pmalek
Copy link
Member

pmalek commented Dec 7, 2022

Thanks for the nice description on this one! 🙇

@GGabriele GGabriele merged commit 7df71a9 into main Dec 7, 2022
@GGabriele GGabriele deleted the fix/fill-config-for-map-fields branch December 7, 2022 14:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants