-
Notifications
You must be signed in to change notification settings - Fork 744
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 not providing values to selected configurable variables through CLI #42978
Allow not providing values to selected configurable variables through CLI #42978
Conversation
Fix a bug that didn't allow to enter values for configurable variables through CLI when values for some variables are left empty. Add an improvement that allows providing configurable values for types such as int? through the CLI.
...-runtime/src/main/java/io/ballerina/runtime/internal/configurable/providers/ConfigUtils.java
Outdated
Show resolved
Hide resolved
...time/src/main/java/io/ballerina/runtime/internal/configurable/providers/cli/CliProvider.java
Show resolved
Hide resolved
Let's shorten the PR title as well. We can elaborate on it inside the description and approach. |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #42978 +/- ##
============================================
+ Coverage 77.34% 77.44% +0.09%
- Complexity 58253 58447 +194
============================================
Files 3450 3453 +3
Lines 218954 219927 +973
Branches 28741 28986 +245
============================================
+ Hits 169356 170318 +962
- Misses 40270 40292 +22
+ Partials 9328 9317 -11 ☔ View full report in Codecov by Sentry. |
bvm/ballerina-runtime/src/test/java/io/ballerina/runtime/test/config/ConfigTest.java
Outdated
Show resolved
Hide resolved
...-runtime/src/main/java/io/ballerina/runtime/internal/configurable/providers/ConfigUtils.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
240ef31
into
ballerina-platform:master
Purpose
Fixes #42859
Approach
Bug fix
When considering unsupported configurable values in the CLI, there could be two cases:
Case 1
A type that is not supported through the CLI is used as a configurable variable but the value is not provided through the CLI. This should not be a problem and the CLI should allow leaving the value for that out as long as a default values is provided through other methods.
Case 2
A type that is not supported through the CLI is used as a configurable variable but the value for that is provided through the CLI. This should cause and error stopping the program.
Checking whether the variable value is null before executing the checks regarding the type can produce the expected outcome.
Improvement
The Ballerina spec mentions the following regarding the supported types for configurable values.
Therefore types such as int? should be supported through the CLI. This can be achieved by accepting the
()
type as a valid member type within union types.Check List