feat: complete semantic alias coverage for discriminated unions#63
Merged
feat: complete semantic alias coverage for discriminated unions#63
Conversation
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>
…ed 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>
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>
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Adds semantic aliases for all remaining user-facing discriminated union types, ensuring downstream users never need to import from
generated_pocor use numbered types.Changes
New Semantic Aliases (10 types)
PublisherProperties variants (selection_type discriminator):
PublisherPropertiesAll→PublisherProperties(selection_type='all')PublisherPropertiesById→PublisherProperties4(selection_type='by_id')PublisherPropertiesByTag→PublisherProperties5(selection_type='by_tag')PropertyId,PropertyTag(constraint types)Deployment variants (type discriminator):
PlatformDeployment→Deployment1(type='platform')AgentDeployment→Deployment2(type='agent')Destination variants (type discriminator):
PlatformDestination→Destination1(type='platform')AgentDestination→Destination2(type='agent')Documentation
Added comprehensive prevention strategy in
CLAUDE.md:Testing
test_type_aliases.pypassingImpact
Before (users had to do this):
After (clean, semantic API):
Coverage Status
✅ 100% of user-facing discriminated unions now have semantic aliases (30 types)
✓ 15 internal helper types correctly left unaliased (Input2, Packages1, etc.)
Breaking Changes
None - only adds new exports, doesn't change existing API.
Checklist
aliases.py,types/__init__.py, and main__init__.pyRelated Issues
Resolves the need for users to import from
generated_pocwhen working with publisher properties and signal deployments/destinations.