pierrejeambrun opened a new pull request, #71780:
URL: https://github.com/apache/airflow/pull/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.
**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 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?
- [X] Yes — Claude Code (Opus 4.7)
Generated-by: Claude Code (Opus 4.7) following [the
guidelines](https://github.com/apache/airflow/blob/main/contributing-docs/05_pull_requests.rst#gen-ai-assisted-contributions)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]