Skip to content

Report missing and invalid fields in airflowctl connections import - #76090

Merged
shahar1 merged 1 commit into
apache:mainfrom
shahar1:airflowctl-connections-import-missing-fields
Oct 31, 2026
Merged

shahar1 merged 1 commit into
apache:mainfrom
shahar1:airflowctl-connections-import-missing-fields

Conversation

@shahar1

@shahar1 shahar1 commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

This PR moves the missing-vs-invalid field check into shared validation so imports report the connection name and readable error before making an API call.

AI Summary

airflowctl connections import builds ConnectionBody by hand, so it missed the readable errors #75177 added for generated commands. An entry without conn_type, or with a bad value, still failed with a raw pydantic dump that did not name the broken connection, and a missing conn_type was reported as a wrong type:

Failed to import connections: 1 validation error for ConnectionBody
conn_type
  Input should be a valid string [type=string_type, input_value=None, input_type=NoneType]

Now the import stops before any API call with:

Invalid connection 'my_conn' in conns.json: missing required field(s): conn_type
Invalid connection 'my_conn' in conns.json: port: Input should be a valid integer, unable to parse string as an integer

The missing-vs-invalid split from CommandFactory._validate_datamodel moves to airflowctl/ctl/utils/validation.py so both paths share it; the messages of generated commands are unchanged. Valid files and API-side failures behave as before. If a file has several broken entries, only the first one is reported, the same as the existing structure checks.

related: #57721

Testing


Was generative AI tooling used to co-author this PR?
  • Yes — Claude Code (Opus 5.5, Sonnet 5.5)

Generated-by: Claude Code (Opus 5.5, Sonnet 5.5) following the guidelines

🤖 Generated with Claude Code

@shahar1

shahar1 commented Oct 30, 2026

Copy link
Copy Markdown
Contributor Author

Current CI failure is unrelated, fixed by: #76092

@shahar1
shahar1 force-pushed the airflowctl-connections-import-missing-fields branch from 712757e to fad1246 Compare October 31, 2026 07:19
@shahar1
shahar1 force-pushed the airflowctl-connections-import-missing-fields branch from fad1246 to a9267f2 Compare October 31, 2026 08:18
@shahar1
shahar1 enabled auto-merge (squash) October 31, 2026 08:18
A connection entry without conn_type, or with a bad value such as a
non-numeric port, made the import fail with a raw pydantic dump. The
dump did not say which connection in the file was broken, and a missing
conn_type showed up as "Input should be a valid string", not as a
missing field. Generated commands got readable messages in apache#75177; the
hand-built import path did not.
@shahar1
shahar1 force-pushed the airflowctl-connections-import-missing-fields branch from a9267f2 to 41c22e3 Compare October 31, 2026 13:14
@shahar1
shahar1 merged commit 2e8f6f9 into apache:main Oct 31, 2026
90 checks passed
@github-actions

Copy link
Copy Markdown
Contributor

Backport successfully created: airflow-ctl/v0-1-test

Note: As of Merging PRs targeted for Airflow 3.X
the committer who merges the PR is responsible for backporting the PRs that are bug fixes (generally speaking) to the maintenance branches.

In matter of doubt please ask in #release-management Slack channel.

Status Branch Result
✅ airflow-ctl/v0-1-test PR Link

@shahar1
shahar1 deleted the airflowctl-connections-import-missing-fields branch October 31, 2026 14:21
shahar1 added a commit that referenced this pull request Oct 31, 2026
…tl connections import (#76090) (#76141)

A connection entry without conn_type, or with a bad value such as a
non-numeric port, made the import fail with a raw pydantic dump. The
dump did not say which connection in the file was broken, and a missing
conn_type showed up as "Input should be a valid string", not as a
missing field. Generated commands got readable messages in #75177; the
hand-built import path did not.
(cherry picked from commit 2e8f6f9)

Co-authored-by: Shahar Epstein <[email protected]>
shahar1 added a commit that referenced this pull request Nov 19, 2026
…tl connections import (#76090) (#76141)

A connection entry without conn_type, or with a bad value such as a
non-numeric port, made the import fail with a raw pydantic dump. The
dump did not say which connection in the file was broken, and a missing
conn_type showed up as "Input should be a valid string", not as a
missing field. Generated commands got readable messages in #75177; the
hand-built import path did not.
(cherry picked from commit 2e8f6f9)

Co-authored-by: Shahar Epstein <[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