Skip to content

fix: forward types in pgTypeToGoType array fallback so enum arrays resolve to []string#1074

Merged
avallete merged 1 commit intosupabase:masterfrom
oniani1:fix/typegen-go-array-types
Apr 30, 2026
Merged

fix: forward types in pgTypeToGoType array fallback so enum arrays resolve to []string#1074
avallete merged 1 commit intosupabase:masterfrom
oniani1:fix/typegen-go-array-types

Conversation

@oniani1
Copy link
Copy Markdown
Contributor

@oniani1 oniani1 commented Apr 29, 2026

pgTypeToGoType recurses through the array branch with only (pgType, nullable), so the third argument defaults to []. Inner enums and composites then can't be resolved and fall through to interface{}, even though the same enum resolves to string outside an array.

This forwards types to the recursive call.

Added test/server/templates/go.test.ts with three cases: non-nullable array of enum should be []string, nullable array of enum should be []*string, and plain text[] continues to be []string. Calls apply with mock GeneratorMetadata so the test runs without Docker.

Closes #1073

@oniani1 oniani1 requested review from a team, avallete and soedirgo as code owners April 29, 2026 20:19
Copy link
Copy Markdown
Member

@avallete avallete left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank's for your contribution !

@avallete avallete merged commit 27e7023 into supabase:master Apr 30, 2026
6 checks passed
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.

Go typegen returns []interface{} for arrays of enums and composite types

2 participants