The Docs.

Prim+RPC is in prerelease mode and may be unstable until official release.

Documentation Generation

This tool is in early stages and the interface is expected to change significantly.

Prim+RPC includes tools to generate RPC-specific documentation. It does this by reusing your existing TypeDoc documentation for your TypeScript or JavaScript code and converts this into a simpler version that documents functions as it relates to RPC.

The first step is to generate TypeDoc documentation for your code. This can be done by running the following command in your project:

npx typedoc src/index.ts --json dist/docs.json

Now you may execute this utility on the result:

import { createDocsForModule } from "@doseofted/prim-rpc-tooling/docs"
import typeDoc from "./dist/docs.json"
 
const rpcDocs = createDocsForModule(typeDoc)

The resulting documentation is a simpler version of the TypeDoc that relates to RPC. This output could be used for a documentation website or fed to another tool like HTTPsnippet to generate requests for other clients outside of JavaScript.

In the future, basic JavaScript types will be turned into JSON Schema for typed usage outside of TypeScript. It’s not planned to support all TypeScript types in RPC documentation since it doesn’t make sense to use them outside of TypeScript but basic JSON Schema support could be useful for using Prim+RPC outside of JavaScript environments.

Report an Issue