fix: avoid generic NPE when refering to missing schema (#11718)

This commit is contained in:
Tomas Bjerre
2022-02-26 03:57:29 +01:00
committed by GitHub
parent d1708294c2
commit d20a32f1f7

View File

@@ -565,6 +565,9 @@ public class DefaultCodegen implements CodegenConfig {
parent.getChildren().add(cm);
parent.hasChildren = true;
Schema parentSchema = this.openAPI.getComponents().getSchemas().get(parent.name);
if (parentSchema == null) {
throw new NullPointerException(parent.name+" in "+this.openAPI.getComponents().getSchemas());
}
if (parentSchema.getDiscriminator() == null) {
parent = allModels.get(parent.getParent());
} else {