Skip to content

Commit ef5cda0

Browse files
bokelleyclaude
andcommitted
refactor: Migrate to datamodel-code-generator for type generation
Replace custom 900-line type generator with battle-tested datamodel-code-generator library. ## Changes ### Type Generation - Generate Pydantic models from JSON schemas using datamodel-code-generator - All 101 schemas now generate proper Pydantic v2 models - Models inherit from AdCPBaseModel to maintain `exclude_none=True` serialization - Generated types use proper Pydantic types (AnyUrl, AwareDatetime, Field validators) ### Backward Compatibility - Added 22 type aliases to preserve existing API surface - Aliases: ActivateSignalSuccess/Error, CreateMediaBuySuccess/Error, etc. - Deployment/Destination variants: PlatformDeployment, AgentDeployment, etc. ### Schema Sync Improvements - Added ETag support for efficient schema updates - Added --force flag to bypass ETags and force re-download - Cache ETags in .etags.json for conditional downloads - Better status reporting (not modified, updated, cached, forced) ### Test Updates - Fixed test_discriminated_unions.py for new schemas - Fixed test_format_id_validation.py for new error messages - Updated Error object construction to use dict syntax - Added URL type handling for AnyUrl comparisons - All migration-related tests passing (219/229 total) ### Files - New: src/adcp/types/generated_poc/ (101 generated type files) - Modified: src/adcp/types/generated.py (consolidated exports) - Modified: scripts/sync_schemas.py (ETag support) - Modified: schemas/cache/ (synced with latest AdCP v1.0.0) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent d0123af commit ef5cda0

File tree

159 files changed

+17896
-2090
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

159 files changed

+17896
-2090
lines changed

schemas/cache/.etags.json

Lines changed: 106 additions & 0 deletions
Large diffs are not rendered by default.

schemas/cache/1.0.0/activate-signal-request.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
"type": "array",
1414
"description": "Target destination(s) for activation. If the authenticated caller matches one of these destinations, activation keys will be included in the response.",
1515
"items": {
16-
"$ref": "destination.json"
16+
"$ref": "/schemas/v1/core/destination.json"
1717
},
1818
"minItems": 1
1919
},

schemas/cache/1.0.0/activate-signal-response.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
"type": "array",
1414
"description": "Array of deployment results for each destination",
1515
"items": {
16-
"$ref": "deployment.json"
16+
"$ref": "/schemas/v1/core/deployment.json"
1717
}
1818
},
1919
"context": {
@@ -40,7 +40,7 @@
4040
"type": "array",
4141
"description": "Array of errors explaining why activation failed (e.g., platform connectivity issues, signal definition problems, authentication failures)",
4242
"items": {
43-
"$ref": "error.json"
43+
"$ref": "/schemas/v1/core/error.json"
4444
},
4545
"minItems": 1
4646
},

schemas/cache/1.0.0/adagents.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@
5454
"type": "array",
5555
"description": "Array of all properties covered by this adagents.json file. Same structure as list_authorized_properties response.",
5656
"items": {
57-
"$ref": "property.json"
57+
"$ref": "/schemas/v1/core/property.json"
5858
},
5959
"minItems": 1
6060
},
@@ -119,7 +119,7 @@
119119
"type": "array",
120120
"description": "Specific properties this agent is authorized for (alternative to property_ids/property_tags). Mutually exclusive with property_ids and property_tags fields.",
121121
"items": {
122-
"$ref": "property.json"
122+
"$ref": "/schemas/v1/core/property.json"
123123
},
124124
"minItems": 1
125125
},

schemas/cache/1.0.0/asset-required.json

Lines changed: 0 additions & 139 deletions
This file was deleted.

schemas/cache/1.0.0/brand-manifest-ref.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"description": "Brand manifest provided either as an inline object or a URL string pointing to a hosted manifest",
66
"oneOf": [
77
{
8-
"$ref": "brand-manifest.json",
8+
"$ref": "/schemas/v1/core/brand-manifest.json",
99
"description": "Inline brand manifest object"
1010
},
1111
{

schemas/cache/1.0.0/build-creative-request.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@
1010
"description": "Natural language instructions for the transformation or generation. For pure generation, this is the creative brief. For transformation, this provides guidance on how to adapt the creative."
1111
},
1212
"creative_manifest": {
13-
"$ref": "creative-manifest.json",
13+
"$ref": "/schemas/v1/core/creative-manifest.json",
1414
"description": "Creative manifest to transform or generate from. For pure generation, this should include the target format_id and any required input assets (e.g., promoted_offerings for generative formats). For transformation (e.g., resizing, reformatting), this is the complete creative to adapt."
1515
},
1616
"target_format_id": {
17-
"$ref": "format-id.json",
17+
"$ref": "/schemas/v1/core/format-id.json",
1818
"description": "Format ID to generate. The format definition specifies required input assets and output structure."
1919
},
2020
"context": {

schemas/cache/1.0.0/build-creative-response.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
"type": "object",
1111
"properties": {
1212
"creative_manifest": {
13-
"$ref": "creative-manifest.json",
13+
"$ref": "/schemas/v1/core/creative-manifest.json",
1414
"description": "The generated or transformed creative manifest"
1515
},
1616
"context": {
@@ -37,7 +37,7 @@
3737
"type": "array",
3838
"description": "Array of errors explaining why creative generation failed",
3939
"items": {
40-
"$ref": "error.json"
40+
"$ref": "/schemas/v1/core/error.json"
4141
},
4242
"minItems": 1
4343
},

schemas/cache/1.0.0/create-media-buy-request.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,19 +13,19 @@
1313
"type": "array",
1414
"description": "Array of package configurations",
1515
"items": {
16-
"$ref": "package-request.json"
16+
"$ref": "/schemas/v1/media-buy/package-request.json"
1717
}
1818
},
1919
"brand_manifest": {
20-
"$ref": "brand-manifest-ref.json",
20+
"$ref": "/schemas/v1/core/brand-manifest-ref.json",
2121
"description": "Brand information manifest serving as the namespace and identity for this media buy. Provides brand context, assets, and product catalog. Can be provided inline or as a URL reference to a hosted manifest. Can be cached and reused across multiple requests."
2222
},
2323
"po_number": {
2424
"type": "string",
2525
"description": "Purchase order number for tracking"
2626
},
2727
"start_time": {
28-
"$ref": "start-timing.json"
28+
"$ref": "/schemas/v1/core/start-timing.json"
2929
},
3030
"end_time": {
3131
"type": "string",
@@ -35,7 +35,7 @@
3535
"reporting_webhook": {
3636
"allOf": [
3737
{
38-
"$ref": "push-notification-config.json"
38+
"$ref": "/schemas/v1/core/push-notification-config.json"
3939
},
4040
{
4141
"type": "object",

schemas/cache/1.0.0/create-media-buy-response.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@
7070
"type": "array",
7171
"description": "Array of errors explaining why the operation failed",
7272
"items": {
73-
"$ref": "error.json"
73+
"$ref": "/schemas/v1/core/error.json"
7474
},
7575
"minItems": 1
7676
},

0 commit comments

Comments
 (0)