Closed mohamuni closed 5 months ago
cc @wing328 @rikotsev I think this regression was introduced by the changes made in https://github.com/OpenAPITools/openapi-generator/pull/18390
We would appreciate your views on this.
In following file, when checking for parent model for composite schema, specify to use parentmodel.classname instead of parentmodel.name
please file a PR with the suggested fix when you've time.
Done
Bug Report Checklist
Description
While generating Go SDK with OpenAPI Generator, if a composite schema's parent schema contains names with special characters (. _) and a discriminator is defined on the parent schema, Go SDK fails because the sanitized name of the parent model is not used in the composite schema model.
openapi-generator version
Latest version(7.5.0)
OpenAPI declaration file content or url
Generation Details
Steps to reproduce
Generate the Go SDK with the specified spec file and observe that the parent schema model name in the composite schema model is not sanitized.
Actual Parent model file
Actual Composite model file when referring to the parent schema Base.Item which is not sanitized name, it leads to failure of generated SDK, Instead of referring to sanitized name(BaseItem) of parent model
Expected model definition in Composite schema model file.
Suggest a fix
In following file, when checking for parent model for composite schema, specify to use parentmodel.classname instead of parentmodel.name https://github.com/OpenAPITools/openapi-generator/blob/master/modules/openapi-generator/src/main/resources/go/model_simple.mustache
Following changes are suggested along with line numbers