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

[bug] two validators with defaults break string casting of lists in .env file #992

Open
aqc-carlodri opened this issue Sep 4, 2023 · 0 comments
Labels
Milestone

Comments

@aqc-carlodri
Copy link

Describe the bug
Having two validators with defaults break string casting of lists in .env file

To Reproduce
Steps to reproduce the behavior:

  1. Having the following folder structure
Project structure
    .env
    .gitignore
    config.py
  1. Having the following config files:
Config files

.env

DYNACONF_GROUP__TEST_LIST = ["'1'", "'2S'"]

DYNACONF_GROUP__ANOTHER = 45
  1. Having the following app code:
Code

config.py

from dynaconf import Dynaconf, Validator

settings = Dynaconf(
    load_dotenv=True,
    environments=True,
)


settings.validators.register(
    Validator("group.something_new", default=2),
    Validator("group.another_new", default=3),
)

settings.validators.validate()
  1. Executing under the following environment
Execution
dynaconf -i config.settings list

Expected behavior
Expected output of the above command:

Working in development environment
LOAD_DOTENV<bool> True
GROUP<dict> {'ANOTHER': 45, 'TEST_LIST': ['1', '2S'], 'another_new': 3, 'something_new': 2}

Notice the first item of TEST_LIST.

Actual behavior
Actual output of the above command:

Working in development environment
LOAD_DOTENV<bool> True
GROUP<dict> {'ANOTHER': 45, 'TEST_LIST': [1, '2S'], 'another_new': 3, 'something_new': 2}

Notice the first item of TEST_LIST.

Environment (please complete the following information):

  • OS: Win10x64
  • Dynaconf Version 3.2.2

Additional context
If you comment out one of the two validators, the problem disappears.

Might be related to #988, as mentioned on gitter by @rochacbruno.

@pedro-psb pedro-psb added this to the 3.3.0 milestone Sep 4, 2023
@rochacbruno rochacbruno modified the milestones: 3.3.0, 3.2.3, 3.2.4 Sep 7, 2023
@pedro-psb pedro-psb modified the milestones: 3.2.4, 3.2.10 Sep 21, 2023
@rochacbruno rochacbruno modified the milestones: 3.2.10, 3.3.0 Oct 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants