|
4 | 4 | import com.samskivert.mustache.Mustache;
|
5 | 5 | import io.swagger.codegen.CliOption;
|
6 | 6 | import io.swagger.codegen.CodegenConstants;
|
| 7 | +import io.swagger.codegen.CodegenModel; |
| 8 | +import io.swagger.codegen.CodegenOperation; |
7 | 9 | import io.swagger.codegen.CodegenType;
|
8 | 10 | import io.swagger.codegen.SupportingFile;
|
9 | 11 | import io.swagger.codegen.mustache.*;
|
| 12 | +import io.swagger.models.ArrayModel; |
| 13 | +import io.swagger.models.Model; |
| 14 | +import io.swagger.models.Operation; |
| 15 | +import io.swagger.models.Swagger; |
| 16 | +import io.swagger.models.parameters.Parameter; |
10 | 17 | import org.slf4j.Logger;
|
11 | 18 | import org.slf4j.LoggerFactory;
|
12 | 19 |
|
|
15 | 22 | import java.util.List;
|
16 | 23 | import java.util.Map;
|
17 | 24 |
|
| 25 | +import static io.swagger.codegen.CodegenConstants.GENERATE_APIS; |
| 26 | + |
18 | 27 | public class KotlinServerCodegen extends AbstractKotlinCodegen {
|
19 | 28 |
|
20 | 29 | public static final String DEFAULT_LIBRARY = Constants.KTOR;
|
21 |
| - static Logger LOGGER = LoggerFactory.getLogger(KotlinServerCodegen.class); |
| 30 | + public static final String GENERATE_APIS = "generateApis"; |
| 31 | + |
| 32 | + private static Logger LOGGER = LoggerFactory.getLogger(KotlinServerCodegen.class); |
22 | 33 | private Boolean autoHeadFeatureEnabled = true;
|
23 | 34 | private Boolean conditionalHeadersFeatureEnabled = false;
|
24 | 35 | private Boolean hstsFeatureEnabled = true;
|
@@ -123,8 +134,14 @@ public CodegenType getTag() {
|
123 | 134 | public void processOpts() {
|
124 | 135 | super.processOpts();
|
125 | 136 |
|
| 137 | + if (!additionalProperties.containsKey(GENERATE_APIS)) { |
| 138 | + additionalProperties.put(GENERATE_APIS, true); |
| 139 | + } |
| 140 | + |
126 | 141 | if (additionalProperties.containsKey(CodegenConstants.LIBRARY)) {
|
127 | 142 | this.setLibrary((String) additionalProperties.get(CodegenConstants.LIBRARY));
|
| 143 | + } else { |
| 144 | + this.setLibrary(DEFAULT_LIBRARY); |
128 | 145 | }
|
129 | 146 |
|
130 | 147 | if (additionalProperties.containsKey(Constants.AUTOMATIC_HEAD_REQUESTS)) {
|
@@ -157,9 +174,9 @@ public void processOpts() {
|
157 | 174 | additionalProperties.put(Constants.COMPRESSION, getCompressionFeatureEnabled());
|
158 | 175 | }
|
159 | 176 |
|
160 |
| - Boolean generateApis = additionalProperties.containsKey(CodegenConstants.GENERATE_APIS) && (Boolean)additionalProperties.get(CodegenConstants.GENERATE_APIS); |
161 | 177 | String packageFolder = (sourceFolder + File.separator + packageName).replace(".", File.separator);
|
162 | 178 | String resourcesFolder = "src/main/resources"; // not sure this can be user configurable.
|
| 179 | + Boolean generateApis = additionalProperties.containsKey(GENERATE_APIS) && (Boolean)additionalProperties.get(GENERATE_APIS); |
163 | 180 |
|
164 | 181 | supportingFiles.add(new SupportingFile("README.mustache", "", "README.md"));
|
165 | 182 | supportingFiles.add(new SupportingFile("Dockerfile.mustache", "", "Dockerfile"));
|
|
0 commit comments