Skip to content

Commit bfd4e5b

Browse files
author
Michael Sonnleitner
committed
review
1 parent 4cbead0 commit bfd4e5b

File tree

8 files changed

+1020
-26
lines changed

8 files changed

+1020
-26
lines changed

.gitattributes

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
* text eol=lf
2+
*.jar -text -eol -working-tree-encoding -merge -diff
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
package io.quarkiverse.openapi.generator.deployment;
2+
3+
import java.util.List;
4+
import java.util.Optional;
5+
6+
import io.smallrye.config.WithDefault;
7+
import io.smallrye.config.WithName;
8+
9+
/*
10+
* Model for the configuration of this extension.
11+
* It's used for documentation purposes only.
12+
* The configuration is consumed in the codegen phase, before build time.
13+
* Not meant to be used outside this scope.
14+
* Config items can be applied only on gav
15+
*/
16+
public interface GavItemConfig extends CommonItemConfig {
17+
/**
18+
* List of OpenAPI spec files in GAV to be generated
19+
*/
20+
@WithName("spec-files")
21+
@WithDefault("openapi.yaml")
22+
Optional<List<String>> gavSpecFiles();
23+
}

client/deployment/src/main/java/io/quarkiverse/openapi/generator/deployment/SpecItemConfig.java

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
package io.quarkiverse.openapi.generator.deployment;
22

3-
import java.util.List;
43
import java.util.Optional;
54

65
import io.smallrye.config.WithDefault;
@@ -80,11 +79,4 @@ public interface SpecItemConfig extends CommonItemConfig {
8079
@WithDefault("false")
8180
Optional<Boolean> useDynamicUrl();
8281

83-
/**
84-
* List of OpenAPI spec files in GAV to be generated
85-
*/
86-
@WithName("gav-spec-files")
87-
@WithDefault("openapi.yaml")
88-
Optional<List<String>> gavSpecFiles();
89-
9082
}

client/deployment/src/main/java/io/quarkiverse/openapi/generator/deployment/codegen/JarOrZipGAVCoordinateOpenApiSpecInputProvider.java

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@
77
import java.nio.file.Files;
88
import java.nio.file.Path;
99
import java.nio.file.Paths;
10+
import java.util.HashSet;
1011
import java.util.List;
1112
import java.util.Set;
12-
import java.util.stream.Collectors;
1313

1414
import io.quarkus.bootstrap.prebuild.CodeGenException;
1515
import io.quarkus.deployment.CodeGenContext;
@@ -54,7 +54,7 @@
5454
* <li>{@code quarkus.openapi-generator.codegen.artifact-id-filter} - Regex pattern for artifact ID filtering</li>
5555
* <li>{@code quarkus.openapi-generator.codegen.exclude-gavs} - List of GAV coordinates to exclude
5656
* (format: groupId:artifactId:classifier)</li>
57-
* <li>{@code quarkus.openapi-generator.codegen.spec.com_sample_customer_service_openapi.gav-spec-files} - List of
57+
* <li>{@code quarkus.openapi-generator.codegen.gav.com_sample_customer_service_openapi.spec-files} - List of
5858
* openAPI specification files in com.sample:customer-service-openapi:jar</li>
5959
* </ul>
6060
*
@@ -65,7 +65,7 @@
6565
* quarkus.openapi-generator.codegen.gav-scanning=true
6666
* quarkus.openapi-generator.codegen.artifact-id-filter=.*api.*
6767
* quarkus.openapi-generator.codegen.exclude-gavs=com.example:old-api
68-
* quarkus.openapi-generator.codegen.spec.com_sample_customer_service_api.gav-spec-files=customer.yaml,another.yaml
68+
* quarkus.openapi-generator.codegen.gav.com_sample_customer_service_api.spec-files=customer.yaml,another.yaml
6969
* </pre>
7070
*
7171
* @see AbstractGAVCoordinateOpenApiSpecInputProvider
@@ -81,7 +81,7 @@ protected void addInputModels(CodeGenContext context,
8181
Path path,
8282
List<SpecInputModel> inputModels) throws CodeGenException {
8383
List<String> rootFilesOfSpecOfDependency = context.config()
84-
.getOptionalValues(getSpecConfigName(GAV_SPEC_FILES, Paths.get(gacString)), String.class)
84+
.getOptionalValues(getGavConfigName(SPEC_FILES, Paths.get(gacString)), String.class)
8585
.orElse(List.of("openapi.yaml"));
8686
for (String rootFileOfSpecForDependency : rootFilesOfSpecOfDependency) {
8787
try {
@@ -104,9 +104,8 @@ protected Set<String> getSupportedExtensions() {
104104

105105
@Override
106106
protected boolean specificGAVSpecInputProviderFilter(final CodeGenContext context, final String gacString) {
107-
return context.config().getOptionalValues(getGlobalConfigName(INCLUDE_GAVS), String.class)
108-
.orElse(List.of()) // default to empty list to disable all if not specified
109-
.stream().collect(Collectors.toSet())
107+
return new HashSet<>(context.config().getOptionalValues(getGlobalConfigName(INCLUDE_GAVS), String.class)
108+
.orElse(List.of())) // default to empty list to disable all if not specified
110109
.contains(gacString);
111110
}
112111
}

client/deployment/src/main/java/io/quarkiverse/openapi/generator/deployment/codegen/OpenApiConfigValidator.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ public final class OpenApiConfigValidator {
1818
private static final Logger LOGGER = LoggerFactory.getLogger(OpenApiConfigValidator.class);
1919

2020
static final Pattern CONFIG_PATTERN = Pattern.compile(
21-
"quarkus\\.openapi-generator\\.codegen\\.(spec.(?<specId>[\\w\\-]*)\\.)?(?<configName>[A-Za-z0-9_\\-]*)\\.?(?<configMap>.+)?");
21+
"quarkus\\.openapi-generator\\.codegen\\.((spec|gav).(?<specId>[\\w\\-]*)\\.)?(?<configName>[A-Za-z0-9_\\-]*)\\.?(?<configMap>.+)?");
2222

2323
private OpenApiConfigValidator() {
2424
}

client/integration-tests/gav/src/it/02-consume-gav/src/main/resources/application.properties

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,6 @@ quarkus.openapi-generator.codegen.include-gavs=io.quarkiverse.openapi.generator:
77
io.quarkiverse.openapi.generator:quarkus-openapi-generator-gav-source-splitted-echo
88
quarkus.openapi-generator.codegen.spec.io_quarkiverse_openapi_generator_quarkus_openapi_generator_gav_source_echo1.serializable-model=true
99

10-
quarkus.openapi-generator.codegen.spec.io_quarkiverse_openapi_generator_quarkus_openapi_generator_gav_source_splitted_echo.gav-spec-files=echo.yaml
11-
quarkus.openapi-generator.codegen.spec.io_quarkiverse_openapi_generator_quarkus_openapi_generator_gav_source_selfcontained_echo.gav-spec-files=echo1.yaml,echo2.yaml
10+
quarkus.openapi-generator.codegen.gav.io_quarkiverse_openapi_generator_quarkus_openapi_generator_gav_source_splitted_echo.spec-files=echo.yaml
11+
quarkus.openapi-generator.codegen.gav.io_quarkiverse_openapi_generator_quarkus_openapi_generator_gav_source_selfcontained_echo.spec-files=echo1.yaml,echo2.yaml
1212
quarkus.openapi-generator.codegen.spec.io_quarkiverse_openapi_generator_quarkus_openapi_generator_gav_source_selfcontained_echo_echo1_yaml.serializable-model=true

0 commit comments

Comments
 (0)