Skip to content

Commit 596b261

Browse files
author
Michael Sonnleitner
committed
renaming and javadoc
1 parent 3c96030 commit 596b261

File tree

2 files changed

+49
-4
lines changed

2 files changed

+49
-4
lines changed
Lines changed: 48 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,53 @@
1919
import io.quarkus.maven.dependency.ResolvedDependency;
2020
import io.smallrye.config.common.utils.StringUtil;
2121

22-
public class GAVCoordinateOpenApiSpecInputProvider implements OpenApiSpecInputProvider {
23-
private static final Logger LOG = Logger.getLogger(GAVCoordinateOpenApiSpecInputProvider.class);
22+
/**
23+
* Provides OpenAPI specification input from Maven GAV (GroupId:ArtifactId:Version) coordinates.
24+
* <p>
25+
* This provider scans the application's dependencies for YAML or JSON files that match
26+
* specific criteria and provides them as input for OpenAPI code generation. It implements
27+
* the {@link OpenApiSpecInputProvider} interface to integrate with the OpenAPI Generator's
28+
* code generation pipeline.
29+
* </p>
30+
*
31+
* <h2>Scanning Behavior</h2>
32+
* <p>
33+
* The provider performs the following steps:
34+
* </p>
35+
* <ol>
36+
* <li>Checks if GAV scanning is enabled via configuration (enabled by default)</li>
37+
* <li>Filters dependencies by artifact type (yaml/yml/json)</li>
38+
* <li>Applies artifact ID filtering using a regex pattern</li>
39+
* <li>Excludes specific GAVs based on configuration</li>
40+
* <li>Creates {@link SpecInputModel} instances for each matching dependency</li>
41+
* </ol>
42+
*
43+
* <h2>Configuration</h2>
44+
* <p>
45+
* The provider respects the following configuration properties:
46+
* </p>
47+
* <ul>
48+
* <li>{@code quarkus.openapi-generator.codegen.gav-scanning} - Enable/disable GAV scanning</li>
49+
* <li>{@code quarkus.openapi-generator.codegen.artifact-id-filter} - Regex pattern for artifact ID filtering</li>
50+
* <li>{@code quarkus.openapi-generator.codegen.exclude-gavs} - List of GAV coordinates to exclude
51+
* (format: groupId:artifactId:classifier)</li>
52+
* </ul>
53+
*
54+
* <h2>Example Usage</h2>
55+
*
56+
* <pre>
57+
* # application.properties
58+
* quarkus.openapi-generator.codegen.gav-scanning=true
59+
* quarkus.openapi-generator.codegen.artifact-id-filter=.*api.*
60+
* quarkus.openapi-generator.codegen.exclude-gavs=com.example:old-api
61+
* </pre>
62+
*
63+
* @see OpenApiSpecInputProvider
64+
* @see SpecInputModel
65+
* @see CodeGenContext
66+
*/
67+
public class YamlOrJsonGAVCoordinateOpenApiSpecInputProvider implements OpenApiSpecInputProvider {
68+
private static final Logger LOG = Logger.getLogger(YamlOrJsonGAVCoordinateOpenApiSpecInputProvider.class);
2469

2570
@Override
2671
public List<SpecInputModel> read(CodeGenContext context) throws CodeGenException {
@@ -37,7 +82,7 @@ public List<SpecInputModel> read(CodeGenContext context) throws CodeGenException
3782
.orElse(".*openapi.*");
3883

3984
List<ResolvedDependency> yamlDependencies = context.applicationModel().getDependencies().stream()
40-
.filter(rd -> SUPPORTED_EXTENSIONS.contains(rd.getType()))
85+
.filter(rd -> SUPPORTED_EXTENSIONS.contains(rd.getType().toLowerCase()))
4186
.filter(rd -> rd.getArtifactId().matches(artifactIdFilter))
4287
.filter(rd -> !gavsToExclude.contains(rd.getKey().toGacString()))
4388
.toList();
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
io.quarkiverse.openapi.generator.deployment.codegen.GAVCoordinateOpenApiSpecInputProvider
1+
io.quarkiverse.openapi.generator.deployment.codegen.YamlOrJsonGAVCoordinateOpenApiSpecInputProvider

0 commit comments

Comments
 (0)