shahar1 opened a new pull request, #76090:
URL: https://github.com/apache/airflow/pull/76090

   `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**
   - `pytest 
airflow-ctl/tests/airflow_ctl/ctl/commands/test_connections_command.py 
airflow-ctl/tests/airflow_ctl/ctl/test_cli_config.py`: 169 passed, 1 failed. 
The new tests fail without the change. The failure, 
`test_create_command_without_required_option_exits_with_friendly_message`, also 
fails on current `main`: #69317 made required body fields argparse-required 
shortly before #75177 merged, so argparse rejects the command before #75177's 
check runs. This PR does not touch it.
   - `prek run mypy-airflow-ctl --all-files` passed. The `pre-commit` stage 
hooks passed on the changed files, except `generate-airflowctl-help-images`, 
which could not build its Docker image locally. No CLI arguments or help text 
change.
   - Not run: Breeze, the `manual` stage hooks, the full airflow-ctl suite.
   
   ---
   
   ##### Was generative AI tooling used to co-author this PR?
   
   - [X] Yes — Claude Code (Opus 5.5, Sonnet 5.5)
   
   Generated-by: Claude Code (Opus 5.5, Sonnet 5.5) following [the 
guidelines](https://github.com/apache/airflow/blob/main/contributing-docs/05_pull_requests.rst#gen-ai-assisted-contributions)
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)


-- 
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]

Reply via email to