Skip to content

Add template formats with deterministic format IDs - #244

Merged
bokelley merged 9 commits into
mainfrom
parameterized-formats
Nov 22, 2025
Merged

bokelley merged 9 commits into
mainfrom
parameterized-formats

Conversation

@bokelley

Copy link
Copy Markdown
Contributor

Summary

Eliminate format explosion by allowing template formats to accept dimension and duration parameters directly in format_id. Publishers can now use one format definition (e.g., display_static) to support unlimited dimension variants instead of creating separate formats for each size.

Changes

  • Added optional width, height, unit, and duration_ms fields to format_id schema
  • Added accepts_parameters array to format schema to declare parameterizable formats
  • Added parameters_from_format_id flag to indicate where format_id parameters flow
  • Created format-id-parameter enum for standardizing parameter types
  • Comprehensive documentation with examples for display, video, audio, and DOOH formats

🤖 Generated with Claude Code

bokelley and others added 9 commits November 22, 2025 10:35
Eliminate format explosion by allowing template formats to accept
dimension and duration parameters in format_id. Includes schema updates,
documentation, and enum for format parameters.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
Address all critical issues identified in expert review:

1. **Documentation consistency**: Replace accepts_duration/accepts_dimensions
   with accepts_parameters array throughout docs

2. **Duration values**: Fix all duration_ms examples (30ms → 30000ms for 30s)
   and correct field descriptions (duration → duration_ms)

3. **Schema validation**: Add mutual exclusivity constraint for
   parameters_from_format_id and explicit dimensions using oneOf

4. **Required unit field**: Add anyOf constraint requiring unit when
   width/height are present (both must be specified together)

5. **Equality rules**: Add comprehensive canonicalization section documenting:
   - Required field dependencies (width+height+unit together)
   - Numeric precision rules (integers for px, decimals for physical units)
   - Field order independence
   - No unit conversion in equality checks
   - Examples of valid/invalid format_ids

All schema validations now enforce correct usage and prevent ambiguous
format_id configurations.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
Address key integration questions with comprehensive documentation:

1. **Generative formats with template outputs**: Added section showing
   output_format_ids are always deterministic (include dimensions), even
   when the generative format itself is a template

2. **Discovery pattern**: New dedicated section explaining the split between
   creative and sales agents:
   - Creative agent returns template formats (format types + accepts_parameters)
   - Sales agent returns concrete instances (specific dimensions per placement)
   - Complete 3-step buyer workflow documented

3. **Format matching semantics**: Added explicit guidance that:
   - list_creative_formats() returns templates without dimensions
   - Format lookup matches on base format (agent_url + id only)
   - Dimension parameters used for validation, not discovery
   - Example: lookup with dimensions matches template format

These additions provide clear implementation guidance for both creative
agents and buyers integrating template formats.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
Address terminology consistency and schema description gaps:

**Terminology Updates:**
- Renamed documentation from "deterministic-format-ids" to "template-format-ids"
- Changed "deterministic format_id" to "parameterized format_id" throughout
- Clarified three types of format IDs: concrete, template (no params), parameterized (with params)
- Updated all schema descriptions to use consistent terminology

**Schema Description Improvements:**
- format-id.json: Updated description to explicitly mention all three format ID types
- creative-asset.json: Added clarification about three types of format IDs
- placement.json: Changed from "deterministic" to "parameterized" terminology
- format-id-parameter.json: Updated to reflect "parameterized format identifiers"
- Removed contradictory "Defaults to 'px'" from unit field description

**Documentation Structure:**
- Added "Format Types and Format IDs" section explaining 2 format definitions → 3 format ID types
- Clarified relationship between concrete/template formats and their format IDs
- Updated discovery pattern to show both creative and sales agents return format definitions
- Changed all "deterministic" references to "template" or "parameterized"

**Key Concept:**
- Concrete formats (fixed dimensions) → concrete format_ids (no parameters)
- Template formats (accept parameters) → template format_ids (no params) OR parameterized format_ids (with params)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
Simplifies schema by removing unit complexity:

**Rationale:**
- All creative formats are digital (pixels)
- DOOH screens are digital displays with pixel dimensions
- Physical dimensions (if needed) are placement metadata, not format spec
- Print output uses pixels + DPI, not physical units in format_id

**Schema Changes:**
- Removed `unit` field from format-id.json
- Changed width/height from `number` to `integer` (minimum: 1)
- Removed unit from format.json render dimensions
- Updated anyOf constraint to require only width+height (not unit)
- All dimension fields now explicitly "in pixels"

**Documentation Updates:**
- Updated all examples to remove unit field
- Changed DOOH example from physical (48in x 14in) to pixels (1920x560)
- Clarified "all dimensions are pixels" throughout
- Removed unit conversion section from canonicalization
- Updated Format ID Fields section to specify integers in pixels

**Changeset Updates:**
- Updated to reflect pixels-only approach
- Clarified dimensions are integers, not numbers
- Fixed documentation path reference

**Benefits:**
- ✅ Simpler mental model (always pixels)
- ✅ Consistent with all other dimension fields in schemas
- ✅ Type-safe integers prevent fractional pixel bugs
- ✅ No ambiguity about units or conversions
- ✅ Matches industry standard (creative assets are always pixels)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
Address code review feedback:

