Skip to content

SyncCreativesRequest.assignments map has ambiguous key direction and missing weight/placement fields #1237

Closed

Description

@bokelley

Problem

SyncCreativesRequest.assignments is typed as { [k: string]: string[] }. The comment says "Optional bulk assignment of creatives to packages" but does not specify whether the key is a creative ID (mapping to package IDs) or a package ID (mapping to creative IDs). These are opposite directions and an implementer reading the raw type without documentation will guess wrong roughly half the time.

Additionally, the freeform map cannot express weight or placement_ids from CreativeAssignment — critical fields for rotation management and format-specific placement. A seller that receives assignments via this field has less information than one that receives assignments via PackageRequest.creatives[].assignments.

Proposed fix

Replace the freeform map with a typed array using the existing CreativeAssignment type:

interface SyncCreativesRequest {
  // existing fields...
  assignments?: Array<{
    creative_id: string;
    package_id: string;
    weight?: number;
    placement_ids?: string[];
  }>;
}

This is unambiguous in direction, maintains feature parity with inline PackageRequest assignments, and is easier to validate.

Activity

  1. bokelley commented on Feb 28, 2026

    @bokelley
    ContributorAuthor

    Resolved in #1252.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions