https://github.com/open-rpc/typings
Generate Type Aliases for your OpenRPC Document
https://github.com/open-rpc/typings
cli open-rpc openrpc
Last synced: about 1 month ago
JSON representation
Generate Type Aliases for your OpenRPC Document
- Host: GitHub
- URL: https://github.com/open-rpc/typings
- Owner: open-rpc
- Created: 2019-05-06T21:34:44.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2024-09-13T07:25:05.000Z (8 months ago)
- Last Synced: 2025-04-09T16:13:04.212Z (about 1 month ago)
- Topics: cli, open-rpc, openrpc
- Language: TypeScript
- Homepage: https://open-rpc.github.io/typings/
- Size: 4.64 MB
- Stars: 24
- Watchers: 2
- Forks: 6
- Open Issues: 23
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
Awesome Lists containing this project
README
# OpenRPC Typings
![]()
![]()
![]()
![]()
![]()
A tool to produce language-specific typings given an OpenRPC document.
This package will extract the json-schemas from your document, and give you types for them (and language-specific functionality for dealing with data of that json schema type).
Need help or have a question? Join us on our [Discord](https://discord.gg/gREUKuF)!
## Installing
`npm install @open-rpc/typings`
## CLI
```bash
$ open-rpc-typings --help
Usage: cli [options]Options:
-v, --version print the version number
-d, --document [openrpcDocument] JSON string, or a filepath or remote URL pointing to an Open-RPC JSON document (default: "./openrpc.json")
--output-rs [directory] path to output dir of Rust typings
--output-ts [directory] path to output dir of Typescript typings
--output-go [directory] path to output dir of Go typings
--name-rs [file] file name to input of Rust typings (default: "./index")
--name-ts [file] file name to input of Typescript typings (default: "./index")
--name-go [file] file name to input of Go typings (default: "./index")
-h, --help print usage information```
## JS/TS SDK
```typescript
import OpenRPCTypings from "@open-rpc/typings";const typings = new OpenRPCTypings(OpenRPCDocument);
await typings.generate()
const rustTypings = typings.toString("rust");
```