forked from loafle/openapi-generator-original
add cli option to specify if to emit default values in datamember
This commit is contained in:
@@ -87,4 +87,8 @@ public class CodegenConstants {
|
||||
|
||||
public static final String MODEL_NAME_SUFFIX = "modelNameSuffix";
|
||||
public static final String MODEL_NAME_SUFFIX_DESC = "Suffix that will be appended to all model names. Default is the empty string.";
|
||||
|
||||
public static final String OPTIONAL_EMIT_DEFAULT_VALUES = "optionalEmitDefaultValues";
|
||||
public static final String OPTIONAL_EMIT_DEFAULT_VALUES_DESC = "Set DataMember's EmitDefaultValue, default false.";
|
||||
|
||||
}
|
||||
|
||||
@@ -13,6 +13,7 @@ public abstract class AbstractCSharpCodegen extends DefaultCodegen implements Co
|
||||
|
||||
protected boolean optionalAssemblyInfoFlag = true;
|
||||
protected boolean optionalProjectFileFlag = false;
|
||||
protected boolean optionalEmitDefaultValue = false;
|
||||
protected boolean optionalMethodArgumentFlag = true;
|
||||
protected boolean useDateTimeOffsetFlag = false;
|
||||
protected boolean useCollection = false;
|
||||
|
||||
@@ -121,6 +121,10 @@ public class CSharpClientCodegen extends AbstractCSharpCodegen {
|
||||
addSwitch(CodegenConstants.OPTIONAL_PROJECT_FILE,
|
||||
CodegenConstants.OPTIONAL_PROJECT_FILE_DESC,
|
||||
this.optionalProjectFileFlag);
|
||||
|
||||
addSwitch(CodegenConstants.OPTIONAL_EMIT_DEFAULT_VALUES,
|
||||
CodegenConstants.OPTIONAL_EMIT_DEFAULT_VALUES_DESC,
|
||||
this.optionalEmitDefaultValue);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -139,6 +143,7 @@ public class CSharpClientCodegen extends AbstractCSharpCodegen {
|
||||
additionalProperties.put("packageDescription", packageDescription);
|
||||
additionalProperties.put("packageCompany", packageCompany);
|
||||
additionalProperties.put("packageCopyright", packageCopyright);
|
||||
additionalProperties.put("emitDefaultValue", optionalEmitDefaultValue);
|
||||
|
||||
if (additionalProperties.containsKey(CodegenConstants.DOTNET_FRAMEWORK)) {
|
||||
setTargetFramework((String) additionalProperties.get(CodegenConstants.DOTNET_FRAMEWORK));
|
||||
|
||||
Reference in New Issue
Block a user