Skip to content

Show the JSON parse-error message on the Variable form warning - #71780

Merged
bbovenzi merged 1 commit into
apache:mainfrom
astronomer:show-json-parse-error-location
Aug 21, 2026
Merged

bbovenzi merged 1 commit into
apache:mainfrom
astronomer:show-json-parse-error-location

Conversation

@pierrejeambrun

@pierrejeambrun pierrejeambrun commented Aug 18, 2026 •

Copy link
Copy Markdown
Member

The Variables form warns "Invalid JSON" the moment the value looks like it might be JSON but doesn't parse. That warning tells the user something's wrong but not where, so a typo halfway through a large value is still a hunt.

The browser's SyntaxError from JSON.parse already carries the position ("Unexpected token ',' at position 42 (line 3 column 12)" on V8; similar on Firefox / Safari). Surface it alongside the localized label so users can jump straight to the character that broke the parse.

Caveat worth naming up front. The parser message is emitted by the JS engine and is only ever in English — mixing it with a localized label is a compromise. The position info is more valuable than perfect localization here IMO, and no browser offers a localized JSON parse error to begin with. Alternative would be a dependency like jsonc-parser for a cross-browser structured error, which is ~30KB and specific code for a UI hint.

Existing test cases (Jinja template {{ var.value.x }}, bracket-prefixed plain string [DRAFT] ..., malformed object with trailing comma) still hit the same warning path — just with a browser-provided detail message now. Updated the getByText assertions to a regex so they don't depend on the exact detail suffix, which varies by browser.

closes: #68262

Was generative AI tooling used to co-author this PR?
  • Yes — Claude Code (Opus 4.7)

Generated-by: Claude Code (Opus 4.7) following the guidelines

The Variables form warns "Invalid JSON" the moment the value looks
like it might be JSON but doesn't parse. That warning tells the user
something's wrong but not where, so a typo halfway through a large
value is still a hunt.

The browser's SyntaxError from JSON.parse already carries the position
("Unexpected token ',' at position 42 (line 3 column 12)" on V8,
similar on Firefox / Safari). Surface it alongside the localized label
so users can jump straight to the character that broke the parse.

The parser message is emitted by the JS engine and is only ever in
English — mixing it with a localized label is a compromise, but the
position info is more valuable than perfect localization here, and no
browser offers a localized JSON parse error to begin with.

closes: apache#68262
@boring-cyborg boring-cyborg Bot added the area:UI Related to UI/UX. For Frontend Developers. label Aug 18, 2026
@pierrejeambrun

Copy link
Copy Markdown
Member Author

Chrome

Screenshot 2026-08-19 at 16 24 35 ## Firefox Screenshot 2026-08-19 at 16 25 32

@bbovenzi
bbovenzi merged commit b5b39cc into apache:main Aug 21, 2026
252 of 255 checks passed
@bbovenzi
bbovenzi deleted the show-json-parse-error-location branch August 21, 2026 14:44
@github-actions

Copy link
Copy Markdown
Contributor

Backport successfully created: v3-3-test

Note: As of Merging PRs targeted for Airflow 3.X
the committer who merges the PR is responsible for backporting the PRs that are bug fixes (generally speaking) to the maintenance branches.

In matter of doubt please ask in #release-management Slack channel.

Status Branch Result
✅ v3-3-test PR Link

