-
-
Notifications
You must be signed in to change notification settings - Fork 682
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
🐛 Fix default value of None
for CLI Parameters when the type is list | None
and the default value is None
#664
Conversation
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.
Thanks!
This PR still requires a test to check for the correct behaviour - that also makes it easier to review as there's a minimal example to test on.
📝 Docs preview for commit 8d6aaf0 at: https://044fd36b.typertiangolo.pages.dev |
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.
I've added an example in the docs and a unit test, and confirmed that this PR indeed changes the type of the argument to None
as you would expect.
The fix itself looks good to me, but I'll leave this one up for review by @tiangolo to get his opinion as well.
📝 Docs preview for commit beaf3f1 at: https://331f9f9c.typertiangolo.pages.dev |
None
for CLI Parameters when the type is list | None
and the default value is None
Great, thank you @theowisear! 🍪 And thanks for the help here @svlandeg! 🙇 🍰 This will be available in Typer 0.10.0, in the next few hours/minutes. 🚀 |
If an optional list type option has default_value set to None, we expect its value to also be set to None if no option has been given to the command.
Related to issue #410