Skip to content

feat(types): add Zod schemas for format asset slot shapes#1653

Closed
bokelley wants to merge 2 commits into
mainfrom
claude/issue-1652-format-asset-slot-schemas
Closed

feat(types): add Zod schemas for format asset slot shapes#1653
bokelley wants to merge 2 commits into
mainfrom
claude/issue-1652-format-asset-slot-schemas

Conversation

@bokelley
Copy link
Copy Markdown
Contributor

Refs #1652

Adds FormatAssetSlotSchema, IndividualAssetSlotSchema, RepeatableGroupSlotSchema, all 14 per-type individual slot schemas (IndividualImageAssetSlotSchema, IndividualVideoAssetSlotSchema, …), and 12 group slot schemas (GroupImageAssetSlotSchema, …) as hand-authored Zod companions to the existing TS types in format-asset-slots.ts. The Zod codegen pipeline (generate-zod-from-ts.ts) cannot process the GroupSlotOf<T> mapped type, so these are maintained manually — referencing the existing *AssetRequirementsSchema and OverlaySchema from schemas.generated.ts. Consumers can now validate Format.assets[] from listCreativeFormats() at runtime without maintaining their own Zod union.

This PR ships Part A only. Part B (tightening Format.assets from the incorrect (IndividualImageAsset | … | RepeatableGroupAsset)[] creative-instance types to FormatAssetSlot[]) is a breaking TypeScript type change — needs a major semver bump decision from @bokelley. See #1652 for details.

Note on type/schema divergence: GroupAssetSlot (the TS union in format-asset-slots.ts) still includes GroupBriefAssetSlot and GroupCatalogAssetSlot, and the builder helpers briefGroupAsset/catalogGroupAsset remain. GroupAssetSlotSchema correctly excludes brief/catalog (matching RepeatableGroupAssetSchema in schemas.generated.ts). Aligning the TS types and removing the builders is a breaking change — same semver decision required as Part B.

What was tested

  • npm run format:check — passes
  • tsc --project tsconfig.lib.json — only pre-existing env errors (missing @types/node, deprecated moduleResolution=node10; confirmed same on main). No new type errors.
  • Build skipped: npm run sync-schemas required to populate schemas/cache/ before build:lib can run; this is an environment limitation, not introduced by this PR.

Pre-PR review

  • code-reviewer: approved — both blockers (missing rejection tests, GroupBrief/GroupCatalog in union) resolved; nit on min_count/max_count being z.number() vs .int() (consistent with generated schemas)
  • ad-tech-protocol-expert: approved at Zod layer — 12-member GroupAssetSlotSchema correctly matches spec and RepeatableGroupAssetSchema; pre-existing TS type divergence (GroupBriefAssetSlot/GroupCatalogAssetSlot in GroupAssetSlot) surfaced as follow-up breaking change

Triage-managed PR. This bot does not currently iterate on
review comments or PR conversation threads (only on the source
issue). To unblock:

  • Push fixup commits directly: gh pr checkout <num>
    fix → push.
  • Or re-trigger: comment /triage execute on the source
    issue.

See adcp#3121
for context.

Session: https://claude.ai/code/session_01RMZexuDcTbgM96xZQwLSjL


Generated by Claude Code

claude added 2 commits May 10, 2026 17:37
Adds FormatAssetSlotSchema, IndividualAssetSlotSchema, RepeatableGroupSlotSchema
and all 14 per-type variants. Hand-authored companion to format-asset-slots.ts;
closes the gap where generate-zod-from-ts.ts cannot process the mapped GroupSlotOf<T>
types. Consumers can now validate Format.assets[] at runtime without maintaining
their own Zod union.

Refs #1652

https://claude.ai/code/session_01RMZexuDcTbgM96xZQwLSjL
…ction tests

GroupBriefAssetSlotSchema and GroupCatalogAssetSlotSchema are not valid members of
RepeatableGroupSlotSchema per spec — brief/catalog are campaign-input metadata types,
not delivery-ready creative assets. Mirrors schemas.generated.ts RepeatableGroupAssetSchema
which also excludes them. Adds tests for inner asset_type rejection and brief/catalog
exclusion from the group union.

https://claude.ai/code/session_01RMZexuDcTbgM96xZQwLSjL
@bokelley
Copy link
Copy Markdown
Contributor Author

Superseded by #1654 (merged), which produces the same slot schemas (IndividualAssetSlotSchema, FormatAssetSlotSchema, per-type IndividualImageAssetSchema { asset_type, requirements }, etc.) via codegen rather than hand authoring. Routes the discriminator + requirements through the existing ts-to-zod pipeline so they stay in sync with the spec automatically. Closing.

@bokelley bokelley closed this May 11, 2026
@bokelley bokelley deleted the claude/issue-1652-format-asset-slot-schemas branch May 11, 2026 06:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants