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

Arbitrary ORTB request configuration changes #1064

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

OlenaPostindustria
Copy link
Collaborator

@OlenaPostindustria OlenaPostindustria marked this pull request as ready for review November 25, 2024 08:07
super.init()
}

public static func enrich(
Copy link
Contributor

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
Copy link
Contributor

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] {
Copy link
Contributor

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() {
Copy link
Contributor

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() {
Copy link
Contributor

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants