Repository navigation
fix(self-hosted): type generation should respect exposed schemas - #47577
Conversation
Self-hosted TypeScript type generation ignored PGRST_DB_SCHEMAS and used a hardcoded include/exclude schema list, so generated types didn't match the schemas actually exposed on the Data API. There was also a param-name typo: pg-meta's typescript generator reads `included_schemas` (plural), but the request sent `included_schema` (singular), which pg-meta silently ignores. Filtering was therefore done entirely by the `excluded_schemas` blocklist, and the "include" list never had any effect. Switch to the plural `included_schemas` param and pass DEFAULT_EXPOSED_SCHEMAS (derived from PGRST_DB_SCHEMAS). A non-empty list is treated by pg-meta as a strict allowlist, so generated types now cover exactly the exposed schemas and the hardcoded exclude list is no longer needed. Also point the self-hosted PostgREST config route at DEFAULT_EXPOSED_SCHEMAS so the fallback default lives in one place, and drop `storage` from that fallback (dev/test only; the shipped .env.example default is unchanged). Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
|
This pull request has been ignored for the connected project Preview Branches by Supabase. |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
5 Skipped Deployments
|
📝 WalkthroughWalkthroughThe default exposed PostgREST schema list is changed to exclude ChangesDefault Exposed Schemas Update
Estimated code review effort: 2 (Simple) | ~10 minutes Related Issues: Not specified in the provided data. Related PRs: Not specified in the provided data. Suggested labels: self-hosted, api Suggested reviewers: Not specified in the provided data. 🐰 A schema once held storage tight, 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
🎭 Playwright Test ResultsDetails
Flaky testsFeatures › sql-editor.spec.ts › SQL Editor › should check if SQL editor is working as expected Skipped testsFeatures › auth-users.spec.ts › should show web3 users as enabled when the matching web3 provider is enabled |
Braintrust eval report
|
I have read the CONTRIBUTING.md file.
YES
What kind of change does this PR introduce?
In non-platform Studio, Generate and download types (Data API docs → Tables and Views → Introduction) ignored the operator's
PGRST_DB_SCHEMASconfig. It called pg-meta with a hardcoded include list (public,graphql_public,storage)plus a hardcoded
excluded_schemasblocklist of internal schemas.Two problems:
PGRST_DB_SCHEMAShad no effect.included_schemas(plural), but the request usedincluded_schema(singular), which pg-meta silently ignores. So the include list never did anything - filtering was done entirely by theexcluded_schemasblocklist.Fixes:
generateTypescriptTypesnow requestsincluded_schemas(plural) withDEFAULT_EXPOSED_SCHEMAS(derived fromPGRST_DB_SCHEMAS). pg-meta treats a non-empty list as a strict allowlist, so generated types cover exactly the exposed schemas/config/postgrest) now reusesDEFAULT_EXPOSED_SCHEMASinstead of duplicating the fallback string, so the fallback default lives in one place and the config route and type generation stay in syncstoragefrom theDEFAULT_EXPOSED_SCHEMASfallback. This only affects the dev/test fallback whenPGRST_DB_SCHEMASis unsetSummary by CodeRabbit
storagewhen no custom schema list is set.