Skip to content

Commit

Permalink
Micronaut openapi 6.12.3
Browse files Browse the repository at this point in the history
  • Loading branch information
altro3 committed Oct 22, 2024
1 parent 810c09e commit 9d7f22f
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,10 @@ private void configureCommonProperties(String name, AbstractOpenApiGenerator<?,
task.getApiNameSuffix().convention(openApiSpec.getApiNameSuffix());
task.getModelNamePrefix().convention(openApiSpec.getModelNamePrefix());
task.getModelNameSuffix().convention(openApiSpec.getModelNameSuffix());

task.getGenerateSwaggerAnnotations().convention(openApiSpec.getGenerateSwaggerAnnotations());
task.getImplicitHeaders().convention(openApiSpec.getImplicitHeaders());
task.getImplicitHeadersRegex().convention(openApiSpec.getImplicitHeadersRegex());
}

private void withJavaSourceSets(Consumer<? super SourceSetContainer> consumer) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,4 +82,10 @@ public interface OpenApiSpec {
Property<String> getModelNamePrefix();

Property<String> getModelNameSuffix();

Property<Boolean> getGenerateSwaggerAnnotations();

Property<Boolean> getImplicitHeaders();

Property<String> getImplicitHeadersRegex();
}
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,18 @@ public abstract class AbstractOpenApiGenerator<W extends AbstractOpenApiWorkActi
@Input
public abstract Property<String> getModelNameSuffix();

@Optional
@Input
public abstract Property<Boolean> getGenerateSwaggerAnnotations();

@Optional
@Input
public abstract Property<Boolean> getImplicitHeaders();

@Optional
@Input
public abstract Property<String> getImplicitHeadersRegex();

@OutputDirectory
public abstract DirectoryProperty getOutputDirectory();

Expand Down Expand Up @@ -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);
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,12 @@ interface OpenApiParameters extends WorkParameters {
Property<String> getModelNamePrefix();

Property<String> getModelNameSuffix();

Property<Boolean> getGenerateSwaggerAnnotations();

Property<Boolean> getImplicitHeaders();

Property<String> getImplicitHeadersRegex();
}

protected abstract void configureBuilder(MicronautCodeGeneratorBuilder builder);
Expand Down Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,8 @@ class OpenApiClientGeneratorSpec extends AbstractOpenApiGeneratorSpec {
fluxForArrays = true
nameMapping = [test: "changedTest"]
clientId = "my-client"
generateSwaggerAnnotations = true
implicitHeadersRegex = ".*"
}
}
}
Expand Down

0 comments on commit 9d7f22f

Please sign in to comment.