Skip to content

fix(merge): dynaconf_merge=False on nested structures#1012

Merged
rochacbruno merged 6 commits intodynaconf:masterfrom
pedro-psb:835-enable-merge-false
Oct 4, 2023
Merged

fix(merge): dynaconf_merge=False on nested structures#1012
rochacbruno merged 6 commits intodynaconf:masterfrom
pedro-psb:835-enable-merge-false

Conversation

@pedro-psb
Copy link
Copy Markdown
Member

@pedro-psb pedro-psb commented Sep 29, 2023

This PR implements two fixes.

fix(merge): dynaconf_merge=False on nested structures

Addresses the case when local dynaconf_merge=False is used inside nested dict structures. Fix #835.

  • implement the fix in object_merge
  • add functional test for the reported setup
  • add unit test for basic merge=false cases

fix(validate_on_update): exception when using validate_on_update with kwargs

validate_on_update would break when using kwargs and initial validators. Fix #994

  • implement the fix in the init loader process (pass validate=False, because validate_on_update don't apply on those calls).
  • add function test for the reported setup

Notes

On "dynaconf_merge=False on nested structures"

The equivalent test/support for lists (local list merge negation) is not supported because we don't have a way of representing them, currently.

# when global merge=True

# layer 1
a=[1,2,3]

# layer 2
a=[4,5,6, "@merge=false"] # nothing like that for lists

# result
a=[4,5,6]

@netlify
Copy link
Copy Markdown

netlify bot commented Sep 29, 2023

Deploy Preview for dynaconf ready!

Name Link
🔨 Latest commit 55dc503
🔍 Latest deploy log https://app.netlify.com/sites/dynaconf/deploys/6517182a88b0190008ae6c29
😎 Deploy Preview https://deploy-preview-1012--dynaconf.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@codecov
Copy link
Copy Markdown

codecov bot commented Sep 29, 2023

Codecov Report

Merging #1012 (55dc503) into master (4ed2350) will increase coverage by 0.04%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##           master    #1012      +/-   ##
==========================================
+ Coverage   98.70%   98.75%   +0.04%     
==========================================
  Files          23       23              
  Lines        2247     2248       +1     
==========================================
+ Hits         2218     2220       +2     
+ Misses         29       28       -1     
Files Coverage Δ
dynaconf/base.py 99.81% <100.00%> (+0.18%) ⬆️
dynaconf/utils/__init__.py 100.00% <100.00%> (ø)

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@rochacbruno rochacbruno merged commit b113e74 into dynaconf:master Oct 4, 2023
pedro-psb added a commit to pedro-psb/dynaconf that referenced this pull request Oct 31, 2023
Shortlog of commit since last release:

    Bruno Rocha (2):
          Release version 3.2.3
          fix(env): allow underscore in env name dynaconf#1011 (dynaconf#1015)

    Jake Callahan (1):
          fix(vault): pin hvac minimum version

    Pedro Pessoa (3):
          fix(set): non-str key raising type error dynaconf#1005 (dynaconf#1008)
          fix(merge): dynaconf_merge=False on nested structures (dynaconf#1012)
          fix(cli): support for 'entrypoint-path' in FLASK_APP dynaconf#946 (dynaconf#1014)

    Sebastian Correa (1):
          doc(validation): Improve Configuration and Validation sections of the docs (dynaconf#989)

    Vladislav Sharapov (1):
          doc(envvars): Fix link to configuration page (dynaconf#1020)
pedro-psb added a commit to pedro-psb/dynaconf that referenced this pull request Nov 19, 2023
Shortlog of commit since last release:

    Bruno Rocha (2):
          Release version 3.2.3
          fix(env): allow underscore in env name dynaconf#1011 (dynaconf#1015)

    Jake Callahan (1):
          fix(vault): pin hvac minimum version

    Pedro Pessoa (3):
          fix(set): non-str key raising type error dynaconf#1005 (dynaconf#1008)
          fix(merge): dynaconf_merge=False on nested structures (dynaconf#1012)
          fix(cli): support for 'entrypoint-path' in FLASK_APP dynaconf#946 (dynaconf#1014)

    Sebastian Correa (1):
          doc(validation): Improve Configuration and Validation sections of the docs (dynaconf#989)

    Vladislav Sharapov (1):
          doc(envvars): Fix link to configuration page (dynaconf#1020)
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.

[bug] validate_on_update causes AttributeError: 'Settings' object has no attribute 'ENVIRONMENTS_FOR_DYNACONF' dynaconf_merge = false supported?

2 participants