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

Allow every possible number as a defaultValue for a number option #1291

Closed
krisztianb opened this issue May 1, 2020 · 2 comments · Fixed by #1296
Closed

Allow every possible number as a defaultValue for a number option #1291

krisztianb opened this issue May 1, 2020 · 2 comments · Fixed by #1296
Labels
enhancement Improved functionality

Comments

@krisztianb
Copy link
Contributor

Search Terms

plugin number declaration option

Problem

Since we allow every possible value for a map option it makes sense to do the same for numbers.

Example usage:

Given a plugin with a number option (minValue = 0 and maxValue = 10). If no value is provided the plugin should completely ignore the option.
Currently defaultValue would default to 0 and therefore there is no way for the plugin to check if the option was provided by the user or not.

Suggested Solution

If we allow every possible number the plugin could define the defaultValue as -1 for example and then proceed accordingly.

Another solution would be not to set the defaultValue to 0 if it is not defined when calling addDeclaration.

What do you think?

@Gerrit0
Copy link
Collaborator

Gerrit0 commented May 13, 2020

This sounds reasonable to me, originally I was going to say that we should instead provide an isSet function, but that complicates the class considerably. This seems like a good compromise.

@Gerrit0
Copy link
Collaborator

Gerrit0 commented May 17, 2020

v0.17.7 released with this :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Improved functionality
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants