1919import io .quarkus .maven .dependency .ResolvedDependency ;
2020import 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 ();
0 commit comments