Skip to content

Commit

Permalink
chore: update docs for json schema (#250)
Browse files Browse the repository at this point in the history
  • Loading branch information
matthova authored Aug 30, 2024
1 parent ceb4951 commit ec0e0b6
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
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

0 comments on commit ec0e0b6

Please sign in to comment.