docs: Update documentation for JSON-RPC methods#3875
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #3875 +/- ##
=======================================
Coverage 98.57% 98.57%
=======================================
Files 425 425
Lines 12314 12314
Branches 1921 1921
=======================================
Hits 12139 12139
Misses 175 175 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Co-authored-by: Frederik Bolding <frederik.bolding@gmail.com>
| method: string; | ||
| params: Json[] | Record<string, Json>; | ||
| }; | ||
| export type ManageAccountsParams = { |
There was a problem hiding this comment.
I wonder if changing this union is gonna have downstream effects
There was a problem hiding this comment.
I can revert if you want to be sure, but will need to adjust the extraction script then to combine them again. Otherwise the result doesn't make much sense 😅
There was a problem hiding this comment.
Do you think it'll cause issues?
There was a problem hiding this comment.
Since snap.request infers the params type as ManageAccountsParams, I don't think it should cause issues. The concern when we implemented this was likely generic Json types, which would only work with exactOptionalPropertyTypes: true (because undefined isn't assignable to Json). I tested this with exactOptionalPropertyTypes: false and it still works fine.
This updates the documentation following the changes in #3872. This makes sure we have proper user-facing documentation for the newly extracted data as well.
Note
Medium Risk
Mostly docstring and typing clarifications across exported SDK method types, but there is a small breaking-shape risk where
ManageAccountsParamsis simplified andCronjob['request']is retyped fromJsonRpcRequestto a{ method, params }shape.Overview
Updates the Snap SDK’s exported JSON-RPC method type docs to be more explicit/consistent (e.g., “params objects”, when results are always
null, and richer field-level JSDoc for dialogs, notifications, web sockets, background events, and client status).Makes a couple of type-shape adjustments:
ManageAccountsParamsbecomes a single object with optionalparams(instead of a union), and cronjob request typing inpermissions.tsswitches to an explicit{ method, params?: JsonRpcParams }structure, which flows into scheduling/background-event request types.Written by Cursor Bugbot for commit 5f64eda. This will update automatically on new commits. Configure here.