Skip to content

Commit

Permalink
Don't import 'github.com/aws/aws-sdk-go-v2/service/schemas' just for …
Browse files Browse the repository at this point in the history
…a single constant.
  • Loading branch information
ewbankkit committed Sep 14, 2023
1 parent 73ea978 commit 2f6e21e
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 10 deletions.
1 change: 0 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ require (
github.com/aws/aws-sdk-go-v2/service/s3 v1.38.5
github.com/aws/aws-sdk-go-v2/service/s3control v1.33.0
github.com/aws/aws-sdk-go-v2/service/scheduler v1.2.5
github.com/aws/aws-sdk-go-v2/service/schemas v1.16.6
github.com/aws/aws-sdk-go-v2/service/securitylake v1.7.0
github.com/aws/aws-sdk-go-v2/service/sesv2 v1.20.0
github.com/aws/aws-sdk-go-v2/service/signer v1.16.5
Expand Down
2 changes: 0 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -150,8 +150,6 @@ github.com/aws/aws-sdk-go-v2/service/s3control v1.33.0 h1:f4qHghGTcns4L4F7u8AHH6
github.com/aws/aws-sdk-go-v2/service/s3control v1.33.0/go.mod h1:YSdqo9knBVm5H3JVmWDhx9Wts9828nColUJzL3OKXDk=
github.com/aws/aws-sdk-go-v2/service/scheduler v1.2.5 h1:AGRPn7Hef59Eb9zfXjf6MGn0xRPpO73dIV8u8pfo5Z8=
github.com/aws/aws-sdk-go-v2/service/scheduler v1.2.5/go.mod h1:cdpHC7Nd4Yvtf/rhRqyqqI0fzoCb0fpo2oOFVZ0HTeQ=
github.com/aws/aws-sdk-go-v2/service/schemas v1.16.6 h1:Sqx33Tr3OBbMpuvj1zmltG1iXbHIZkZmuGkKNSMTi+Q=
github.com/aws/aws-sdk-go-v2/service/schemas v1.16.6/go.mod h1:IJI1++/Kjsjg6R3ZjOkR+MtW6TP1j1pU7CffPQDRNVQ=
github.com/aws/aws-sdk-go-v2/service/securitylake v1.7.0 h1:Ou2rjk3siybv09bzpi5fs+9zOYZACxT1LT0KkcDAtIs=
github.com/aws/aws-sdk-go-v2/service/securitylake v1.7.0/go.mod h1:/MCawoN8Xib5q04k2HsIQ+K2cNtC3CHamrfLZXd6KmA=
github.com/aws/aws-sdk-go-v2/service/sesv2 v1.20.0 h1:BVjuGDN2ek2gjSB46aIODXIYq3Aw/o0F/ZwBPP883GU=
Expand Down
12 changes: 5 additions & 7 deletions internal/service/schemas/schema.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import (
"time"

"github.com/YakDriver/regexache"
"github.com/aws/aws-sdk-go-v2/service/schemas/types"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/service/schemas"
"github.com/hashicorp/aws-sdk-go-base/v2/awsv1shim/v2/tfawserr"
Expand All @@ -18,6 +17,7 @@ import (
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation"
"github.com/hashicorp/terraform-provider-aws/internal/conns"
"github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag"
tfslices "github.com/hashicorp/terraform-provider-aws/internal/slices"
tftags "github.com/hashicorp/terraform-provider-aws/internal/tags"
"github.com/hashicorp/terraform-provider-aws/internal/tfresource"
"github.com/hashicorp/terraform-provider-aws/internal/verify"
Expand Down Expand Up @@ -78,7 +78,7 @@ func ResourceSchema() *schema.Resource {
"type": {
Type: schema.TypeString,
Required: true,
ValidateFunc: validation.StringInSlice(schemaTypes(), true),
ValidateFunc: validation.StringInSlice(type_Values(), true),
},

"version": {
Expand Down Expand Up @@ -236,9 +236,7 @@ func resourceSchemaDelete(ctx context.Context, d *schema.ResourceData, meta inte
return diags
}

func schemaTypes() []string {
return []string{
string(types.TypeOpenApi3),
string(types.TypeJSONSchemaDraft4),
}
func type_Values() []string {
// For some reason AWS SDK for Go v1 does not define a TypeJSONSchemaDraft4 constant.
return tfslices.AppendUnique(schemas.Type_Values(), "JSONSchemaDraft4")
}

0 comments on commit 2f6e21e

Please sign in to comment.