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:
Akihito Nakano
2018-04-30 18:18:58 +09:00
committed by William Cheng
parent aa5719e008
commit be19724849
13 changed files with 94 additions and 94 deletions

View File

@@ -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;

View File

@@ -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";