-
Notifications
You must be signed in to change notification settings - Fork 765
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
New Adapter: Smoot #4148
base: master
Are you sure you want to change the base?
New Adapter: Smoot #4148
Conversation
Code coverage summaryNote:
smootRefer here for heat map coverage report
|
Thank you @ccorbo ! I imagine we'll need a couple approvals here, right? Docs were already approved btw: prebid/prebid.github.io#5811 |
Hello! - Yes you will need other approvals as well, it is in the queue. |
Thank you @ccorbo ! I'll stay tuned then. By the way:
Did you send the email to |
@@ -0,0 +1,136 @@ | |||
{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: rename to simple-app-banner.json to easily differentiate between the simple-web-banner.json
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done ✅
var bidderExt adapters.ExtImpBidder | ||
var smootExt openrtb_ext.ImpExtSmoot | ||
|
||
if err := jsonutil.Unmarshal(imp.Ext, &bidderExt); err != nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add test coverage on these unmarshal errors
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, sorry for that. Done ✅
adapters/smoot/smoot.go
Outdated
headers.Add("Content-Type", "application/json;charset=utf-8") | ||
headers.Add("Accept", "application/json") | ||
return &adapters.RequestData{ | ||
Method: "POST", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
suggestion: use http.MethodPost
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome, thanks! Done ✅
Sorry about that - missed hitting the send button before I posted that. Just sent it over |
Verified maintainer email address |
Code coverage summaryNote:
smootRefer here for heat map coverage report
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM from my POV - will need another approval from another reviewer however
Awesome, thank you @ccorbo . Who should I reach to get the final approval? |
Hi @leamarty, I'll review tomorrow and get back to you. Thanks for your patience. |
Awesome, thank you @bsardo ! Any news? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, just a few minor comments.
`{"placementId": 42}`, | ||
`{"endpointId": 42}`, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add the following test cases to test the minimum length:
`{"placementId": ""}`
`{"endpointId": ""}`
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done ✅
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Adding these two separate test cases instead of combining them into one test case like you have ({"placementId": "", "endpointId": ""}
ensures that there is a min length constraint on each field instead of on at least one of the fields. I suggest making this change.
adapters/smoot/smoot.go
Outdated
if smootExt.PlacementID != "" { | ||
impExt.SmootBidderExt.PlacementID = smootExt.PlacementID | ||
impExt.SmootBidderExt.Type = "publisher" | ||
} else if smootExt.EndpointID != "" { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This conditional can be deleted with the else if
just becoming an else
since you've guaranteed that your bidder will only be called if placementId
or endpointId
is set based on how you've defined your bidder parameters.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done ✅
bid := seatBid.Bid[i] | ||
bidType, err := getBidType(bid) | ||
if err != nil { | ||
return nil, []error{err} | ||
} | ||
|
||
b := &adapters.TypedBid{ | ||
Bid: &seatBid.Bid[i], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What you have works. I'll leave it up to you but you can optimize this with a couple of simple tweaks so you don't ever copy the bid (which you're doing twice) but rather copy the bid address and pass that reference around to read the mtype and to include in the typed bid:
bid := &seatBid.Bid[i]
bidType, err := getBidType(bid)
if err != nil {
return nil, []error{err}
}
b := &adapters.TypedBid{
Bid: bid,
....
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Decided not to do it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use underscores in the file name: bad-media-type.json
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done ✅
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use underscores in the file name: bad-response.json
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done ✅
"mockResponse": { | ||
"status": 204 | ||
} | ||
} | ||
], | ||
"expectedBidResponses": [] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is debatable and I know some adapters have done this but for an exemplary test like this, I would expect to see a happy path 200 with at least one bid, especially when we have a supplemental 204 test case defined.
"mockBidRequest": { | ||
"id": "test-request-id", | ||
"imp": [ | ||
{ | ||
"id": "test-imp-id", | ||
"ext": { | ||
"bidder": 999 | ||
} | ||
} | ||
] | ||
}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nitpick: this gets the job done as far as forcing the error path. I suggest making this a stripped down valid mockBidRequest
with just the imp[0].ext.bidder
being invalid:
"mockBidRequest": {
"id": "test-request-id",
"imp": [
{
"id": "test-imp-id",
"banner": {
"format": [
{
"w": 300,
"h": 250
}
]
},
"ext": {
"bidder": {
"placementId": 999
}
}
}
],
"app": {
"id": "1",
"bundle": "com.wls.testwlsapplication"
}
},
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done ✅
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nitpick: same suggestion as on invalid-bidder.json
regarding minimum valid request with just the ext being invalid.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done ✅
Also can you please merge with master? One of the validate jobs is failing because your branch is off of a version of master that contains a PR that has since been reverted. The validate job should then start passing. |
Code coverage summaryNote:
smootRefer here for heat map coverage report
|
Thank you so much for your comments @bsardo ! We already went through them. Please I'd ask you to have some speed on the remaining approval, since we've been waiting for 3 weeks already and we may get another "out of date" situation with the master branch. Thanks! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We're close. I have just two comments stemming from previous ones.
"mockBidRequest": { | ||
"id": "test-request-id", | ||
"imp": [ | ||
{ | ||
"id": "test-imp-id", | ||
"banner": { | ||
"format": [ | ||
{ | ||
"w": 300, | ||
"h": 250 | ||
} | ||
] | ||
}, | ||
"ext": 123 | ||
} | ||
] | ||
}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add site
or app
to make this a valid request. This should suffice:
"app": {
"id": "1",
"bundle": "com.wls.testwlsapplication"
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perfect, done ✅
`{"placementId": 42}`, | ||
`{"endpointId": 42}`, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Adding these two separate test cases instead of combining them into one test case like you have ({"placementId": "", "endpointId": ""}
ensures that there is a min length constraint on each field instead of on at least one of the fields. I suggest making this change.
Code coverage summaryNote:
smootRefer here for heat map coverage report
|
DOC - prebid/prebid.github.io#5811