From 09616ae6863692305a470bdf7ab2106259595c91 Mon Sep 17 00:00:00 2001 From: altro3 Date: Sat, 24 Aug 2024 18:32:53 +0700 Subject: [PATCH] Micronaut openapi: fix set fluxForArrays and invokerPackage properties --- .../gradle/openapi/tasks/AbstractOpenApiWorkAction.java | 3 ++- .../gradle/openapi/tasks/OpenApiClientWorkAction.java | 1 + .../gradle/openapi/tasks/OpenApiServerWorkAction.java | 7 +++++-- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/openapi-plugin/src/main/java/io/micronaut/gradle/openapi/tasks/AbstractOpenApiWorkAction.java b/openapi-plugin/src/main/java/io/micronaut/gradle/openapi/tasks/AbstractOpenApiWorkAction.java index 8511ff1f..72c1f44d 100644 --- a/openapi-plugin/src/main/java/io/micronaut/gradle/openapi/tasks/AbstractOpenApiWorkAction.java +++ b/openapi-plugin/src/main/java/io/micronaut/gradle/openapi/tasks/AbstractOpenApiWorkAction.java @@ -122,10 +122,11 @@ public void execute() { .map(MicronautCodeGeneratorEntryPoint.OutputKind::of) .toArray(MicronautCodeGeneratorEntryPoint.OutputKind[]::new) ) - .withOptions(options -> options.withInvokerPackage(parameters.getInvokerPackageName().get()) + .withOptions(options -> options .withLang("kotlin".equalsIgnoreCase(lang) ? GeneratorLanguage.KOTLIN : GeneratorLanguage.JAVA) .withApiPackage(parameters.getApiPackageName().get()) .withModelPackage(parameters.getModelPackageName().get()) + .withInvokerPackage(parameters.getInvokerPackageName().get()) .withBeanValidation(parameters.getUseBeanValidation().get()) .withUseOneOfInterfaces(parameters.getUseOneOfInterfaces().get()) .withOptional(parameters.getUseOptional().get()) diff --git a/openapi-plugin/src/main/java/io/micronaut/gradle/openapi/tasks/OpenApiClientWorkAction.java b/openapi-plugin/src/main/java/io/micronaut/gradle/openapi/tasks/OpenApiClientWorkAction.java index 52001dff..cdf2e457 100644 --- a/openapi-plugin/src/main/java/io/micronaut/gradle/openapi/tasks/OpenApiClientWorkAction.java +++ b/openapi-plugin/src/main/java/io/micronaut/gradle/openapi/tasks/OpenApiClientWorkAction.java @@ -46,6 +46,7 @@ protected void configureBuilder(MicronautCodeGeneratorBuilder builder) { spec.withAuthorization(parameters.getUseAuth().get()) .withAdditionalClientTypeAnnotations(parameters.getAdditionalClientTypeAnnotations().getOrElse(List.of())) .withGeneratedAnnotation(parameters.getGeneratedAnnotation().get()) + .withFluxForArrays(parameters.getFluxForArrays().get()) .withKsp(parameters.getKsp().get()); if (parameters.getClientId().isPresent()) { diff --git a/openapi-plugin/src/main/java/io/micronaut/gradle/openapi/tasks/OpenApiServerWorkAction.java b/openapi-plugin/src/main/java/io/micronaut/gradle/openapi/tasks/OpenApiServerWorkAction.java index fcdbf502..c35b8475 100644 --- a/openapi-plugin/src/main/java/io/micronaut/gradle/openapi/tasks/OpenApiServerWorkAction.java +++ b/openapi-plugin/src/main/java/io/micronaut/gradle/openapi/tasks/OpenApiServerWorkAction.java @@ -34,17 +34,20 @@ protected void configureBuilder(MicronautCodeGeneratorBuilder builder) { var parameters = getParameters(); if ("kotlin".equalsIgnoreCase(parameters.getLang().get())) { - builder.forKotlinServer(spec -> spec.withControllerPackage(parameters.getControllerPackage().get()) + builder.forKotlinServer(spec -> spec + .withControllerPackage(parameters.getControllerPackage().get()) .withAuthentication(parameters.getUseAuth().get()) .withAot(parameters.getAot().get()) .withGenerateImplementationFiles(false) .withGenerateControllerFromExamples(false) .withGenerateOperationsToReturnNotImplemented(false) .withGeneratedAnnotation(parameters.getGeneratedAnnotation().get()) + .withFluxForArrays(parameters.getFluxForArrays().get()) .withKsp(parameters.getKsp().get()) ); } else { - builder.forJavaServer(spec -> spec.withControllerPackage(parameters.getControllerPackage().get()) + builder.forJavaServer(spec -> spec + .withControllerPackage(parameters.getControllerPackage().get()) .withAuthentication(parameters.getUseAuth().get()) .withAot(parameters.getAot().get()) .withGenerateImplementationFiles(false)