feat(gen): add dart and json output languages to gen types - #6230
Draft
spydon wants to merge 4 commits into
Draft
Conversation
This was referenced Aug 17, 2026
feat: add supabase_typegen package generating typed table definitions
supabase/supabase-flutter#1635
Draft
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds two
--langvalues tosupabase gen types, makingsupabase gen types --lang dartwork end to end:json: passes the language-neutralGeneratorMetadataintrospection document (the@supabase/postgrest-typegencontract) 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 thejsongenerator, collects the metadata instead of printing it, and pipes it throughdart 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 thesupabase_typegenpackage 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:
GeneratorMetadatacontract, and feat: consume @supabase/postgrest-typegen for type generation postgres-meta#1084 makes postgres-meta consume that package; thejsonvalue forPG_META_GENERATE_TYPESis added on top of it in feat: add json output exposing the GeneratorMetadata contract postgres-meta#1110 (stacked on fix: bump edge-runtime to v1.2.19 #1084; It should be possible to run npx supabase init without human interaction #1106 was closed as a duplicate of that stack), and this PR needs a pg-meta image that ships it.supabase_typegenpackage (its--input -/--output -stdin/stdout contract is already in place there).Implementation notes:
docs/go-cli-divergences.md;SIDE_EFFECTS.mdcovers the newdartsubprocess and the json-collection behavior.dart run supabase_typegen --input - --output -) is pinned intypes.shared.tsso the handler and tests share one definition.jsonpassthrough 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 #
open-for-contributionlabel (or I'm a Supabase maintainer).Checklist
fix(cli): …).pnpm check:allandpnpm testpass for the workspace(s) I touched (check:allfully; unit and integration suites forgen typespass, the docker-dependent e2e suite was not run locally).