-
Notifications
You must be signed in to change notification settings - Fork 16.3k
Allow non-string valid JSON values in Variable import. #49844
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
Conversation
airflow-core/tests/unit/api_fastapi/core_api/routes/public/test_variables.py
Show resolved
Hide resolved
shubhamraj-git
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.
Thanks for the fix.
Some tests failures needs to be fixed.
|
It seems airflow-ctl is trying to do some work for non-primitive types in this case |
Thanks for the PR @tirkarthi and tagging! I will check this out in a couple of hours. |
|
#49917 this should fix it @tirkarthi :) |
|
Need to rebase and fix mypy before merging. (rebasing should fix the unrelated boto failure) |
|
VariableBody definition airflow/airflow-ctl/src/airflowctl/api/datamodels/generated.py Lines 831 to 841 in 61e45b2
Error |
|
Below code is getting auto generated and added to generated.py . Any help @bugraoz93 on how to fix this? Tried running pre-commit but it doesn't help. class JsonValue(RootModel[Any]):
root: Any |
|
To fix: You can just use that instead in line 666 variable = VariableBody.model_validate(
{"key": key, "value": value, "description": description},
) |
|
A similar fix might be needed in Connections: #49734 |
That generation is expected. We are syncing the
Thanks Pierre! Indeed, this should solve it. |
|
Thanks @pierrejeambrun and @bugraoz93 for the help on fixing the tests. Thanks everyone for the reviews. |
Backport failed to create: v3-0-test. View the failure log Run details
You can attempt to backport this manually by running: cherry_picker 61dfd44 v3-0-testThis should apply the commit to the v3-0-test branch and leave the commit in conflict state marking After you have resolved the conflicts, you can continue the backport process by running: cherry_picker --continue |
(cherry picked from commit 61dfd44)
(cherry picked from commit 61dfd44)
|
Backport PR : #50063 |
Airflow 3.0 had the change to accept only string values as variable values during import through API that prohibited using int, list, etc that are valid JSON values. Airflow 3 cli accepts import of valid JSON without this restriction. The API should also accept valid JSON values.
Closes #49837