Skip to content

Commit

Permalink
Enable selection of annotation scanners (#1370) via maven plugin conf…
Browse files Browse the repository at this point in the history
…ig. (#1894)

* Enable selection of annotation scanners (#1370) via maven plugin config.
* Update tools/maven-plugin/README.adoc

---------

Co-authored-by: Bernhard Öhlinger <[email protected]>
Co-authored-by: Michael Edgar <[email protected]>
  • Loading branch information
3 people authored Jul 4, 2024
1 parent 7c9f425 commit c4df7f4
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>) - Names of the AnnotationScanner implementations that should be executed. If omitted or an empty list, all scanners will be executed. The names of the scanners available by default are `JAX-RS`, `Spring`, and `Vert.x`.

== 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 c4df7f4

Please sign in to comment.