Add a NoOptionalPointers
config option for gocode types gen
#100
Labels
enhancement
New feature or request
NoOptionalPointers
config option for gocode types gen
#100
Currently, optional fields in a schema result in Go code with pointer types, as that's the only means Go has for actually expressing field optionality.
While technically correct, this is very non-ergonomic Go. While it pains me to do it as it introduces an ambiguity (see grafana/grok#1), we should at least add an option to
gocode.TypeConfigOpenAPI
, sayNoOptionalPointers
, which causes optional fields not to be generated with pointers.Additionally, we should just never render slice and map types with pointers. It's redundant.
I wrote this little thing a while ago to fix that, though never committed it:
It will need to be shifted to
dst
, but i suspect it's a good basis for handling both of these problems at once.The text was updated successfully, but these errors were encountered: