Skip to content

RPRS-5424-Change Native.RequestObject from string to object#8

Open
hadarcohen13 wants to merge 1 commit into
rise-openrtbfrom
RPRS-5424-AddImpNativeReqObj
Open

RPRS-5424-Change Native.RequestObject from string to object#8
hadarcohen13 wants to merge 1 commit into
rise-openrtbfrom
RPRS-5424-AddImpNativeReqObj

Conversation

@hadarcohen13

Copy link
Copy Markdown

No description provided.

- Updates RequestObject field type to support unescaped JSON object serialization
- Adds comprehensive documentation explaining the dual-field pattern
- Enables simultaneous sending of request (string) and requestobj (object)
@codeguard-pr-analyzer

codeguard-pr-analyzer Bot commented Apr 19, 2026

Copy link
Copy Markdown

🤖 CodeGuard PR Analysis

✨ Summary

This pull request updates the RequestObject field in the openrtb2.Native struct from string to json.RawMessage. This change enables the correct representation of imp.native.requestobj as a JSON object, improving parsing efficiency for partners like Magnite as described in RPRS-5424.

🎯 Jira Ticket Alignment: ✅ Fully Aligned

Requirements addressed: The change to json.RawMessage directly addresses the need to represent imp.native.requestobj as a parsed JSON object rather than a string.

Scope analysis: The PR correctly scopes to the type definition change, which is a prerequisite for populating requestobj with a JSON structure.

Implementation match: Yes, the PR modifies the type of RequestObject to json.RawMessage as required for an object representation.

Completeness: This PR completes the type definition change; the actual logic for populating this field with the parsed JSON content would be implemented separately using this new type.

⚠️ Risk Level: 🟡 Medium

Changing a struct field's type directly impacts its JSON serialization/deserialization behavior. If other parts of the codebase were already using or expecting RequestObject as a string (even if empty), this change could introduce runtime errors. However, based on the Jira description, this field's intended use was as an object, suggesting prior string usage was either minimal or incorrect.

🧪 Test Coverage

⚠️ No tests added for the type change. Unit tests for the openrtb2.Native struct's JSON marshaling and unmarshaling behavior, specifically for the RequestObject field, would be beneficial to confirm correct serialization as json.RawMessage.

📊 Root Cause Analysis

Previously, Native ad requests were sent with imp.native.request as a JSON-encoded string, but imp.native.requestobj was not properly populated as a parsed object. This change is driven by the need to align with modern OpenRTB Native specifications and improve parsing efficiency for SSPs like Magnite, which prefer requestobj to avoid double-parsing overhead.

🔗 Dependency Chain
  • Modified: openrtb2/native.go
  • Impacts: Any code that serializes or deserializes openrtb2.Native structs, particularly in bid request generation for native ads.
  • Dependencies: No new external dependencies.
📝 Detailed Changes

Modified:

  • openrtb2/native.go: Changed the type of RequestObject field in the Native struct from string to json.RawMessage and updated its inline comments to reflect its purpose as an unescaped JSON object.

Powered by Gemini 2.5 Flash | Last updated: 19/04/2026 11:32:08 UTC

@hadarcohen13 hadarcohen13 changed the title RPRS-5523-Change Native.RequestObject from string to json.RawMessage RPRS-5424-Change Native.RequestObject from string to json.RawMessage Apr 19, 2026
@hadarcohen13 hadarcohen13 changed the title RPRS-5424-Change Native.RequestObject from string to json.RawMessage RPRS-5424-Change Native.RequestObject from string to object Apr 19, 2026
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