diff options
author | Michael Muré <batolettre@gmail.com> | 2019-07-06 16:32:57 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-07-06 16:32:57 +0200 |
commit | f4d4b2f41326d08fdfa574cd4732e950fa9532d8 (patch) | |
tree | 04cdd9508bf8c2fd1f3b928dd419a15cdb9709d0 /vendor/github.com/shurcooL/githubv4/gen.go | |
parent | aa4464dbba0b1e0ce39ae53e35971e6924d404d3 (diff) | |
parent | 9e611ee66787b9f005540395da2ea10b3320362c (diff) | |
download | git-bug-f4d4b2f41326d08fdfa574cd4732e950fa9532d8.tar.gz |
Merge pull request #166 from MichaelMure/github-exporter
[Bridge] GitHub exporter
Diffstat (limited to 'vendor/github.com/shurcooL/githubv4/gen.go')
-rw-r--r-- | vendor/github.com/shurcooL/githubv4/gen.go | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/vendor/github.com/shurcooL/githubv4/gen.go b/vendor/github.com/shurcooL/githubv4/gen.go index 43ad1e35..628ce57b 100644 --- a/vendor/github.com/shurcooL/githubv4/gen.go +++ b/vendor/github.com/shurcooL/githubv4/gen.go @@ -86,12 +86,12 @@ package githubv4 {{- define "enum" -}} -// {{.name}} {{.description | endSentence}} +// {{.name}} {{.description | clean | endSentence}} type {{.name}} string -// {{.description | fullSentence}} +// {{.description | clean | fullSentence}} const ({{range .enumValues}} - {{$.name}}{{.name | enumIdentifier}} {{$.name}} = {{.name | quote}} // {{.description | fullSentence}}{{end}} + {{$.name}}{{.name | enumIdentifier}} {{$.name}} = {{.name | quote}} // {{.description | clean | fullSentence}}{{end}} ) {{- end -}} `), @@ -110,12 +110,12 @@ type Input interface{} {{- define "inputObject" -}} -// {{.name}} {{.description | endSentence}} +// {{.name}} {{.description | clean | endSentence}} type {{.name}} struct {{"{"}}{{range .inputFields}}{{if eq .type.kind "NON_NULL"}} - // {{.description | fullSentence}} (Required.) + // {{.description | clean | fullSentence}} (Required.) {{.name | identifier}} {{.type | type}} ` + "`" + `json:"{{.name}}"` + "`" + `{{end}}{{end}} {{range .inputFields}}{{if ne .type.kind "NON_NULL"}} - // {{.description | fullSentence}} (Optional.) + // {{.description | clean | fullSentence}} (Optional.) {{.name | identifier}} {{.type | type}} ` + "`" + `json:"{{.name}},omitempty"` + "`" + `{{end}}{{end}} } {{- end -}} @@ -167,6 +167,7 @@ func t(text string) *template.Template { "identifier": func(name string) string { return ident.ParseLowerCamelCase(name).ToMixedCaps() }, "enumIdentifier": func(name string) string { return ident.ParseScreamingSnakeCase(name).ToMixedCaps() }, "type": typeString, + "clean": func(s string) string { return strings.Join(strings.Fields(s), " ") }, "endSentence": func(s string) string { s = strings.ToLower(s[0:1]) + s[1:] switch { |