Remove the JSON-RPC from the example's code in the documentation#288
Conversation
There was a problem hiding this comment.
Pull request overview
This PR updates the documentation/example generation so that JSON-RPC example code is no longer emitted in generated docs, and adjusts demo OpenRPC definitions and a manual test script to align with the new behavior.
Changes:
- In
insertExampleMacros, skip JSON-RPC entries when iterating example languages so JSON-RPC example code is omitted from generated documentation. - Update
demo_sdk/openrpc/simple.jsonto introduce atestMethodWithoutParamsmethod, adjust example payloads and result schemas for a few methods, and refine examples used by docs generation. - Simplify
demo_sdk/test/component/manualTest.mjsto run a singleEventExtension.onBasicEventsubscription scenario and comment out the more complex manual scenarios.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| src/macrofier/engine.mjs | Omits JSON-RPC language blocks when rendering method examples in templates while preserving other language handling. |
| demo_sdk/test/component/manualTest.mjs | Switches the manual test to a basic onBasicEvent example and comments out the more complex event/property manual flows. |
| demo_sdk/openrpc/simple.json | Adjusts demo OpenRPC methods, including adding a no-params method, updating result schemas and examples, and reordering/expanding example data used for docs. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| let languages = '' | ||
| Object.entries(example.languages).forEach(([name, language]) => { | ||
|
|
||
| //In the generated documentation, the example code for JSON-RPC is deprecated, so we omit it. |
There was a problem hiding this comment.
This inline comment is missing a space after the //, which is inconsistent with the surrounding comment style in this file (e.g., line 1954 uses // ...). For consistency with existing comments, please add a space after //.
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| "summary": "A method that pulls its description from an external markdown file.", | ||
| "description": { |
There was a problem hiding this comment.
The summary text "A method that pulls it's description from an external markdown file." uses "it's" (contraction of "it is") instead of the possessive "its". Please update this to use the correct possessive form to avoid a grammatical error in the generated documentation.
| Object.entries(example.languages).forEach(([name, language]) => { | ||
|
|
||
| //In the generated documentation, the example code for JSON-RPC is deprecated, so we omit it. | ||
| if (name.toLowerCase() === 'json-rpc') { | ||
| return; | ||
| } | ||
|
|
There was a problem hiding this comment.
Filtering out the json-rpc language here means that any example whose languages object only contains JSON-RPC (e.g., RPC-only methods after isRPCOnlyMethod pruning) will still generate an example title but with an empty body in the rendered documentation because languages stays empty. If the goal is to remove JSON-RPC examples from the docs entirely, consider also skipping creation of the example block when all languages are filtered out, so the generated docs do not show an empty example section.
No description provided.