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

Provides a way to provide custom handling for unknown parameters in ReflectiveConfigGroup #3027

Merged
merged 1 commit into from
Dec 30, 2023

Conversation

mrieser
Copy link
Contributor

@mrieser mrieser commented Dec 30, 2023

If a ConfigGroup based on ReflectiveConfigGroup has to add an unmapped parameter, usually an exception is thrown.

In some cases, it could make sense to provide special handling in such cases, e.g. to implement backward compatibility to older parameter names, to support a migration from older to newer parameters, etc.

This PR adds two methods handleAddUnknownParam(...) and handleGetUnknownValue(...) (matching addParam(...) and getValue(...)) that are designed to be overwritten. The default implementation reuses the existing logic in ReflectiveConfigGroup. Custom config groups can overwrite the methods and add custom functionality to deal with unknown parameters.

Fixes #2960

@mrieser mrieser enabled auto-merge December 30, 2023 21:18
@steffenaxer
Copy link
Collaborator

Nice job! Thanks 🙏

@mrieser mrieser merged commit 1ec0633 into master Dec 30, 2023
48 checks passed
@mrieser mrieser deleted the 2960-support-custom-config-migration branch December 30, 2023 21:30
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.

Migration path between config version
2 participants