**Changes:**
1. Created new dimensions.json schema for width/height pair
   - Makes it explicit that width and height are always together
   - Cleaner than inline anyOf constraint
   - Reusable in other contexts

2. Fixed duration_ms minimum from 0 to 1
   - Zero-duration video/audio doesn't make sense
   - Minimum 1ms required

3. Refactored format-id.json to reference dimensions schema
   - Uses oneOf to clearly show: no dimensions OR full dimensions object
   - More readable and maintainable
   - Better for type generators

**Schema structure:**
```json
"oneOf": [
  { "not": { "anyOf": [{"required": ["width"]}, {"required": ["height"]}] } },  // No dimensions
  { "$ref": "/schemas/core/dimensions.json" }  // Full dimensions (width + height)
]
```

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
Reuse dimensions.json schema wherever width/height appear together:

**Updated schemas:**
- image-asset.json - Now uses allOf with dimensions.json
- video-asset.json - Now uses allOf with dimensions.json
- Also fixed video duration_ms minimum from 0 to 1

**Benefits:**
- ✅ Single source of truth for width/height pair
- ✅ Consistent validation across all dimension usage
- ✅ Clearer schema composition with allOf
- ✅ Easier to maintain (change dimensions once, applies everywhere)

**Current dimensions.json usage:**
1. format-id.json - parameterized format IDs
2. image-asset.json - image file dimensions
3. video-asset.json - video frame dimensions

**Not using dimensions.json:**
- format.json renders - Has additional fields (min_width, max_width, responsive)
- brand-manifest.json - Uses inline dimensions for brand assets
- preview-render.json - Uses inline dimensions for iframe sizing

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
All three expert reviews identified that documentation still had unit field
examples but schema doesn't include unit field.

Fixed: Removed last 3 instances of unit field from examples.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
**Critical requirement**: Sales agents MUST always return parameterized
format_ids (with specific dimensions/duration) in placements. Template
format_ids without parameters are ONLY used in format definitions from
list_creative_formats().

**Changes:**
- Updated all placement examples to remove template format_id pattern
- Added CRITICAL/REQUIREMENT warnings throughout documentation
- Emphasized exact matching requirement for placement validation
- Fixed duration_ms minimum from 0 to 1
- Removed all "unit": "px" references from examples
- Clarified DOOH uses pixel dimensions, physical size is placement metadata
- Updated changeset to reflect placement requirements

**Why this matters:**
- Buyers need explicit lists of supported dimensions
- No ambiguity about what will be accepted
- Enables clear validation at creative submission time
- Separates format discovery (templates) from placement discovery (parameterized)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
@bokelley
bokelley merged commit 73cb9f4 into main Nov 22, 2025
bmilekic pushed a commit to bmilekic/adcp that referenced this pull request Dec 5, 2025
…#244)

* Add template formats with deterministic format IDs

Eliminate format explosion by allowing template formats to accept
dimension and duration parameters in format_id. Includes schema updates,
documentation, and enum for format parameters.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>

* Fix critical issues in template formats implementation

Address all critical issues identified in expert review:

1. **Documentation consistency**: Replace accepts_duration/accepts_dimensions
   with accepts_parameters array throughout docs

2. **Duration values**: Fix all duration_ms examples (30ms → 30000ms for 30s)
   and correct field descriptions (duration → duration_ms)

3. **Schema validation**: Add mutual exclusivity constraint for
   parameters_from_format_id and explicit dimensions using oneOf

4. **Required unit field**: Add anyOf constraint requiring unit when
   width/height are present (both must be specified together)

5. **Equality rules**: Add comprehensive canonicalization section documenting:
   - Required field dependencies (width+height+unit together)
   - Numeric precision rules (integers for px, decimals for physical units)
   - Field order independence
   - No unit conversion in equality checks
   - Examples of valid/invalid format_ids

All schema validations now enforce correct usage and prevent ambiguous
format_id configurations.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>

* Add implementation guidance for template formats workflows

Address key integration questions with comprehensive documentation:

1. **Generative formats with template outputs**: Added section showing
   output_format_ids are always deterministic (include dimensions), even
   when the generative format itself is a template

2. **Discovery pattern**: New dedicated section explaining the split between
   creative and sales agents:
   - Creative agent returns template formats (format types + accepts_parameters)
   - Sales agent returns concrete instances (specific dimensions per placement)
   - Complete 3-step buyer workflow documented

3. **Format matching semantics**: Added explicit guidance that:
   - list_creative_formats() returns templates without dimensions
   - Format lookup matches on base format (agent_url + id only)
   - Dimension parameters used for validation, not discovery
   - Example: lookup with dimensions matches template format

These additions provide clear implementation guidance for both creative
agents and buyers integrating template formats.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>

* Refine template format IDs terminology and documentation

Address terminology consistency and schema description gaps:

**Terminology Updates:**
- Renamed documentation from "deterministic-format-ids" to "template-format-ids"
- Changed "deterministic format_id" to "parameterized format_id" throughout
- Clarified three types of format IDs: concrete, template (no params), parameterized (with params)
- Updated all schema descriptions to use consistent terminology

