Skip to main content

README

SDK code snippets

Updating the SDK code snippets automatically

To update the SDK snippets automatically, you can run:

in the root of the repository. This will remove all the existing snippets and will re-generate them from the example files from the SDK's GitHub repositories, from main.

To generate snippets for only one language, you can run:

with language being go, js or python.

Generate snippets from a specific branch

Sometimes, it's useful to generate snippets already before they reach the main branch in the GitHub repositories. For that, you can set the SDK_BRANCH environment variable. For example:

This will checkout the example file on the add-item-crud branch of the JavaScript SDK repository and will parse the example file from there. The make sdk-snippets/all job also reads <LANGUAGE>_SDK_BRANCH for more customizability, e.g. GO_SDK_BRANCH, JS_SDK_BRANCH.

Validate snippets across languages

To validate that, for every language, the same snippets are available (i.e. under docs/sdks/snippets/<language> files with the same names exist), you can run:

Was this page helpful?