This repository was archived by the owner on Mar 15, 2026. It is now read-only.
Update to AdCP v2.4.1 with structured renders field - #11
Merged
Conversation
Implements the new renders array from AdCP PR #119, replacing the unstructured requirements.dimensions string with a proper structured schema. Changes: - Updated format.json schema with renders array containing role and dimensions objects - Regenerated Pydantic models with Dimensions, Render, Responsive, and Unit types (fixed Pydantic v2 syntax) - Updated all 26 formats (generative, display, video, DOOH) to use renders field - Created create_fixed_render helper for non-responsive formats - Updated server.py preview code to extract dimensions from renders[0].dimensions - Updated filter_formats to use renders for dimension filtering while maintaining backward compatibility with "WxH" string format - Added mypy disable for call-arg errors in standard_formats (Pydantic extra='forbid' false positives) Fixes: 'Format' object has no attribute 'dimensions' error in preview rendering 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
The CI was failing because manually edited schemas had different formatting than what the official generate_schemas.py script produces. This commit regenerates both _schemas_v1_core_format_json.py and _schemas_v1_creative_list_creative_formats_response_json.py using the official script to ensure consistent formatting. Changes: - Single-quote strings changed to double-quote (PEP 8) - Annotated types use consistent formatting - Response schema now includes Render/Dimensions/Unit/Responsive classes inline instead of importing from core format (avoids circular deps) All tests pass (57/57).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes the
'Format' object has no attribute 'dimensions'error in preview rendering by implementing the new structuredrendersfield from AdCP PR #119.What Changed
Schema Updates
format.jsonschema with newrendersarray containing:role: Semantic role of the rendered piece (e.g., "primary", "companion")dimensions: Structured object withwidth,height,responsive,unit, etc.Format Definitions
create_fixed_render()helper for non-responsive formatsrequirements={"dimensions": "300x250"}torenders=[create_fixed_render(300, 250)]Code Updates
format_obj.requirements["dimensions"]toformat_obj.renders[0].dimensionsrendersarray while maintaining backward compatibility with "WxH" string queriesrendersfield to list_creative_formats response FormatWhy This Matters
The old approach buried critical dimension metadata in an unstructured
requirementsdict with string parsing. The new structured approach provides:✅ Type-safe access to dimensions
✅ Support for responsive layouts (
responsive.width,responsive.height)✅ Multiple render targets (companion ads, adaptive formats)
✅ Proper units (px, dp, inches, cm)
✅ Aspect ratio constraints
✅ Min/max dimension ranges
This is now properly validated by Pydantic and won't cause AttributeError at runtime.
Test Plan
🤖 Generated with Claude Code