diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/v3/DefaultGenerator.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/v3/DefaultGenerator.java index e3f942bdfd3..86d83f8a644 100644 --- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/v3/DefaultGenerator.java +++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/v3/DefaultGenerator.java @@ -465,9 +465,6 @@ public int compare(String o1, String o2) { } private void generateApis(List files, List allOperations, List allModels) { - if (!generateApis) { - return; - } boolean hasModel = true; if (allModels == null || allModels.isEmpty()) { hasModel = false; @@ -537,6 +534,12 @@ public int compare(CodegenOperation one, CodegenOperation another) { } } + // Some target languages refer to API operations in + // their supporting files and so we always process the + // API operations above, even when we need to skip the + // actual API generation. + if (!generateApis) continue; + for (String templateName : config.apiTemplateFiles().keySet()) { String filename = config.apiFilename(templateName, tag); if (!config.shouldOverwrite(filename) && new File(filename).exists()) {