Skip to content
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

AIP-84 Migrate patch a connection to FastAPI API #43102

Merged

Conversation

bugraoz93
Copy link
Collaborator

closes: #42592.
Include, making fields nullable for patch endpoints for backward compatibility.


^ Add meaningful description above
Read the Pull Request Guidelines for more information.
In case of fundamental code changes, an Airflow Improvement Proposal (AIP) is needed.
In case of a new dependency, check compliance with the ASF 3rd Party License Policy.
In case of backwards incompatible changes please leave a note in a newsfragment file, named {pr_number}.significant.rst or {issue_number}.significant.rst, in newsfragments.

@boring-cyborg boring-cyborg bot added area:API Airflow's REST/HTTP API area:UI Related to UI/UX. For Frontend Developers. labels Oct 17, 2024
@rawwar rawwar added the legacy api Whether legacy API changes should be allowed in PR label Oct 18, 2024
@bugraoz93 bugraoz93 force-pushed the feat/42592/patch-connections-fast-api branch 2 times, most recently from f33126e to e58dae7 Compare October 24, 2024 18:49
@bugraoz93 bugraoz93 force-pushed the feat/42592/patch-connections-fast-api branch 2 times, most recently from 94bfe26 to fa62ca2 Compare October 26, 2024 11:06
@bugraoz93 bugraoz93 force-pushed the feat/42592/patch-connections-fast-api branch from fa62ca2 to 104d004 Compare October 27, 2024 01:04
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 should also make consistant the behavior for PATCH regarding None value.

Here when there is a mask you take them. And when there is no mask, you filter them out.

I did something different for Pool which I think can be extented. When there is a mask, same thing, we use values. When there is no mask, we validate that the payload is valide by it's own, i.e it's a valid db entity by its own, and we use everything. (none or not).

The idea is to allow someone to not specify mask and reset some fields to None if needed.

@pierrejeambrun
Copy link
Member

pierrejeambrun commented Oct 28, 2024

I just pushed one commit to remove a remnent of old code _parse_comma_separated_query_params. PR rebased. Should be good to merge.

@pierrejeambrun pierrejeambrun force-pushed the feat/42592/patch-connections-fast-api branch from 104d004 to f4c90dd Compare October 28, 2024 11:28
@pierrejeambrun
Copy link
Member

pierrejeambrun commented Oct 28, 2024

I think we have the same issue here, we cannot update the password field. This should be possible, and the returned password should be redacted I believe. Otherwise we have no way for a user to update the password of a connection, or set it (event the POST create connection does not allow it in its current state.)

@bugraoz93
Copy link
Collaborator Author

I just pushed one commit to remove a remnent of old code _parse_comma_separated_query_params. PR rebased. Should be good to merge.

I totally missed this one, thanks for the changes! :)

@bugraoz93
Copy link
Collaborator Author

I think we should also make consistant the behavior for PATCH regarding None value.

Here when there is a mask you take them. And when there is no mask, you filter them out.

I did something different for Pool which I think can be extented. When there is a mask, same thing, we use values. When there is no mask, we validate that the payload is valide by it's own, i.e it's a valid db entity by its own, and we use everything. (none or not).

The idea is to allow someone to not specify mask and reset some fields to None if needed.

I think I looked from the lazy path when no parameter, no value to you :) Saw your changes. Looks good and makes sense! I agree, we should have a common approach for common methods because what we are doing at the end is pretty similar.

@pierrejeambrun
Copy link
Member

For 'common' behavior of null values we can do that in another PR. That is not really specific to this one. I think we can just handle the 'password', then merge it, maybe you can take care of making all PATCH consistent regarding none values in a follow up, if that sounds good ?

@bugraoz93
Copy link
Collaborator Author

For 'common' behavior of null values we can do that in another PR. That is not really specific to this one. I think we can just handle the 'password', then merge it, maybe you can take care of making all PATCH consistent regarding none values in a follow up, if that sounds good ?

Yeap, it sounds perfect! I am going to take care of that after finishing the password part. There is a small work left for password. I couldn't make redact work in the tests, which I will check it out today and push it to both PRs related to this

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.

We need to handle the password

@bugraoz93 bugraoz93 force-pushed the feat/42592/patch-connections-fast-api branch from 2b85e78 to 0b67aae Compare October 31, 2024 21:13
@bugraoz93 bugraoz93 force-pushed the feat/42592/patch-connections-fast-api branch from 3ea9442 to 591657d Compare November 4, 2024 18:46
@bugraoz93
Copy link
Collaborator Author

Tests should be fixed in #43654.

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.

Looking good.

Need rebasing to fix conflicts, we can merge after.

@bugraoz93 bugraoz93 force-pushed the feat/42592/patch-connections-fast-api branch from d26497a to 7c19e96 Compare November 5, 2024 19:11
@bugraoz93
Copy link
Collaborator Author

Looking good.

Need rebasing to fix conflicts, we can merge after.

Many thanks for rebasing and merging the other PR! You saved me from facing the conflict twice 🙏 Rebased.

@pierrejeambrun pierrejeambrun merged commit cd75707 into apache:main Nov 6, 2024
56 checks passed
ellisms pushed a commit to ellisms/airflow that referenced this pull request Nov 13, 2024
* Migrate Patch Connection endpoint to FastAPI and Include Optional parameter Field default value for backward compatibility

* Make all tests parametrized

* Make UpdateMask Annotated for Patch endpoints, update the serialisation for backward compat and fix for variables serialisation won't update val in setattr()

* Merge duplicate imports

* Revert update_mask to explode true and include significant.rst for update_mask breaking change

* Amend update_mask as array

* generalize handling of list query parameters in newsfragment

* Include password field

* Include password to response and tests, rebase and rerun pre-commit

* Fix copy&paste mistakes for method and naming

* Convert redact_password to agreed approach, rebase and pre-commits

* Include new exception doc generation

* Run pre-commit after rebase
@Lee-W Lee-W mentioned this pull request Nov 18, 2024
96 tasks
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 area:UI Related to UI/UX. For Frontend Developers. legacy api Whether legacy API changes should be allowed in PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

AIP-84 Migrate the public endpoint Patch Connection to FastAPI
3 participants