Commit ab49c98
feat: complete semantic alias coverage for discriminated unions (#63)
* feat: add semantic aliases for PublisherProperties discriminated union
Add user-friendly type aliases for the PublisherProperties discriminated
union variants to improve developer experience and avoid direct imports
from generated_poc.
Changes:
- Add PublisherPropertiesAll (selection_type='all')
- Add PublisherPropertiesById (selection_type='by_id')
- Add PublisherPropertiesByTag (selection_type='by_tag')
- Export PropertyId and PropertyTag types for use with the variants
- Update all export paths (aliases.py, types/__init__.py, __init__.py)
- Add comprehensive tests covering imports, type checking, and instantiation
These aliases follow the established pattern for other discriminated unions
(PreviewRender, VastAsset, etc.) and provide clear, semantic names that
match the spec's discriminator values.
Example usage:
```python
from adcp import PublisherPropertiesByTag, PropertyTag
props = PublisherPropertiesByTag(
publisher_domain="example.com",
selection_type="by_tag",
property_tags=[PropertyTag("premium"), PropertyTag("video")]
)
```
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
* feat: add semantic aliases for Deployment and Destination discriminated unions
Complete the semantic aliasing coverage by adding aliases for signal
deployment and destination types used in GetSignalsResponse.
Changes:
- Add PlatformDeployment (Deployment1, type='platform')
- Add AgentDeployment (Deployment2, type='agent')
- Add PlatformDestination (Destination1, type='platform')
- Add AgentDestination (Destination2, type='agent')
- Update all export paths (aliases.py, __init__.py)
- Add 7 comprehensive tests covering imports, type checking, and instantiation
These aliases complete coverage of all user-facing discriminated unions
in the AdCP SDK. Users no longer need to import numbered types or reach
into generated_poc for any common operations.
Example usage:
```python
from adcp import PlatformDeployment, AgentDestination
deployment = PlatformDeployment(
type="platform",
platform="the-trade-desk",
is_live=True
)
destination = AgentDestination(
type="agent",
agent_url="https://agent.example.com"
)
```
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
* docs: document comprehensive semantic aliasing strategy
Add detailed documentation on:
- Complete coverage of all 30 user-facing discriminated union aliases
- List of 15 internal types that don't need aliases
- Five-strategy approach to prevent numbered type usage:
1. Complete aliasing coverage checklist
2. Automated detection script (check_missing_aliases.py)
3. CI enforcement in workflows
4. Import linting with pre-commit hooks
5. Type regeneration workflow documentation
This ensures downstream users never need to import from generated_poc
or use numbered types, maintaining a clean and stable public API.
The documentation includes:
- Updated list of all current semantic aliases
- Guidelines for when to alias vs skip
- Bash commands for auditing numbered types
- Python script templates for automation
- CI/CD integration examples
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
* style: fix import sorting in aliases.py
---------
Co-authored-by: Claude <noreply@anthropic.com>1 parent d05fbf6 commit ab49c98
File tree
5 files changed
+671
-2
lines changed- src/adcp
- types
- tests
5 files changed
+671
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
160 | 160 | | |
161 | 161 | | |
162 | 162 | | |
163 | | - | |
| 163 | + | |
164 | 164 | | |
165 | 165 | | |
166 | 166 | | |
| |||
189 | 189 | | |
190 | 190 | | |
191 | 191 | | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
192 | 212 | | |
193 | 213 | | |
194 | 214 | | |
| |||
201 | 221 | | |
202 | 222 | | |
203 | 223 | | |
| 224 | + | |
| 225 | + | |
204 | 226 | | |
205 | 227 | | |
206 | 228 | | |
207 | 229 | | |
208 | | - | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
209 | 340 | | |
210 | 341 | | |
211 | 342 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
101 | 101 | | |
102 | 102 | | |
103 | 103 | | |
| 104 | + | |
| 105 | + | |
104 | 106 | | |
105 | 107 | | |
106 | 108 | | |
| |||
111 | 113 | | |
112 | 114 | | |
113 | 115 | | |
| 116 | + | |
| 117 | + | |
114 | 118 | | |
115 | 119 | | |
116 | 120 | | |
117 | 121 | | |
| 122 | + | |
118 | 123 | | |
| 124 | + | |
119 | 125 | | |
120 | 126 | | |
121 | 127 | | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
122 | 131 | | |
123 | 132 | | |
124 | 133 | | |
| |||
281 | 290 | | |
282 | 291 | | |
283 | 292 | | |
| 293 | + | |
| 294 | + | |
284 | 295 | | |
285 | 296 | | |
286 | 297 | | |
| |||
290 | 301 | | |
291 | 302 | | |
292 | 303 | | |
| 304 | + | |
| 305 | + | |
293 | 306 | | |
294 | 307 | | |
295 | 308 | | |
296 | 309 | | |
| 310 | + | |
297 | 311 | | |
| 312 | + | |
298 | 313 | | |
299 | 314 | | |
300 | 315 | | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
301 | 319 | | |
302 | 320 | | |
303 | 321 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
20 | 25 | | |
21 | 26 | | |
22 | 27 | | |
| |||
89 | 94 | | |
90 | 95 | | |
91 | 96 | | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
92 | 104 | | |
93 | 105 | | |
94 | 106 | | |
| |||
0 commit comments