Skip to content

Conversation

@bokelley
Copy link
Contributor

@bokelley bokelley commented Nov 8, 2025

Summary

Pull latest AdCP schemas (v1.0.0) and improve type generation to handle discriminated unions with proper type discrimination. Destination and Deployment types now use oneOf with discriminators, resulting in much better type safety and IDE support.

Changes

  • Type Generator: New generate_discriminated_union() function handles oneOf schemas, automatically detecting discriminators and generating typed variants
  • Discriminator Support: Handle const fields to generate Literal types (e.g., Literal["platform"])
  • New Types: PlatformDestination/AgentDestination, PlatformDeployment/AgentDeployment, ActivationKey
  • Better Inference: BrandManifestRef, StartTiming, and PricingOption now have proper discriminated union types instead of Any

All 114 tests pass. ✅

- Pull latest AdCP schemas (v1.0.0) with new destination and deployment types
- Add discriminated union generation for oneOf schemas with type discriminators
- Handle const fields for proper Literal types in discriminators
- Add missing ActivationKey type alias for deployment schema

Changes to type generation:
- New `generate_discriminated_union()` function handles oneOf schemas
- Automatically detects discriminator field (type) and generates typed variants
- Example: Destination = PlatformDestination | AgentDestination
- Each variant gets proper Literal["platform"] | Literal["agent"] type

New types added:
- PlatformDestination / AgentDestination (discriminated union)
- PlatformDeployment / AgentDeployment (discriminated union)
- ActivationKey type alias

Improved existing types:
- BrandManifestRef now discriminated union (was Any)
- StartTiming now discriminated union (was Any)
- PricingOption now discriminated union (was Any)

All tests pass with Python 3.11+.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
@bokelley bokelley merged commit 54da596 into main Nov 8, 2025
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants