8000 fix(gen): change HttpBody.Data from string to any for monitoring:v1 (… · googleapis/google-api-go-client@eda6a59 · GitHub
[go: up one dir, main page]

Skip to content

Commit eda6a59

Browse files
authored
fix(gen): change HttpBody.Data from string to any for monitoring:v1 (#2744)
fixes: #2304
1 parent f836095 commit eda6a59

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

google-api-go-generator/gen.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1587,6 +1587,14 @@ func (s *Schema) writeSchemaStruct(api *API) {
15871587
typ = "*" + typ
15881588
}
15891589

1590+
// HACK(chrisdsmith) Hardcodes HttpBody.Data to the Go type "any" only
1591+
// for monitoring:v1 in order to avoid errors with JSON objects in the responses.
1592+
// (json: cannot unmarshal object into Go struct field HttpBody.data of type string)
1593+
// See https://github.com/googleapis/google-api-go-client/issues/2304
1594+
if s.api.Name == "monitoring" && s.api.Version == "v1" && s.GoName() == "HttpBody" && pname == "Data" {
1595+
typ = "any"
1596+
}
1597+
15901598
s.api.pn(" %s %s `json:\"%s,omitempty%s\"`", pname, typ, p.p.Name, extraOpt)
15911599
if firstFieldName == "" {
15921600
firstFieldName = pname

monitoring/v1/monitoring-gen.go

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)
0