webhooks.net icon indicating copy to clipboard operation
webhooks.net copied to clipboard

[FEAT]: Discriminated union support

Open JamieMagee opened this issue 2 years ago • 1 comments

Describe the need

There are quite a few types that are discriminated unions. See #178 for an example of one. Currently we sidestep the issue by deserializing to dynamic and letting the SDK consumer figure out what the actual type is.

Discriminated unions aren't likely to make it into C# in the near future^1 (and I'm not likely to rewrite this SDK in F#). The only viable alternative I see right now is OneOf. However, the System.Text.Json story doesn't seem to be fully fleshed out.

SDK Version

No response

API Version

No response

Relevant log output

No response

Code of Conduct

  • [X] I agree to follow this project's Code of Conduct

JamieMagee avatar Jun 01 '23 04:06 JamieMagee

Another potential avenue: https://learn.microsoft.com/en-us/dotnet/standard/serialization/system-text-json/polymorphism

JamieMagee avatar Sep 07 '23 04:09 JamieMagee

👋 Hey Friends, this issue has been automatically marked as stale because it has no recent activity. It will be closed if no further activity occurs. Please add the Status: Pinned label if you feel that this issue needs to remain open/active. Thank you for your contributions and help in keeping things tidy!

github-actions[bot] avatar Jun 04 '24 01:06 github-actions[bot]