Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: update docs for json schema #250

Merged
merged 1 commit into from
Aug 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions docs/local-sdk-development.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,7 @@
When developing the SDK locally, you can enable the SDK to rebuild "on save" by running `npm run dev`.

We recommend testing changes to the SDK against the SDK-Playground example, which can be found [here](https://github.com/discord/embedded-app-sdk-examples/tree/main/sdk-playground#testing-sdk-changes-locally).

## JSON Schema updates

If you need to update any generated JSON schema values, follow the guide [here](/docs/schema-gen.md).
8 changes: 8 additions & 0 deletions docs/schema-gen.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
Some of the RPC commands and Typescript Types are constructed via a JSON schema which is generated by Discord. To update the JSON schema, please do the following:

- From Discord, make sure you have run `clyde gen rpc`
- From the root of this github repo, run the following
```
npm run sync -- --path path/to/monorepo/discord_common/js/packages/rpc-schema/generated/schema.json
```
- Commit your changes and update as needed
2 changes: 1 addition & 1 deletion scripts/syncRPCSchema.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const defaultBranch = 'main';
const branch = argv.branch ?? defaultBranch;
let jsonSchemaPath = argv.path;
if (jsonSchemaPath == null) {
throw new Error('Expected --path argument.\nThis should point to the generated JSON Schema.');
throw new Error('Expected -- --path argument.\nThis should point to the generated JSON Schema file.\nExample command below:\nnpm run sync -- --path path/to/monorepo/discord_common/js/packages/rpc-schema/generated/schema.json');
}
// Resolve absolute path
jsonSchemaPath = path.resolve(jsonSchemaPath);
Expand Down