Fix GET /api crash on server notification docs#16
Conversation
Guard nil example_request in the API docs template and encode notification examples via a shared notify/2 helper so html_escape always receives strings. Co-authored-by: Cursor <cursoragent@cursor.com>
There was a problem hiding this comment.
Code Review
This pull request refactors the API and RPC documentation generation. In lib/network/api_docs.html.eex, it conditionally displays the example request block and dynamically labels the response section as either "Example response" or "Example notification" depending on the presence of an example request. In lib/network/rpc_docs.ex, it introduces a notify/2 helper function to clean up the generation of JSON-RPC notification examples. Feedback was provided to use the more idiomatic Elixir Access syntax (doc[:example_request]) instead of mixing Map.get/2 and dot-notation, which helps prevent potential KeyError exceptions.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
Co-authored-by: Cursor <cursoragent@cursor.com>
Cover server notification endpoints that omit example_request and assert the HTML page renders without crashing. Co-authored-by: Cursor <cursoragent@cursor.com>
Add contributor testing guidelines, Plug.Test examples, and README links so bug fixes and new behavior include tests in every PR. Co-authored-by: Cursor <cursoragent@cursor.com>
Document dio_ticket follow-up for dio_ticket_request and continued dio_message usage for dio_notify, with notification-first ordering in the code rail. Co-authored-by: Cursor <cursoragent@cursor.com>
Summary
FunctionClauseErroronGET /apiwhen rendering server-to-client notification endpoints (dio_ticket_request,dio_notify) that have no client request exampleexample_requestis absent and labels the payload "Example notification" instead of "Example response"notify/2helper inNetwork.RpcDocsso notification examples are JSON-encoded strings like other RPC examplesTest plan
mix compileapi_docs.html.eexwithNetwork.RpcDocs.all()and confirm no crashGET /apion a running node and verify the page loadsdio_ticket_requestanddio_notifyshow notification examples without an empty request blockMade with Cursor