-
Notifications
You must be signed in to change notification settings - Fork 424
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
Strict null handling mode #2334
Comments
Not sure that I follow your intention. You could just define each option and positional parameter as required. Alternatively, you could have validation at the beginning of your |
1 similar comment
Not sure that I follow your intention. You could just define each option and positional parameter as required. Alternatively, you could have validation at the beginning of your |
Definitely, but it introduces places for mistakes. For worlds without nulls (e.g. Scala or null-prohibited Java), the information about "requiredness" is then encoded in two places: types and
I haven't thought of that. If there is a plugin point at which this can be done generically, it might work, although its still a bit different. Validation will be case by case, while the transformer ensures strictness at spec and parser level. |
Sorry I am not convinced that this should be done at the library level. |
Sure, that's fine with me. There is a solution available in the user space (the transformer) hence no need to have it on the library level. Maybe more voices from the community will join the discussion in the future. Feel free to close the ticket AFAIC. |
Could picocli have an alternative opt-in mode where all options and parameters are considered required, unless typed as
Optional
or multivalue? The goal is to not use nulls at all.I sketched the following model transformer (in scala) that seems to work in a simple scenario.
(I'm not suggesting this as an implementation baseline of the new mode, I expect it would need to be something much more sophisticated).
The text was updated successfully, but these errors were encountered: