You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If we use methods like validate_with and configure with nested deep setting structure and custom validation methods, validation methods gets old settings payload and always returns true
Code
classFlatConfig < Qonfig::DataSetexpose_yamlRails.root.join('tmp/flat_config.yml'),via: :env_key,env: :defaultvalidateby: :some_validation_methoddefsome_validation_methodputs"try to validate settings.some_key = #{settings.some_key}"settings.some_key != 'bad'endendclassNestedDeepConfig < Qonfig::DataSetexpose_yamlRails.root.join('tmp/deep_config.yml'),via: :env_key,env: :defaultvalidateby: :some_validation_methoddefsome_validation_methodputs"try to validate settings.some_key.some_key2 = #{settings.some_key.some_key2}"settings.some_key.some_key2 != 'bad'# HERE we have settings.some_key.some_key2 = goodendendend
Summary
If we use methods like
validate_with
andconfigure
with nested deep setting structure and custom validation methods, validation methods gets old settings payload and always returns trueCode
example 1 (flat)
example 2 (nested)
tmp/flat_config.yml
tmp/deep_config.yml
Expected behavior
valid_with?
= falseconfigure(invalid_payload)
- raises errorvalid_with?
= falseconfigure(invalid_payload)
- raises errorCurrent behavior
valid_with?
= falseconfigure(invalid_payload)
- raises errorvalid_with?
= trueconfigure(invalid_payload)
- no error raises =(The text was updated successfully, but these errors were encountered: