This repository was archived by the owner on Mar 15, 2026. It is now read-only.
Enforce structured FormatId for creative formats - #14
Merged
Conversation
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.
Background
Previous versions of the AdCP schema allowed
format_idto be a string. AdCP v2.4.1 requiresformat_idto be a structured object (FormatId) containingagent_urlandid. This change ensures compliance by removing support for string-basedformat_ids and enforcing the structured object.Changes
src/creative_agent/schemas_generated/_schemas_v1_core_format_json.py: UpdatedFormat.format_idto use theFormatIdschema instead ofstr.src/creative_agent/data/standard_formats.py:create_format_idhelper function to generate structuredFormatIdobjects using the agent's URL.create_format_id.get_format_by_idandfilter_formatsto correctly handle and filter byFormatIdobjects.src/creative_agent/server.py:list_creative_formatsto convert input stringformat_idstoFormatIdobjects.preview_creativeto usenormalize_format_id_for_comparisonfor strictFormatIdcomparison, removing support for string format IDs.src/creative_agent/schemas/manifest.py: ChangedPreviewCreativeRequest.format_idto strictly expect aFormatIdobject, removing thestroption.tests/schema_compliance/test_format_schema_compliance.py: Updatedtest_output_format_ids_are_stringsto verify thatoutput_format_idscontain validFormatIdobjects (dictionaries withagent_urlandid), not strings.tests/smoke/test_server_startup.py: Updatedtest_list_creative_formatsto correctly access theidfield fromFormatIdobjects.Testing
create_format_idusing the correctAGENT_URL.preview_creativecorrectly validatesFormatIdobjects from manifests and requests.list_creative_formatscorrectly filters by structuredFormatIdobjects.