Skip to content

ProblemDetails has custom MarshalJSON but no UnmarshalJSON — problem responses can't round-trip #18

Closed

Description

@rluders

`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.

Activity

  1. added
    orkestra:ready
    on Oct 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    orkestra:ready

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions