Skip to content

Commit 2f580e8

Browse files
remove operation id prefix
1 parent 1230fb8 commit 2f580e8

File tree

4 files changed

+22
-10
lines changed

4 files changed

+22
-10
lines changed

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ public enum ConfigName {
6767
USE_FIELD_NAME_IN_PART_FILENAME("use-field-name-in-part-filename"),
6868
ADDITIONAL_PROPERTIES_AS_ATTRIBUTE("additional-properties-as-attribute"),
6969
ADDITIONAL_REQUEST_ARGS("additional-request-args"),
70+
REMOVE_OPERATION_ID_PREFIX("remove-operation-id-prefix"),
7071
BEAN_VALIDATION("use-bean-validation");
7172

7273
private final String name;

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

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,4 +38,11 @@ public class SpecItemConfig extends CommonItemConfig {
3838
*/
3939
@ConfigItem(name = "model-name-prefix")
4040
public Optional<String> modelNamePrefix;
41+
42+
/**
43+
* Remove operation id prefix
44+
*/
45+
@ConfigItem(name = "remove-operation-id-prefix")
46+
public Optional<String> removeOperationIdPrefix;
47+
4148
}

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

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,7 @@
55
import static io.quarkiverse.openapi.generator.deployment.CodegenConfig.getGlobalConfigName;
66
import static io.quarkiverse.openapi.generator.deployment.CodegenConfig.getSanitizedFileName;
77
import static io.quarkiverse.openapi.generator.deployment.CodegenConfig.getSpecConfigName;
8-
import static io.quarkiverse.openapi.generator.deployment.CodegenConfig.ConfigName.API_NAME_SUFFIX;
9-
import static io.quarkiverse.openapi.generator.deployment.CodegenConfig.ConfigName.BASE_PACKAGE;
10-
import static io.quarkiverse.openapi.generator.deployment.CodegenConfig.ConfigName.DEFAULT_SECURITY_SCHEME;
11-
import static io.quarkiverse.openapi.generator.deployment.CodegenConfig.ConfigName.EXCLUDE;
12-
import static io.quarkiverse.openapi.generator.deployment.CodegenConfig.ConfigName.INCLUDE;
13-
import static io.quarkiverse.openapi.generator.deployment.CodegenConfig.ConfigName.INPUT_BASE_DIR;
14-
import static io.quarkiverse.openapi.generator.deployment.CodegenConfig.ConfigName.MODEL_NAME_PREFIX;
15-
import static io.quarkiverse.openapi.generator.deployment.CodegenConfig.ConfigName.MODEL_NAME_SUFFIX;
16-
import static io.quarkiverse.openapi.generator.deployment.CodegenConfig.ConfigName.TEMPLATE_BASE_DIR;
17-
import static io.quarkiverse.openapi.generator.deployment.CodegenConfig.ConfigName.VALIDATE_SPEC;
8+
import static io.quarkiverse.openapi.generator.deployment.CodegenConfig.ConfigName.*;
189

1910
import java.io.IOException;
2011
import java.nio.file.Files;
@@ -228,6 +219,9 @@ protected void generate(OpenApiGeneratorOptions options) {
228219
getModelNamePrefix(config, openApiFilePath)
229220
.ifPresent(generator::withModelNamePrefix);
230221

222+
getRemoveOperationIdPrefix(config, openApiFilePath)
223+
.ifPresent(generator::withRemoveOperationIdPrefix);
224+
231225
getValues(config, openApiFilePath, CodegenConfig.ConfigName.MUTINY, Boolean.class)
232226
.ifPresent(generator::withMutiny);
233227

@@ -350,6 +344,11 @@ private Optional<String> getModelNamePrefix(final Config config, final Path open
350344
.getOptionalValue(getSpecConfigName(MODEL_NAME_PREFIX, openApiFilePath), String.class);
351345
}
352346

347+
private Optional<Boolean> getRemoveOperationIdPrefix(final Config config, final Path openApiFilePath) {
348+
return config
349+
.getOptionalValue(getSpecConfigName(REMOVE_OPERATION_ID_PREFIX, openApiFilePath), Boolean.class);
350+
}
351+
353352
private Optional<String> getInputBaseDirRelativeToModule(final Path sourceDir, final Config config) {
354353
return config.getOptionalValue(getGlobalConfigName(INPUT_BASE_DIR), String.class).map(baseDir -> {
355354
int srcIndex = sourceDir.toString().lastIndexOf("src");

client/deployment/src/main/java/io/quarkiverse/openapi/generator/deployment/wrapper/OpenApiClientGeneratorWrapper.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -261,6 +261,11 @@ public OpenApiClientGeneratorWrapper withModelNamePrefix(final String modelNameP
261261
return this;
262262
}
263263

264+
public OpenApiClientGeneratorWrapper withRemoveOperationIdPrefix(final Boolean modelNamePrefix) {
265+
this.configurator.setRemoveOperationIdPrefix(modelNamePrefix);
266+
return this;
267+
}
268+
264269
public List<File> generate(final String basePackage) {
265270
this.basePackage = basePackage;
266271
this.consolidatePackageNames();

0 commit comments

Comments
 (0)