|
| 1 | +# Mustache template override |
| 2 | + |
| 3 | +Two Hotdata-specific DX tweaks applied to the Python `configuration.mustache`: |
| 4 | + |
| 5 | +1. **`api_key` is the bearer token** — matching Hotdata's docs and CLI |
| 6 | + (`--api-key`, `HOTDATA_API_KEY`). Stock openapi-generator calls the |
| 7 | + bearer token `access_token`; we drop that name entirely and replace it |
| 8 | + with `api_key`. Internal `auth_settings()` is patched to read |
| 9 | + `self.api_key`. |
| 10 | + |
| 11 | +2. **`workspace_id` and `session_id` are first-class kwargs and |
| 12 | + attributes.** Stock openapi-generator exposes apiKey security schemes |
| 13 | + only via an opaque `api_key: Dict[str, str]` dict keyed by scheme name. |
| 14 | + That's a footgun — callers have to know the generator's |
| 15 | + `apiKey`-security machinery to set a workspace scope. The template |
| 16 | + adds typed `workspace_id` / `session_id` kwargs (and properties) that |
| 17 | + store into a renamed `self.api_keys` dict. |
| 18 | + |
| 19 | +Net caller DX: |
| 20 | + |
| 21 | +```python |
| 22 | +cfg = hotdata.Configuration( |
| 23 | + api_key="sk_live_...", |
| 24 | + workspace_id="ws_abc", |
| 25 | + session_id="sb_xyz", |
| 26 | +) |
| 27 | +``` |
| 28 | + |
| 29 | +## Drift tripwire |
| 30 | + |
| 31 | +The regenerate workflow runs `import hotdata` and relies on |
| 32 | +`openapi-generator` 7.20.0 (pinned in `openapitools.json`). If a future |
| 33 | +release renames the mustache vars our patch references (`authMethods`, |
| 34 | +`isApiKey`, `isBasicBearer`, `isOAuth`, `name`, `keyParamName`), the |
| 35 | +import will fail and the regen PR will be obviously broken rather than |
| 36 | +shipping subtly wrong code. |
| 37 | + |
| 38 | +Bumping the pinned generator version should include a diff of this |
| 39 | +template against upstream's |
| 40 | +`modules/openapi-generator/src/main/resources/python/configuration.mustache`. |
0 commit comments