-
Notifications
You must be signed in to change notification settings - Fork 763
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
OpenX: accept incoming string fields to support Prebid.js 9 #3668
Conversation
Code coverage summaryNote:
openxRefer here for heat map coverage report
|
Code coverage summaryNote:
openxRefer here for heat map coverage report
|
@@ -7,7 +7,7 @@ | |||
"banner": {}, | |||
"ext": { | |||
"bidder": { | |||
"unit": "banner-unit-1", |
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.
Was this test case previously invalid? Doesn't look like it adhered to the unit json schema pattern.
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.
I don't recall if these were valid at some point in the past, but they are not now.
@@ -7,7 +7,7 @@ | |||
"banner": {}, | |||
"ext": { | |||
"bidder": { | |||
"unit": "banner-unit-1", | |||
"unit": "111", |
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.
Curious, why "111" instead of "1"? Is there a test involved with the length of the unit string?
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.
No functional reason, just think it's easier to find and replace if needed.
@@ -56,7 +59,8 @@ var invalidParams = []string{ | |||
`{"unit": "123", "delDomain": "foo.b"}`, | |||
`{"unit": "123", "delDomain": "foo.barr"}`, | |||
`{"unit": "123", "delDomain": ".bar"}`, | |||
`{"unit": "123", "delDomain": "foo.bar", "customFloor": "0.1"}`, | |||
`{"unit": "123", "delDomain": "foo.bar", "customFloor": ""}`, | |||
`{"unit": "123", "delDomain": "foo.bar", "customFloor": "-0.1"}`, | |||
`{"unit": "123", "delDomain": "foo.bar", "customFloor": -0.1}`, | |||
`{"unit": "123", "delDomain": "foo.bar", "customParams": "foo: bar"}`, |
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.
I recommend adding customFloor tests invalid test cases as "1." and "1.0x" to add more test coverage of the regex.
Code coverage summaryNote:
openxRefer here for heat map coverage report
|
Code coverage summaryNote:
openxRefer here for heat map coverage report
|
Please let me know if there is anything else we should do |
"openx": { | ||
"unit": "539439964", | ||
"delDomain": "se-demo-d.openx.net", | ||
"customFloor": 0.1, | ||
"customFloor": "0.5", | ||
"customParams": {"foo": "bar"} | ||
} | ||
} |
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.
@laurb9 why was this file changed? Adapter change should be limited to Adapter package
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.
This file contains an OpenX adapter request, and we thought it would be best if it were updated to the most recent request format.
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.
could move this to openx specific exemplary test folder
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.
I can undo this particular line change if it blocks the review, but moving it to the openx test folder does not add any new use cases there. Removing samples from openrtb2/sample-requests
is outside the scope of this PR, aside from that openrtb2/sample-requests
contains requests for other adapters as well, so the file looks consistent with the intended purpose of that directory, not as an adapter-specific request, but an usage example for certain pbs configurations.
"description": "The minimum CPM price in USD.", | ||
"minimum": 0 |
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.
should add/update json tests
- to have request where unit is string
- to have request where unit is number
- to have request where customFloor is string
- to have request where customFloor is number
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.
These parameter variations are in optional-params.json
:
unit
is string: https://github.com/prebid/prebid-server/pull/3668/files#diff-4214c2dc95f1c24891a70e424d9576ab40f10447745b95f68a877ca7145f1bd5R12
unit
is number: https://github.com/prebid/prebid-server/pull/3668/files#diff-4214c2dc95f1c24891a70e424d9576ab40f10447745b95f68a877ca7145f1bd5R28
customFloor
is string: https://github.com/prebid/prebid-server/pull/3668/files#diff-4214c2dc95f1c24891a70e424d9576ab40f10447745b95f68a877ca7145f1bd5R15
customFloor
is number: https://github.com/prebid/prebid-server/pull/3668/files#diff-4214c2dc95f1c24891a70e424d9576ab40f10447745b95f68a877ca7145f1bd5R31
Code coverage summaryNote:
openxRefer here for heat map coverage report
|
@laurb9 requesting to take a look at https://github.com/prebid/prebid-server/pull/3668/files#r1652722717 |
Unit json.Number `json:"unit"` | ||
Platform string `json:"platform"` | ||
DelDomain string `json:"delDomain"` | ||
CustomFloor float64 `json:"customFloor"` | ||
CustomFloor json.Number `json:"customFloor"` |
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.
@laurb9
could use StringInt
data type for Unit, CustomFloor
prebid-server/util/jsonutil/stringInt.go
Lines 7 to 29 in a1f48b5
type StringInt int | |
func (st *StringInt) UnmarshalJSON(b []byte) error { | |
if len(b) == 0 { | |
return nil | |
} | |
if b[0] == '"' { | |
b = b[1 : len(b)-1] | |
} | |
if len(b) == 0 { | |
return nil | |
} | |
i, err := jsonparser.ParseInt(b) | |
if err != nil { | |
return err | |
} | |
*st = StringInt(i) | |
return 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.
@laurb9 could use
StringInt
data type for Unit, CustomFloor
CustomFloor
is a string|float emitted as float and Unit
is a string|int emitted as a string.
I believe neither can make use of StringInt
which is a int|string serialized to int.
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.
Just checking if there is anything else to be done here, this PR addresses breaking changes in Prebid.js 9 |
imp[].ext.customFloor
as string or float, emit float inimp[].bidfloor
imp[].ext.unit
as string or integer, emit string inimp[].tagid
1,2 are to support the Prebid.js 9 changes introduced in prebid/Prebid.js#11458
Corresponding PBS-Java change: prebid/prebid-server-java#3178