Skip to content

feat(gen): add dart and json output languages to gen types - #6230

Draft
spydon wants to merge 4 commits into
developfrom
feat/gen-types-json-dart
Draft

feat(gen): add dart and json output languages to gen types#6230
spydon wants to merge 4 commits into
developfrom
feat/gen-types-json-dart

Conversation

@spydon

@spydon spydon commented Aug 17, 2026

Copy link
Copy Markdown

Summary

Adds two --lang values to supabase gen types, making supabase gen types --lang dart work end to end:

  • json: passes the language-neutral GeneratorMetadata introspection document (the @supabase/postgrest-typegen contract) straight through (the same catalog introspection the typescript/go/swift/python generators consume, with exact nullability, defaults, and identity information). This gives third-party and community type generators a single high-fidelity source instead of parsing lossy API descriptions.
  • dart: runs the pg-meta container with the json generator, collects the metadata instead of printing it, and pipes it through dart run supabase_typegen --input - --output - on the host. The generated Dart code arrives on stdout like every other language; the typegen's summary line goes to stderr. Requires the Dart SDK on PATH and the supabase_typegen package as a dev dependency of the current project; a missing SDK or failing typegen produces an actionable error.

Both languages work on every connection path (--local, --db-url, --linked, --project-id, and the implicit linked fallback), since non-TypeScript languages already run pg-meta directly.

Draft because of upstream dependencies:

Implementation notes:

  • The lang additions are TS-only and documented in docs/go-cli-divergences.md; SIDE_EFFECTS.md covers the new dart subprocess and the json-collection behavior.
  • The invocation contract (dart run supabase_typegen --input - --output -) is pinned in types.shared.ts so the handler and tests share one definition.
  • Integration tests cover the json passthrough env, the dart pipe (metadata collected rather than printed, dart argv, generated code on stdout), and the non-zero typegen exit error.

Linked issue

Closes #

  • The linked issue is open and carries the open-for-contribution label (or I'm a Supabase maintainer).

Checklist

  • The PR title follows Conventional Commits (e.g. fix(cli): …).
  • Tests added or updated for the change.
  • pnpm check:all and pnpm test pass for the workspace(s) I touched (check:all fully; unit and integration suites for gen types pass, the docker-dependent e2e suite was not run locally).

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