feat: add json output exposing the GeneratorMetadata contract - #1110
Open
spydon wants to merge 1 commit into
Open
feat: add json output exposing the GeneratorMetadata contract#1110spydon wants to merge 1 commit into
spydon wants to merge 1 commit into
Conversation
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.
What kind of change does this PR introduce?
Feature, stacked on #1084 (base branch is its
claude/funny-tesla-wofjdjhead; only the last commit is new). Adds ajsonoutput alongside typescript, go, swift, and python, emitting the rawGeneratorMetadatacontract of@supabase/postgrest-typegenthat #1084 makes postgres-meta consume.What is the new behavior?
GET /generators/jsonreturns the introspectedGeneratorMetadata(schemas, tables, foreign tables, views, materialized views, columns, relationships, functions, types) as pretty-printed JSON, with the sameincluded_schemas/excluded_schemasquery parameters as the other generators.PG_META_GENERATE_TYPES=json(and thegen:types:jsonnpm script) emits the same document on stdout, so the Supabase CLI can expose it assupabase gen types --lang jsonand pipe it into out-of-process generators as--lang dart(feat(gen): add dart and json output languages to gen types cli#6230, feat: add supabase_typegen package generating typed table definitions supabase-flutter#1635 whose parser consumes exactly this contract).This gives third-party and community type generators a single high-fidelity, language-neutral introspection source: exact nullability, database defaults, identity and generated columns, enum values, views, and materialized views, which lossy sources like the PostgREST OpenAPI description cannot provide.
Additional context
JSON.stringifyover thesortGeneratorMetadata-canonicalized introspection result, so it adds no new queries and stays in sync with whatever the built-in generators see.versionenvelope; whether the serialized contract should carry one is raised on the postgrest-typegen RFC.master(SSL and query-timeout tests).