Skip to content

Commit d083391

Browse files
authored
chore: bump openapi spec and overlay (#4293)
2 parents 4785f7a + fb16450 commit d083391

File tree

6 files changed

+477
-20
lines changed

6 files changed

+477
-20
lines changed

api/overlay.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,9 @@ actions:
3232
- target: $.components.schemas.*.properties.connectionString
3333
description: Removes deprecated field that conflicts with naming convention
3434
remove: true
35+
- target: $.components.schemas.*.properties.region_selection.discriminator
36+
description: Replaces discriminated union with concrete type
37+
remove: true
3538
- target: $.components.schemas.*.properties.private_jwk.discriminator
3639
description: Replaces discriminated union with concrete type
3740
remove: true

cmd/projects.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import (
1414
"github.com/supabase/cli/internal/utils"
1515
"github.com/supabase/cli/internal/utils/flags"
1616
"github.com/supabase/cli/pkg/api"
17+
"github.com/supabase/cli/pkg/cast"
1718
"golang.org/x/term"
1819
)
1920

@@ -78,7 +79,7 @@ var (
7879
Name: projectName,
7980
OrganizationId: orgId,
8081
DbPass: dbPassword,
81-
Region: api.V1CreateProjectBodyRegion(region.Value),
82+
Region: cast.Ptr(api.V1CreateProjectBodyRegion(region.Value)),
8283
}
8384
if cmd.Flags().Changed("size") {
8485
body.DesiredInstanceSize = (*api.V1CreateProjectBodyDesiredInstanceSize)(&size.Value)

internal/projects/create/create.go

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,11 +74,13 @@ func promptMissingParams(ctx context.Context, body *api.V1CreateProjectBody) err
7474
}
7575
fmt.Fprintln(os.Stderr, printKeyValue("Selected org-id", body.OrganizationId))
7676
}
77-
if len(body.Region) == 0 {
78-
if body.Region, err = promptProjectRegion(ctx); err != nil {
77+
if body.Region == nil || len(*body.Region) == 0 {
78+
region, err := promptProjectRegion(ctx)
79+
if err != nil {
7980
return err
8081
}
81-
fmt.Fprintln(os.Stderr, printKeyValue("Selected region", string(body.Region)))
82+
body.Region = &region
83+
fmt.Fprintln(os.Stderr, printKeyValue("Selected region", string(region)))
8284
}
8385
if len(body.DbPass) == 0 {
8486
body.DbPass = flags.PromptPassword(os.Stdin)

internal/projects/create/create_test.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,15 @@ import (
1111
"github.com/supabase/cli/internal/testing/apitest"
1212
"github.com/supabase/cli/internal/utils"
1313
"github.com/supabase/cli/pkg/api"
14+
"github.com/supabase/cli/pkg/cast"
1415
)
1516

1617
func TestProjectCreateCommand(t *testing.T) {
1718
var params = api.V1CreateProjectBody{
1819
Name: "Test Project",
1920
OrganizationId: "combined-fuchsia-lion",
2021
DbPass: "redacted",
21-
Region: api.V1CreateProjectBodyRegionUsWest1,
22+
Region: cast.Ptr(api.V1CreateProjectBodyRegionUsWest1),
2223
}
2324

2425
t.Run("creates a new project", func(t *testing.T) {
@@ -38,7 +39,7 @@ func TestProjectCreateCommand(t *testing.T) {
3839
Id: apitest.RandomProjectRef(),
3940
OrganizationId: params.OrganizationId,
4041
Name: params.Name,
41-
Region: string(params.Region),
42+
Region: string(*params.Region),
4243
CreatedAt: "2022-04-25T02:14:55.906498Z",
4344
})
4445
// Run test

pkg/api/client.gen.go

Lines changed: 136 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)