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

Add 'type' to OptionDefinition #2493

Merged
merged 2 commits into from
Dec 19, 2022
Merged

Conversation

delner
Copy link
Contributor

@delner delner commented Dec 19, 2022

What does this PR do?

Adds a type field to OptionDefinition, which can be used to identify what kind of value the option should hold.

It also adds type to settings via to its OptionDefinition. type contains the auto-generated class used to encapsulate the option definitions contained within settings. Exposing this class allows you to metaprogram against an existing settings, such as adding or modifying option definitions.

Motivation

type allow for more descriptive option definitions, possibly type checking/coercion features later.

When creating settings options using the configuration DSL, it auto-generates an appropriate class with configuration behavior loaded. This class was entirely inaccessible, unless you instantiate the settings and its default value. Exposing type makes this class accessible without hacks.

Additional Notes

Also did a minor expansion on tests to encompass a bit more of the pre-existing behavior (adding coverage).

@delner delner added core Involves Datadog core libraries dev/refactor Involves refactoring existing components labels Dec 19, 2022
@delner delner self-assigned this Dec 19, 2022
@delner delner requested a review from a team December 19, 2022 03:46
@delner delner added feature Involves a product feature and removed dev/refactor Involves refactoring existing components labels Dec 19, 2022
@delner delner merged commit 9d47c21 into master Dec 19, 2022
@delner delner deleted the feature/add_config_option_type branch December 19, 2022 18:02
@github-actions github-actions bot added this to the 1.9.0 milestone Dec 19, 2022
@TonyCTHsu TonyCTHsu mentioned this pull request Jan 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core Involves Datadog core libraries feature Involves a product feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants