forked from loafle/openapi-generator-original
Fix NPE with cpp-restsdk
client generator (#1477)
* fix_cpprest_npe * fix_code_format
This commit is contained in:
parent
7f8ff35245
commit
0e693cd9a8
@ -411,7 +411,6 @@ public class CppRestSdkClientCodegen extends AbstractCppCodegen {
|
||||
|
||||
@Override
|
||||
public Map<String, Object> postProcessAllModels(final Map<String, Object> models) {
|
||||
|
||||
final Map<String, Object> processed = super.postProcessAllModels(models);
|
||||
postProcessParentModels(models);
|
||||
return processed;
|
||||
@ -432,9 +431,13 @@ public class CppRestSdkClientCodegen extends AbstractCppCodegen {
|
||||
*/
|
||||
private void processParentPropertiesInChildModel(final CodegenModel parent, final CodegenModel child) {
|
||||
final Map<String, CodegenProperty> childPropertiesByName = new HashMap<>(child.vars.size());
|
||||
if (child != null && child.vars != null && !child.vars.isEmpty()) {
|
||||
for (final CodegenProperty childSchema : child.vars) {
|
||||
childPropertiesByName.put(childSchema.name, childSchema);
|
||||
}
|
||||
}
|
||||
|
||||
if (parent != null && parent.vars != null && !parent.vars.isEmpty()) {
|
||||
for (final CodegenProperty parentSchema : parent.vars) {
|
||||
final CodegenProperty duplicatedByParent = childPropertiesByName.get(parentSchema.name);
|
||||
if (duplicatedByParent != null) {
|
||||
@ -442,5 +445,6 @@ public class CppRestSdkClientCodegen extends AbstractCppCodegen {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user