Skip to content

fix: normalize job metadata JSON string to dict in job reponses#52

Merged
MatehElismar merged 1 commit intomasterfrom
fix/TAG-2271-job-metadata-normalization
Mar 19, 2026
Merged

fix: normalize job metadata JSON string to dict in job reponses#52
MatehElismar merged 1 commit intomasterfrom
fix/TAG-2271-job-metadata-normalization

Conversation

@MatehElismar
Copy link
Contributor

@MatehElismar MatehElismar commented Mar 19, 2026

Issue/Ticket: TAG-2273

Summary

When fetching jobs, the API returns the metadata field as a JSON-encoded string rather than a parsed object. This caused callers to receive raw strings instead of usable dicts, leading to mismatches in processing and downstream consumption. This fix adds normalization in the SDK so that metadata is always a dict by the time it reaches the caller.

Changes

  • Jobs.get and Jobs.get_all now parse JSON-string metadata into a dict before returning
  • Handles wrapped responses (result key with single job or list), direct job objects, and edge cases (empty, invalid JSON, non-dict values — all coerced to {})
  • Added tests/test_smoke.py with unit tests covering the normalization scenarios
  • Refactored integration tests to read config from env vars instead of hardcoded values
  • Removed test.py (replaced by proper test structure); updated Makefile to use python -m unittest

The API returns job metadata as a JSON-encoded string. This adds
normalization in Jobs.get and Jobs.get_all so metadata is always
a dict by the time it reaches the caller.

Relates to: TAG-2271
@MatehElismar MatehElismar requested a review from a team as a code owner March 19, 2026 18:01
@MatehElismar MatehElismar self-assigned this Mar 19, 2026
@MatehElismar MatehElismar requested review from mlovera and rroa March 19, 2026 18:03
@MatehElismar MatehElismar changed the title Normalize job metadata JSON string to dict in SDK fix: normalize job metadata JSON string to dict in SDK Mar 19, 2026
@MatehElismar MatehElismar changed the title fix: normalize job metadata JSON string to dict in SDK fix: normalize job metadata JSON string to dict in job reponses Mar 19, 2026
@MatehElismar MatehElismar merged commit dc8907a into master Mar 19, 2026
11 of 12 checks passed
@MatehElismar MatehElismar deleted the fix/TAG-2271-job-metadata-normalization branch March 19, 2026 19:33
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.

3 participants