Skip to content

Commit

Permalink
Fixes linter complains
Browse files Browse the repository at this point in the history
  • Loading branch information
ksysoev authored and omissis committed Sep 30, 2023
1 parent 04c853c commit 25469af
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions pkg/generator/generate.go
Original file line number Diff line number Diff line change
Expand Up @@ -991,12 +991,13 @@ func (g *schemaGenerator) generateEnumType(
return nil, fmt.Errorf("invalid type %q: %w", t.Type[0], err)
}

//Enforce integer type for enum values
// Enforce integer type for enum values.
if t.Type[0] == "integer" {
for i, v := range t.Enum {
switch v.(type) {
switch v := v.(type) {
case float64:
t.Enum[i] = int(v.(float64))
t.Enum[i] = int(v)

default:
return nil, fmt.Errorf("%w %v", errEnumNonPrimitiveVal, v)
}
Expand Down

0 comments on commit 25469af

Please sign in to comment.