Skip to content

Commit

Permalink
Enable selection of annotation scanners (smallrye#1370) via maven plu…
Browse files Browse the repository at this point in the history
…gin config.
  • Loading branch information
Bernhard Öhlinger committed Jul 2, 2024
1 parent 7c9f425 commit d3ac874
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
1 change: 1 addition & 0 deletions tools/maven-plugin/README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ E.g. for includeDependenciesScopes could be configured as:
- `skip` (boolean, default: false) - Skip execution of the plugin.
- `encoding` (String) - Encoding of output OpenAPI files.
- `outputFileTypeFilter` (String, default: ALL) - Set this to `YAML` in order to let the generation process produce just *.yaml output, `JSON` to obtain *.json files only. The default is `ALL`, which will generate both file types.
- `scanners` (List<String>) - To set the names of the AnnotationScanner implementations that should be executed.

== MicroProfile OpenAPI Properties

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,12 @@ public class GenerateSchemaMojo extends AbstractMojo {
@Parameter(property = "configProperties")
private File configProperties;

/**
* Configuration property to specify the list of scanners to use. If the list is empty the default scanners are used.
*/
@Parameter(property = "scanners")
private List<String> scanners;

// Properies as per OpenAPI Config.

/**
Expand Down Expand Up @@ -295,6 +301,7 @@ private SmallRyeOpenAPI generateOpenAPI(IndexView index) throws IOException, Dep
.withConfig(config)
.withApplicationClassLoader(getClassLoader())
.withIndex(index)
.withScannerFilter(scanners != null && !scanners.isEmpty() ? x -> scanners.contains(x) : x -> true)
.build();
}

Expand Down

0 comments on commit d3ac874

Please sign in to comment.