Skip to content

OpenRTB: Fix request model types and preserve missing fields - #4626

Open
pavel-ptashyts wants to merge 2 commits into
prebid:masterfrom
pavel-ptashyts:feature/openrtb-request-model-compatibility
Open

OpenRTB: Fix request model types and preserve missing fields#4626
pavel-ptashyts wants to merge 2 commits into
prebid:masterfrom
pavel-ptashyts:feature/openrtb-request-model-compatibility

Conversation

@pavel-ptashyts

@pavel-ptashyts pavel-ptashyts commented Sep 6, 2026

Copy link
Copy Markdown
Contributor

Type of changes

  • bugfix

What's the context?

The shared request model rejects alphanumeric OpenRTB 2.6 pod IDs and drops several content fields during JSON round trips. For example, video.podid: "pod-001" cannot be decoded as an Integer, and content.genres and content.data[].cids disappear from the serialized request.

Change Video.podid and Audio.podid to String. Add Content.gtax, genres, realtime, firstbroadcast, and Data.cids. Update the livestream JavaDoc to distinguish scheduled broadcasts from real-time events and explain the version-dependent interpretation.

Also retain the legacy OpenRTB 2.5 fields Banner.wmax/hmax/wmin/hmin, Video.protocol, and Content.videoquality so a 2.5 request can pass through the shared model without losing them. Their JavaDoc explains that they were removed in 2.6 in favor of format, protocols, and prodq. Values remain independent; the model does not perform implicit conversion between legacy fields and their replacements.

ProtobufRequestUtils now maps all six legacy fields to their existing protobuf counterparts. The bundled protobuf schema does not define the other 2.6 fields added or corrected here, so this PR does not add protobuf tags or invent extension mappings for them.

Rationale behind the change

  • IAB OpenRTB 2.6 specifies string pod IDs for both Video and Audio.
  • The Go implementation made the same Video correction in prebid/openrtb#2. Both Video and Audio use string PodID.
  • The content attributes are defined in the IAB Content and Data tables. The change log documents removal of the legacy 2.5 attributes.

Numeric JSON pod IDs are still accepted through existing Jackson coercion and are serialized as strings. Java consumers must update Integer pod ID builder arguments/getter usages to String and recompile. The separate video endpoint's numeric pod IDs are unchanged.

The 2.5/2.6 converters were checked: these fields introduce no new ext-to-root relocation. Their existing behavior of retaining newer content and media fields for older adapters is preserved.

Test plan

  • Focused run on JDK 25: 55 tests passed in ProtobufRequestUtilsTest, both request version-converter test classes and BidRequestOrtbVersionConverterFactoryTest. Checkstyle passed; production, Java test and Groovy functional test sources compiled.
  • Existing protobuf fixtures cover all six legacy fields alongside their replacements. Three additional tests verify that absent legacy values remain unset in protobuf.
  • Existing functional pod-ID cases use strings. New OrtbConverterSpec scenarios cover content metadata and data.cids in site/app/DOOH for 2.5 and 2.6 adapters, including zero flags and leading-zero identifiers. These scenarios compile. A local Docker run using the rebuilt server image was attempted but stopped during global Testcontainers setup: the JVM waited in CopyArchiveToContainerCmd while copying files into MySQL, before any scenarios ran. No functional pass is claimed.

The generic DTO round-trip test class and separate compatibility document were removed following review.

Quality check

  • Follow project code style guidelines.
  • Breaking Java model API change is documented above.
  • No debug logging or temporary code added.

The existing JaCoCo configuration excludes com/iab/openrtb/**; no DTO coverage percentage is claimed.

@CTMBNara CTMBNara left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Check whether you need to add any logic to BidRequestOrtbVersionConverter.
Also, update ProtobufRequestUtils if needed

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

no need for this tests

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Removed OpenRtbRequestModelTest as requested. The protobuf mapping changes are covered in the existing ProtobufRequestUtilsTest, and content preservation scenarios were added to the existing OrtbConverterSpec.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

remove this file

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Removed this file. The field/version explanations remain in the model JavaDoc and PR description.

@pavel-ptashyts

Copy link
Copy Markdown
Contributor Author

Thanks for the review. I updated ProtobufRequestUtils to map banner.wmax/hmax/wmin/hmin, video.protocol and content.videoquality to their existing protobuf fields. The existing mapper fixtures now cover these values alongside their replacements, with additional checks that missing legacy values stay unset.

I also checked both BidRequestOrtbVersionConverter implementations. These additions do not introduce an ext-to-root relocation, so no conversion logic was added. The existing behavior of retaining newer content/media fields for 2.5 adapters is preserved. The bundled protobuf schema does not define the other 2.6 fields in this PR, so I have not added arbitrary protobuf tags or extension mappings for them.

The requested document and generic DTO test class are removed. I added scenarios to OrtbConverterSpec for gtax, genres, realtime, firstbroadcast and data.cids across site/app/DOOH and both adapter versions, including zero flags and leading-zero identifiers.

Validation: all 55 focused protobuf/version-converter Java tests pass, Checkstyle passes, and the Groovy scenarios compile. I attempted the new scenarios with a rebuilt server Docker image, but the local run stalled during global Testcontainers setup while copying files into MySQL, before any scenarios executed; I stopped that run rather than reporting it as passed.

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