Skip to content

Commit

Permalink
use toJSONNumber
Browse files Browse the repository at this point in the history
  • Loading branch information
candiduslynx committed Sep 26, 2023
1 parent 7c6ea7a commit 5fe0827
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions reflect.go
Original file line number Diff line number Diff line change
Expand Up @@ -859,13 +859,8 @@ func (t *Schema) numericalKeywords(tags []string) {
t.Examples = append(t.Examples, num)
}
case "enum":
switch t.Type {
case "integer":
i, _ := strconv.Atoi(val)
t.Enum = append(t.Enum, i)
case "number":
f, _ := strconv.ParseFloat(val, 64)
t.Enum = append(t.Enum, f)
if num, ok := toJSONNumber(val); ok {
t.Enum = append(t.Enum, num)
}
}
}
Expand Down

0 comments on commit 5fe0827

Please sign in to comment.