openrtb2: use 2.6 test examples

This commit is contained in:
mxmCherry
2022-05-16 23:03:02 +03:00
parent a27c40aabf
commit 917bf91516
22 changed files with 536 additions and 21 deletions
+35 -12
View File
@@ -28,29 +28,52 @@ var _ = Describe("BidRequest", func() {
Expect(actual).To(MatchJSON(expected))
},
// 2.5
Entry(
"Simple Banner",
"bid-request/simple-banner.json",
"2.5 Simple Banner",
"bid-request/2.5/simple-banner.json",
new(BidRequest)),
Entry(
"Expandable Creative",
"bid-request/expandable-creative.json",
"2.5 Expandable Creative",
"bid-request/2.5/expandable-creative.json",
new(BidRequest)),
Entry(
"Mobile",
"bid-request/mobile.json",
"2.5 Mobile",
"bid-request/2.5/mobile.json",
new(BidRequest)),
Entry(
"Video",
"bid-request/video.json",
"2.5 Video",
"bid-request/2.5/video.json",
new(BidRequest)),
Entry(
"PMP with Direct Deal",
"bid-request/pmp-with-direct-deal.json",
"2.5 PMP with Direct Deal",
"bid-request/2.5/pmp-with-direct-deal.json",
new(BidRequest)),
Entry(
"Native Ad",
"bid-request/native-ad.json",
"2.5 Native Ad",
"bid-request/2.5/native-ad.json",
new(BidRequest)),
// 2.6
Entry(
"2.6 Simple Banner",
"bid-request/2.6/simple-banner.json",
new(BidRequest)),
Entry(
"2.6 Expandable Creative",
"bid-request/2.6/expandable-creative.json",
new(BidRequest)),
Entry(
"2.6 Mobile",
"bid-request/2.6/mobile.json",
new(BidRequest)),
Entry(
"2.6 Video",
"bid-request/2.6/video.json",
new(BidRequest)),
Entry(
"2.6 PMP with Direct Deal",
"bid-request/2.6/pmp-with-direct-deal.json",
new(BidRequest)),
)
})
+27 -8
View File
@@ -28,21 +28,40 @@ var _ = Describe("BidResponse", func() {
Expect(actual).To(MatchJSON(expected))
},
// 2.5
Entry(
"Ad Served on Win Notice",
"bid-response/ad-served-on-win-notice.json",
"2.5 Ad Served on Win Notice",
"bid-response/2.5/ad-served-on-win-notice.json",
new(BidResponse)),
Entry(
"VAST XML Document Returned Inline",
"bid-response/vast-xml-document-returned-inline.json",
"2.5 VAST XML Document Returned Inline",
"bid-response/2.5/vast-xml-document-returned-inline.json",
new(BidResponse)),
Entry(
"Direct Deal Ad Served on Win Notice",
"bid-response/direct-deal-ad-served-on-win-notice.json",
"2.5 Direct Deal Ad Served on Win Notice",
"bid-response/2.5/direct-deal-ad-served-on-win-notice.json",
new(BidResponse)),
Entry(
"Native Markup Returned Inline",
"bid-response/native-markup-returned-inline.json",
"2.5 Native Markup Returned Inline",
"bid-response/2.5/native-markup-returned-inline.json",
new(BidResponse)),
// 2.6
Entry(
"2.6 Ad Served on Win Notice",
"bid-response/2.6/ad-served-on-win-notice.json",
new(BidResponse)),
Entry(
"2.6 VAST XML Document Returned Inline",
"bid-response/2.6/vast-xml-document-returned-inline.json",
new(BidResponse)),
Entry(
"2.6 Direct Deal Ad Served on Win Notice",
"bid-response/2.6/direct-deal-ad-served-on-win-notice.json",
new(BidResponse)),
Entry(
"2.6 Native Markup Returned Inline",
"bid-response/2.6/native-markup-returned-inline.json",
new(BidResponse)),
)
})
+10 -1
View File
@@ -1,5 +1,14 @@
# testdata
JSON examples copied from [OpenRTB](https://iabtechlab.com/standards/openrtb/) [2.6](https://iabtechlab.com/wp-content/uploads/2022/04/OpenRTB-2-6_FINAL.pdf) spec - section 6. Bid Request/Response Samples.
JSON examples copied from [OpenRTB](https://iabtechlab.com/standards/openrtb/) spec documents:
- [2.5](https://iabtechlab.com/wp-content/uploads/2016/07/OpenRTB-API-Specification-Version-2-5-FINAL.pdf) spec - section 6. Bid Request/Response Samples
- [2.6](https://iabtechlab.com/wp-content/uploads/2022/04/OpenRTB-2-6_FINAL.pdf) spec - section 6. Bid Request/Response Samples
Some empty/zero attributes were omited (not copied) because of [encoding/json](https://golang.org/pkg/encoding/json/) `omitempty` and [gomega.MatchJSON(...)](http://onsi.github.io/gomega/#matchjsonjson-interface).
Sloppy examples (and types) is not something new for OpenRTB spec, so the following adjustments were made:
- [bid-request/2.6/simple-banner.json](bid-request/2.6/simple-banner.json) - spec example embedded `user` into `site`, moved `user` to top level
- [bid-request/2.6/expandable-creative.json](bid-request/2.6/expandable-creative.json) - `data[2].value` added, moved to `data[2].segment[0].value`
- [bid-request/2.6/mobile.json](bid-request/2.6/mobile.json) - `imp[0].instl = 0` removed (because of JSON/omitempty)
- [bid-request/2.6/VIDEO.json](bid-request/2.6/VIDEO.json) - `imp[0].video.apis` renamed to `api` (it is singular in spec, but plural in example)
@@ -0,0 +1,68 @@
{
"id": "123456789316e6ede735f123ef6e32361bfc7b22",
"at": 2,
"cur": [
"USD"
],
"imp": [
{
"id": "1",
"bidfloor": 0.03,
"iframebuster": [
"vendor1.com",
"vendor2.com"
],
"banner": {
"h": 250,
"w": 300,
"pos": 0,
"battr": [
13
],
"expdir": [
2,
4
]
}
}
],
"site": {
"id": "102855",
"cat": [
"IAB3-1"
],
"domain": "www.foobar.com",
"page": "http://www.foobar.com/1234.html",
"publisher": {
"id": "8953",
"name": "foobar.com",
"cat": [
"IAB3-1"
],
"domain": "foobar.com"
}
},
"user": {
"id": "55816b39711f9b5acf3b90e313ed29e51665623f",
"buyeruid": "545678765467876567898765678987654",
"data": [
{
"id": "12341318394918",
"name": "auto intenders"
},
{
"id": "1234131839491234",
"name": "auto enthusiasts"
},
{
"id": "23423424",
"name": "data-provider1-age",
"segment": [
{
"value": "30-40"
}
]
}
]
}
}
+70
View File
@@ -0,0 +1,70 @@
{
"id": "IxexyLDIIk",
"at": 2,
"bcat": [
"IAB25",
"IAB7-39",
"IAB8-18",
"IAB8-5",
"IAB9-9"
],
"badv": [
"apple.com",
"go-text.me",
"heywire.com"
],
"imp": [
{
"id": "1",
"bidfloor": 0.5,
"tagid": "agltb3B1Yi1pbmNyDQsSBFNpdGUY7fD0FAw",
"banner": {
"w": 728,
"h": 90,
"pos": 1,
"btype": [
4
],
"battr": [
14
],
"api": [
3
]
}
}
],
"app": {
"id": "agltb3B1Yi1pbmNyDAsSA0FwcBiJkfIUDA",
"name": "Yahoo Weather",
"cat": [
"IAB15",
"IAB15-10"
],
"ver": "1.0.2",
"bundle": "12345",
"storeurl": "https://itunes.apple.com/id628677149",
"publisher": {
"id": "agltb3B1Yi1pbmNyDAsSA0FwcBiJkfTUCV",
"name": "yahoo",
"domain": "www.yahoo.com"
}
},
"device": {
"dnt": 0,
"ua": "Mozilla/5.0 (iPhone; CPU iPhone OS 6_1 like Mac OS X) AppleWebKit/534.46 (KHTML, like Gecko) Version/5.1 Mobile/9A334 Safari/7534.48.3",
"ifa": "AA000DFE74168477C70D291f574D344790E0BB11",
"carrier": "VERIZON",
"language": "en",
"make": "Apple",
"model": "iPhone",
"os": "iOS",
"osv": "6.1",
"js": 1,
"connectiontype": 3,
"devicetype": 1
},
"user": {
"id": "ffffffd5135596709273b3a1a07e466ea2bf4fff"
}
}
@@ -0,0 +1,61 @@
{
"id": "80ce30c53c16e6ede735f123ef6e32361bfc7b22",
"at": 1,
"cur": [
"USD"
],
"imp": [
{
"id": "1",
"bidfloor": 0.03,
"banner": {
"h": 250,
"w": 300,
"pos": 0
},
"pmp": {
"private_auction": 1,
"deals": [
{
"id": "AB-Agency1-0001",
"at": 1,
"bidfloor": 2.5,
"wseat": [
"Agency1"
]
},
{
"id": "XY-Agency2-0001",
"at": 2,
"bidfloor": 2,
"wseat": [
"Agency2"
]
}
]
}
}
],
"site": {
"id": "102855",
"domain": "www.foobar.com",
"cat": [
"IAB3-1"
],
"page": "http://www.foobar.com/1234.html",
"publisher": {
"id": "8953",
"name": "foobar.com",
"cat": [
"IAB3-1"
],
"domain": "foobar.com"
}
},
"device": {
"ua": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_6_8) AppleWebKit/537.13 (KHTML, like Gecko) Version/5.1.7 Safari/534.57.2"
},
"user": {
"id": "55816b39711f9b5acf3b90e313ed29e51665623f"
}
}
+37
View File
@@ -0,0 +1,37 @@
{
"id": "80ce30c53c16e6ede735f123ef6e32361bfc7b22",
"at": 1,
"cur": [
"USD"
],
"imp": [
{
"id": "1",
"bidfloor": 0.03,
"banner": {
"h": 250,
"w": 300,
"pos": 0
}
}
],
"site": {
"id": "102855",
"cat": [
"IAB3-1"
],
"domain": "www.foobar.com",
"page": "http://www.foobar.com/1234.html ",
"publisher": {
"id": "8953",
"name": "foobar.com",
"cat": [
"IAB3-1"
],
"domain": "foobar.com"
}
},
"user": {
"id": "55816b39711f9b5acf3b90e313ed29e51665623f"
}
}
+130
View File
@@ -0,0 +1,130 @@
{
"id": "1234567893",
"at": 2,
"tmax": 120,
"imp": [
{
"id": "1",
"bidfloor": 0.03,
"video": {
"w": 640,
"h": 480,
"pos": 1,
"startdelay": 0,
"minduration": 5,
"maxduration": 30,
"maxextended": 30,
"minbitrate": 300,
"maxbitrate": 1500,
"api": [
1,
2
],
"protocols": [
2,
3
],
"mimes": [
"video/x-flv",
"video/mp4",
"application/javascript"
],
"linearity": 1,
"boxingallowed": 1,
"playbackmethod": [
1,
3
],
"delivery": [
2
],
"battr": [
13,
14
],
"companionad": [
{
"id": "1234567893-1",
"w": 300,
"h": 250,
"pos": 1,
"battr": [
13,
14
],
"expdir": [
2,
4
]
},
{
"id": "1234567893-2",
"w": 728,
"h": 90,
"pos": 1,
"battr": [
13,
14
]
}
],
"companiontype": [
1,
2
]
}
}
],
"site": {
"id": "1345135123",
"name": "Site ABCD",
"domain": "siteabcd.com",
"cat": [
"IAB2-1",
"IAB2-2"
],
"page": "http://siteabcd.com/page.htm",
"ref": "http://referringsite.com/referringpage.htm",
"privacypolicy": 1,
"publisher": {
"id": "pub12345",
"name": "Publisher A"
},
"content": {
"id": "1234567",
"series": "All About Cars",
"season": "2",
"episode": 23,
"title": "Car Show",
"cat": [
"IAB2-2"
],
"keywords": "keyword-a,keyword-b,keyword-c"
}
},
"device": {
"ua": "Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; en-US; rv:1.9.2.16) Gecko/20110319 Firefox/3.6.16",
"os": "OS X",
"js": 1
},
"user": {
"id": "456789876567897654678987656789",
"buyeruid": "545678765467876567898765678987654",
"data": [
{
"id": "6",
"name": "Data Provider 1",
"segment": [
{
"id": "12341318394918",
"name": "auto intenders"
},
{
"id": "1234131839491234",
"name": "auto enthusiasts"
}
]
}
]
}
}
@@ -0,0 +1,34 @@
{
"id": "1234567890",
"bidid": "abc1123",
"cur": "USD",
"seatbid": [
{
"seat": "512",
"bid": [
{
"id": "1",
"impid": "102",
"price": 9.43,
"nurl": "http://adserver.com/winnotice?impid=102",
"iurl": "http://adserver.com/pathtosampleimage",
"adomain": [
"advertiserdomain.com"
],
"cid": "campaign111",
"crid": "creative112",
"attr": [
1,
2,
3,
4,
5,
6,
7,
12
]
}
]
}
]
}
@@ -0,0 +1,32 @@
{
"id": "1234567890",
"bidid": "abc1123",
"cur": "USD",
"seatbid": [
{
"seat": "512",
"bid": [
{
"id": "1",
"impid": "102",
"price": 5,
"dealid": "ABC-1234-6789",
"nurl": "http: //adserver.com/winnotice?impid=102",
"adomain": [
"advertiserdomain.com"
],
"iurl": "http: //adserver.com/pathtosampleimage",
"cid": "campaign111",
"crid": "creative112",
"adid": "314",
"attr": [
1,
2,
3,
4
]
}
]
}
]
}
@@ -0,0 +1,16 @@
{
"id": "123",
"seatbid": [
{
"bid": [
{
"id": "12345",
"impid": "2",
"price": 3,
"nurl": "http://example.com/winnoticeurl",
"adm": "{\"native\":{\"ver\":\"1.0\",\"link\":{ ... },\"imptrackers\":[ ... ],\"assets\":[ ... ]}}"
}
]
}
]
}
@@ -0,0 +1,16 @@
{
"id": "123",
"seatbid": [
{
"bid": [
{
"id": "12345",
"impid": "2",
"price": 3,
"nurl": "http://example.com/winnoticeurl",
"adm": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<VAST version=\"2.0\">\n<Ad id=\"12345\">\n<InLine>\n<AdSystem version=\"1.0\">SpotXchange</AdSystem>\n<AdTitle>\n<![CDATA[Sample VAST]]>\n</AdTitle>\n<Impression>http://sample.com</Impression>\n<Description>\n<![C DATA[A sample VAST feed]]>\n</Description>\n <Creatives>\n<Creative sequence=\"1\" id=\"1\">\n<Linear>\n<Duration>00:00:30</Duration>\n <TrackingEvents>< /TrackingEvents>\n<VideoClicks>\n<ClickThrough>\n<![CDATA[http://sample.com/openrtb test]]>\n</ClickThrough >\n</ VideoClicks >\n< MediaFiles >\n < MediaFile delivery =\"progressive\" bitrate=\"256\" width=\"640\" height=\"480\" type=\"video/mp4\">\n<![CDATA[http://sample.com/video.mp4]]>\n< /MediaFile>\n</MediaFiles >\n < /Linear>\n< /Creative>\n</Creatives >\n < /InLine>\n</Ad >\n < /VAST>"
}
]
}
]
}