Module adcp.types.domains.formats.canonical.responsive_creative

Classes

class CanonicalFormatResponsiveCreative (**data: Any)
Expand source code
class CanonicalFormatResponsiveCreative(CanonicalFormatBase):
    model_config = ConfigDict(
        extra='allow',
    )
    experimental: Annotated[
        Any | None,
        Field(
            description="Marked experimental at 3.1 GA: composition is algorithmic (the surface picks combinations and reports per-asset breakdowns), and there's no clean v1-translatable equivalent. Buyers ship asset pools rather than rendered creatives; the surface's per-impression composition cannot be predicted by `validate_input`. Adopters SHOULD validate behavior per surface (Google PMax vs Meta Advantage+ creative differ meaningfully)."
        ),
    ] = True
    v1_translatable: Annotated[
        Any | None,
        Field(
            description="Inherently new in v2 — algorithmic asset-pool composition (Google PMax / Meta Advantage+ creative) wasn't expressible as v1 named formats. SDKs MUST NOT emit `FORMAT_PROJECTION_FAILED` for products using this canonical; the v1-unreachability is structural."
        ),
    ] = False
    slots: Any | None = [
        {
            'asset_group_id': 'headlines',
            'asset_type': 'text',
            'required': True,
            'min': 3,
            'max': 15,
        },
        {
            'asset_group_id': 'long_headlines',
            'asset_type': 'text',
            'required': False,
            'min': 1,
            'max': 5,
        },
        {
            'asset_group_id': 'descriptions',
            'asset_type': 'text',
            'required': True,
            'min': 2,
            'max': 5,
        },
        {
            'asset_group_id': 'images_landscape',
            'asset_type': 'image',
            'required': False,
            'min': 1,
            'max': 20,
        },
        {
            'asset_group_id': 'images_square',
            'asset_type': 'image',
            'required': False,
            'min': 1,
            'max': 20,
        },
        {
            'asset_group_id': 'images_vertical',
            'asset_type': 'image',
            'required': False,
            'min': 1,
            'max': 20,
        },
        {'asset_group_id': 'video', 'asset_type': 'video', 'required': False, 'min': 0, 'max': 5},
        {
            'asset_group_id': 'logo',
            'asset_type': 'image',
            'required': True,
            'min': 1,
            'max': 5,
            'logo_slots': [
                'logo_card_light',
                'logo_card_dark',
                'marketplace_listing',
                'ad_end_card',
            ],
            'required_logo_slots': ['logo_card_light', 'logo_card_dark'],
        },
        {
            'asset_group_id': 'landing_page_url',
            'asset_type': 'url',
            'required': True,
            'min': 1,
            'max': 1,
        },
    ]
    headlines_min: Annotated[SchemaInt | None, Field(ge=0)] = None
    headlines_max: Annotated[SchemaInt | None, Field(ge=0)] = None
    headline_max_chars: Annotated[SchemaInt | None, Field(ge=1)] = None
    long_headlines_min: Annotated[SchemaInt | None, Field(ge=0)] = None
    long_headlines_max: Annotated[SchemaInt | None, Field(ge=0)] = None
    long_headline_max_chars: Annotated[SchemaInt | None, Field(ge=1)] = None
    descriptions_min: Annotated[SchemaInt | None, Field(ge=0)] = None
    descriptions_max: Annotated[SchemaInt | None, Field(ge=0)] = None
    description_max_chars: Annotated[SchemaInt | None, Field(ge=1)] = None
    images_landscape_min: Annotated[SchemaInt | None, Field(ge=0)] = None
    images_landscape_max: Annotated[SchemaInt | None, Field(ge=0)] = None
    images_landscape_aspect_ratio: str | None = None
    images_square_min: Annotated[SchemaInt | None, Field(ge=0)] = None
    images_square_max: Annotated[SchemaInt | None, Field(ge=0)] = None
    images_vertical_min: Annotated[SchemaInt | None, Field(ge=0)] = None
    images_vertical_max: Annotated[SchemaInt | None, Field(ge=0)] = None
    videos_min: Annotated[SchemaInt | None, Field(ge=0)] = None
    videos_max: Annotated[SchemaInt | None, Field(ge=0)] = None
    video_min_duration_ms: Annotated[SchemaInt | None, Field(ge=1)] = None
    video_max_duration_ms: Annotated[SchemaInt | None, Field(ge=1)] = None
    logo_min: Annotated[SchemaInt | None, Field(ge=0)] = None
    logo_max: Annotated[SchemaInt | None, Field(ge=0)] = None
    logo_aspect_ratios: list[str] | None = None
    business_name_max_chars: Annotated[SchemaInt | None, Field(ge=1)] = None
    asset_image_max_file_size_kb: Annotated[SchemaInt | None, Field(ge=1)] = None
    supports_catalog_input: Annotated[
        StrictBool | None,
        Field(
            description='Whether the product can additionally consume a catalog reference (e.g., PMax with product feed).'
        ),
    ] = None

Base model for AdCP types with spec-compliant serialization.

Defaults to extra='ignore' so unknown fields from newer spec versions are silently dropped rather than causing validation errors. Generated types whose schemas set additionalProperties: true override this with extra='allow' in their own model_config.

Set ADCP_STRICT_VALIDATION=1 in the environment ("1", "true", "yes", "on" are accepted) to flip the default to extra='forbid'. Use this during spec upgrades to catch silently-dropped renamed fields in tests. See :func:_resolve_extra_policy.

Important

The env var is resolved once at module import time. Set it in your shell or CI environment before import adcp runs — mutating os.environ["ADCP_STRICT_VALIDATION"] after the first adcp import has no effect on already-imported model classes (they captured the policy at class-body evaluation).

Consumers who want per-model strict validation can override model_config on their subclass.

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

Ancestors

  • adcp.types.domains.formats.canonical._base.CanonicalFormatBase
  • AdCPBaseModel
  • pydantic.main.BaseModel

Class variables

var asset_image_max_file_size_kb : int | None
var business_name_max_chars : int | None
var description_max_chars : int | None
var descriptions_max : int | None
var descriptions_min : int | None
var experimental : typing.Any | None
var headline_max_chars : int | None
var headlines_max : int | None
var headlines_min : int | None
var images_landscape_aspect_ratio : str | None
var images_landscape_max : int | None
var images_landscape_min : int | None
var images_square_max : int | None
var images_square_min : int | None
var images_vertical_max : int | None
var images_vertical_min : int | None
var logo_aspect_ratios : list[str] | None
var logo_max : int | None
var logo_min : int | None
var long_headline_max_chars : int | None
var long_headlines_max : int | None
var long_headlines_min : int | None
var model_config
var slots : typing.Any | None
var supports_catalog_input : bool | None
var v1_translatable : typing.Any | None
var video_max_duration_ms : int | None
var video_min_duration_ms : int | None
var videos_max : int | None
var videos_min : int | None

Inherited members