From 440b6f447b12a77ec23b749b82dc42bd09797920 Mon Sep 17 00:00:00 2001 From: Matheus Cruz Date: Thu, 25 Jan 2024 21:34:20 -0300 Subject: [PATCH 1/2] Add comments to operation methods --- .../template/QuteTemplatingEngineAdapter.java | 3 ++- .../templates/libraries/microprofile/api.qute | 10 +-------- .../microprofile/operationJavaDoc.qute | 21 +++++++++++++++++++ 3 files changed, 24 insertions(+), 10 deletions(-) create mode 100644 deployment/src/main/resources/templates/libraries/microprofile/operationJavaDoc.qute diff --git a/deployment/src/main/java/io/quarkiverse/openapi/generator/deployment/template/QuteTemplatingEngineAdapter.java b/deployment/src/main/java/io/quarkiverse/openapi/generator/deployment/template/QuteTemplatingEngineAdapter.java index fb51cb94..0bea9b5d 100644 --- a/deployment/src/main/java/io/quarkiverse/openapi/generator/deployment/template/QuteTemplatingEngineAdapter.java +++ b/deployment/src/main/java/io/quarkiverse/openapi/generator/deployment/template/QuteTemplatingEngineAdapter.java @@ -30,7 +30,8 @@ public class QuteTemplatingEngineAdapter extends AbstractTemplatingEngineAdapter "auth/compositeAuthenticationProvider.qute", "auth/headersFactory.qute", "multipartFormdataPojo.qute", - "pojoAdditionalProperties.qute" + "pojoAdditionalProperties.qute", + "operationJavaDoc.qute" }; public final Engine engine; diff --git a/deployment/src/main/resources/templates/libraries/microprofile/api.qute b/deployment/src/main/resources/templates/libraries/microprofile/api.qute index 59585914..c50e0ac6 100644 --- a/deployment/src/main/resources/templates/libraries/microprofile/api.qute +++ b/deployment/src/main/resources/templates/libraries/microprofile/api.qute @@ -45,16 +45,8 @@ public interface {classname} { {#for op in operations.operation} {#if !op.isDeprecated || openapi:genDeprecatedApiAttr(package, classname, classes-codegen)} - {#if op.summary} - /** - * {op.summary} - * - {#if op.notes} - * {op.notes} - * - {/if} + {#include operationJavaDoc.qute op=op/} */ - {/if} @{op.httpMethod} {#if op.subresourceOperation} @Path("{op.path}") diff --git a/deployment/src/main/resources/templates/libraries/microprofile/operationJavaDoc.qute b/deployment/src/main/resources/templates/libraries/microprofile/operationJavaDoc.qute new file mode 100644 index 00000000..c06bc9a0 --- /dev/null +++ b/deployment/src/main/resources/templates/libraries/microprofile/operationJavaDoc.qute @@ -0,0 +1,21 @@ + /** + {#if op.summary} + * {op.summary} + * + {/if} + {#if op.notes} + * {op.notes} + * + {/if} + {#for p in op.pathParams} + * @param {p.paramName} {p.description} + {/for} + {#for p in op.queryParams} + * @param {p.paramName} {p.description} + {/for} + {#for p in op.bodyParams} + * @param {p.paramName} {p.description} + {/for} + {#for p in op.headerParams} + * @param {p.paramName} {p.description} + {/for} From 9dc8e8996b25c1fea171a3b5edf044cb13ddde7e Mon Sep 17 00:00:00 2001 From: Matheus Cruz Date: Sat, 27 Jan 2024 20:09:40 -0300 Subject: [PATCH 2/2] Adjust templates --- .../src/main/resources/templates/libraries/microprofile/api.qute | 1 + .../templates/libraries/microprofile/operationJavaDoc.qute | 1 - 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/deployment/src/main/resources/templates/libraries/microprofile/api.qute b/deployment/src/main/resources/templates/libraries/microprofile/api.qute index c50e0ac6..faa40b59 100644 --- a/deployment/src/main/resources/templates/libraries/microprofile/api.qute +++ b/deployment/src/main/resources/templates/libraries/microprofile/api.qute @@ -45,6 +45,7 @@ public interface {classname} { {#for op in operations.operation} {#if !op.isDeprecated || openapi:genDeprecatedApiAttr(package, classname, classes-codegen)} + /** {#include operationJavaDoc.qute op=op/} */ @{op.httpMethod} diff --git a/deployment/src/main/resources/templates/libraries/microprofile/operationJavaDoc.qute b/deployment/src/main/resources/templates/libraries/microprofile/operationJavaDoc.qute index c06bc9a0..db3caa21 100644 --- a/deployment/src/main/resources/templates/libraries/microprofile/operationJavaDoc.qute +++ b/deployment/src/main/resources/templates/libraries/microprofile/operationJavaDoc.qute @@ -1,4 +1,3 @@ - /** {#if op.summary} * {op.summary} *