New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Support for Pydantic Tagged Union #74
Comments
I recently ran into a use-case for this as well. It'd be a great addition. It looks like it can be supported as a standard union (haven't looked into tagged) with the following one-line change to u = value.get("anyOf") to u = value.get("anyOf", value.get("oneOf")) |
The suggested change above was generating an invalid Avro schema. The following patch provides support for converting a JSON discriminated union to an Avro union
|
@timvancann @ffinfo What do you think? Would this be a welcome change? |
@OffByOnee I don't see any reason why we can't support this. If you create a PR with this change and some tests I can review it properly :). |
Pydantic has a new feature for tagged unions.
https://docs.pydantic.dev/latest/usage/types/#discriminated-unions-aka-tagged-unions
Example usage of Tagged Union
In the method
get_type
this is the value that is passed in for the above Tagged Union.If we can at least support the avro schema generation of tagged union to match a standard union, it would be very helpful
The text was updated successfully, but these errors were encountered: