-
Notifications
You must be signed in to change notification settings - Fork 93
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
Arbitrary ORTB request configuration changes #1064
base: master
Are you sure you want to change the base?
Conversation
super.init() | ||
} | ||
|
||
public static func enrich( |
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.
Let's change the signature of this method due to it's resposibility.
public static func merge(
sdkORTB: [String: Any],
globalORTB: String?,
impORTB: String?
) -> [String: Any] {
///
|
||
if var globalORTBDict = ArbitraryGlobalORTBHelper(ortb: globalORTB).getValidatedORTBDict() { | ||
let existingImpDict = resultORTB["imp"] as? [[String: Any]] | ||
resultORTB["imp"] = 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.
Can we make this function better?
In line 35, we added the "imp" object. In line 40, we are removing it.
I believe the algorithm can be more convenient.
|
||
struct ProtectedFields { | ||
|
||
static var deviceProps: [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.
I'm just curious: why is it var
?
Because of this: https://forums.swift.org/t/static-var-vs-static-let/59215 ?
resultORTB["imp"] = existingImps?.map { $0.deepMerging(with: impORTBDict) } ?? [impORTBDict] | ||
} | ||
|
||
if var globalORTBDict = ArbitraryGlobalORTBHelper(ortb: globalORTB).getValidatedORTBDict() { |
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.
Does it make sense to apply getValidatedORTBDict only once when the publisher sets the respective property?
XCTAssertNil(result) | ||
} | ||
|
||
func testGlobalORTBHelper_ValidJSON_RemoveProtectedFields() { |
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.
We also need some tests that checks the correct work and combinations of setGlobalORTBConfig
and setImpressionORTBConfig
.
It's ok if it will be integration tests.
#1017