Skip to content

Commit

Permalink
Fix: multiline enum was generating bad swagger
Browse files Browse the repository at this point in the history
  • Loading branch information
shane-tw committed Oct 8, 2021
1 parent 5465e14 commit fcb61ef
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion docparse/jsonschema.go
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,8 @@ func setTags(name, fName string, p *Schema, tags []string) error {
switch {
case strings.HasPrefix(t, "enum: "):
p.Type = "enum"
for _, e := range strings.Split(t[5:], " ") {
t = strings.Replace(t[5:], "\n", " ", 999)
for _, e := range strings.Split(t, " ") {
e = strings.TrimSpace(e)
if e != "" {
p.Enum = append(p.Enum, e)
Expand Down

0 comments on commit fcb61ef

Please sign in to comment.