[BUG][Go] undeclared name: isNil
Created by: jonrosner
Description
When generating Go structs with the latest docker container, a function isNil
is used in the code but not generated.
openapi-generator version
v6.2.1
latest docker container (IMAGE ID: 0f04bb22fe23)
OpenAPI declaration file content or URL
Every file depends on this function.
Generation Details
func (o *MyObject) GetField() string {
if o == nil || isNil(o.Field) {
var ret string
return ret
}
return *o.Field
}
Note that isNil(o.Field)
Steps to reproduce
$ docker run --rm -v \"${PWD}:/local\" \
openapitools/openapi-generator-cli:latest generate \
-i openapi.yaml \
-g go -o ${PWD}/gen/openapi \
--global-property models,modelDocs=false \
--additional-properties packageName=openapi"
Suggest a fix
Seems to be related to this MR: https://github.com/OpenAPITools/openapi-generator/pull/13843/files#diff-f85b9f51529f9922081dd92244891f831a26e126f4e27dd53bdaa03c7d55456c
My guess would be that because I only generate the models, this "utils" is not generated. So a fix would be to generate this utils anyway, even if only models are to be generated.