-
Notifications
You must be signed in to change notification settings - Fork 757
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
Adapter Name Case Insensitive: First Party Data #3211
Conversation
} | ||
fpdBidderData.Site = bidderConfig.Config.ORTB2.Site | ||
fpdBidderData.App = bidderConfig.Config.ORTB2.App | ||
fpdBidderData.User = bidderConfig.Config.ORTB2.User |
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.
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 |
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.
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 { |
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.
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) { |
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.
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"` | ||
} |
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.
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) |
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: fpdFile
that is returned should probably have different name to avoid confusion with the fpdFile
struct.
Something like: testFile, err := loadFpdFile[fpdFile](filePath)
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.
Good point. Renamed variable to testFile
and kept the struct name. Let me know if that looks good.
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
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
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.
Thank you for the updates, looks good to me
No description provided.