Skip to content

Commit

Permalink
Add logging, if we have problems with getting beanProperties (#970)
Browse files Browse the repository at this point in the history
  • Loading branch information
altro3 authored Mar 29, 2023
1 parent 7cd22d8 commit 57b2102
Showing 1 changed file with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
package io.micronaut.openapi.visitor;

import java.io.IOException;
import java.io.PrintWriter;
import java.io.StringWriter;
import java.lang.annotation.Annotation;
import java.math.BigDecimal;
import java.math.BigInteger;
Expand Down Expand Up @@ -2287,6 +2289,10 @@ private void populateSchemaProperties(OpenAPI openAPI, VisitorContext context, E
try {
beanProperties = classElement.getBeanProperties().stream().filter(p -> !"groovy.lang.MetaClass".equals(p.getType().getName())).collect(Collectors.toList());
} catch (Exception e) {
StringWriter sw = new StringWriter();
PrintWriter pw = new PrintWriter(sw);
e.printStackTrace(pw);
context.warn("Error with getting properties for class " + classElement.getName() + ": " + e + "\n" + sw, classElement);
// Workaround for https://github.com/micronaut-projects/micronaut-openapi/issues/313
beanProperties = Collections.emptyList();
}
Expand Down

0 comments on commit 57b2102

Please sign in to comment.