Eason09053360 commented on code in PR #73317:
URL: https://github.com/apache/airflow/pull/73317#discussion_r4091875206
##########
airflow-ctl/src/airflowctl/ctl/cli_config.py:
##########
@@ -730,6 +736,7 @@ def _create_arg_for_non_primitive_type(
arg_type=self._python_type_from_string(annotation),
arg_action=argparse.BooleanOptionalAction if annotation is
bool else None, # type: ignore
arg_help=f"{field} for {parameter_key} operation",
+ arg_required=field_type.is_required() and
cli_defaults[field] is None,
Review Comment:
Thanks for the patch! LGTM Overall
Just one nit:
In Pydantic, "required" means the key must be present. It doesn't mean the
value can't be `None`. argparse already sets an omitted option to `None`, so a
field that is required but nullable is satisfied without the flag. argparse
only has to enforce fields that are required **and** not nullable:
```suggestion
arg_required=field_type.is_required() and type(None) not
in get_args(field_type.annotation),
```
This follows the same rule as primitive parameters a few lines below
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]