diff --git a/.travis.yml b/.travis.yml index 0b6df85..fd5ac41 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,6 +1,6 @@ language: go go: - - 1.10.x + - 1.17.x go_import_path: github.com/teamwork/kommentaar notifications: email: false @@ -10,6 +10,8 @@ cache: - $HOME/.cache/go-build install: - ./bin/setup-travis +env: + - GO111MODULE=off script: - cd $HOME/gopath/src/github.com/teamwork/kommentaar - ./bin/test -race ./... diff --git a/docparse/jsonschema.go b/docparse/jsonschema.go index 390fa5a..70ff5ef 100644 --- a/docparse/jsonschema.go +++ b/docparse/jsonschema.go @@ -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.ReplaceAll(t[5:], "\n", " ") + for _, e := range strings.Split(t, " ") { e = strings.TrimSpace(e) if e != "" { p.Enum = append(p.Enum, e) diff --git a/docparse/jsonschema_test.go b/docparse/jsonschema_test.go index f1c06ff..8fb89c9 100644 --- a/docparse/jsonschema_test.go +++ b/docparse/jsonschema_test.go @@ -30,7 +30,7 @@ func TestFieldToProperty(t *testing.T) { "deeper": {Reference: "a.refAnother"}, "docs": {Type: "string", Description: "This has some documentation!", Required: []string{"docs"}, - Enum: []string{"one", "two", "three"}, + Enum: []string{"one", "two", "three", "four", "five", "six", "seven"}, }, } diff --git a/docparse/testdata/src/a/a.go b/docparse/testdata/src/a/a.go index 8b55415..99feb59 100644 --- a/docparse/testdata/src/a/a.go +++ b/docparse/testdata/src/a/a.go @@ -30,7 +30,8 @@ type foo struct { deeper refAnother // This has some documentation! {required} - // {enum: one two three} + // {enum: one two three + // four five six seven} docs string //m map[string]int }