use of com.github.javaparser.javadoc.JavadocBlockTag in project flow by vaadin.
the class OpenAPIObjectGenerator method createApiSuccessfulResponse.
private ApiResponse createApiSuccessfulResponse(MethodDeclaration methodDeclaration, ResolvedTypeParametersMap resolvedTypeParametersMap) {
Content successfulContent = new Content();
// "description" is a REQUIRED property of Response
ApiResponse successfulResponse = new ApiResponse().description("");
methodDeclaration.getJavadoc().ifPresent(javadoc -> {
for (JavadocBlockTag blockTag : javadoc.getBlockTags()) {
if (blockTag.getType() == JavadocBlockTag.Type.RETURN) {
successfulResponse.setDescription("Return " + blockTag.getContent().toText());
}
}
});
if (!methodDeclaration.getType().isVoidType()) {
MediaType mediaItem = createReturnMediaType(methodDeclaration, resolvedTypeParametersMap);
successfulContent.addMediaType("application/json", mediaItem);
successfulResponse.content(successfulContent);
}
return successfulResponse;
}
Aggregations