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

Adapter Name Case Insensitive: First Party Data #3211

Merged
merged 2 commits into from
Oct 18, 2023

Conversation

SyntaxNode
Copy link
Contributor

No description provided.

}
fpdBidderData.Site = bidderConfig.Config.ORTB2.Site
fpdBidderData.App = bidderConfig.Config.ORTB2.App
fpdBidderData.User = bidderConfig.Config.ORTB2.User
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not related to the PR. Realized there is no need to check if nil, because fpdBidderData.XX is already nil and there is no harm in setting it to nil again. There is small cpu cost to the nil check, so we're better to remove it.

@@ -223,6 +223,7 @@ type BidderRequest struct {
BidderCoreName openrtb_ext.BidderName
BidderLabels metrics.AdapterLabels
BidderStoredResponses map[string]json.RawMessage
IsRequestAlias bool
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Helps to inform when to use the normalized BidderCoreName vs request provided BidderName.

if fpd.Site != nil {
bidReq.Site = fpd.Site
func applyFPD(fpd map[openrtb_ext.BidderName]*firstpartydata.ResolvedFirstPartyData, r BidderRequest) {
if fpd == nil {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Move some logic down since there's added complexity in choosing which bidder name to use and the main func was getting crowded.

@@ -3237,60 +3237,145 @@ func TestCleanOpenRTBRequestsBidAdjustment(t *testing.T) {
}

func TestApplyFPD(t *testing.T) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Expanded to account for refactored applyFPD.

BidderConfigFPD map[openrtb_ext.BidderName]*openrtb_ext.ORTB2 `json:"bidderConfigFPD,omitempty"`
GlobalFPD map[string]json.RawMessage `json:"globalFPD,omitempty"`
ValidationErrors []*errortypes.BadInput `json:"validationErrors,omitempty"`
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Needed a different output format. To avoid more json unmashal code, i created a separate structure and changed the load mechanism to use generics.

@@ -476,7 +476,7 @@ func TestExtractBidderConfigFPD(t *testing.T) {
t.Run(test.Name(), func(t *testing.T) {
filePath := testPath + "/" + test.Name()

fpdFile, err := loadFpdFile(filePath)
fpdFile, err := loadFpdFile[fpdFile](filePath)
Copy link
Contributor

Choose a reason for hiding this comment

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

Nitpick: fpdFile that is returned should probably have different name to avoid confusion with the fpdFile struct.
Something like: testFile, err := loadFpdFile[fpdFile](filePath)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good point. Renamed variable to testFile and kept the struct name. Let me know if that looks good.

guscarreon
guscarreon previously approved these changes Oct 16, 2023
Copy link
Contributor

@guscarreon guscarreon left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Contributor

@guscarreon guscarreon left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Contributor

@VeronikaSolovei9 VeronikaSolovei9 left a comment

Choose a reason for hiding this comment

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

Thank you for the updates, looks good to me

@SyntaxNode SyntaxNode merged commit 11ef54d into prebid:master Oct 18, 2023
3 checks passed
svamiftah pushed a commit to sovrn/prebid-server that referenced this pull request Nov 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants