Skip to content
This repository has been archived by the owner on Sep 6, 2021. It is now read-only.

Commit

Permalink
Fix it in generate.go
Browse files Browse the repository at this point in the history
  • Loading branch information
ustcweizhou authored and psycofdj committed Jan 22, 2021
1 parent 6c3a436 commit f3592da
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion generate/generate.go
Original file line number Diff line number Diff line change
Expand Up @@ -1355,7 +1355,7 @@ func (s *service) generateResponseType(a *API) {
// If this is a 'list' response, we need an separate list struct. There seem to be other
// types of responses that also need a separate list struct, so checking on exact matches
// for those once.
if strings.HasPrefix(a.Name, "list") || a.Name == "registerTemplate" {
if strings.HasPrefix(a.Name, "list") && a.Name != "listCapabilities" || a.Name == "registerTemplate" {
pn("type %s struct {", tn)
pn(" Count int `json:\"count\"`")

Expand All @@ -1376,6 +1376,12 @@ func (s *service) generateResponseType(a *API) {
pn("}")
pn("")
tn = parseSingular(ln)
} else if a.Name == "listCapabilities" {
pn("type %s struct {", tn)
pn(" %s *%s `json:\"%s\"`", ln, parseSingular(ln), "capability")
pn("}")
pn("")
tn = parseSingular(ln)
}

sort.Sort(a.Response)
Expand Down

0 comments on commit f3592da

Please sign in to comment.