Fix - Array entries duplicated when using Validator with default for computed value#910
Merged
rochacbruno merged 3 commits intodynaconf:masterfrom Apr 4, 2023
Merged
Conversation
- when using validator with the default field, list items would get duplicated under certain circunstances.
- this avoids an unwanted merge when setting the default for some value.
✅ Deploy Preview for dynaconf ready!
To edit notification comments on pull requests, go to your Netlify site settings. |
rochacbruno
approved these changes
Apr 4, 2023
|
Thanks for the fix @pedro-psb! |
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This fixes #905
Just for the records, I'll try to explain what I've understood about the problem, sorry if it is too confusing.
One of the key-point of the problem was that the process of setting the default for the Validator uses
tomlfy=Trueand this causes some side-effect on thedefaultfield siblings.In the last step of recording this value there is a
merge_before_set(new, old)function. I would expect that the new data to be merged in the existing data would be only thedefaultvalue provided in Validation, but all of it's siblings are used too (including list).Before this merge,
parse_conf_data(data, tomlfy=True, ...)is called with 'default' value and all of it's existing siblings, and this makesnewandolddata to have different version oftest_list, one that is "tomlyfied" and the other that is not (the original one).