Skip to content

feat: add runtime/templates package for declarative connectors (template-connectors v2, PR 1)#9325

Draft
royendo wants to merge 6 commits into
mainfrom
royendo/template-connectors-v2
Draft

feat: add runtime/templates package for declarative connectors (template-connectors v2, PR 1)#9325
royendo wants to merge 6 commits into
mainfrom
royendo/template-connectors-v2

Conversation

@royendo
Copy link
Copy Markdown
Contributor

@royendo royendo commented Apr 28, 2026

First slice of the template-connectors restart (PR 1 of 4 from PRD-template-connectors-v2.md). Lands the new runtime/templates package and the JSON template definitions, with no consumers — RPCs, frontend rewire, and TS deletions follow in subsequent PRs.

  • New runtime/templates package: Registry (loads embedded definitions/*/*.json), Render (schema-driven property processing, x-secret env-var extraction, x-step splitting, headers handling), and helpers in funcmap.go for duckdbSQL, Azure URI decomposition, S3/GCS HTTPS conversion, and ClickHouse url()/headers() SQL.
  • 36 connector definitions: 6 OLAPs, 18 source-to-DuckDB, 12 source-to-ClickHouse. JSON Schema drives the form on the frontend (PR 3) and property metadata on the backend.
  • definitions/README.md documents the x-* extension dictionary and the template helper API so future connector authors don't have to reverse-engineer it.
  • defaultVal keeps the v1 review hardening (positional-only) and the //go:embed glob is tightened to definitions/*/*.json so editor swap files / docs can't slip in.

Restart of #8981. The ported code came from feat-template-connector with the embed-glob and README updates applied on top.

Checklist:

  • Covered by tests
  • Ran it and it works as intended
  • Reviewed the diff before requesting a review
  • Checked for unhandled edge cases
  • Linked the issues it closes
  • Checked if the docs need to be updated. If so, create a separate Linear DOCS issue
  • Intend to cherry-pick into the release branch
  • I'm proud of this work!

Developed in collaboration with Claude Code

royendo and others added 6 commits April 28, 2026 12:01
Captures scope, splittable changes (EnvVarName/headers/icons), and
sequenced PR plan derived from #8981.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
HTTPS headers ConfigProperty is form metadata only — should ship with
the HTTPS template that uses it. ClickHouse url()/headers() SQL is
inside runtime/templates/funcmap.go and headers.go, not a separate
driver change.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Drop the PR-A and PR-D split notes; land the HTTPS `headers`
ConfigProperty and ClickHouse `url()`/`headers()` SQL helpers as
part of PR 1 instead. Remove the DuckLake out-of-scope bullet
since DuckLake never used template schemas.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
…ates

Introduces a new package that loads connector and OLAP templates from
embedded JSON definitions, validates them against a JSON Schema, and
renders YAML output via Go `text/template` with `[[ ]]` delimiters.
This replaces the hand-written TypeScript schemas and the Go-side
template code used by the legacy add-data flow; the runtime becomes
the single source of truth for connector form metadata, secret
extraction, and YAML generation.

Includes:

- `registry.go` — loads `definitions/*/*.json` at process start (strict
  embed glob), preserves JSON property order for stable form rendering.
- `render.go` — schema-driven property processing: `x-secret` extraction
  to `.env`, `x-omit-if-default` suppression, `x-step` splitting between
  connector and source outputs, header map handling.
- `funcmap.go` — template helpers: `renderProps`, `duckdbSQL`, Azure URI
  decomposition, `s3ToHTTPS` / `gcsToHTTPS`, `clickhouseFormat`,
  `clickhouseURLSuffix`. `default` only supports positional syntax.
- `env.go` — `ResolveEnvVarNameForKey` with `_1`/`_2` suffix-on-conflict
  policy and `.env` key reader.
- `headers.go` — sensitive header detection, auth-scheme prefix split,
  env-var name derivation for HTTPS `headers` properties.
- 36 JSON definitions: 6 OLAPs, 18 DuckDB-targeted source connectors,
  12 ClickHouse-targeted source connectors.
- `definitions/README.md` — documents the JSON Schema `x-*` extension
  dictionary and template helpers.

No consumers yet; the new `ListTemplates` and `GenerateFile` RPCs land
in a follow-up PR.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Working notes; not intended to ship.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
… databricks source

Catches the templates package up to current `main`, which now ships
OLAP support for these drivers and a databricks-as-source path that
postdate the original v1 PR.

- `olap/databricks.json`, `olap/bigquery.json`, `olap/snowflake.json` —
  OLAP connector forms backed by `runtime/drivers/{driver}/olap.go`.
- `olap/ducklake.json` — driver `duckdb` with the phase-1 single-field
  ATTACH-clause form from `web-common/.../schemas/ducklake.ts`.
- `duckdb-models/databricks-duckdb.json` — Databricks as a DuckDB source
  (per `feat: databricks as duckdb src` #9288).
- Removes `duckdb-models/clickhouse-duckdb.json`; ClickHouse is not a
  source-into-DuckDB target.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant