Skip to content

[v3-3-test] Fix Variables API handling of non-string JSON values (#71018) - #71526

Merged
potiuk merged 1 commit into
apache:v3-3-testfrom
jason810496:backport-537feaf-v3-3-test
Aug 13, 2026
Merged

potiuk merged 1 commit into
apache:v3-3-testfrom
jason810496:backport-537feaf-v3-3-test

Conversation

@jason810496

@jason810496 jason810496 commented Aug 13, 2026 •

Copy link
Copy Markdown
Member

POST /api/v2/variables with a non-string JSON value (array, object, bool, null) silently stored the Python repr of the value, which cannot be read back with deserialize_json. PATCH with the same payload failed with a masked 500 because the raw value hit the ORM Fernet encryption step.

VariableBody now JSON-encodes non-string values once at request validation, covering POST, PATCH and bulk consistently, matching the behaviour the bulk create path already had for dicts and lists. Variable.set_val also raises a clear TypeError instead of the cryptic "encoding without a string argument".
(cherry picked from commit 537feaf)

…che#71018)

POST /api/v2/variables with a non-string JSON value (array, object,
bool, null) silently stored the Python repr of the value, which cannot
be read back with deserialize_json. PATCH with the same payload failed
with a masked 500 because the raw value hit the ORM Fernet encryption
step.

VariableBody now JSON-encodes non-string values once at request
validation, covering POST, PATCH and bulk consistently, matching the
behaviour the bulk create path already had for dicts and lists.
Variable.set_val also raises a clear TypeError instead of the cryptic
"encoding without a string argument".
(cherry picked from commit 537feaf)

Co-authored-by: Kaxil Naik <[email protected]>
(cherry picked from commit d83617b37526fad9c0ecc6161322f67dbe987fc8)
@potiuk
potiuk force-pushed the backport-537feaf-v3-3-test branch from d83617b to 66f5bdc Compare August 13, 2026 12:17
@potiuk
potiuk merged commit baf1173 into apache:v3-3-test Aug 13, 2026
75 checks passed
vatsrahul1001 pushed a commit that referenced this pull request Sep 7, 2026
) (#71526)

POST /api/v2/variables with a non-string JSON value (array, object,
bool, null) silently stored the Python repr of the value, which cannot
be read back with deserialize_json. PATCH with the same payload failed
with a masked 500 because the raw value hit the ORM Fernet encryption
step.

VariableBody now JSON-encodes non-string values once at request
validation, covering POST, PATCH and bulk consistently, matching the
behaviour the bulk create path already had for dicts and lists.
Variable.set_val also raises a clear TypeError instead of the cryptic
"encoding without a string argument".
(cherry picked from commit 537feaf)


(cherry picked from commit d83617b37526fad9c0ecc6161322f67dbe987fc8)

Co-authored-by: Kaxil Naik <[email protected]>
Co-authored-by: Kaxil Naik <[email protected]>
@vatsrahul1001 vatsrahul1001 added the type:bug-fix Changelog: Bug Fixes label Sep 8, 2026
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.

4 participants