Skip to content

Commit bf80ccb

Browse files
authored
remove getPropertyDefaultValue (#16003)
1 parent 8d62598 commit bf80ccb

1 file changed

Lines changed: 5 additions & 32 deletions

File tree

modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultCodegen.java

Lines changed: 5 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -2139,6 +2139,8 @@ public void setParameterEncodingValues(CodegenParameter codegenParameter, MediaT
21392139

21402140
/**
21412141
* Return the example value of the property
2142+
* <p>
2143+
* This method should be overridden in the generator to meet its requirement.
21422144
*
21432145
* @param schema Property schema
21442146
* @return string presentation of the example value of the property
@@ -2148,12 +2150,13 @@ public String toExampleValue(Schema schema) {
21482150
return schema.getExample().toString();
21492151
}
21502152

2151-
return getPropertyDefaultValue(schema);
2153+
return "null";
21522154
}
21532155

21542156
/**
21552157
* Return the default value of the property
21562158
* <p>
2159+
* This method should be overridden in the generator to meet its requirement.
21572160
* Return null if you do NOT want a default value.
21582161
* Any non-null value will cause {{#defaultValue} check to pass.
21592162
*
@@ -2166,7 +2169,7 @@ public String toDefaultValue(Schema schema) {
21662169
return schema.getDefault().toString();
21672170
}
21682171

2169-
return getPropertyDefaultValue(schema);
2172+
return "null";
21702173
}
21712174

21722175
/**
@@ -2198,36 +2201,6 @@ public String toDefaultParameterValue(CodegenProperty codegenProperty, Schema<?>
21982201
return toDefaultParameterValue(schema);
21992202
}
22002203

2201-
/**
2202-
* Return property value depending on property type.
2203-
*
2204-
* @param schema property type
2205-
* @return property value
2206-
*/
2207-
@SuppressWarnings("squid:S3923")
2208-
private String getPropertyDefaultValue(Schema schema) {
2209-
/*
2210-
* Although all branches return null, this is left intentionally as examples for new contributors
2211-
*/
2212-
if (ModelUtils.isBooleanSchema(schema)) {
2213-
return "null";
2214-
} else if (ModelUtils.isDateSchema(schema)) {
2215-
return "null";
2216-
} else if (ModelUtils.isDateTimeSchema(schema)) {
2217-
return "null";
2218-
} else if (ModelUtils.isNumberSchema(schema)) {
2219-
return "null";
2220-
} else if (ModelUtils.isIntegerSchema(schema)) {
2221-
return "null";
2222-
} else if (ModelUtils.isStringSchema(schema)) {
2223-
return "null";
2224-
} else if (ModelUtils.isObjectSchema(schema)) {
2225-
return "null";
2226-
} else {
2227-
return "null";
2228-
}
2229-
}
2230-
22312204
/**
22322205
* Return the property initialized from a data object
22332206
* Useful for initialization with a plain object in Javascript

0 commit comments

Comments
 (0)