forked from loafle/openapi-generator-original
Fix examples for request body with array to not raise java.lang.NullPointerException (#11170)
This commit is contained in:
parent
0a09f1faa3
commit
5a616757e7
@ -657,7 +657,11 @@ public class CrystalClientCodegen extends DefaultCodegen {
|
||||
if (codegenProperty.isArray) { // array
|
||||
return "[" + constructExampleCode(codegenProperty.items, modelMaps, processedModelMap) + "]";
|
||||
} else if (codegenProperty.isMap) {
|
||||
return "{ key: " + constructExampleCode(codegenProperty.items, modelMaps, processedModelMap) + "}";
|
||||
if (codegenProperty.items != null) {
|
||||
return "{ key: " + constructExampleCode(codegenProperty.items, modelMaps, processedModelMap) + "}";
|
||||
} else {
|
||||
return "{ ... }";
|
||||
}
|
||||
} else if (codegenProperty.isPrimitiveType) { // primitive type
|
||||
if (codegenProperty.isEnum) {
|
||||
// When inline enum, set example to first allowable value
|
||||
|
@ -555,6 +555,9 @@ public class GoClientCodegen extends AbstractGoCodegen {
|
||||
if (modelMaps.containsKey(dataType)) {
|
||||
prefix = "map[string][]" + goImportAlias + "." + dataType;
|
||||
}
|
||||
if (codegenProperty.items == null) {
|
||||
return prefix + "{ ... }";
|
||||
}
|
||||
return prefix + "{\"key\": " + constructExampleCode(codegenProperty.items, modelMaps, processedModelMap) + "}";
|
||||
} else if (codegenProperty.isPrimitiveType) { // primitive type
|
||||
if (codegenProperty.isString) {
|
||||
|
@ -1230,7 +1230,11 @@ public class PowerShellClientCodegen extends DefaultCodegen implements CodegenCo
|
||||
example.append(constructExampleCode(codegenProperty.items, modelMaps, processedModelMap, requiredOnly));
|
||||
} else if (codegenProperty.isMap) {
|
||||
example.append("@{ key_example = ");
|
||||
example.append(constructExampleCode(codegenProperty.items, modelMaps, processedModelMap, requiredOnly));
|
||||
if (codegenProperty.items != null) {
|
||||
example.append(constructExampleCode(codegenProperty.items, modelMaps, processedModelMap, requiredOnly));
|
||||
} else {
|
||||
example.append(" ... ");
|
||||
}
|
||||
example.append(" }");
|
||||
} else if (codegenProperty.isEnum || (codegenProperty.allowableValues != null && !codegenProperty.allowableValues.isEmpty())) {
|
||||
example.append(constructEnumExample(codegenProperty.allowableValues));
|
||||
|
@ -680,7 +680,11 @@ public class RubyClientCodegen extends AbstractRubyCodegen {
|
||||
}
|
||||
return "[" + constructExampleCode(codegenProperty.items, modelMaps, processedModelMap) + "]";
|
||||
} else if (codegenProperty.isMap) {
|
||||
return "{ key: " + constructExampleCode(codegenProperty.items, modelMaps, processedModelMap) + "}";
|
||||
if (codegenProperty.items != null) {
|
||||
return "{ key: " + constructExampleCode(codegenProperty.items, modelMaps, processedModelMap) + "}";
|
||||
} else {
|
||||
return "{ ... }";
|
||||
}
|
||||
} else if (codegenProperty.isPrimitiveType) { // primitive type
|
||||
if (codegenProperty.isEnum) {
|
||||
// When inline enum, set example to first allowable value
|
||||
|
Loading…
x
Reference in New Issue
Block a user