Skip to content

Commit

Permalink
fix enum processing
Browse files Browse the repository at this point in the history
  • Loading branch information
AgustinBettati committed Oct 18, 2024
1 parent 4af4852 commit b3ec0ed
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
10 changes: 5 additions & 5 deletions tools/codegen/schema/schema_attribute_timeout.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@ type timeoutAttributeGenerator struct {

func (s *timeoutAttributeGenerator) AttributeCode() CodeStatement {
var optionProperties string
for op := range s.timeouts.ConfigurableTimeouts {
for _, op := range s.timeouts.ConfigurableTimeouts {
switch op {
case int(codespec.Create):
case codespec.Create:
optionProperties += "Create: true,\n"
case int(codespec.Update):
case codespec.Update:
optionProperties += "Update: true,\n"
case int(codespec.Delete):
case codespec.Delete:
optionProperties += "Delete: true,\n"
case int(codespec.Read):
case codespec.Read:
optionProperties += "Read: true,\n"
}
}
Expand Down
2 changes: 1 addition & 1 deletion tools/codegen/schema/schema_file_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ func TestSchemaGenerationFromCodeSpec(t *testing.T) {
{
Name: "timeouts",
Timeouts: &codespec.TimeoutsAttribute{
ConfigurableTimeouts: []codespec.Operation{codespec.Create, codespec.Read, codespec.Delete},
ConfigurableTimeouts: []codespec.Operation{codespec.Create, codespec.Update, codespec.Delete},
},
},
},
Expand Down
2 changes: 1 addition & 1 deletion tools/codegen/schema/testdata/timeouts.golden.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ func ResourceSchema(ctx context.Context) schema.Schema {
"timeouts": timeouts.Attributes(ctx, timeouts.Opts{
Create: true,
Update: true,
Read: true,
Delete: true,
}),
},
}
Expand Down

0 comments on commit b3ec0ed

Please sign in to comment.