Adapt a v3-style package request for a v2 server.
Converts creative_assignments to creative_ids (dropping weight and placement_ids).
Strips v3-only package fields (optimization_goals, catalogs).
When ctx is provided and the input has no buyer_ref, derives one from —
in order — package.context.buyer_ref, package.idempotency_key, or
${ctx.parentBuyerRef}-${ctx.index} so v2.5 package-request validation
passes. Caller-supplied top-level buyer_ref always wins. The context.buyer_ref
fallback exists because v3 callers put their per-package correlation ref in
context.buyer_ref (per the 3.0 package schema); this adapter is the only
place that promotes it back to the top-level shape v2.5 sellers still expect.
Adapt a v3-style package request for a v2 server. Converts creative_assignments to creative_ids (dropping weight and placement_ids). Strips v3-only package fields (optimization_goals, catalogs).
When
ctxis provided and the input has nobuyer_ref, derives one from — in order —package.context.buyer_ref,package.idempotency_key, or${ctx.parentBuyerRef}-${ctx.index}so v2.5 package-request validation passes. Caller-supplied top-levelbuyer_refalways wins. Thecontext.buyer_reffallback exists because v3 callers put their per-package correlation ref incontext.buyer_ref(per the 3.0 package schema); this adapter is the only place that promotes it back to the top-level shape v2.5 sellers still expect.