Skip to content

Commit 524f629

Browse files
committed
video: changed protocol field to interface{}
one non-conforming exchange sends multiple protocols in both the protocols and the protocol field which causes an unmarshalling error
1 parent 20dca94 commit 524f629

File tree

1 file changed

+23
-26
lines changed

1 file changed

+23
-26
lines changed

video.go

Lines changed: 23 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -7,28 +7,28 @@ import (
77
// The "video" object must be included directly in the impression object if the impression offered
88
// for auction is an in-stream video ad opportunity.
99
type Video struct {
10-
Mimes []string `json:"mimes,omitempty"` // Content MIME types supported.
11-
Minduration *int `json:"minduration,omitempty"` // Minimum video ad duration in seconds
12-
Maxduration *int `json:"maxduration,omitempty"` // Maximum video ad duration in seconds
13-
Protocol *int `json:"protocol,omitempty"` // Video bid response protocols
14-
Protocols []int `json:"protocols,omitempty"` // Video bid response protocols
15-
W *int `json:"w,omitempty"` // Width of the player in pixels
16-
H *int `json:"h,omitempty"` // Height of the player in pixels
17-
Startdelay *int `json:"startdelay,omitempty"` // Indicates the start delay in seconds
18-
Linearity *int `json:"linearity,omitempty"` // Indicates whether the ad impression is linear or non-linear
19-
Sequence *int `json:"sequence,omitempty"` // Default: 1
20-
Battr []int `json:"battr,omitempty"` // Blocked creative attributes
21-
Maxextended *int `json:"maxextended,omitempty"` // Maximum extended video ad duration
22-
Minbitrate *int `json:"minbitrate,omitempty"` // Minimum bit rate in Kbps
23-
Maxbitrate *int `json:"maxbitrate,omitempty"` // Maximum bit rate in Kbps
24-
Boxingallowed *int `json:"boxingallowed,omitempty"` // If exchange publisher has rules preventing letter boxing
25-
Playbackmethod []int `json:"playbackmethod,omitempty"` // List of allowed playback methods
26-
Delivery []int `json:"delivery,omitempty"` // List of supported delivery methods
27-
Pos *int `json:"pos,omitempty"` // Ad Position
28-
Companionad []Banner `json:"companionad,omitempty"`
29-
Api []int `json:"api,omitempty"` // List of supported API frameworks
30-
Companiontype []int `json:"companiontype,omitempty"`
31-
Ext Extensions `json:"ext,omitempty"`
10+
Mimes []string `json:"mimes,omitempty"` // Content MIME types supported.
11+
Minduration *int `json:"minduration,omitempty"` // Minimum video ad duration in seconds
12+
Maxduration *int `json:"maxduration,omitempty"` // Maximum video ad duration in seconds
13+
Protocol interface{} `json:"protocol,omitempty"` // Video bid response protocols - use interface{} to cater for nonconformant exchanges
14+
Protocols []int `json:"protocols,omitempty"` // Video bid response protocols
15+
W *int `json:"w,omitempty"` // Width of the player in pixels
16+
H *int `json:"h,omitempty"` // Height of the player in pixels
17+
Startdelay *int `json:"startdelay,omitempty"` // Indicates the start delay in seconds
18+
Linearity *int `json:"linearity,omitempty"` // Indicates whether the ad impression is linear or non-linear
19+
Sequence *int `json:"sequence,omitempty"` // Default: 1
20+
Battr []int `json:"battr,omitempty"` // Blocked creative attributes
21+
Maxextended *int `json:"maxextended,omitempty"` // Maximum extended video ad duration
22+
Minbitrate *int `json:"minbitrate,omitempty"` // Minimum bit rate in Kbps
23+
Maxbitrate *int `json:"maxbitrate,omitempty"` // Maximum bit rate in Kbps
24+
Boxingallowed *int `json:"boxingallowed,omitempty"` // If exchange publisher has rules preventing letter boxing
25+
Playbackmethod []int `json:"playbackmethod,omitempty"` // List of allowed playback methods
26+
Delivery []int `json:"delivery,omitempty"` // List of supported delivery methods
27+
Pos *int `json:"pos,omitempty"` // Ad Position
28+
Companionad []Banner `json:"companionad,omitempty"`
29+
Api []int `json:"api,omitempty"` // List of supported API frameworks
30+
Companiontype []int `json:"companiontype,omitempty"`
31+
Ext Extensions `json:"ext,omitempty"`
3232
}
3333

3434
// Returns the sequence number, with default fallback
@@ -126,9 +126,6 @@ func (v *Video) SetMaxduration(mdur int) *Video {
126126

127127
// Set the Protocol
128128
func (v *Video) SetProtocol(p int) *Video {
129-
if v.Protocol == nil {
130-
v.Protocol = new(int)
131-
}
132-
*v.Protocol = p
129+
v.Protocol = p
133130
return v
134131
}

0 commit comments

Comments
 (0)