oapi-codegen icon indicating copy to clipboard operation
oapi-codegen copied to clipboard

feat: generate union types like Speakeasy does

Open jamietanna opened this issue 1 year ago • 1 comments

I quite like the way they do it - one type per field, and a Type string to indicate what it is

(More details TBC)

jamietanna avatar Jul 03 '24 08:07 jamietanna

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.

benweint avatar Oct 29 '25 05:10 benweint