Fix airflowctl date parameters rejecting every input value - #71328
Fix airflowctl date parameters rejecting every input value#71328DHBhensdadia wants to merge 1 commit into
Conversation
Auto-generated commands derive their argparse ``type=`` callable from the OpenAPI parameter annotation. For ``datetime.date`` that callable was the class itself, which takes three integers rather than a string, so no value a user could type was ever accepted. argparse surfaced the resulting TypeError as "invalid date value", which reads as a formatting complaint and gives no hint that the option cannot work at all.
|
Congratulations on your first Pull Request and welcome to the Apache Airflow community! If you have any issues or are unsure about any anything please check our Contributors' Guide
|
|
Thanks for this, and sorry to close it. Same situation as #70250: this fixes the Worth being explicit that this PR and #70250 are complementary rather than duplicates of each other — each fixes one half. But #70249 subsumes both, so I'd rather land that one than take two partial fixes. Closing in favour of #70249. Your Drafted by an AI assistant and may contain mistakes — if you think this call is wrong, say so and the PR will be reopened; a human maintainer has the final word. Drafted-by: Claude Code (Opus 5); reviewed by @potiuk before posting |
_python_type_from_stringmaps OpenAPI parameter annotations to the argparsetype=callable used by auto-generated commands.datetime.datewas mapped to the class itself, but argparse calls that callable with the raw string from the command line anddate.__init__expects three integers, so every value was rejected:The message reads as a complaint about the format, but no input can succeed.
_is_primitive_typeacceptsdatetime.date, andDagRunOperations.listdeclarespartition_date_gteandpartition_date_lteasdatetime.date | None, so this affects the shipped CLI. The hand-written commands indag_command.pyalready parse these values withdate.fromisoformat; the generated path had no equivalent.This adds
iso_date_typealongside the existingjson_dict_typeand wires it into the mapping, so a valid value is parsed into adateand an invalid one reports the format that is actually expected.datetime.datetimehas the same root cause but is left untouched here, since #70249 and #70250 are already open against it. The remaining constructor entries (bytes,list,tuple,set) are not reachable today, as no operation is annotated with them.related: #70232
Was generative AI tooling used to co-author this PR?
Generated-by: Claude Code (Opus 5) following the guidelines
{pr_number}.significant.rst, in airflow-core/newsfragments. You can add this file in a follow-up commit after the PR is created so you know the PR number.