Skip to content
This repository was archived by the owner on Mar 31, 2025. It is now read-only.

Files

Latest commit

27dd03c · Apr 29, 2024

History

History

codegen

README.md

toggl-py codegen

This folder contains configuration and scripts for generating the toggl-py source from Toggl's OpenApi (Swagger) spec.

Code generation uses a custom Docker image wrapping the swagger-codegen-cli.

Setup

From the root of this repository

  1. Create an environment file from the sample (defaults are good for now)

    cp .env.sample .env
  2. Then build the main Docker image:

    docker compose build

Open a devcontainer

Open this repository in VS Code, then Rebuild and Reopen in Container.

Generate the code

(Outside a devcontainer), run the Docker Compose codegen service:

docker compose run codegen

(Inside the devcontainer), run the codegen script directly:

codegen/bin/run.sh

Edit configuration

Some configuration values can be changed in config.json.

Other flags for swagger-codegen can be modified in the run.sh script.

Use the help.sh script to find out more about swagger-codegen-cli configuration options:

codegen/bin/help.sh

Edit templates

Custom Mustache templates used to generate the files live under ./TogglPythonClientCodegen/src/main/resources/TogglPythonClientCodegen/.

Edit the generator class

TogglPythonClientCodegen is the custom Java class, inheriting from and overriding some behavior of Swagger's PythonClientCodegen, serving as the "language" implementation that swagger-codegen-cli uses to generate toggl-py.