mirror of
https://github.com/OpenAPITools/openapi-generator.git
synced 2026-03-18 17:39:25 +00:00
Fix default value (#260)
* Fix missing default value of form param * Update php sample with OAS2 * Update php sample with OAS3 * Delete quotes as default value may have integer * Update php samples with OAS2 * use toDefaultValue() in order to apply the decoration rules of generator * Update php samples with OAS2 * Tweak: add quotes only if example is null * Update php sample with OAS2 * Update php sample with OAS3
This commit is contained in:
committed by
William Cheng
parent
aa5719e008
commit
be19724849
@@ -2514,7 +2514,7 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
}
|
||||
// set default value
|
||||
if (parameterSchema.getDefault() != null) {
|
||||
codegenParameter.defaultValue = String.valueOf(parameterSchema.getDefault());
|
||||
codegenParameter.defaultValue = toDefaultValue(parameterSchema);
|
||||
}
|
||||
// TDOO revise collectionFormat
|
||||
String collectionFormat = null;
|
||||
|
||||
@@ -586,9 +586,9 @@ public class PhpClientCodegen extends DefaultCodegen implements CodegenConfig {
|
||||
|
||||
if ("String".equalsIgnoreCase(type) || p.isString) {
|
||||
if (example == null) {
|
||||
example = p.paramName + "_example";
|
||||
example = "'" + p.paramName + "_example'";
|
||||
}
|
||||
example = "\"" + escapeText(example) + "\"";
|
||||
example = escapeText(example);
|
||||
} else if ("Integer".equals(type) || "int".equals(type)) {
|
||||
if (example == null) {
|
||||
example = "56";
|
||||
|
||||
Reference in New Issue
Block a user