OpenAPI Generator allows generation of API client libraries (SDK generation), server stubs, documentation and configuration automatically given an OpenAPI Spec (v2, v3)
[ ] [Optional] Sponsorship to speed up the bug fix or feature request (example)
Description
When one runs the openapi-generator-cli 2.7.0-2.10.0 against a swagger.json to make a csharp client with the argument conditionalSerialization=true, the generated model class's constructor does not initialize any enum properties, though they are present in the constructor parameters, and the arguments for them are passed by the calling code.
Constructor that is output is:
public TestModel(string text = default(string), SomeEnumEnum? someEnum = SomeEnumEnum.NUMBER_1)
{
this._Text = text;
if (this.Text != null)
{
this._flagText = true;
}
}
Expected result is:
public TestModel(string text = default(string), SomeEnumEnum? someEnum = SomeEnumEnum.NUMBER_1)
{
this._Text = text;
if (this.Text != null)
{
this._flagText = true;
}
this._someEnum = someEnum;
if (this.SomeEnum != null)
{
this._flagSomeEnum = true;
}
}
This doesn't happen when conditionalSerialization=false; at that point, the enum is initialized properly just as expected.
openapi-generator version
CLI version:
2.7.0 - 2.10.0 (don't know if it affects earlier versions)
Bug Report Checklist
Description
When one runs the openapi-generator-cli 2.7.0-2.10.0 against a swagger.json to make a csharp client with the argument
conditionalSerialization=true
, the generated model class's constructor does not initialize any enum properties, though they are present in the constructor parameters, and the arguments for them are passed by the calling code.Constructor that is output is:
Expected result is:
This doesn't happen when conditionalSerialization=false; at that point, the enum is initialized properly just as expected.
openapi-generator version
CLI version:
2.7.0 - 2.10.0 (don't know if it affects earlier versions)
OpenAPI declaration file content or url