Skip to content
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

Vrtcal adapter: Added Native Support #2956

Merged
merged 6 commits into from
Aug 7, 2023
Merged

Vrtcal adapter: Added Native Support #2956

merged 6 commits into from
Aug 7, 2023

Conversation

vrtcal-dev
Copy link
Contributor

No description provided.

@gargcreation1992 gargcreation1992 changed the title Added Native Support Vrtcal adapter: Added Native Support Jul 21, 2023
site:
mediaTypes:
- banner
- video
- native
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Requesting you to please add the json test case for this change.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Native test cases added


if imp.Native != nil {
return openrtb_ext.BidTypeNative, nil
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Warning - This is an anti-pattern. This code assumes that for multi-format bid request, mediatype will be set to type by default. I would recommend to set the mediaType based on bidder response. Your bidder should be able to set openrtb2.Bid.MType field and use that field here to get mediaTypeForImp. Here is an example on how this is done. Even if your bidder does not support multi-format request, I would highly encourage you to make this change.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the feedback...We've updated to support the 2.6 mtype parameter when present....We've also included code to still support the pre 2.6 non passed mtype (being it wasnt in the oRTB standard until 2.6).

@@ -101,10 +101,17 @@ func getReturnTypeForImp(impID string, imps []openrtb2.Imp) (openrtb_ext.BidType
return openrtb_ext.BidTypeBanner, nil
}


Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nitpick - Please remove this blank line.

if imp.Video != nil {
return openrtb_ext.BidTypeVideo, nil
}


Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit - there is already a blank line above line 109. Please remove this blank line.

return openrtb_ext.BidTypeNative, nil
}


Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nitpick - Please remove this blank line.

Copy link
Contributor

@onkarvhanumante onkarvhanumante left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

g2g after addressing @gargcreation1992 comments

@gargcreation1992
Copy link
Contributor

@vrtcal-dev Requesting you to please address the open comments.

adapters/vrtcal/vrtcal.go Outdated Show resolved Hide resolved
adapters/vrtcal/vrtcal.go Outdated Show resolved Hide resolved
adapters/vrtcal/vrtcal.go Outdated Show resolved Hide resolved
@@ -94,25 +94,37 @@ func Builder(bidderName openrtb_ext.BidderName, config config.Adapter, server co
return bidder, nil
}

func getReturnTypeForImp(impID string, imps []openrtb2.Imp) (openrtb_ext.BidType, error) {
func getReturnTypeForImp(MType openrtb2.MarkupType, impID string, imps []openrtb2.Imp) (openrtb_ext.BidType, error) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should use camelCase style for var. MType -> mType

onkarvhanumante
onkarvhanumante previously approved these changes Aug 2, 2023

return "", &errortypes.BadServerResponse{
Message: fmt.Sprintf("Unsupported return type for ID: \"%s\"", impID),
if mType != 0 {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This part of code does not have to be in for loop. This function argument is having mType as input that is set on seatBid.Bid[i] which can only hold one impression. I would suggest to remove this for loop.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cleaned up this function to reflect your suggestions and updated related test cases.

return "", &errortypes.BadServerResponse{
Message: fmt.Sprintf("Unsupported return type for ID (mtype present): \"%s\"", impID)}
}
} else { //Pre-2.6 support when mtype is not passed
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If your bidder supports MType and you are setting adapters.TypedBid.BidType - I do not think you need this fallback here. I suggest to remove this fallback check and use single source of truth to define adapters.TypedBid.BidType.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cleaned up this function to reflect your suggestions and updated related test cases.

Copy link
Contributor

@gargcreation1992 gargcreation1992 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

requesting few changes.

@gargcreation1992 gargcreation1992 merged commit b288ff9 into prebid:master Aug 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants