explicitly handle discriminator + oneOf for pydantic Unions#1202
Open
cosmicBboy wants to merge 2 commits into
Open
explicitly handle discriminator + oneOf for pydantic Unions#1202cosmicBboy wants to merge 2 commits into
cosmicBboy wants to merge 2 commits into
Conversation
Signed-off-by: Niels Bantilan <niels.bantilan@gmail.com>
Contributor
Author
|
@copilot resolve the merge conflicts in this pull request |
Resolved the merge conflict in |
AdilFayyaz
reviewed
Jun 12, 2026
| # top-level "type"; instead it has "oneOf" with the variant schemas. | ||
| if property_val.get("oneOf"): | ||
| # Handle discriminated unions (Pydantic v2) - check for both discriminator and oneOf together | ||
| if "discriminator" in property_val and "oneOf" in property_val: |
Collaborator
There was a problem hiding this comment.
Can a oneOf exist without a discriminator?
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.
This pull request refactors the logic for generating attribute lists from dataclass JSON schemas, improving the handling of
$refreferences and discriminated unions in Pydantic-generated schemas. It also updates dependency recency exclusion for theflytepackage.Schema processing improvements
$refreferences and discriminated unions ingenerate_attribute_list_from_dataclass_json_mixin, ensuring that non-dict property values and discriminated unions with bothdiscriminatorandoneOfare handled before$reflogic. This makes the type inference more robust and fixes edge cases with Pydantic v2 schemas.$refhandling block to after the checks for non-dict property values and discriminated unions, restoring and improving the previous logic for nested models and custom types.Dependency management
flyte = "0 days"to the[tool.uv.exclude-newer-package]section inpyproject.toml, ensuring that the latestflytepackage releases are picked up immediately, similar to other Flyte-related packages.