[WIP] Fix Union type with dataclass ambiguous error and support superset comparison #5858
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.
Tracking issue
Related to #5489
Why are the changes needed?
When a function accepts a
Union
of two dataclasses as input, Flyte cannot distinguish which dataclass matches the user's input. This is because Flyte only compares the simple types, and both dataclasses are identified asflyte.SimpleType_STRUCT
in this scenario. As a result, there will be multiple matches, causing ambiguity and leading to an error.union_test.py
What changes were proposed in this pull request?
marshmallow_jsonschema.JSONSchema
(draft-07) ormashumaro.jsonschema.build_json_schema
(draft 2020-12). To check equivalence, we compare the bytes from marshaling the json schemas if they are in the same draft version (generated by the same package). For comparing different draft versions, we are still finding a way to cover all possible types, including flyte types and nested types.How was this patch tested?
See Screenshot section for details
Setup process
Screenshots
Example with two different versions of schema on remote
union_test_diff_schema_version.py
Check all the applicable boxes
Related PRs
None
Docs link
TODO