forked from loafle/openapi-generator-original
better error handling for invalid array/map type
This commit is contained in:
parent
5bf4d022cf
commit
42e10fbb14
@ -814,6 +814,7 @@ public class DefaultCodegen {
|
|||||||
LOGGER.error("unexpected missing property for name " + name);
|
LOGGER.error("unexpected missing property for name " + name);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
CodegenProperty property = CodegenModelFactory.newInstance(CodegenModelType.PROPERTY);
|
CodegenProperty property = CodegenModelFactory.newInstance(CodegenModelType.PROPERTY);
|
||||||
|
|
||||||
property.name = toVarName(name);
|
property.name = toVarName(name);
|
||||||
@ -1908,6 +1909,12 @@ public class DefaultCodegen {
|
|||||||
// encountered so far and hopefully make it easier for others to add more special
|
// encountered so far and hopefully make it easier for others to add more special
|
||||||
// cases in the future.
|
// cases in the future.
|
||||||
|
|
||||||
|
// better error handling when map/array type is invalid
|
||||||
|
if (name == null) {
|
||||||
|
LOGGER.error("String to be sanitized is null. Default to ERROR_UNKNOWN");
|
||||||
|
return "ERROR_UNKNOWN";
|
||||||
|
}
|
||||||
|
|
||||||
// input[] => input
|
// input[] => input
|
||||||
name = name.replaceAll("\\[\\]", "");
|
name = name.replaceAll("\\[\\]", "");
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user