**Schema Description Improvements:**
- format-id.json: Updated description to explicitly mention all three format ID types
- creative-asset.json: Added clarification about three types of format IDs
- placement.json: Changed from "deterministic" to "parameterized" terminology
- format-id-parameter.json: Updated to reflect "parameterized format identifiers"
- Removed contradictory "Defaults to 'px'" from unit field description

**Documentation Structure:**
- Added "Format Types and Format IDs" section explaining 2 format definitions → 3 format ID types
- Clarified relationship between concrete/template formats and their format IDs
- Updated discovery pattern to show both creative and sales agents return format definitions
- Changed all "deterministic" references to "template" or "parameterized"

**Key Concept:**
- Concrete formats (fixed dimensions) → concrete format_ids (no parameters)
- Template formats (accept parameters) → template format_ids (no params) OR parameterized format_ids (with params)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>

* Remove unit field - all dimensions are pixels (integers)

Simplifies schema by removing unit complexity:

**Rationale:**
- All creative formats are digital (pixels)
- DOOH screens are digital displays with pixel dimensions
- Physical dimensions (if needed) are placement metadata, not format spec
- Print output uses pixels + DPI, not physical units in format_id

**Schema Changes:**
- Removed `unit` field from format-id.json
- Changed width/height from `number` to `integer` (minimum: 1)
- Removed unit from format.json render dimensions
- Updated anyOf constraint to require only width+height (not unit)
- All dimension fields now explicitly "in pixels"

**Documentation Updates:**
- Updated all examples to remove unit field
- Changed DOOH example from physical (48in x 14in) to pixels (1920x560)
- Clarified "all dimensions are pixels" throughout
- Removed unit conversion section from canonicalization
- Updated Format ID Fields section to specify integers in pixels

**Changeset Updates:**
- Updated to reflect pixels-only approach
- Clarified dimensions are integers, not numbers
- Fixed documentation path reference

**Benefits:**
- ✅ Simpler mental model (always pixels)
- ✅ Consistent with all other dimension fields in schemas
- ✅ Type-safe integers prevent fractional pixel bugs
- ✅ No ambiguity about units or conversions
- ✅ Matches industry standard (creative assets are always pixels)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>

* Extract dimensions schema and fix duration minimum

Address code review feedback:

**Changes:**
1. Created new dimensions.json schema for width/height pair
   - Makes it explicit that width and height are always together
   - Cleaner than inline anyOf constraint
   - Reusable in other contexts

2. Fixed duration_ms minimum from 0 to 1
   - Zero-duration video/audio doesn't make sense
   - Minimum 1ms required

3. Refactored format-id.json to reference dimensions schema
   - Uses oneOf to clearly show: no dimensions OR full dimensions object
   - More readable and maintainable
   - Better for type generators

**Schema structure:**
```json
"oneOf": [
  { "not": { "anyOf": [{"required": ["width"]}, {"required": ["height"]}] } },  // No dimensions
  { "$ref": "/schemas/core/dimensions.json" }  // Full dimensions (width + height)
]
```

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>

* Use dimensions schema in image and video assets

Reuse dimensions.json schema wherever width/height appear together:

**Updated schemas:**
- image-asset.json - Now uses allOf with dimensions.json
- video-asset.json - Now uses allOf with dimensions.json
- Also fixed video duration_ms minimum from 0 to 1

**Benefits:**
- ✅ Single source of truth for width/height pair
- ✅ Consistent validation across all dimension usage
- ✅ Clearer schema composition with allOf
- ✅ Easier to maintain (change dimensions once, applies everywhere)

**Current dimensions.json usage:**
1. format-id.json - parameterized format IDs
2. image-asset.json - image file dimensions
3. video-asset.json - video frame dimensions

**Not using dimensions.json:**
- format.json renders - Has additional fields (min_width, max_width, responsive)
- brand-manifest.json - Uses inline dimensions for brand assets
- preview-render.json - Uses inline dimensions for iframe sizing

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>

* Remove remaining unit field references from documentation

All three expert reviews identified that documentation still had unit field
examples but schema doesn't include unit field.

Fixed: Removed last 3 instances of unit field from examples.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>

* Clarify that placements MUST use parameterized format_ids

**Critical requirement**: Sales agents MUST always return parameterized
format_ids (with specific dimensions/duration) in placements. Template
format_ids without parameters are ONLY used in format definitions from
list_creative_formats().

**Changes:**
- Updated all placement examples to remove template format_id pattern
- Added CRITICAL/REQUIREMENT warnings throughout documentation
- Emphasized exact matching requirement for placement validation
- Fixed duration_ms minimum from 0 to 1
- Removed all "unit": "px" references from examples
- Clarified DOOH uses pixel dimensions, physical size is placement metadata
- Updated changeset to reflect placement requirements

**Why this matters:**
- Buyers need explicit lists of supported dimensions
- No ambiguity about what will be accepted
- Enables clear validation at creative submission time
- Separates format discovery (templates) from placement discovery (parameterized)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>

---------

Co-authored-by: Claude <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant