Add complete OpenRTB 2.6 data model crate#390
Draft
ChristianPavilonis wants to merge 5 commits intomainfrom
Draft
Add complete OpenRTB 2.6 data model crate#390ChristianPavilonis wants to merge 5 commits intomainfrom
ChristianPavilonis wants to merge 5 commits intomainfrom
Conversation
f2eee35 to
0c0e4fa
Compare
Enrich outgoing Prebid Server requests with fields that were already available in the AuctionRequest/context but not being mapped: - Imp: bidfloor/bidfloorcur (from AdSlot.floor_price), secure (1), tagid (slot id) - Geo: lat/lon (from GeoInfo), metro (DMA code) - User: consent (TCF consent string from UserInfo) - Regs: gdpr flag (when consent present), us_privacy promoted to first-class field - Device: dnt (from DNT header), language (from Accept-Language) - Site: ref (from Referer header), publisher object with domain - BidRequest: tmax (from config timeout_ms), cur (["USD"]) Also refactor build_openrtb_request to use a params struct to satisfy clippy argument limits, and fix pre-existing test compilation errors where ext fields were accessed with struct syntax instead of Map::get.
- Validate Sec-GPC header value is '1' (not just presence) - Add comment documenting GDPR flag trade-off (conservative approach) - Add comment about hardcoded USD currency - Remove dead RegsExt struct (us_privacy promoted to first-class field) - Remove unnecessary language.clone() - Add 13 tests covering all new OpenRTB field mappings: bidfloor, secure, tagid, consent/gdpr, Sec-GPC, DNT, language, geo lat/lon/ metro, tmax, cur, site.ref, site.publisher
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
trusted-server-openrtbcrate containing a complete OpenRTB 2.6 data model (all request/response objects with every field from the spec) to replace the minimal hand-rolled structs incrates/common/src/openrtb.rs.crates/commonto use the new crate's types via builder functions, keeping call sites clean while gaining full spec coverage (video, audio, native, DOOH, supply chain, EIDs, pod bidding, etc.).openrtb.mdreference document covering the full OpenRTB 2.6 schema for contributor use.OpenRTB Field Enrichment
The Prebid integration now maps the following fields that were previously left empty despite data being available:
Imp.bidfloor/bidfloorcurAdSlot.floor_priceImp.secure1Imp.tagidslot.idGeo.lat/lonGeoInfo.latitude/longitudeGeo.metroGeoInfo.metro_code(DMA)User.consentUserInfo.consent(TCF string)Regs.gdpr1when consent presentRegs.us_privacySec-GPCheader →"1YYN"Device.dntDNT: 1headerDevice.languageAccept-LanguageheaderSite.refRefererheaderSite.publisherBidRequest.tmaxconfig.timeout_msBidRequest.cur["USD"]Changes
crates/openrtb/Cargo.tomltrusted-server-openrtbwithserde+serde_jsondepscrates/openrtb/src/lib.rsBidRequest,BidResponse,Imp,Banner,Video,Audio,Native,Site,App,Dooh,Device,User,Geo,Regs,SeatBid,Bid,Source,SupplyChain,Pmp,Deal,Publisher,Content,Producer,Network,Channel,EID,UserAgent,Qty,Refresh,DurFloors, and moreCargo.tomlcrates/openrtbto workspace memberscrates/common/Cargo.tomltrusted-server-openrtbdependencycrates/common/src/openrtb.rsOpenRtbRequestParamsstruct,build_publisher, lat/lon/metro on geo, bidfloor/secure/tagid on imp, consent on user, gdpr/us_privacy on regs, dnt/language on device, ref/publisher on site, tmax/cur on request)crates/common/src/auction/formats.rscrates/common/src/integrations/prebid.rsopenrtb.mdCloses
Closes #386
Test plan
cargo test --workspace(467 tests pass)cargo clippy --all-targets --all-features -- -D warningscargo fmt --all -- --checkcd crates/js/lib && npx vitest runcd crates/js/lib && npm run formatcd docs && npm run formatcargo build --bin trusted-server-fastly --release --target wasm32-wasip1fastly compute serveChecklist
unwrap()in production code — usesexpect("should ...")where neededtracingmacros (notprintln!)