You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: CLAUDE.md
+48-7Lines changed: 48 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -17,6 +17,32 @@ FormatId = str
17
17
PackageRequest = dict[str, Any]
18
18
```
19
19
20
+
**Stable Public API Layer**
21
+
22
+
**CRITICAL**: The `generated_poc` directory is internal implementation. **Never import directly from it**.
23
+
24
+
Generated types in `src/adcp/types/generated_poc/` may have:
25
+
- Numbered suffixes (e.g., `BrandManifest1`, `BrandManifest2`) due to schema evolution
26
+
- Structural changes between minor versions
27
+
- Files added/removed as schemas evolve
28
+
29
+
**Always use the stable API:**
30
+
```python
31
+
# ✅ CORRECT - Stable public API
32
+
from adcp.types import BrandManifest, Product, CpmFixedRatePricingOption
33
+
from adcp.types.stable import BrandManifest, Product
34
+
35
+
# ❌ WRONG - Internal generated types (will break)
36
+
from adcp.types.generated_poc.brand_manifest import BrandManifest1
37
+
from adcp.types._generated import BrandManifest1
38
+
```
39
+
40
+
The stable API (`src/adcp/types/stable.py`) provides:
41
+
1.**Clean names** - `BrandManifest` not `BrandManifest1`
42
+
2.**Stability** - Aliases are updated when schemas evolve
43
+
3.**Versioning** - Breaking changes require major version bumps
44
+
4.**Deprecation warnings** - Direct `generated_poc` imports trigger warnings
45
+
20
46
**NEVER Modify Generated Files Directly**
21
47
22
48
Files in `src/adcp/types/generated_poc/` and `src/adcp/types/generated.py` are auto-generated by `scripts/generate_types.py`. Any manual edits will be lost on regeneration.
@@ -27,6 +53,14 @@ Files in `src/adcp/types/generated_poc/` and `src/adcp/types/generated.py` are a
27
53
28
54
We use `scripts/post_generate_fixes.py` which runs automatically after type generation to apply necessary modifications that can't be generated.
29
55
56
+
**Preventing Stale Files:**
57
+
58
+
The generation script (`scripts/generate_types.py`) **deletes the entire output directory** before regenerating types. This prevents stale files from persisting when schemas are renamed or removed. Without this, old generated files could remain checked in indefinitely, causing import errors and confusion about which types are actually current.
59
+
60
+
**Avoiding Noisy Commits:**
61
+
62
+
After generation, the script automatically restores files where only the timestamp changed (e.g., `# timestamp: 2025-11-18T03:32:03+00:00`). This prevents commits with 100+ file changes where the only difference is the generation timestamp, making actual changes easier to review.
63
+
30
64
**Type Name Collisions:**
31
65
32
66
The upstream AdCP schemas define multiple types with the same name (e.g., `Contact`, `Asset`, `Status`) in different schema files. These are **genuinely different types** with different fields, not duplicates.
@@ -35,7 +69,7 @@ When consolidating exports in `generated.py`, we use a "first wins" strategy (al
35
69
36
70
```python
37
71
# Access the "winning" version
38
-
from adcp.types.generatedimport Asset
72
+
from adcp.types._generatedimport Asset
39
73
40
74
# Access specific versions
41
75
from adcp.types.generated_poc.brand_manifest import Asset as BrandAsset
@@ -48,17 +82,24 @@ from adcp.types.generated_poc.format import Asset as FormatAsset
3.**~~Publisher properties validation~~ (DEPRECATED)** - After PR #213 added explicit discriminator to `publisher_properties` schema, Pydantic now generates proper discriminated union variants (`PublisherProperties`, `PublisherProperties4`, `PublisherProperties5`) with automatic validation. Manual validator injection is no longer needed.
94
+
95
+
**Note on Pricing Options:**
96
+
97
+
The code generator creates individual files for each pricing option (e.g., `cpm_fixed_option.py`, `cpm_auction_option.py`) with the `is_fixed` discriminator field already included:
Copy file name to clipboardExpand all lines: README.md
+28-3Lines changed: 28 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -219,10 +219,16 @@ client = ADCPClient(config)
219
219
220
220
### Type Safety
221
221
222
-
Full type hints with Pydantic validation and auto-generated types from the AdCP spec:
222
+
Full type hints with Pydantic validation and auto-generated types from the AdCP spec. All commonly-used types are exported from the main `adcp` package for convenience:
0 commit comments