Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@raphael
Copy link
Member

@raphael raphael commented Aug 17, 2025

Summary

  • JSON-RPC envelope ID now supports both string and number consistently across HTTP, SSE, and WebSocket.

Changes

  • jsonrpc/types: RawResponse.ID is now any.
  • WebSocket client: treat missing ID as nil; backfill typed result ID fields using jsonrpc.IDToString.
  • Integration test generator (idmap modifier): payload/result are objects with value, id (string), and request_id (string). Methods declare JSON-RPC ID("request_id"). Non-idmap methods unchanged.
  • Integration tests: added scenarios verifying numeric envelope IDs for HTTP and WebSocket; aligned existing scenarios to design types.

Rationale

  • JSON-RPC 2.0 allows ID to be string, number, or null. We keep the transport envelope dynamic while mapping into typed fields via the DSL, preserving strong typing and avoiding reflection.

Backwards compatibility

  • Runtime packages keep the same API surface; behavior is more robust for numeric IDs.

Tests

  • All JSON-RPC integration tests pass locally (including new numeric-ID cases).

raphael added 11 commits August 16, 2025 15:10
- Updated the SSE server stream template to correctly handle multiple error responses by iterating through nested error structures.
- Ensured that the generated code properly emits error handling cases for each defined error, improving robustness in SSE implementations.

Tests: all unit tests pass; JSON-RPC integration tests pass.
…meter name collisions

- Updated the analyze method in ServicesData to reserve the service package name, ensuring it does not conflict with parameter names in generated code.

Tests: all unit tests pass.
…\n- SSE: emit protocol errors as SSE events; normalize error messages; no leaks (one-shot stream).\n- WS: fix request vs notification, generic error messages, empty-method handling.\n- HTTP: restore proper parse-error envelopes for invalid JSON.\n- Harness: support null/numeric IDs and explicit id presence for WS; honor JSONRPC field on SSE.\n- Scenarios: add WS/SSE protocol edge cases and mixed HTTP/JSON-RPC cases.\n- Templates: clean handler wiring (avoid recursion), correct SSE mount/init.\n\nAll JSON-RPC integration tests pass locally.
…ke executor and executor options private; Runner remains public.\n- update Runner to use private executor via factory/ctor.\n- minor formatting cleanups.\n\nAll integration tests pass.
…ndpoint generation; parse in MethodInfo and conditionally emit GRPC() in DSL; rename mixed scenario method to grpc_process
…c_ methods are present; auto-assign grpc port; detect readiness
…transports; make RawResponse.ID any; websocket client: treat missing id as nil and backfill via IDToString; integration tests: add numeric envelope id scenarios; idmap: payload/result use string id + string request_id; generator: only add id/request_id for idmap methods; fix echo impl for idmap; align scenarios to types
… keep JSON-RPC endpoints; keep single-line handler calls
@raphael raphael enabled auto-merge (squash) August 17, 2025 15:46
@raphael raphael merged commit 16ec71a into v3 Aug 17, 2025
7 checks passed
@raphael raphael deleted the fix/jsonrpc-id-consistency branch August 17, 2025 15:48
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.

1 participant