github-actions Bot pushed a commit to aws-mwaa/upstream-to-airflow that referenced this pull request Aug 21, 2026
… warning (apache#71780)

The Variables form warns "Invalid JSON" the moment the value looks
like it might be JSON but doesn't parse. That warning tells the user
something's wrong but not where, so a typo halfway through a large
value is still a hunt.

The browser's SyntaxError from JSON.parse already carries the position
("Unexpected token ',' at position 42 (line 3 column 12)" on V8,
similar on Firefox / Safari). Surface it alongside the localized label
so users can jump straight to the character that broke the parse.

The parser message is emitted by the JS engine and is only ever in
English — mixing it with a localized label is a compromise, but the
position info is more valuable than perfect localization here, and no
browser offers a localized JSON parse error to begin with.
(cherry picked from commit b5b39cc)

Co-authored-by: Pierre Jeambrun <pierrejbrun@gmail.com>
closes: apache#68262
aws-airflow-bot pushed a commit to aws-mwaa/upstream-to-airflow that referenced this pull request Aug 21, 2026
… warning (apache#71780)

The Variables form warns "Invalid JSON" the moment the value looks
like it might be JSON but doesn't parse. That warning tells the user
something's wrong but not where, so a typo halfway through a large
value is still a hunt.

The browser's SyntaxError from JSON.parse already carries the position
("Unexpected token ',' at position 42 (line 3 column 12)" on V8,
similar on Firefox / Safari). Surface it alongside the localized label
so users can jump straight to the character that broke the parse.

The parser message is emitted by the JS engine and is only ever in
English — mixing it with a localized label is a compromise, but the
position info is more valuable than perfect localization here, and no
browser offers a localized JSON parse error to begin with.
(cherry picked from commit b5b39cc)

Co-authored-by: Pierre Jeambrun <pierrejbrun@gmail.com>
closes: apache#68262
bbovenzi pushed a commit that referenced this pull request Aug 24, 2026
… warning (#71780) (#71953)

The Variables form warns "Invalid JSON" the moment the value looks
like it might be JSON but doesn't parse. That warning tells the user
something's wrong but not where, so a typo halfway through a large
value is still a hunt.

The browser's SyntaxError from JSON.parse already carries the position
("Unexpected token ',' at position 42 (line 3 column 12)" on V8,
similar on Firefox / Safari). Surface it alongside the localized label
so users can jump straight to the character that broke the parse.

The parser message is emitted by the JS engine and is only ever in
English — mixing it with a localized label is a compromise, but the
position info is more valuable than perfect localization here, and no
browser offers a localized JSON parse error to begin with.
(cherry picked from commit b5b39cc)


closes: #68262

Co-authored-by: Pierre Jeambrun <pierrejbrun@gmail.com>
vatsrahul1001 pushed a commit that referenced this pull request Sep 7, 2026
… warning (#71780) (#71953)

The Variables form warns "Invalid JSON" the moment the value looks
like it might be JSON but doesn't parse. That warning tells the user
something's wrong but not where, so a typo halfway through a large
value is still a hunt.

The browser's SyntaxError from JSON.parse already carries the position
("Unexpected token ',' at position 42 (line 3 column 12)" on V8,
similar on Firefox / Safari). Surface it alongside the localized label
so users can jump straight to the character that broke the parse.

The parser message is emitted by the JS engine and is only ever in
English — mixing it with a localized label is a compromise, but the
position info is more valuable than perfect localization here, and no
browser offers a localized JSON parse error to begin with.
(cherry picked from commit b5b39cc)


closes: #68262

Co-authored-by: Pierre Jeambrun <pierrejbrun@gmail.com>
imrichardwu pushed a commit to imrichardwu/airflow that referenced this pull request Sep 11, 2026
…ache#71780)

The Variables form warns "Invalid JSON" the moment the value looks
like it might be JSON but doesn't parse. That warning tells the user
something's wrong but not where, so a typo halfway through a large
value is still a hunt.

The browser's SyntaxError from JSON.parse already carries the position
("Unexpected token ',' at position 42 (line 3 column 12)" on V8,
similar on Firefox / Safari). Surface it alongside the localized label
so users can jump straight to the character that broke the parse.

The parser message is emitted by the JS engine and is only ever in
English — mixing it with a localized label is a compromise, but the
position info is more valuable than perfect localization here, and no
browser offers a localized JSON parse error to begin with.

closes: apache#68262
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:UI Related to UI/UX. For Frontend Developers.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Make the "Invalid JSON" validation warning on the Edit Variable form more prominent (and block/guard Save)

2 participants