Skip to content

Commit

Permalink
Review feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
bsardo committed Oct 29, 2024
1 parent 8636a19 commit a496202
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 22 deletions.
5 changes: 2 additions & 3 deletions endpoints/openrtb2/amp_auction.go
Original file line number Diff line number Diff line change
Expand Up @@ -510,9 +510,8 @@ func (deps *endpointDeps) parseAmpRequest(httpRequest *http.Request) (req *openr
// move to using the request wrapper
req = &openrtb_ext.RequestWrapper{BidRequest: reqNormal}

// upgrade to 2.6 here
err := openrtb_ext.ConvertUpTo26(req)
if err != nil {
// normalize to openrtb 2.6
if err := openrtb_ext.ConvertUpTo26(req); err != nil {
errs = append(errs, err)
}
if errortypes.ContainsFatalError(errs) {
Expand Down
33 changes: 15 additions & 18 deletions endpoints/openrtb2/auction.go
Original file line number Diff line number Diff line change
Expand Up @@ -534,7 +534,7 @@ func (deps *endpointDeps) parseRequest(httpRequest *http.Request, labels *metric
return
}

// upgrade to 2.6 here
// normalize to openrtb 2.6
if err := openrtb_ext.ConvertUpTo26(req); err != nil {
errs = []error{err}
return
Expand Down Expand Up @@ -1271,20 +1271,18 @@ func (deps *endpointDeps) validateUser(req *openrtb_ext.RequestWrapper, aliases
}

// Check Universal User ID
if req.User.EIDs != nil {
for eidIndex, eid := range req.User.EIDs {
if eid.Source == "" {
return append(errL, fmt.Errorf("request.user.eids[%d] missing required field: \"source\"", eidIndex))
}
for eidIndex, eid := range req.User.EIDs {
if eid.Source == "" {
return append(errL, fmt.Errorf("request.user.eids[%d] missing required field: \"source\"", eidIndex))
}

if len(eid.UIDs) == 0 {
return append(errL, fmt.Errorf("request.user.eids[%d].uids must contain at least one element or be undefined", eidIndex))
}
if len(eid.UIDs) == 0 {
return append(errL, fmt.Errorf("request.user.eids[%d].uids must contain at least one element or be undefined", eidIndex))
}

for uidIndex, uid := range eid.UIDs {
if uid.ID == "" {
return append(errL, fmt.Errorf("request.user.eids[%d].uids[%d] missing required field: \"id\"", eidIndex, uidIndex))
}
for uidIndex, uid := range eid.UIDs {
if uid.ID == "" {
return append(errL, fmt.Errorf("request.user.eids[%d].uids[%d] missing required field: \"id\"", eidIndex, uidIndex))
}
}
}
Expand Down Expand Up @@ -1313,11 +1311,10 @@ func validateRegs(req *openrtb_ext.RequestWrapper, gpp gpplib.GppContainer) []er
WarningCode: errortypes.InvalidPrivacyConsentWarningCode})
}
}
if req.BidRequest.Regs.GDPR != nil {
reqGDPR := req.BidRequest.Regs.GDPR
if reqGDPR != nil && *reqGDPR != 0 && *reqGDPR != 1 {
return append(errL, errors.New("request.regs.gdpr must be either 0 or 1"))
}

reqGDPR := req.BidRequest.Regs.GDPR
if reqGDPR != nil && *reqGDPR != 0 && *reqGDPR != 1 {
return append(errL, errors.New("request.regs.gdpr must be either 0 or 1"))
}
return errL
}
Expand Down
1 change: 0 additions & 1 deletion macros/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,6 @@ func (b *MacroProvider) populateRequestMacros(reqWrapper *openrtb_ext.RequestWra
}
}

//is this happening after upconvert?
if reqWrapper.User != nil && len(reqWrapper.User.Consent) > 0 {
b.macros[MacroKeyConsent] = reqWrapper.User.Consent
}
Expand Down

0 comments on commit a496202

Please sign in to comment.