ConnectAd: Add video, native and audio support - #4506
Conversation
…ropagate network/site IDs in imp extension
Co-authored-by: Cursor <cursoragent@cursor.com>
| if (imp.getBanner() == null && imp.getVideo() == null && imp.getXNative() == null && imp.getAudio() == null) { | ||
| throw new PreBidException("We need a Banner, Video, Native or Audio Object in the request"); | ||
| } |
There was a problem hiding this comment.
No need for this validation
| .build(); | ||
| } | ||
|
|
||
| private ObjectNode modifyImpExt(ObjectNode impExt, ExtImpConnectAd extImpConnectAd) { |
There was a problem hiding this comment.
Reorder methods, so they are in call order
| } | ||
|
|
||
| private ObjectNode modifyImpExt(ObjectNode impExt, ExtImpConnectAd extImpConnectAd) { | ||
| final ObjectNode modifiedExt = impExt != null ? impExt.deepCopy() : mapper.mapper().createObjectNode(); |
| if (networkId != null) { | ||
| try { | ||
| modifiedExt.put("networkId", Integer.parseInt(networkId)); | ||
| } catch (NumberFormatException e) { | ||
| modifiedExt.put("networkId", networkId); | ||
| } | ||
| } | ||
|
|
||
| if (siteId != null) { | ||
| try { | ||
| modifiedExt.put("siteId", Integer.parseInt(siteId)); | ||
| } catch (NumberFormatException e) { | ||
| modifiedExt.put("siteId", siteId); | ||
| } | ||
| } | ||
|
|
||
| return modifiedExt; | ||
| } |
There was a problem hiding this comment.
Why do you need this? This fields already present in initial impExt
There was a problem hiding this comment.
The reason I asked the question is the following (connectad.json):
"networkId": {
"type": [
"integer",
"string"
]
},
"siteId": {
"type": [
"integer",
"string"
],
If you want to transfer data in the format it originally came in, then simply copy it from impExt.get("bidder").get("networkId/siteId"). Furthermore, your implementation differs from the GO implementation. GO only accepts parsable integers (see StringInt). You can change ExtImpConnectAd that way:
@Value(staticConstructor = "of")
public class ExtImpConnectAd {
@JsonProperty("networkId")
Integer networkId;
@JsonProperty("siteId")
Integer siteId;
@JsonProperty("bidfloor")
BigDecimal bidFloor;
}
- Remove unnecessary null check on bidRequest in getBidType() method - Remove unnecessary empty check on bidRequest.getImp() in getBidType() method - Reorder modifyImpExt() method to be between updateImp() and updateBanner() for better code organization and readability - Add comprehensive JavaDoc comments explaining: - Why media type validation is necessary and validates all media types - Why networkId and siteId must be propagated to root level of imp.ext - Why getBidType() can safely assume bidRequest is non-null - Keep defensive null check on impExt parameter for robustness (as per review discussion) These changes address feedback from code review while maintaining code quality and robustness. Addresses review comments from PR prebid#4506
|
Remove all the comments you have added |
Addresses review feedback on PR prebid#4506 to remove newly added comments. Co-authored-by: rtuschkany <rtuschkany@users.noreply.github.com>
| if (imp.getBanner() == null && imp.getVideo() == null && imp.getXNative() == null && imp.getAudio() == null) { | ||
| throw new PreBidException("We need a Banner, Video, Native or Audio Object in the request"); | ||
| } |
| } | ||
|
|
||
| private ObjectNode modifyImpExt(ObjectNode impExt, ExtImpConnectAd extImpConnectAd) { | ||
| final ObjectNode modifiedExt = impExt != null ? impExt.deepCopy() : mapper.mapper().createObjectNode(); |
| .build(); | ||
| } | ||
|
|
||
| private ObjectNode modifyImpExt(ObjectNode impExt, ExtImpConnectAd extImpConnectAd) { |
| if (networkId != null) { | ||
| try { | ||
| modifiedExt.put("networkId", Integer.parseInt(networkId)); | ||
| } catch (NumberFormatException e) { | ||
| modifiedExt.put("networkId", networkId); | ||
| } | ||
| } | ||
|
|
||
| if (siteId != null) { | ||
| try { | ||
| modifiedExt.put("siteId", Integer.parseInt(siteId)); | ||
| } catch (NumberFormatException e) { | ||
| modifiedExt.put("siteId", siteId); | ||
| } | ||
| } | ||
|
|
||
| return modifiedExt; | ||
| } |
There was a problem hiding this comment.
The reason I asked the question is the following (connectad.json):
"networkId": {
"type": [
"integer",
"string"
]
},
"siteId": {
"type": [
"integer",
"string"
],
If you want to transfer data in the format it originally came in, then simply copy it from impExt.get("bidder").get("networkId/siteId"). Furthermore, your implementation differs from the GO implementation. GO only accepts parsable integers (see StringInt). You can change ExtImpConnectAd that way:
@Value(staticConstructor = "of")
public class ExtImpConnectAd {
@JsonProperty("networkId")
Integer networkId;
@JsonProperty("siteId")
Integer siteId;
@JsonProperty("bidfloor")
BigDecimal bidFloor;
}
- Remove media type validation and related test - Use Integer types in ExtImpConnectAd aligned with Go StringInt - Copy networkId/siteId from imp.ext.bidder preserving original format - Drop impExt null fallback; reorder methods in call order - Add ortb-version 2.6 and HTTPS endpoint in connectad.yaml - Update integration test expectations for ORTB 2.6 and ext copy Co-authored-by: rtuschkany <rtuschkany@connectad.io>
|
@CTMBNara Addressed all review points in the latest commit. Happy to re-review. |
…ropagate network/site IDs in imp extension
🔧 Type of changes