diff --git a/openapi-plugin/src/main/java/io/micronaut/gradle/openapi/DefaultOpenApiExtension.java b/openapi-plugin/src/main/java/io/micronaut/gradle/openapi/DefaultOpenApiExtension.java index 19890515..5d671801 100644 --- a/openapi-plugin/src/main/java/io/micronaut/gradle/openapi/DefaultOpenApiExtension.java +++ b/openapi-plugin/src/main/java/io/micronaut/gradle/openapi/DefaultOpenApiExtension.java @@ -189,6 +189,10 @@ private void configureCommonProperties(String name, AbstractOpenApiGenerator consumer) { diff --git a/openapi-plugin/src/main/java/io/micronaut/gradle/openapi/OpenApiSpec.java b/openapi-plugin/src/main/java/io/micronaut/gradle/openapi/OpenApiSpec.java index 15f39c8f..26844bcd 100644 --- a/openapi-plugin/src/main/java/io/micronaut/gradle/openapi/OpenApiSpec.java +++ b/openapi-plugin/src/main/java/io/micronaut/gradle/openapi/OpenApiSpec.java @@ -82,4 +82,10 @@ public interface OpenApiSpec { Property getModelNamePrefix(); Property getModelNameSuffix(); + + Property getGenerateSwaggerAnnotations(); + + Property getImplicitHeaders(); + + Property getImplicitHeadersRegex(); } diff --git a/openapi-plugin/src/main/java/io/micronaut/gradle/openapi/tasks/AbstractOpenApiGenerator.java b/openapi-plugin/src/main/java/io/micronaut/gradle/openapi/tasks/AbstractOpenApiGenerator.java index 1b5db867..b0843720 100644 --- a/openapi-plugin/src/main/java/io/micronaut/gradle/openapi/tasks/AbstractOpenApiGenerator.java +++ b/openapi-plugin/src/main/java/io/micronaut/gradle/openapi/tasks/AbstractOpenApiGenerator.java @@ -146,6 +146,18 @@ public abstract class AbstractOpenApiGenerator getModelNameSuffix(); + @Optional + @Input + public abstract Property getGenerateSwaggerAnnotations(); + + @Optional + @Input + public abstract Property getImplicitHeaders(); + + @Optional + @Input + public abstract Property getImplicitHeadersRegex(); + @OutputDirectory public abstract DirectoryProperty getOutputDirectory(); @@ -197,6 +209,10 @@ public final void execute() { params.getModelNamePrefix().set(getModelNamePrefix().orElse("")); params.getModelNameSuffix().set(getModelNameSuffix().orElse("")); + params.getGenerateSwaggerAnnotations().set(getGenerateSwaggerAnnotations()); + params.getImplicitHeaders().set(getImplicitHeaders()); + params.getImplicitHeadersRegex().set(getImplicitHeadersRegex().orElse("")); + configureWorkerParameters(params); }); } 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 72c1f44d..282a362b 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 @@ -105,6 +105,12 @@ interface OpenApiParameters extends WorkParameters { Property getModelNamePrefix(); Property getModelNameSuffix(); + + Property getGenerateSwaggerAnnotations(); + + Property getImplicitHeaders(); + + Property getImplicitHeadersRegex(); } protected abstract void configureBuilder(MicronautCodeGeneratorBuilder builder); @@ -170,6 +176,9 @@ public void execute() { .withApiNameSuffix(parameters.getApiNameSuffix().orElse("").get()) .withModelNamePrefix(parameters.getModelNamePrefix().orElse("").get()) .withModelNameSuffix(parameters.getModelNameSuffix().orElse("").get()) + .withGenerateSwaggerAnnotations(parameters.getGenerateSwaggerAnnotations().get()) + .withImplicitHeaders(parameters.getImplicitHeaders().get()) + .withImplicitHeadersRegex(parameters.getImplicitHeadersRegex().orElse("").get()) ); configureBuilder(builder); diff --git a/openapi-plugin/src/test/groovy/io/micronaut/openapi/gradle/OpenApiClientGeneratorSpec.groovy b/openapi-plugin/src/test/groovy/io/micronaut/openapi/gradle/OpenApiClientGeneratorSpec.groovy index 9ee5fe79..efc676c0 100644 --- a/openapi-plugin/src/test/groovy/io/micronaut/openapi/gradle/OpenApiClientGeneratorSpec.groovy +++ b/openapi-plugin/src/test/groovy/io/micronaut/openapi/gradle/OpenApiClientGeneratorSpec.groovy @@ -68,6 +68,8 @@ class OpenApiClientGeneratorSpec extends AbstractOpenApiGeneratorSpec { fluxForArrays = true nameMapping = [test: "changedTest"] clientId = "my-client" + generateSwaggerAnnotations = true + implicitHeadersRegex = ".*" } } }