Skip to content

[airflow-ctl/v0-1-test] Report missing required airflowctl options as readable errors (#75177) - #76089

Merged
shahar1 merged 1 commit into
airflow-ctl/v0-1-testfrom
backport-fbc18bc-airflow-ctl/v0-1-test
Oct 30, 2026
Merged

shahar1 merged 1 commit into
airflow-ctl/v0-1-testfrom
backport-fbc18bc-airflow-ctl/v0-1-test

Conversation

@github-actions

Copy link
Copy Markdown
Contributor

When a generated airflowctl command such as connections create is run
without a datamodel field that the API requires, the unset option reaches
pydantic as None and the CLI crashes with a raw ValidationError traceback
("Input should be a valid string ... input_value=None").

Catch the ValidationError when the request body is built, use pydantic's
FieldInfo.is_required() to tell missing required fields from invalid values,
and exit with a message naming the flags, e.g.
"the following arguments are required: --conn-type". Invalid values are
reported against their flag. No request is sent in either case.

Part of #57633, addresses #57721.
(cherry picked from commit fbc18bc)

Co-authored-by: Rishabh [email protected]

… readable errors (#75177)

When a generated airflowctl command such as `connections create` is run
without a datamodel field that the API requires, the unset option reaches
pydantic as None and the CLI crashes with a raw ValidationError traceback
("Input should be a valid string ... input_value=None").

Catch the ValidationError when the request body is built, use pydantic's
FieldInfo.is_required() to tell missing required fields from invalid values,
and exit with a message naming the flags, e.g.
"the following arguments are required: --conn-type". Invalid values are
reported against their flag. No request is sent in either case.

Part of #57633, addresses #57721.
(cherry picked from commit fbc18bc)

Co-authored-by: Rishabh <[email protected]>
@shahar1
shahar1 enabled auto-merge (squash) October 30, 2026 21:02
@shahar1
shahar1 merged commit 232b25b into airflow-ctl/v0-1-test Oct 30, 2026
13 checks passed
@shahar1
shahar1 deleted the backport-fbc18bc-airflow-ctl/v0-1-test branch October 30, 2026 21:04
shahar1 pushed a commit that referenced this pull request Nov 19, 2026
… readable errors (#75177) (#76089)

When a generated airflowctl command such as `connections create` is run
without a datamodel field that the API requires, the unset option reaches
pydantic as None and the CLI crashes with a raw ValidationError traceback
("Input should be a valid string ... input_value=None").

Catch the ValidationError when the request body is built, use pydantic's
FieldInfo.is_required() to tell missing required fields from invalid values,
and exit with a message naming the flags, e.g.
"the following arguments are required: --conn-type". Invalid values are
reported against their flag. No request is sent in either case.

Part of #57633, addresses #57721.
(cherry picked from commit fbc18bc)

Co-authored-by: Rishabh <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants