ogen
ogen copied to clipboard
Generated type for Discriminator conflicts with existing type
What version of ogen are you using?
$ go list -m github.com/ogen-go/ogen
github.com/ogen-go/ogen v0.72.0
Can this issue be reproduced with the latest version?
Yes
What did you do?
- Define a schema component like
FooTypewhich is an enum of strings. - Create a oneOf sum type called
Foowhere thediscriminator.propertyName = 'type' - The library generates two types named
FooType, one for the enum and another as the discriminator type.
I've tried to use the x-ogen-name extension on the discriminator object but this doesn't change anything.
What did you expect to see?
To generate a unique name, or use the extension property to manually control it.
What did you see instead?
Go code which does not compile.
Looks like this is hardcoded within the template, it's going to be hard to fix this
https://github.com/ogen-go/ogen/blob/eb1bcf60a92dbea6dd2b0fea1870944f4c0c150a/gen/_template/schema/sum.tmpl#L4-L26
This is still open? Hm.