Skip to content

Latest commit

 

History

History
76 lines (45 loc) · 2.81 KB

CONTRIBUTING.md

File metadata and controls

76 lines (45 loc) · 2.81 KB

Install dependencies

After cloning the repository, install the dependencies by running the following command:

yarn

Install git commit hooks with:

yarn prepare

Update OpenAPI specification

API clients are generated using @openapitools/openapi-generator-cli. They are generated based on the API specifications defined in the spec.json file.

Each endpoint in the specification must have a unique operationId, because the client method names are derived from it.

Generate the miro-api client

To generate the miro-api client, run the following command:

yarn build

The command produces:

  1. Low-level client methods
  2. High-level client methods and models
  3. JavaScript code, compiled from the source TypeScript code.

1. Low-level client methods

The command generates low-level code in the api and model subdirectories. This command runs openapi-generator-cli with the miro-api generator, based on the Mustache template files in the miro-api-template directory.

2. High-level client methods and models

This command executes ./generator/generate_node_highlevel_models.ts, which generates high-level client models that use the low-level client code generated with openapi-generator-cli.
This is based on the model definitions in the ./generator/modelDefinition.ts file.

To customize autogenerated models:

  1. Define additional classes in the highlevel directory.

  2. Update the extended model definition to point to the new file.
    To view an example, see packages/miro-api/highlevel/Team.ts for an example.

    To view the generated model hierarchy, see MODELS.md.

3. Compiling to JavaScript

As a final step, the command runs yarn build to compile the source TypeScript code to JavaScript, and to generate .d.ts files.

Build the documentation

Documentation for the client is generated with TypeDoc.

To build the documentation, run the following command:

yarn build:docs

The resulting static HTML files and their related assets are in the docs-out directory.

Publish the client

When the version in package.json changes, the publish GitHub action publishes the packages/miro-api content to the npm registry as @mirohq/miro-api.

Publish the documentation

The pages-build-deployment GitHub action publishes the client documentation to GitHub pages.