Skip to content

Commit 84c03a1

Browse files
committed
Fix
1 parent dfd89c1 commit 84c03a1

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

openapi/src/main/java/io/micronaut/openapi/visitor/SchemaDefinitionUtils.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2928,7 +2928,14 @@ private static void processPropertyElements(OpenAPI openApi, VisitorContext cont
29282928
if (classElement != null) {
29292929
for (FieldElement field : classElement.getFields()) {
29302930
if (field.getName().equals(publicField.getName())) {
2931-
fieldJavadoc = Utils.getJavadocParser().parse(publicField.getDocumentation().orElse(field.getDocumentation().orElse(null)));
2931+
Optional<String> documentation;
2932+
if (publicField instanceof PropertyElement propEl) {
2933+
documentation = propEl.getReadMethod().flatMap(Element::getDocumentation)
2934+
.or(publicField::getDocumentation);
2935+
} else {
2936+
documentation = publicField.getDocumentation();
2937+
}
2938+
fieldJavadoc = Utils.getJavadocParser().parse(documentation.orElse(field.getDocumentation().orElse(null)));
29322939
break;
29332940
}
29342941
}

0 commit comments

Comments
 (0)