Skip to content

Commit 3b0bca1

Browse files
author
Michael Sonnleitner
committed
review
1 parent bfd4e5b commit 3b0bca1

File tree

1 file changed

+21
-1
lines changed
  • client/deployment/src/main/java/io/quarkiverse/openapi/generator/deployment

1 file changed

+21
-1
lines changed

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

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ public interface CodegenConfig extends GlobalCodegenConfig {
2727
// package visibility for unit tests
2828
String BUILD_TIME_GLOBAL_PREFIX_FORMAT = "quarkus." + CODEGEN_TIME_CONFIG_PREFIX + ".%s";
2929
String BUILD_TIME_SPEC_PREFIX_FORMAT = "quarkus." + CODEGEN_TIME_CONFIG_PREFIX + ".spec.%s";
30+
String BUILD_TIME_GAV_PREFIX_FORMAT = "quarkus." + CODEGEN_TIME_CONFIG_PREFIX + ".gav.%s";
3031

3132
List<String> SUPPORTED_CONFIGURATIONS = Arrays.stream(ConfigName.values()).map(cn -> cn.name)
3233
.toList();
@@ -50,7 +51,9 @@ enum ConfigName {
5051
API_NAME_SUFFIX("api-name-suffix"),
5152
MODEL_NAME_SUFFIX("model-name-suffix"),
5253
MODEL_NAME_PREFIX("model-name-prefix"),
53-
GAV_SPEC_FILES("gav-spec-files"),
54+
55+
//gav configs only
56+
SPEC_FILES("spec-files"),
5457

5558
//global & spec configs
5659
SKIP_FORM_MODEL("skip-form-model"),
@@ -99,6 +102,12 @@ enum ConfigName {
99102
@WithName("spec")
100103
Map<String, SpecItemConfig> specItem();
101104

105+
/**
106+
* OpenAPI GAV details for codegen configuration.
107+
*/
108+
@WithName("gav")
109+
Map<String, GavItemConfig> gavItem();
110+
102111
static String resolveApiPackage(final String basePackage) {
103112
return String.format("%s%s", basePackage, API_PKG_SUFFIX);
104113
}
@@ -121,6 +130,13 @@ static String getSpecConfigName(ConfigName configName, final Path openApiFilePat
121130
return String.format("%s.%s", getBuildTimeSpecPropertyPrefix(openApiFilePath), configName.name);
122131
}
123132

133+
/**
134+
* Return gav config name openapi-generator.codegen.gav.%s.config-name
135+
*/
136+
static String getGavConfigName(ConfigName configName, final Path openApiFilePath) {
137+
return String.format("%s.%s", getBuildTimeGavPropertyPrefix(openApiFilePath), configName.name);
138+
}
139+
124140
/**
125141
* Return spec config name by config-key (<b>openapi-generator.codegen.spec.%s.config-key</b>) property.
126142
* For example, given a configuration <code>quarkus.openapi.generator.codegen.spec.spec_yaml.config-key=petstore</code>, the
@@ -142,6 +158,10 @@ static String getBuildTimeSpecPropertyPrefix(final Path openApiFilePath) {
142158
return String.format(BUILD_TIME_SPEC_PREFIX_FORMAT, getSanitizedFileName(openApiFilePath));
143159
}
144160

161+
static String getBuildTimeGavPropertyPrefix(final Path openApiFilePath) {
162+
return String.format(BUILD_TIME_GAV_PREFIX_FORMAT, getSanitizedFileName(openApiFilePath));
163+
}
164+
145165
static String getSanitizedFileName(final Path openApiFilePath) {
146166
return StringUtil
147167
.replaceNonAlphanumericByUnderscores(OpenApiGeneratorOutputPaths.getRelativePath(openApiFilePath).toString());

0 commit comments

Comments
 (0)