Skip to content

Commit d29ada1

Browse files
bokelleyclaude
andcommitted
fix: complete FormatId union support and update all ImageAsset usages
- Add core/**/*.py to FormatId union reference fixes - Add GetProductsRequest and other request types to model_rebuild list - Update all ImageAsset creations to include required width/height fields - preview_cache.py: _create_sample_manifest_for_format_id - test_preview_html.py: all test manifests Test results: 306 passing (all tests passing!) This completes the schema sync work. All tests now pass with the new FormatId discriminated union and updated asset dimension requirements. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent c6d6d18 commit d29ada1

File tree

12 files changed

+46
-25
lines changed

12 files changed

+46
-25
lines changed

scripts/consolidate_exports.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -236,8 +236,11 @@ def generate_consolidated_exports() -> str:
236236
"Placement.model_rebuild()",
237237
"",
238238
"# Rebuild request types that reference FormatId discriminated unions",
239+
"GetProductsRequest.model_rebuild()",
239240
"ListCreativeFormatsRequest.model_rebuild()",
240241
"BuildCreativeRequest.model_rebuild()",
242+
"SyncCreativesRequest.model_rebuild()",
243+
"ListCreativesRequest.model_rebuild()",
241244
"",
242245
"# Rebuild response types that reference FormatId discriminated unions",
243246
"GetProductsResponse.model_rebuild()",

scripts/post_generate_fixes.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ def fix_format_id_union_references():
190190
This fixes field annotations to accept both variants.
191191
"""
192192
files_to_fix = []
193-
for pattern in ["creative/**/*.py", "media_buy/**/*.py"]:
193+
for pattern in ["core/**/*.py", "creative/**/*.py", "media_buy/**/*.py"]:
194194
files_to_fix.extend(OUTPUT_DIR.glob(pattern))
195195

196196
for file_path in files_to_fix:

src/adcp/types/_generated.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
DO NOT EDIT MANUALLY.
1111
1212
Generated from: https://github.com/adcontextprotocol/adcp/tree/main/schemas
13-
Generation date: 2025-11-22 19:30:48 UTC
13+
Generation date: 2025-11-22 19:37:19 UTC
1414
"""
1515
# ruff: noqa: E501, I001
1616
from __future__ import annotations
@@ -243,8 +243,11 @@
243243
Placement.model_rebuild()
244244

245245
# Rebuild request types that reference FormatId discriminated unions
246+
GetProductsRequest.model_rebuild()
246247
ListCreativeFormatsRequest.model_rebuild()
247248
BuildCreativeRequest.model_rebuild()
249+
SyncCreativesRequest.model_rebuild()
250+
ListCreativesRequest.model_rebuild()
248251

249252
# Rebuild response types that reference FormatId discriminated unions
250253
GetProductsResponse.model_rebuild()

src/adcp/types/generated_poc/core/creative_asset.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,7 @@ class CreativeAsset(AdCPBaseModel):
6969
Field(description='Assets required by the format, keyed by asset_role'),
7070
]
7171
creative_id: Annotated[str, Field(description='Unique identifier for the creative')]
72-
format_id: Annotated[
73-
FormatId2,
72+
format_id: Annotated[FormatId1 | FormatId2,
7473
Field(
7574
description='Format identifier specifying which format this creative conforms to. Can be: (1) concrete format_id referencing a format with fixed dimensions, (2) template format_id referencing a template format, or (3) parameterized format_id with dimensions/duration parameters for template formats.',
7675
title='Format ID',

src/adcp/types/generated_poc/core/creative_manifest.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,7 @@ class CreativeManifest(AdCPBaseModel):
5454
),
5555
]
5656
ext: ext_1.ExtensionObject | None = None
57-
format_id: Annotated[
58-
FormatId2,
57+
format_id: Annotated[FormatId1 | FormatId2,
5958
Field(
6059
description="Format identifier this manifest is for. Can be a template format (id only) or a deterministic format (id + dimensions/duration). For dimension-specific creatives, include width/height/unit in the format_id to create a unique identifier (e.g., {id: 'display_static', width: 300, height: 250, unit: 'px'}).",
6160
title='Format ID',

src/adcp/types/generated_poc/core/format.py

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -148,8 +148,7 @@ class FormatCard(AdCPBaseModel):
148148
model_config = ConfigDict(
149149
extra='forbid',
150150
)
151-
format_id: Annotated[
152-
FormatId2,
151+
format_id: Annotated[FormatId1 | FormatId2,
153152
Field(
154153
description='Creative format defining the card layout (typically format_card_standard)',
155154
title='Format ID',
@@ -165,8 +164,7 @@ class FormatCardDetailed(AdCPBaseModel):
165164
model_config = ConfigDict(
166165
extra='forbid',
167166
)
168-
format_id: Annotated[
169-
FormatId2,
167+
format_id: Annotated[FormatId1 | FormatId2,
170168
Field(
171169
description='Creative format defining the detailed card layout (typically format_card_detailed)',
172170
title='Format ID',
@@ -224,16 +222,15 @@ class Format(AdCPBaseModel):
224222
description='Optional detailed card with carousel and full specifications. Provides rich format documentation similar to ad spec pages.'
225223
),
226224
] = None
227-
format_id: Annotated[
228-
FormatId2,
225+
format_id: Annotated[FormatId1 | FormatId2,
229226
Field(
230227
description='Structured format identifier with agent URL and format name',
231228
title='Format ID',
232229
),
233230
]
234231
name: Annotated[str, Field(description='Human-readable format name')]
235232
output_format_ids: Annotated[
236-
list[FormatId2] | None,
233+
list[FormatId1 | FormatId2] | None,
237234
Field(
238235
description='For generative formats: array of format IDs that this format can generate. When a format accepts inputs like brand_manifest and message, this specifies what concrete output formats can be produced (e.g., a generative banner format might output standard image banner formats).'
239236
),

src/adcp/types/generated_poc/core/package.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ class Package(AdCPBaseModel):
4242
] = None
4343
ext: ext_1.ExtensionObject | None = None
4444
format_ids_to_provide: Annotated[
45-
list[FormatId2] | None,
45+
list[FormatId1 | FormatId2] | None,
4646
Field(description='Format IDs that creative assets will be provided for this package'),
4747
] = None
4848
impressions: Annotated[

src/adcp/types/generated_poc/core/placement.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ class Placement(AdCPBaseModel):
2020
str | None, Field(description='Detailed description of where and how the placement appears')
2121
] = None
2222
format_ids: Annotated[
23-
list[FormatId2] | None,
23+
list[FormatId1 | FormatId2] | None,
2424
Field(
2525
description='Format IDs supported by this specific placement. Can include: (1) concrete format_ids (fixed dimensions), (2) template format_ids without parameters (accepts any dimensions/duration), or (3) parameterized format_ids (specific dimension/duration constraints).',
2626
min_length=1,

src/adcp/types/generated_poc/core/product.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,7 @@ class ProductCard(AdCPBaseModel):
4848
model_config = ConfigDict(
4949
extra='forbid',
5050
)
51-
format_id: Annotated[
52-
FormatId2,
51+
format_id: Annotated[FormatId1 | FormatId2,
5352
Field(
5453
description='Creative format defining the card layout (typically product_card_standard)',
5554
title='Format ID',
@@ -65,8 +64,7 @@ class ProductCardDetailed(AdCPBaseModel):
6564
model_config = ConfigDict(
6665
extra='forbid',
6766
)
68-
format_id: Annotated[
69-
FormatId2,
67+
format_id: Annotated[FormatId1 | FormatId2,
7068
Field(
7169
description='Creative format defining the detailed card layout (typically product_card_detailed)',
7270
title='Format ID',
@@ -110,7 +108,7 @@ class Product(AdCPBaseModel):
110108
] = None
111109
ext: ext_1.ExtensionObject | None = None
112110
format_ids: Annotated[
113-
list[FormatId2],
111+
list[FormatId1 | FormatId2],
114112
Field(
115113
description='Array of supported creative format IDs - structured format_id objects with agent_url and id'
116114
),

src/adcp/types/generated_poc/core/product_filters.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ class ProductFilters(AdCPBaseModel):
7474
),
7575
] = None
7676
format_ids: Annotated[
77-
list[FormatId2] | None, Field(description='Filter by specific format IDs')
77+
list[FormatId1 | FormatId2] | None, Field(description='Filter by specific format IDs')
7878
] = None
7979
format_types: Annotated[
8080
list[format_category.FormatCategory] | None, Field(description='Filter by format types')

0 commit comments

Comments
 (0)