Skip to content

Dynamic config generic parse hooks #7840

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

Merged
merged 7 commits into from
Jun 3, 2025
Merged

Dynamic config generic parse hooks #7840

merged 7 commits into from
Jun 3, 2025

Conversation

dnr
Copy link
Member

@dnr dnr commented May 30, 2025

What changed?

Add interfaces that can be used for types to implement custom dynamic config parsing.

Why?

It's nice to be able to parse strings into enum values.

How did you test it?

  • added new unit test(s)

@dnr dnr requested a review from a team as a code owner May 30, 2025 22:44

out := mth.Func.Call([]reflect.Value{reflect.Zero(t), reflect.ValueOf(data)})
if !out[1].IsNil() {
return nil, out[1].Interface().(error) // nolint:revive // type checked above
Copy link
Contributor

Choose a reason for hiding this comment

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

Where does this error go? Is it logged or returned anywhere? I see in the test that Get doesn't return it.

Copy link
Member Author

Choose a reason for hiding this comment

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

It gets sometimes-logged here:

c.logger.Warn("Failed to convert value, using default", tag.Key(key.String()), tag.IgnoredValue(val), tag.Error(convertErr))

Copy link
Member Author

Choose a reason for hiding this comment

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

on second thought I'll check the conversion just in case

@dnr dnr force-pushed the dc24enum branch 2 times, most recently from 1477cd2 to 685a70b Compare June 3, 2025 22:24
@dnr dnr enabled auto-merge (squash) June 3, 2025 22:25
@dnr dnr merged commit b337861 into temporalio:main Jun 3, 2025
63 of 78 checks passed
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