Skip to content

Conversation

@bokelley
Copy link
Contributor

Summary

Adds AdCPBaseModel base class that ensures spec-compliant JSON serialization where optional fields with None values are omitted entirely rather than sent as null. Updates all generated models to use this base class.

Changes

  • Create AdCPBaseModel that defaults exclude_none=True in model_dump() and model_dump_json()
  • Update code generator to use AdCPBaseModel instead of BaseModel
  • Regenerate all 74 Pydantic models with new base class
  • Export AdCPBaseModel from adcp.types

Testing

All 180 tests pass, including new serialization behavior verification.

@bokelley bokelley changed the title Add AdCPBaseModel with exclude_none serialization feat: add AdCPBaseModel with exclude_none serialization Nov 13, 2025
Copy link
Collaborator

@youbek youbek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

bokelley and others added 2 commits November 13, 2025 07:36
AdCP JSON schemas use `additionalProperties: false` and don't allow null
for optional fields. Optional fields must be omitted entirely when not present.

Changes:
- Create AdCPBaseModel base class with exclude_none=True by default
- Update code generator to use AdCPBaseModel instead of BaseModel
- Regenerate all models with new base class
- Export AdCPBaseModel from adcp.types

This ensures spec-compliant JSON serialization where None values are
omitted from the output instead of being sent as null.

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

Co-Authored-By: Claude <noreply@anthropic.com>
Add proper type annotations to model_dump() and model_dump_json()
to satisfy mypy strict type checking.

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

Co-Authored-By: Claude <noreply@anthropic.com>
@bokelley bokelley force-pushed the exclude-none-base-model branch from 26d3ed6 to bdccada Compare November 13, 2025 12:36
@bokelley bokelley merged commit c3cd590 into main Nov 13, 2025
7 checks passed
bokelley added a commit that referenced this pull request Nov 18, 2025
* feat: add AdCPBaseModel with exclude_none serialization

AdCP JSON schemas use `additionalProperties: false` and don't allow null
for optional fields. Optional fields must be omitted entirely when not present.

Changes:
- Create AdCPBaseModel base class with exclude_none=True by default
- Update code generator to use AdCPBaseModel instead of BaseModel
- Regenerate all models with new base class
- Export AdCPBaseModel from adcp.types

This ensures spec-compliant JSON serialization where None values are
omitted from the output instead of being sent as null.

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

Co-Authored-By: Claude <noreply@anthropic.com>

* fix: add type annotations to AdCPBaseModel methods

Add proper type annotations to model_dump() and model_dump_json()
to satisfy mypy strict type checking.

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

Co-Authored-By: Claude <noreply@anthropic.com>

---------

Co-authored-by: Claude <noreply@anthropic.com>
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.

3 participants