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

TheMediaGrid: support native mediaType #2377

Merged
merged 72 commits into from
Oct 5, 2022
Merged

Conversation

TheMediaGrid
Copy link
Contributor

@@ -75,6 +77,22 @@ type KeywordsPublisherItem struct {
Segments []KeywordSegment `json:"segments"`
}

type GridNative struct {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This struct has no usages

Ext json.RawMessage `json:"ext,omitempty"`
}

type NativeImp struct {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This struct has no usages

Native json.RawMessage `json:"native,omitempty"`
}

type NativeGridRequest struct {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This struct has no usages. Please delete them

@@ -312,6 +359,9 @@ func (a *GridAdapter) MakeRequests(request *openrtb2.BidRequest, reqInfo *adapte
request.Imp = validImps

reqJSON, err := json.Marshal(request)

fixedReqJSON, err := fixNative(reqJSON)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please do not ignore error from the previous statement

if err := json.Unmarshal([]byte(request), &parsedRequest); err == nil {
native["request_native"] = parsedRequest
} else {
native["request_native"] = request
Copy link
Contributor

@VeronikaSolovei9 VeronikaSolovei9 Sep 22, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At this point you want to set native.request back even if err!=nil. What data other than json do you expect here?
Here you want to replace imp.native.request to imp.native.request_native, that is not a part of openRTB, right?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's right, but even if we got errors when trying to parse json , we still want to get native.request to be able to see what the value is

var gridReq map[string]interface{}
var parsedRequest map[string]interface{}

if err := json.Unmarshal(req, &gridReq); err != nil {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right before executing this function you reqJSON, err := json.Marshal(request). Do you think it will be easier to pass openrtb2.BidRequest here instead of req json.RawMessage?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess it would be easier to operate on abstract json since we need to change its structure

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see it now, ok!

@VeronikaSolovei9
Copy link
Contributor

VeronikaSolovei9 commented Sep 24, 2022

Thank you for the updates.
I didn't find a better way to rename json field, so I'm ok with current implementation.

file grid.go Line 302 is not covered by unit tests and the way to do this - is to add test similar to "simple-native.json" and set req.imp[].native.request to string like "hello". It will throw the Unmarshal error and L304 will be executed.
Please add this kind of test.

Copy link
Contributor

@AlexBVolcy AlexBVolcy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Contributor

@VeronikaSolovei9 VeronikaSolovei9 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for addressing comments, LGTM

@bsardo bsardo merged commit 20793a3 into prebid:master Oct 5, 2022
gwi-mmuths added a commit to gwinteractive/prebid-server that referenced this pull request Oct 10, 2022
* origin/master: (316 commits)
  Fix alt bidder code test broken by imp wrapper commit (prebid#2405)
  ImpWrapper (prebid#2375)
  Update sspBC adapter to v5.7 (prebid#2394)
  Change errors to warnings (prebid#2385)
  TheMediaGrid: support native mediaType (prebid#2377)
  Huaweiadsadapter gdpr (prebid#2345)
  Add alternatebiddercodes in Prebid request ext (prebid#2339)
  Changed FS bidder names to mixed case (prebid#2390)
  Load bidders names from file system in lowercase (prebid#2388)
  consumable adapter: add schain and coppa support (prebid#2361)
  Adapter aliases: moved adapter related configs to bidder.yaml files (prebid#2353)
  pubmatic adapter: add param prebiddealpriority (prebid#2281)
  Yieldlab Adapter: Add support for ad unit sizes (prebid#2364)
  GDPR: add enforce_algo config flag and convert enforce_purpose to bool (prebid#2330)
  Resolves CVE-2022-27664 (prebid#2376)
  AMP Endpoint: support parameters consentType and gdprApplies (prebid#2338)
  Dianomi - added usync for redirect (prebid#2368)
  Create issue_prioritization.yml (prebid#2372)
  Update yaml files for gzip supported bidders (prebid#2365)
  Adnuntius Adapter: Set no cookies as a parameter (prebid#2352)
  ...
shunj-nb pushed a commit to ParticleMedia/prebid-server that referenced this pull request Nov 8, 2022
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.

6 participants