Problem statement
Batch response handling requires repeated custom code for id correlation, missing response detection, and success/error partitioning. This creates inconsistent behavior between integrations and increases maintenance cost.
Proposed solution
Add JsonRpcResponseIndex in jsonrpc-core to provide structured access to parsed batch responses:
- index by
id for fast lookup
findById(...), requireById(...)
successes(), errors() views
- missing-id / duplicate-id diagnostics
- configurable duplicate-id policy (for example: reject, keep-first, keep-last)
Alternatives considered
- Keep exposing only raw
List<JsonRpcIncomingResponse>
- Encourage each project to write local helper functions
These alternatives preserve flexibility but continue the same duplication and behavior drift.
JSON-RPC behavior impact
No protocol behavior change. This is a consumer-side utility for parsed responses.
Additional context
- Works with existing parser/validator output (
JsonRpcIncomingResponseEnvelope).
- Include deterministic behavior docs for duplicate response IDs.
- Add focused tests for empty batch, mixed success/error, and duplicate-id paths.
Problem statement
Batch response handling requires repeated custom code for
idcorrelation, missing response detection, and success/error partitioning. This creates inconsistent behavior between integrations and increases maintenance cost.Proposed solution
Add
JsonRpcResponseIndexinjsonrpc-coreto provide structured access to parsed batch responses:idfor fast lookupfindById(...),requireById(...)successes(),errors()viewsAlternatives considered
List<JsonRpcIncomingResponse>These alternatives preserve flexibility but continue the same duplication and behavior drift.
JSON-RPC behavior impact
No protocol behavior change. This is a consumer-side utility for parsed responses.
Additional context
JsonRpcIncomingResponseEnvelope).