Skip to content

Reject an empty top-level value in _string_from_json - #1529

Merged
adamtheturtle merged 1 commit into
mainfrom
adamtheturtle/vws-web-tools-issue-1487
Aug 27, 2026
Merged

Reject an empty top-level value in _string_from_json#1529
adamtheturtle merged 1 commit into
mainfrom
adamtheturtle/vws-web-tools-issue-1487

Conversation

@adamtheturtle

Copy link
Copy Markdown
Member

Closes #1487.

_string_from_json skipped a top-level key whose value was an empty string and carried on searching nested objects for the same key. So a response of the shape {"client_id": "", "someOtherThing": {"clientId": "..."}} returned the nested value — a different field from a different object — as the client ID.

An object which has the key we asked for is the object we were looking for. If its value is empty the response is malformed, and that is now a ValueError naming the key rather than a silent fall-through to something else.

The recursive calls still suppress ValueError, so a malformed nested object does not abort the search of its siblings; the strictness applies at whichever level the key actually appears.

test_string_from_json_finds_nested_values asserted the old behaviour, so it now uses a top-level key that is not one of the wanted keys, and a new test covers the empty-value case.

🤖 Generated with Claude Code

https://claude.ai/code/session_01YJDy3qA1LyNTh11zS98ukM

Closes #1487

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01YJDy3qA1LyNTh11zS98ukM
@adamtheturtle
adamtheturtle merged commit 8417d22 into main Aug 27, 2026
29 checks passed
@adamtheturtle
adamtheturtle deleted the adamtheturtle/vws-web-tools-issue-1487 branch August 27, 2026 06:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

_string_from_json returns nested match when top-level key is empty string

1 participant