Closed justin-boshoven-vizio closed 1 year ago
This PR fixes the exact issues I was looking into recently, it'd be great to get this merged/released!
That said, here's a small change for the fork which addresses my above comment and issues encountered running cargo test
:
diff --git a/src/v2_5/bid_request.rs b/src/v2_5/bid_request.rs
index 232f21e..a22c30d 100644
--- a/src/v2_5/bid_request.rs
+++ b/src/v2_5/bid_request.rs
@@ -177,7 +177,7 @@ impl BidRequest {
user: None,
test: false,
auction_type: AuctionType::FirstPrice,
- tmax: Some(0),
+ tmax: None,
seat_whitelist: vec![],
seat_blocklist: vec![],
all_imps: false,
@@ -240,7 +240,7 @@ mod tests {
user: None,
test: false,
auction_type: AuctionType::FirstPrice,
- tmax: 0,
+ tmax: None,
seat_whitelist: vec![],
seat_blocklist: vec![],
all_imps: false,
@@ -254,7 +254,7 @@ mod tests {
ext: None,
};
- let expected = r#"{"id":"1234","imp":[],"at":1,"tmax":0}"#;
+ let expected = r#"{"id":"1234","imp":[],"at":1}"#;
let serialized = serde_json::to_string(&b).unwrap();
assert_eq!(expected, serialized)
@@ -285,7 +285,7 @@ mod tests {
user: None,
test: false,
auction_type: AuctionType::SecondPricePlus,
- tmax: 0,
+ tmax: None,
seat_whitelist: vec![],
seat_blocklist: vec![],
all_imps: false,
What do we gotta do to get this thing checked in?
@sriggin You know how I can get this checked in?
Hey @justin-boshoven-vizio , would you mind if I add you as a maintainer? Give me your crates username if yes
I think it matches my github username? justin-boshoven-vizio
@justin-boshoven-vizio invitest sent!
Now capable of parsing all examples at https://github.com/openrtb/examples after they have been made valid json. I had to add commas and remove trailing commas to make them valid.
The spec: https://www.iab.com/wp-content/uploads/2016/03/OpenRTB-API-Specification-Version-2-5-FINAL.pdf
BidRequest::tmax
is now optional.User::data
is now optional.Video::boxingallowed
is now a bool that can be parsed from u8 or bool.Device::dnt
now supports parsing from bool or u8.Bid::id
andBid::imp_id
can now be an integer when deserializing.The big parts of this change were expanding flexibility of
u8_to_bool
andu8_to_mbool
so that they can parse fromtrue
,false
,0
, or1
.The other odd one is adding
anything_to_string
that will take any valid json value and convert it to aString
to supportid
s that may come in as integers from incorrect json.See #3, this may help.