Skip to content

Conversation

@jscheffl
Copy link
Contributor

During implementation of #48102 we saw that the patch API for connections is not working correctly.

This PR fixes the problem - reason is that pydantic fields to not map 1:1 to API fields - as well as extends pytests to cover the difference

@boring-cyborg boring-cyborg bot added the area:API Airflow's REST/HTTP API label Mar 23, 2025
@jscheffl jscheffl added the type:bug-fix Changelog: Bug Fixes label Mar 23, 2025
Copy link
Member

@pierrejeambrun pierrejeambrun left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, thanks for the catch.

@jscheffl jscheffl force-pushed the bugfix/connections-api-patch-all-fields branch from 0ec69f1 to 1441339 Compare March 25, 2025 22:06
@jscheffl jscheffl requested a review from pierrejeambrun March 25, 2025 22:06
@jscheffl jscheffl added this to the Airflow 3.0.0 milestone Mar 25, 2025
Copy link
Member

@pierrejeambrun pierrejeambrun left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, sounds good to me.

Just a few nits and one test need fixing

@jscheffl jscheffl force-pushed the bugfix/connections-api-patch-all-fields branch from 1441339 to 7f187e5 Compare March 26, 2025 20:58
Copy link
Member

@pierrejeambrun pierrejeambrun left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we removed the model_fields_set and this is the source of confusion.

When no 'mask' is passed to the function, only fields that are explicitely specified in the payload (even if passed to 'None') should be set. Other missing fields from the partial body should not be updated. I tried locally and we observe the opposite in this current state.

@jscheffl jscheffl force-pushed the bugfix/connections-api-patch-all-fields branch from 7f187e5 to a7ff401 Compare March 27, 2025 21:05
@jscheffl jscheffl requested a review from pierrejeambrun March 27, 2025 21:06
@jscheffl jscheffl force-pushed the bugfix/connections-api-patch-all-fields branch from a7ff401 to dca8763 Compare March 29, 2025 19:42
Copy link
Member

@pierrejeambrun pierrejeambrun left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice thanks

@jscheffl jscheffl force-pushed the bugfix/connections-api-patch-all-fields branch from dca8763 to d9f160d Compare March 31, 2025 19:19
@jscheffl jscheffl force-pushed the bugfix/connections-api-patch-all-fields branch from d9f160d to 587852e Compare March 31, 2025 21:09
@jscheffl jscheffl merged commit b66ce98 into apache:main Mar 31, 2025
91 checks passed
kaxil added a commit to astronomer/airflow that referenced this pull request Mar 31, 2025
I am sure this wasn't intended to be added in apache#48109
pierrejeambrun pushed a commit that referenced this pull request Mar 31, 2025
I am sure this wasn't intended to be added in #48109
shubham-pyc pushed a commit to shubham-pyc/airflow that referenced this pull request Apr 2, 2025
* Connections API is able to patch all fields correctly

* Fix implementation and pytest, apply to bulk service as well

* Consolidate Pydantic to ORM update in connections API

* Review feedback - genralize via model_dump where possible

* Fix pytest

* Review feedback

* Review feedback, extended pytests

* Add a explicit test if None is passed in body
shubham-pyc pushed a commit to shubham-pyc/airflow that referenced this pull request Apr 2, 2025
I am sure this wasn't intended to be added in apache#48109
nailo2c pushed a commit to nailo2c/airflow that referenced this pull request Apr 4, 2025
* Connections API is able to patch all fields correctly

* Fix implementation and pytest, apply to bulk service as well

* Consolidate Pydantic to ORM update in connections API

* Review feedback - genralize via model_dump where possible

* Fix pytest

* Review feedback

* Review feedback, extended pytests

* Add a explicit test if None is passed in body
nailo2c pushed a commit to nailo2c/airflow that referenced this pull request Apr 4, 2025
I am sure this wasn't intended to be added in apache#48109
diogotrodrigues pushed a commit to diogotrodrigues/airflow that referenced this pull request Apr 6, 2025
* Connections API is able to patch all fields correctly

* Fix implementation and pytest, apply to bulk service as well

* Consolidate Pydantic to ORM update in connections API

* Review feedback - genralize via model_dump where possible

* Fix pytest

* Review feedback

* Review feedback, extended pytests

* Add a explicit test if None is passed in body
diogotrodrigues pushed a commit to diogotrodrigues/airflow that referenced this pull request Apr 6, 2025
I am sure this wasn't intended to be added in apache#48109
simonprydden pushed a commit to simonprydden/airflow that referenced this pull request Apr 8, 2025
* Connections API is able to patch all fields correctly

* Fix implementation and pytest, apply to bulk service as well

* Consolidate Pydantic to ORM update in connections API

* Review feedback - genralize via model_dump where possible

* Fix pytest

* Review feedback

* Review feedback, extended pytests

* Add a explicit test if None is passed in body
simonprydden pushed a commit to simonprydden/airflow that referenced this pull request Apr 8, 2025
I am sure this wasn't intended to be added in apache#48109
kosteev pushed a commit to GoogleCloudPlatform/composer-airflow that referenced this pull request May 29, 2025
I am sure this wasn't intended to be added in apache/airflow#48109

GitOrigin-RevId: 71bbaebfea7d1a582c3ef03b07d8cc39a88928ef
kosteev pushed a commit to GoogleCloudPlatform/composer-airflow that referenced this pull request Sep 24, 2025
I am sure this wasn't intended to be added in apache/airflow#48109

GitOrigin-RevId: 71bbaebfea7d1a582c3ef03b07d8cc39a88928ef
@jscheffl jscheffl deleted the bugfix/connections-api-patch-all-fields branch October 5, 2025 07:43
kosteev pushed a commit to GoogleCloudPlatform/composer-airflow that referenced this pull request Oct 22, 2025
I am sure this wasn't intended to be added in apache/airflow#48109

GitOrigin-RevId: 71bbaebfea7d1a582c3ef03b07d8cc39a88928ef
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:API Airflow's REST/HTTP API type:bug-fix Changelog: Bug Fixes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants