Repository navigation
WI-003: #18 ProblemDetails has custom MarshalJSON but no UnmarshalJSON — problem responses can't round-trip - #21
Conversation
…N — problem responses can't round-trip Implemented by the Weave Autoloop, attempt 1 (execution exe_4feb2775d52c).
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: reviews:
auto_review:
drafts: true
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #21 +/- ##
==========================================
+ Coverage 83.60% 84.35% +0.75%
==========================================
Files 14 14
Lines 500 524 +24
==========================================
+ Hits 418 442 +24
Misses 63 63
Partials 19 19 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
Weave review: approved (execution
Acceptance criteria
Minor notes (not blocking)
|
Work item WI-003 of work package WP-001 (GitHub issues).
`ProblemDetails.MarshalJSON` flattens `Extensions` to the top level per RFC 9457 (`type`/`title`/`status`/`detail`/`instance` plus arbitrary extension keys, all siblings). There's no corresponding `UnmarshalJSON`, so decoding a problem response back into a `ProblemDetails` loses every extension member — `json.Unmarshal` only populates the struct's declared fields and silently drops the rest, since `Extensions` isn't itself a tagged field that captures leftover keys.
This bites API clients and tests that need to decode a problem response and inspect an extension (e.g. a `messageKey` i18n hint, or a `correlationId`) — there's no way to get it back out via the type this library provides.
Requested: a matching `UnmarshalJSON` that reads the known fields and stuffs everything else into `Extensions`, so `ProblemDetails` round-trips through JSON.
Implemented by the Weave Autoloop, attempt 1, execution
exe_4feb2775d52c.Changed files:
problem_details.goproblem_details_test.go