Skip to content

Macro declaration models are reachable only by numbered names (MacroDeclaration15, MacroDeclaration16, asset_union.MacroDeclaration6) #1783

Closed

Description

@bokelley

A seller that validates or builds an asset's macro_declarations has to pick the generated model for that asset. Today the only names are codegen counters. On 10.0.0b4:

  • display_tag_asset has MacroDeclaration (tag URL: location.field is Literal['url']), MacroDeclaration15 (inline markup: Literal['markup']) and MacroDeclaration16 (paired redirect: ad_request_url / clickthrough_url);
  • asset_union has MacroDeclaration through MacroDeclaration10 plus MacroDeclarationModel.

The numbers move when the bundle changes. On 9.3.0 the three display-tag variants shared one location type. AdCP 3.3 gave each delivery its own fields, so the same import now validates different things. Code written against MacroDeclaration for a paired redirect started refusing clickthrough_url on 10.0.0b2 with no rename to signal it.

Example

The Scope3 embedded sales agent's test factory (tests/factories/macro_declaration.py) builds declarations for each display_tag delivery and has to import:

from adcp.types.domains.core.assets.asset_union import MacroDeclaration6
from adcp.types.domains.core.assets.display_tag_asset import MacroDeclaration as TagUrlMacroDeclaration
from adcp.types.domains.core.assets.display_tag_asset import MacroDeclaration15 as InlineMarkupMacroDeclaration
from adcp.types.domains.core.assets.display_tag_asset import MacroDeclaration16 as PairedRedirectMacroDeclaration

On 10.0.0b4:

from adcp.types.domains.core.assets.display_tag_asset import MacroDeclaration
MacroDeclaration.model_validate({..., "location": {"field": "clickthrough_url", "occurrence": 0, "context": "url_query_value"}})
# ValidationError: location.field Input should be 'url'

Suggested fix

Emit stable, meaningful names for these variants: per delivery_type for display_tag (TagUrlMacroDeclaration, InlineMarkupMacroDeclaration, PairedRedirectMacroDeclaration) and per asset type in asset_union, or a title-derived name from the schema. Export them from adcp.types, as #1360 did for other generated classes. A helper such as macro_declaration_model(asset_type, delivery_type) would also work.

Activity

  1. added a commit that references this issue on Nov 2, 2026
    64bc9b7
  2. bokelley commented on Nov 2, 2026

    @bokelley
    ContributorAuthor

    Fixed on next by #1801 (squash 64bc9b77): adcp.types exports one name per asset arm (TagUrlMacroDeclaration, PairedRedirectMacroDeclaration, UrlVastMacroDeclaration, ...) plus macro_declaration_model(asset_type, delivery_type=None); tests/test_macro_declaration_names.py derives the mapping from the AssetVariant arms so a renumber fails instead of repointing a name.

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