Skip to content

Commit 032aac5

Browse files
committed
add tagged field for v1 flexible messages
1 parent f8535d3 commit 032aac5

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

protocol/alterclientquotas/alterclientquotas.go

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,11 @@ func init() {
88

99
// Detailed API definition: https://kafka.apache.org/protocol#The_Messages_AlterClientQuotas
1010
type Request struct {
11-
Entries []Entry `kafka:"min=v0,max=v1"`
12-
ValidateOnly bool `kafka:"min=v0,max=v1"`
11+
// We need at least one tagged field to indicate that this is a "flexible" message
12+
// type.
13+
_ struct{} `kafka:"min=v1,max=v1,tag"`
14+
Entries []Entry `kafka:"min=v0,max=v1"`
15+
ValidateOnly bool `kafka:"min=v0,max=v1"`
1316
}
1417

1518
func (r *Request) ApiKey() protocol.ApiKey { return protocol.AlterClientQuotas }
@@ -35,6 +38,9 @@ type Ops struct {
3538
}
3639

3740
type Response struct {
41+
// We need at least one tagged field to indicate that this is a "flexible" message
42+
// type.
43+
_ struct{} `kafka:"min=v1,max=v1,tag"`
3844
ThrottleTimeMs int32 `kafka:"min=v0,max=v1"`
3945
Results []ResponseQuotas `kafka:"min=v0,max=v1"`
4046
}

protocol/describeclientquotas/describeclientquotas.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ func init() {
77
}
88

99
type Request struct {
10+
// We need at least one tagged field to indicate that this is a "flexible" message
11+
// type.
12+
_ struct{} `kafka:"min=v1,max=v1,tag"`
1013
Components []Component `kafka:"min=v0,max=v1"`
1114
Strict bool `kafka:"min=v0,max=v1"`
1215
}
@@ -24,6 +27,9 @@ type Component struct {
2427
}
2528

2629
type Response struct {
30+
// We need at least one tagged field to indicate that this is a "flexible" message
31+
// type.
32+
_ struct{} `kafka:"min=v1,max=v1,tag"`
2733
ThrottleTimeMs int32 `kafka:"min=v0,max=v1"`
2834
ErrorCode int16 `kafka:"min=v0,max=v1"`
2935
ErrorMessage string `kafka:"min=v0,max=v1,nullable"`

0 commit comments

Comments
 (0)