-
Notifications
You must be signed in to change notification settings - Fork 16.4k
Connections API is able to patch all fields correctly #48109
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Connections API is able to patch all fields correctly #48109
Conversation
airflow-core/src/airflow/api_fastapi/core_api/routes/public/connections.py
Outdated
Show resolved
Hide resolved
pierrejeambrun
left a comment
There was a problem hiding this 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.
airflow-core/src/airflow/api_fastapi/core_api/services/public/connections.py
Show resolved
Hide resolved
0ec69f1 to
1441339
Compare
pierrejeambrun
left a comment
There was a problem hiding this 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
airflow-core/src/airflow/api_fastapi/core_api/routes/public/connections.py
Show resolved
Hide resolved
airflow-core/src/airflow/api_fastapi/core_api/services/public/connections.py
Outdated
Show resolved
Hide resolved
airflow-core/tests/unit/api_fastapi/core_api/routes/public/test_connections.py
Show resolved
Hide resolved
1441339 to
7f187e5
Compare
There was a problem hiding this 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.
airflow-core/src/airflow/api_fastapi/core_api/services/public/connections.py
Outdated
Show resolved
Hide resolved
airflow-core/tests/unit/api_fastapi/core_api/routes/public/test_connections.py
Show resolved
Hide resolved
7f187e5 to
a7ff401
Compare
a7ff401 to
dca8763
Compare
pierrejeambrun
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice thanks
airflow-core/tests/unit/api_fastapi/core_api/routes/public/test_connections.py
Show resolved
Hide resolved
airflow-core/tests/unit/api_fastapi/core_api/routes/public/test_connections.py
Show resolved
Hide resolved
dca8763 to
d9f160d
Compare
d9f160d to
587852e
Compare
I am sure this wasn't intended to be added in apache#48109
* 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
I am sure this wasn't intended to be added in apache#48109
* 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
I am sure this wasn't intended to be added in apache#48109
* 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
I am sure this wasn't intended to be added in apache#48109
* 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
I am sure this wasn't intended to be added in apache#48109
I am sure this wasn't intended to be added in apache/airflow#48109 GitOrigin-RevId: 71bbaebfea7d1a582c3ef03b07d8cc39a88928ef
I am sure this wasn't intended to be added in apache/airflow#48109 GitOrigin-RevId: 71bbaebfea7d1a582c3ef03b07d8cc39a88928ef
I am sure this wasn't intended to be added in apache/airflow#48109 GitOrigin-RevId: 71bbaebfea7d1a582c3ef03b07d8cc39a88928ef
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