Skip to content

Conversation

@phawxby
Copy link
Contributor

@phawxby phawxby commented Oct 28, 2025

Description

Fix bug with config validation incorrectly generating error messages omitting the field name segment resulting in the source of configuration problems not being obvious

Test Coverage

  • This change is covered by existing or additional automated tests.
  • Manual testing has been performed (and evidence provided) as automated testing was not feasible.
  • Additional tests are not required for this change (e.g. documentation update).

Fix bug with config validation incorrectly generating error messages omitting the field name segment resulting in the source of configuration problems not being obvious
@phawxby phawxby requested a review from acabarbaye October 28, 2025 12:11
@acabarbaye
Copy link
Contributor

could you have a test where the field has a mapstructure tag different from the field name
e.g. test {
db string `"mapstructure"="elephant_trunk"
}
the environment variable should be ..._ELEPHANT_TRUNK

@phawxby phawxby marked this pull request as ready for review October 29, 2025 13:31
err = LoadFromSystem("test", configTest2, defaults)

errortest.AssertError(t, err, commonerrors.ErrInvalid)
assert.Contains(t, err.Error(), "invalid: structure failed validation: (TestConfigDeep->TestConfig2->dummy_host) [TEST_DEEP_CONFIG_DUMMY_CONFIG_DUMMY_HOST] cannot be blank")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks for this

@phawxby phawxby merged commit 44bb790 into master Oct 30, 2025
6 checks passed
@phawxby phawxby deleted the fix-config-paths branch October 30, 2025 09:01
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