fix: expose GetSignalsRequest as union alias, not RootModel#143
Closed
fix: expose GetSignalsRequest as union alias, not RootModel#143
Conversation
Pydantic hard-rejects model_config['extra'] on RootModel subclasses, which broke the documented pattern of subclassing library types with env-based config. Adding a plain union alias in aliases.py shadows the generated RootModel wrapper, restoring the ability for consumers to subclass GetSignalsRequest1 or GetSignalsRequest2 with custom model_config. Closes #138 Co-Authored-By: Claude Sonnet 4.6 <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.
Closes #138
Problem
GetSignalsRequestis generated asRootModel[GetSignalsRequest1 | GetSignalsRequest2]. Pydantic hard-rejectsmodel_config['extra']on anyRootModelsubclass at class construction time, breaking the documented pattern of subclassing library types with env-based config:Fix
Add a plain union alias in
aliases.pythat shadows theRootModelwrapper in the public API:__init__.pynow exports this alias instead of the generatedRootModel. Consumers can subclass either variant:Test plan
GetSignalsRequestis atypes.UnionType, not aRootModelsubclassGetSignalsRequest1 | GetSignalsRequest2model_configworks without error🤖 Generated with Claude Code