Skip to content

fix(types): align SyncCreativesResponse Creative & CreateMediaBuyResponse1 with rc.9 schema#921

Closed
bokelley wants to merge 1 commit into
mainfrom
claude/issue-918-creative-spec-fields
Closed

fix(types): align SyncCreativesResponse Creative & CreateMediaBuyResponse1 with rc.9 schema#921
bokelley wants to merge 1 commit into
mainfrom
claude/issue-918-creative-spec-fields

Conversation

@bokelley
Copy link
Copy Markdown
Contributor

@bokelley bokelley commented Jun 6, 2026

Two codegen type-accuracy fixes against the cached AdCP 3.1.0-rc.9 schemas. Both buggy classes are hand-authored snippets in scripts/post_generate_fixes.py, so a future schema regen would not auto-fix them — the snippets are edited and the generated files regenerated to match.

#918SyncCreativesResponse Creative missing 9 of 12 spec fields

The per-creative result item (oneOf[0].properties.creatives.items in sync-creatives-response.json, required=[creative_id, action]) defines 12 properties. The snippet declared only creative_id, action, errors. Added the 9 missing optional fields with types derived from the rc.9 bundled schema:

field type
account Account | None = None
status CreativeStatus | str | None = None
platform_id str | None = None
changes list[str] | None = None
warnings list[str] | None = None
preview_url str | None = None
expires_at AwareDatetime | None = None
assigned_to list[str] | None = None
assignment_errors dict[str, str] | None = None

#914CreateMediaBuyResponse1 incorrectly declares buyer_ref

buyer_ref is absent from create-media-buy-response.json arm 0 (it exists only on the request). Removed the field.

Tests

Added to tests/test_code_generation.py:

  • test_sync_creatives_response_creative_covers_all_spec_fields — asserts all 12 schema property names are in Creative.model_fields
  • test_create_media_buy_response_arm0_omits_buyer_ref — asserts buyer_ref not in CreateMediaBuyResponse1.model_fields

Verification

make lint, make typecheck, validate-generated, and tests/test_code_generation.py all pass. Regenerated locally from the cached rc.9 schemas (no re-download, no version bump). Variant-renumber churn in other generated files was discarded per CLAUDE.md.

Closes #918
Closes #914

🤖 Generated with Claude Code

…sponse1 with rc.9 schema

The Creative item in SyncCreativesResponse declared only creative_id,
action, and errors, dropping 9 optional fields the AdCP schema defines on
oneOf[0].properties.creatives.items. Add account, status, platform_id,
changes, warnings, preview_url, expires_at, assigned_to, and
assignment_errors with types derived from the rc.9 bundled schema.

CreateMediaBuyResponse1 declared buyer_ref, which the response schema does
not define (it exists only on the request). Remove it.

Both classes are hand-authored snippets in scripts/post_generate_fixes.py;
edit the snippets and regenerate from the cached rc.9 schemas.

Closes #918
Closes #914

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@bokelley
Copy link
Copy Markdown
Contributor Author

bokelley commented Jun 6, 2026

Superseded by #922, which is now merged. #922 fixes this at the root cause — it removes the hand-authored _write_if_needed response-arm snippets in post_generate_fixes.py entirely and schema-derives the arms instead, so the full 12-field Creative (#918) and the buyer_ref removal (#914) come straight from the rc.9 schemas with more faithful types (AnyUrl, pattern-constrained assignment_errors, no | str escape hatch). Closing in favor of #922.

@bokelley bokelley closed this Jun 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant