/** * Constructs an instance of `KotlinClientCodegen`. */ public KotlinClientCodegen() { super(); artifactId = "kotlin-client"; packageName = "io.swagger.client"; outputFolder = "generated-code" + File.separator + "kotlin-client"; modelTemplateFiles.put("model.mustache", ".kt"); apiTemplateFiles.put("api.mustache", ".kt"); modelDocTemplateFiles.put("model_doc.mustache", ".md"); apiDocTemplateFiles.put("api_doc.mustache", ".md"); embeddedTemplateDir = templateDir = "kotlin-client"; apiPackage = packageName + ".apis"; modelPackage = packageName + ".models"; CliOption dateLibrary = new CliOption(DATE_LIBRARY, "Option. Date library to use"); Map<String, String> dateOptions = new HashMap<>(); dateOptions.put(DateLibrary.THREETENBP.value, "Threetenbp"); dateOptions.put(DateLibrary.STRING.value, "String"); dateOptions.put(DateLibrary.JAVA8.value, "Java 8 native JSR310"); dateLibrary.setEnum(dateOptions); cliOptions.add(dateLibrary); }
public JavaJerseyServerCodegen() { super(); outputFolder = "generated-code/JavaJaxRS-Jersey"; CliOption library = new CliOption(CodegenConstants.LIBRARY, "library template (sub-template) to use"); supportedLibraries.put(LIBRARY_JERSEY1, "Jersey core 1.x"); supportedLibraries.put(LIBRARY_JERSEY2, "Jersey core 2.x"); library.setEnum(supportedLibraries); library.setDefault(DEFAULT_JERSEY_LIBRARY); cliOptions.add(library); cliOptions.add(CliOption.newBoolean(SUPPORT_JAVA6, "Whether to support Java6 with the Jersey1/2 library.")); cliOptions.add(CliOption.newBoolean(USE_TAGS, "use tags for creating interface and controller classnames")); }
public JavaJAXRSSpecServerCodegen() { super(); invokerPackage = "io.swagger.api"; artifactId = "swagger-jaxrs-server"; outputFolder = "generated-code/JavaJaxRS-Spec"; additionalProperties.put("title", title); typeMapping.put("date", "LocalDate"); importMapping.put("LocalDate", "org.joda.time.LocalDate"); for (int i = 0; i < cliOptions.size(); i++) { if (CodegenConstants.LIBRARY.equals(cliOptions.get(i).getOpt())) { cliOptions.remove(i); break; } } CliOption library = new CliOption(CodegenConstants.LIBRARY, "library template (sub-template) to use"); library.setDefault(DEFAULT_LIBRARY); Map<String, String> supportedLibraries = new LinkedHashMap<String, String>(); supportedLibraries.put(DEFAULT_LIBRARY, "JAXRS"); library.setEnum(supportedLibraries); cliOptions.add(library); cliOptions.add(CliOption.newBoolean(GENERATE_POM, "Whether to generate pom.xml if the file does not already exist.").defaultValue(String.valueOf(generatePom))); cliOptions.add(CliOption.newBoolean(INTERFACE_ONLY, "Whether to generate only API interface stubs without the server files.").defaultValue(String.valueOf(interfaceOnly))); }
libraryOption.setEnum(supportedLibraries);
public SwaggerCodegen() { super(); embeddedTemplateDir = "codegen"; // standard opts to be overridden by user options outputFolder = "."; apiPackage = "com.centurylink.api.service"; modelPackage = "com.centurylink.api.model"; cliOptions.add(CliOption .newString(TRIM_API_PATHS, "Trim API paths and adjust package names accordingly") .defaultValue(Boolean.TRUE.toString())); additionalProperties.put(TRIM_API_PATHS, true); cliOptions.add(CliOption.newString(GENERATED_FLOW_BASE_PACKAGE, "Base package for generated microservice orchestration workflow processes")); // relevant once we submit a PR to swagger-code to become an official // java library supportedLibraries.put(NAME, getHelp()); setLibrary(NAME); CliOption library = new CliOption(CodegenConstants.LIBRARY, "library template (sub-template) to use"); library.setDefault(NAME); library.setEnum(supportedLibraries); library.setDefault(NAME); cliOptions.add(library); }
library.setEnum(supportedLibraries); library.setDefault(DEFAULT_LIBRARY); cliOptions.add(library);
dateOptions.put("joda", "Joda (for legacy app only)"); dateOptions.put("legacy", "Legacy java.util.Date (if you really have a good reason not to use threetenbp"); dateLibrary.setEnum(dateOptions); cliOptions.add(dateLibrary); java8ModeOptions.put("true", "Use Java 8 classes such as Base64"); java8ModeOptions.put("false", "Various third party libraries as needed"); java8Mode.setEnum(java8ModeOptions); cliOptions.add(java8Mode);
/** * Constructs an instance of `KotlinServerCodegen`. */ public KotlinServerCodegen() { super(); artifactId = "kotlin-server"; packageName = "io.swagger.server"; outputFolder = "generated-code" + File.separator + "kotlin-server"; modelTemplateFiles.put("model.mustache", ".kt"); apiTemplateFiles.put("api.mustache", ".kt"); embeddedTemplateDir = templateDir = "kotlin-server"; apiPackage = packageName + ".apis"; modelPackage = packageName + ".models"; supportedLibraries.put("ktor", "ktor framework"); // TODO: Configurable server engine. Defaults to netty in build.gradle. CliOption library = new CliOption(CodegenConstants.LIBRARY, "library template (sub-template) to use"); library.setDefault(DEFAULT_LIBRARY); library.setEnum(supportedLibraries); cliOptions.add(library); addSwitch(Constants.AUTOMATIC_HEAD_REQUESTS, Constants.AUTOMATIC_HEAD_REQUESTS_DESC, getAutoHeadFeatureEnabled()); addSwitch(Constants.CONDITIONAL_HEADERS, Constants.CONDITIONAL_HEADERS_DESC, getConditionalHeadersFeatureEnabled()); addSwitch(Constants.HSTS, Constants.HSTS_DESC, getHstsFeatureEnabled()); addSwitch(Constants.CORS, Constants.CORS_DESC, getCorsFeatureEnabled()); addSwitch(Constants.COMPRESSION, Constants.COMPRESSION_DESC, getCompressionFeatureEnabled()); }