oapi-codegen
oapi-codegen copied to clipboard
feat: generate union types like Speakeasy does
I quite like the way they do it - one type per field, and a Type string to indicate what it is
(More details TBC)
I think this would be a great improvement over the status quo! I'll point out that it does come with the trade-off of making it possible to construct invalid configurations (e.g. incorrect combinations of Type + the per-member pointer fields), but it seems worth it for the ergonomic improvement in the generated code.