Skip to content
This repository was archived by the owner on Mar 15, 2026. It is now read-only.

Enforce structured FormatId for creative formats - #14

Merged
bokelley merged 3 commits into
mainfrom
fix-format-id-structure
Oct 16, 2025
Merged

Enforce structured FormatId for creative formats#14
bokelley merged 3 commits into
mainfrom
fix-format-id-structure

Conversation

@bokelley

Copy link
Copy Markdown
Contributor

Background

Previous versions of the AdCP schema allowed format_id to be a string. AdCP v2.4.1 requires format_id to be a structured object (FormatId) containing agent_url and id. This change ensures compliance by removing support for string-based format_ids and enforcing the structured object.

Changes

  • src/creative_agent/schemas_generated/_schemas_v1_core_format_json.py: Updated Format.format_id to use the FormatId schema instead of str.
  • src/creative_agent/data/standard_formats.py:
    • Created a create_format_id helper function to generate structured FormatId objects using the agent's URL.
    • Modified all format definitions to use create_format_id.
    • Updated get_format_by_id and filter_formats to correctly handle and filter by FormatId objects.
  • src/creative_agent/server.py:
    • Updated list_creative_formats to convert input string format_ids to FormatId objects.
    • Modified preview_creative to use normalize_format_id_for_comparison for strict FormatId comparison, removing support for string format IDs.
  • src/creative_agent/schemas/manifest.py: Changed PreviewCreativeRequest.format_id to strictly expect a FormatId object, removing the str option.
  • tests/schema_compliance/test_format_schema_compliance.py: Updated test_output_format_ids_are_strings to verify that output_format_ids contain valid FormatId objects (dictionaries with agent_url and id), not strings.
  • tests/smoke/test_server_startup.py: Updated test_list_creative_formats to correctly access the id field from FormatId objects.

Testing

  • All existing tests pass (57/57).
  • New formats created with create_format_id using the correct AGENT_URL.
  • preview_creative correctly validates FormatId objects from manifests and requests.
  • list_creative_formats correctly filters by structured FormatId objects.

@bokelley
bokelley merged commit 9cc0813 into main Oct 16, 2025
3 checks passed
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant