public TypeScriptAngularClientCodegen() { super(); this.outputFolder = "generated-code" + File.separator + "typescript-angular"; this.cliOptions.add(new CliOption(NPM_NAME, "The name under which you want to publish generated npm package")); this.cliOptions.add(new CliOption(NPM_VERSION, "The version of your npm package")); this.cliOptions.add(new CliOption(NPM_REPOSITORY, "Use this property to set an url your private npmRepo in the package.json")); this.cliOptions.add(new CliOption(SNAPSHOT, "When setting this property to true the version will be suffixed with -SNAPSHOT.yyyyMMddHHmm", SchemaTypeUtil.BOOLEAN_TYPE).defaultValue(Boolean.FALSE.toString())); this.cliOptions.add(new CliOption(WITH_INTERFACES, "Setting this property to true will generate interfaces next to the default class implementations.", SchemaTypeUtil.BOOLEAN_TYPE).defaultValue(Boolean.FALSE.toString())); this.cliOptions.add(new CliOption(NG_VERSION, "The version of Angular. Default is '4.3'")); }
@SuppressWarnings("static-method") protected CliOption buildLibraryCliOption(Map<String, String> supportedLibraries) { StringBuilder sb = new StringBuilder("library template (sub-template) to use:"); for (String lib : supportedLibraries.keySet()) { sb.append("\n").append(lib).append(" - ").append(supportedLibraries.get(lib)); } return new CliOption("library", sb.toString()); }
public AbstractJavaJAXRSServerCodegen() { super(); sourceFolder = "src/gen/java"; invokerPackage = "io.swagger.api"; artifactId = "swagger-jaxrs-server"; dateLibrary = "legacy"; //TODO: add joda support to all jax-rs apiPackage = "io.swagger.api"; modelPackage = "io.swagger.model"; additionalProperties.put("title", title); // java inflector uses the jackson lib additionalProperties.put("jackson", "true"); cliOptions.add(new CliOption(CodegenConstants.IMPL_FOLDER, CodegenConstants.IMPL_FOLDER_DESC)); cliOptions.add(new CliOption("title", "a title describing the application")); cliOptions.add(CliOption.newBoolean(USE_BEANVALIDATION, "Use BeanValidation API annotations")); cliOptions.add(new CliOption("serverPort", "The port on which the server should be started")); }
protected void addOption(String key, String description, String defaultValue) { CliOption option = new CliOption(key, description); if (defaultValue != null) option.defaultValue(defaultValue); cliOptions.add(option); }
public StaticHtmlCodegen() { super(); outputFolder = "docs"; defaultIncludes = new HashSet<String>(); cliOptions.add(new CliOption("appName", "short name of the application")); cliOptions.add(new CliOption("appDescription", "description of the application")); cliOptions.add(new CliOption("infoUrl", "a URL where users can get more information about the application")); cliOptions.add(new CliOption("infoEmail", "an email address to contact for inquiries about the application")); cliOptions.add(new CliOption("licenseInfo", "a short description of the license")); cliOptions.add(new CliOption("licenseUrl", "a URL pointing to the full license")); cliOptions.add(new CliOption(CodegenConstants.INVOKER_PACKAGE, CodegenConstants.INVOKER_PACKAGE_DESC)); cliOptions.add(new CliOption(CodegenConstants.GROUP_ID, CodegenConstants.GROUP_ID_DESC)); cliOptions.add(new CliOption(CodegenConstants.ARTIFACT_ID, CodegenConstants.ARTIFACT_ID_DESC)); cliOptions.add(new CliOption(CodegenConstants.ARTIFACT_VERSION, CodegenConstants.ARTIFACT_VERSION_DESC)); additionalProperties.put("appName", "Swagger Sample"); additionalProperties.put("appDescription", "A sample swagger server"); additionalProperties.put("infoUrl", "https://helloreverb.com"); additionalProperties.put("infoEmail", "hello@helloreverb.com"); additionalProperties.put("licenseInfo", "All rights reserved"); additionalProperties.put("licenseUrl", "http://apache.org/licenses/LICENSE-2.0.html"); additionalProperties.put(CodegenConstants.INVOKER_PACKAGE, invokerPackage); additionalProperties.put(CodegenConstants.GROUP_ID, groupId); additionalProperties.put(CodegenConstants.ARTIFACT_ID, artifactId); additionalProperties.put(CodegenConstants.ARTIFACT_VERSION, artifactVersion); supportingFiles.add(new SupportingFile("index.mustache", "", "index.html")); reservedWords = new HashSet<String>(); languageSpecificPrimitives = new HashSet<String>(); importMapping = new HashMap<String, String>(); }
cliOptions.add(new CliOption("appName", "short name of the application")); cliOptions.add(new CliOption("appDescription", "description of the application")); cliOptions.add(new CliOption("infoUrl", "a URL where users can get more information about the application")); cliOptions.add(new CliOption("infoEmail", "an email address to contact for inquiries about the application")); cliOptions.add(new CliOption("licenseInfo", "a short description of the license")); cliOptions.add(new CliOption("licenseUrl", "a URL pointing to the full license")); cliOptions.add(new CliOption(CodegenConstants.INVOKER_PACKAGE, CodegenConstants.INVOKER_PACKAGE_DESC)); cliOptions.add(new CliOption(CodegenConstants.PHP_INVOKER_PACKAGE, CodegenConstants.PHP_INVOKER_PACKAGE_DESC)); cliOptions.add(new CliOption(CodegenConstants.PERL_MODULE_NAME, CodegenConstants.PERL_MODULE_NAME_DESC)); cliOptions.add(new CliOption(CodegenConstants.PYTHON_PACKAGE_NAME, CodegenConstants.PYTHON_PACKAGE_NAME_DESC)); cliOptions.add(new CliOption(CodegenConstants.PACKAGE_NAME, "C# package name")); cliOptions.add(new CliOption(CodegenConstants.GROUP_ID, CodegenConstants.GROUP_ID_DESC)); cliOptions.add(new CliOption(CodegenConstants.ARTIFACT_ID, CodegenConstants.ARTIFACT_ID_DESC)); cliOptions.add(new CliOption(CodegenConstants.ARTIFACT_VERSION, CodegenConstants.ARTIFACT_VERSION_DESC));
/** * 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")); }
typeMapping.put("UUID", "UUID"); cliOptions.add(new CliOption(PROJECT_NAME, "Project name in Xcode")); cliOptions.add(new CliOption(RESPONSE_AS, "Optionally use libraries to manage response. Currently " + StringUtils.join(RESPONSE_LIBRARIES, ", ") + " are available.")); cliOptions.add(new CliOption(UNWRAP_REQUIRED, "Treat 'required' properties in response as non-optional " + "(which would crash the app if api returns null as opposed to required option specified in json schema")); cliOptions.add(new CliOption(OBJC_COMPATIBLE, "Add additional properties and methods for Objective-C compatibility (default: false)")); cliOptions.add(new CliOption(POD_SOURCE, "Source information used for Podspec")); cliOptions.add(new CliOption(CodegenConstants.POD_VERSION, "Version used for Podspec")); cliOptions.add(new CliOption(POD_AUTHORS, "Authors used for Podspec")); cliOptions.add(new CliOption(POD_SOCIAL_MEDIA_URL, "Social Media URL used for Podspec")); cliOptions.add(new CliOption(POD_DOCSET_URL, "Docset URL used for Podspec")); cliOptions.add(new CliOption(POD_LICENSE, "License used for Podspec")); cliOptions.add(new CliOption(POD_HOMEPAGE, "Homepage used for Podspec")); cliOptions.add(new CliOption(POD_SUMMARY, "Summary used for Podspec")); cliOptions.add(new CliOption(POD_DESCRIPTION, "Description used for Podspec")); cliOptions.add(new CliOption(POD_SCREENSHOTS, "Screenshots used for Podspec")); cliOptions.add(new CliOption(POD_DOCUMENTATION_URL, "Documentation URL used for Podspec")); cliOptions.add(new CliOption(SWIFT_USE_API_NAMESPACE, "Flag to make all the API classes inner-class of {{projectName}}API")); cliOptions.add(new CliOption(CodegenConstants.HIDE_GENERATION_TIMESTAMP, CodegenConstants.HIDE_GENERATION_TIMESTAMP_DESC) .defaultValue(Boolean.TRUE.toString())); cliOptions.add(new CliOption(LENIENT_TYPE_CAST, "Accept and cast values for simple types (string->bool, string->int, int->string)") .defaultValue(Boolean.FALSE.toString()));
cliOptions.add(new CliOption(CodegenConstants.MODEL_PACKAGE, CodegenConstants.MODEL_PACKAGE_DESC)); cliOptions.add(new CliOption(CodegenConstants.API_PACKAGE, CodegenConstants.API_PACKAGE_DESC)); cliOptions.add(new CliOption(CodegenConstants.INVOKER_PACKAGE, CodegenConstants.INVOKER_PACKAGE_DESC)); cliOptions.add(new CliOption(CodegenConstants.GROUP_ID, CodegenConstants.GROUP_ID_DESC)); cliOptions.add(new CliOption(CodegenConstants.ARTIFACT_ID, CodegenConstants.ARTIFACT_ID_DESC)); cliOptions.add(new CliOption(CodegenConstants.ARTIFACT_VERSION, CodegenConstants.ARTIFACT_VERSION_DESC)); cliOptions.add(new CliOption(CodegenConstants.ARTIFACT_URL, CodegenConstants.ARTIFACT_URL_DESC)); cliOptions.add(new CliOption(CodegenConstants.ARTIFACT_DESCRIPTION, CodegenConstants.ARTIFACT_DESCRIPTION_DESC)); cliOptions.add(new CliOption(CodegenConstants.SCM_CONNECTION, CodegenConstants.SCM_CONNECTION_DESC)); cliOptions.add(new CliOption(CodegenConstants.SCM_DEVELOPER_CONNECTION, CodegenConstants.SCM_DEVELOPER_CONNECTION_DESC)); cliOptions.add(new CliOption(CodegenConstants.SCM_URL, CodegenConstants.SCM_URL_DESC)); cliOptions.add(new CliOption(CodegenConstants.DEVELOPER_NAME, CodegenConstants.DEVELOPER_NAME_DESC)); cliOptions.add(new CliOption(CodegenConstants.DEVELOPER_EMAIL, CodegenConstants.DEVELOPER_EMAIL_DESC)); cliOptions.add(new CliOption(CodegenConstants.DEVELOPER_ORGANIZATION, CodegenConstants.DEVELOPER_ORGANIZATION_DESC)); cliOptions.add(new CliOption(CodegenConstants.DEVELOPER_ORGANIZATION_URL, CodegenConstants.DEVELOPER_ORGANIZATION_URL_DESC)); cliOptions.add(new CliOption(CodegenConstants.LICENSE_NAME, CodegenConstants.LICENSE_NAME_DESC)); cliOptions.add(new CliOption(CodegenConstants.LICENSE_URL, CodegenConstants.LICENSE_URL_DESC)); cliOptions.add(new CliOption(CodegenConstants.SOURCE_FOLDER, CodegenConstants.SOURCE_FOLDER_DESC)); cliOptions.add(new CliOption(CodegenConstants.LOCAL_VARIABLE_PREFIX, CodegenConstants.LOCAL_VARIABLE_PREFIX_DESC)); cliOptions.add(CliOption.newBoolean(CodegenConstants.SERIALIZABLE_MODEL, CodegenConstants.SERIALIZABLE_MODEL_DESC)); cliOptions.add(CliOption.newBoolean(CodegenConstants.SERIALIZE_BIG_DECIMAL_AS_STRING, CodegenConstants .SERIALIZE_BIG_DECIMAL_AS_STRING_DESC)); cliOptions.add(CliOption.newBoolean(FULL_JAVA_UTIL, "whether to use fully qualified name for classes under java.util. This option only works for Java API client")); cliOptions.add(new CliOption(CodegenConstants.HIDE_GENERATION_TIMESTAMP, CodegenConstants.HIDE_GENERATION_TIMESTAMP_DESC)); cliOptions.add(CliOption.newBoolean(WITH_XML, "whether to include support for application/xml content type and include XML annotations in the model (works with libraries that provide support for JSON and XML)")); CliOption dateLibrary = new CliOption(DATE_LIBRARY, "Option. Date library to use"); Map<String, String> dateOptions = new HashMap<String, String>(); dateOptions.put("java8", "Java 8 native JSR310 (preferred for jdk 1.8+) - note: this also sets \"" + JAVA8_MODE + "\" to true");
typeMapping.put("UUID", "string"); cliOptions.add(new CliOption(CodegenConstants.MODEL_PACKAGE, CodegenConstants.MODEL_PACKAGE_DESC)); cliOptions.add(new CliOption(CodegenConstants.API_PACKAGE, CodegenConstants.API_PACKAGE_DESC)); cliOptions.add(new CliOption(VARIABLE_NAMING_CONVENTION, "naming convention of variable name, e.g. camelCase.") .defaultValue("snake_case")); cliOptions.add(new CliOption(CodegenConstants.INVOKER_PACKAGE, "The main namespace to use for all classes. e.g. Yay\\Pets")); cliOptions.add(new CliOption(PACKAGE_PATH, "The main package name for classes. e.g. GeneratedPetstore")); cliOptions.add(new CliOption(SRC_BASE_PATH, "The directory under packagePath to serve as source root.")); cliOptions.add(new CliOption(COMPOSER_VENDOR_NAME, "The vendor name used in the composer package name. The template uses {{composerVendorName}}/{{composerProjectName}} for the composer package name. e.g. yaypets. IMPORTANT NOTE (2016/03): composerVendorName will be deprecated and replaced by gitUserId in the next swagger-codegen release")); cliOptions.add(new CliOption(CodegenConstants.GIT_USER_ID, CodegenConstants.GIT_USER_ID_DESC)); cliOptions.add(new CliOption(COMPOSER_PROJECT_NAME, "The project name used in the composer package name. The template uses {{composerVendorName}}/{{composerProjectName}} for the composer package name. e.g. petstore-client. IMPORTANT NOTE (2016/03): composerProjectName will be deprecated and replaced by gitRepoId in the next swagger-codegen release")); cliOptions.add(new CliOption(CodegenConstants.GIT_REPO_ID, CodegenConstants.GIT_REPO_ID_DESC)); cliOptions.add(new CliOption(CodegenConstants.ARTIFACT_VERSION, "The version to use in the composer package version field. e.g. 1.2.3")); cliOptions.add(new CliOption(CodegenConstants.HIDE_GENERATION_TIMESTAMP, "hides the timestamp when files were generated") .defaultValue(Boolean.TRUE.toString()));
typeMapping.put("UUID", "string"); cliOptions.add(new CliOption(CodegenConstants.MODEL_PACKAGE, CodegenConstants.MODEL_PACKAGE_DESC)); cliOptions.add(new CliOption(CodegenConstants.API_PACKAGE, CodegenConstants.API_PACKAGE_DESC)); cliOptions.add(new CliOption(VARIABLE_NAMING_CONVENTION, "naming convention of variable name, e.g. camelCase.") .defaultValue("snake_case")); cliOptions.add(new CliOption(CodegenConstants.INVOKER_PACKAGE, "The main namespace to use for all classes. e.g. Yay\\Pets")); cliOptions.add(new CliOption(PACKAGE_PATH, "The main package name for classes. e.g. GeneratedPetstore")); cliOptions.add(new CliOption(SRC_BASE_PATH, "The directory under packagePath to serve as source root.")); cliOptions.add(new CliOption(CodegenConstants.GIT_USER_ID, CodegenConstants.GIT_USER_ID_DESC)); cliOptions.add(new CliOption(CodegenConstants.GIT_REPO_ID, CodegenConstants.GIT_REPO_ID_DESC)); cliOptions.add(new CliOption(CodegenConstants.ARTIFACT_VERSION, "The version to use in the composer package version field. e.g. 1.2.3"));
cliOptions.add(new CliOption(PROJECT_NAME, "Project name in Xcode")); cliOptions.add(new CliOption(RESPONSE_AS, "Optionally use libraries to manage response. Currently " + StringUtils.join(RESPONSE_LIBRARIES, ", ") + " are available.")); cliOptions.add(new CliOption(UNWRAP_REQUIRED, "Treat 'required' properties in response as non-optional " + "(which would crash the app if api returns null as opposed " + "to required option specified in json schema")); cliOptions.add(new CliOption(OBJC_COMPATIBLE, "Add additional properties and methods for Objective-C " + "compatibility (default: false)")); cliOptions.add(new CliOption(POD_SOURCE, "Source information used for Podspec")); cliOptions.add(new CliOption(CodegenConstants.POD_VERSION, "Version used for Podspec")); cliOptions.add(new CliOption(POD_AUTHORS, "Authors used for Podspec")); cliOptions.add(new CliOption(POD_SOCIAL_MEDIA_URL, "Social Media URL used for Podspec")); cliOptions.add(new CliOption(POD_DOCSET_URL, "Docset URL used for Podspec")); cliOptions.add(new CliOption(POD_LICENSE, "License used for Podspec")); cliOptions.add(new CliOption(POD_HOMEPAGE, "Homepage used for Podspec")); cliOptions.add(new CliOption(POD_SUMMARY, "Summary used for Podspec")); cliOptions.add(new CliOption(POD_DESCRIPTION, "Description used for Podspec")); cliOptions.add(new CliOption(POD_SCREENSHOTS, "Screenshots used for Podspec")); cliOptions.add(new CliOption(POD_DOCUMENTATION_URL, "Documentation URL used for Podspec")); cliOptions.add(new CliOption(SWIFT_USE_API_NAMESPACE, "Flag to make all the API classes inner-class " + "of {{projectName}}API")); cliOptions.add(new CliOption(CodegenConstants.HIDE_GENERATION_TIMESTAMP, CodegenConstants.HIDE_GENERATION_TIMESTAMP_DESC)
public StaticDocCodegen() { super(); // clear import mapping (from default generator) as this generator does not use it // at the moment importMapping.clear(); outputFolder = "docs"; modelTemplateFiles.put("model.mustache", ".html"); apiTemplateFiles.put("operation.mustache", ".html"); cliOptions.add(new CliOption(CodegenConstants.INVOKER_PACKAGE, CodegenConstants.INVOKER_PACKAGE_DESC)); cliOptions.add(new CliOption(CodegenConstants.GROUP_ID, CodegenConstants.GROUP_ID_DESC)); cliOptions.add(new CliOption(CodegenConstants.ARTIFACT_ID, CodegenConstants.ARTIFACT_ID_DESC)); cliOptions.add(new CliOption(CodegenConstants.ARTIFACT_VERSION, CodegenConstants.ARTIFACT_VERSION_DESC)); additionalProperties.put(CodegenConstants.INVOKER_PACKAGE, invokerPackage); additionalProperties.put(CodegenConstants.GROUP_ID, groupId); additionalProperties.put(CodegenConstants.ARTIFACT_ID, artifactId); additionalProperties.put(CodegenConstants.ARTIFACT_VERSION, artifactVersion); supportingFiles.add(new SupportingFile("package.mustache", "", "package.json")); supportingFiles.add(new SupportingFile("main.mustache", "", "main.js")); supportingFiles.add(new SupportingFile("assets/css/bootstrap-responsive.css", outputFolder + "/assets/css", "bootstrap-responsive.css")); supportingFiles.add(new SupportingFile("assets/css/bootstrap.css", outputFolder + "/assets/css", "bootstrap.css")); supportingFiles.add(new SupportingFile("assets/css/style.css", outputFolder + "/assets/css", "style.css")); supportingFiles.add(new SupportingFile("assets/images/logo.png", outputFolder + "/assets/images", "logo.png")); supportingFiles.add(new SupportingFile("assets/js/bootstrap.js", outputFolder + "/assets/js", "bootstrap.js")); supportingFiles.add(new SupportingFile("assets/js/jquery-1.8.3.min.js", outputFolder + "/assets/js", "jquery-1.8.3.min.js")); supportingFiles.add(new SupportingFile("assets/js/main.js", outputFolder + "/assets/js", "main.js")); supportingFiles.add(new SupportingFile("index.mustache", outputFolder, "index.html")); instantiationTypes.put("array", "ArrayList"); instantiationTypes.put("map", "HashMap"); }
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))); }
cliOptions.add(new CliOption(TITLE, "server title name or client service name")); cliOptions.add(new CliOption(CONFIG_PACKAGE, "configuration package for generated code")); cliOptions.add(new CliOption(BASE_PACKAGE, "base package (invokerPackage) for generated code")); cliOptions.add(CliOption.newBoolean(INTERFACE_ONLY, "Whether to generate only API interface stubs without the server files.")); cliOptions.add(CliOption.newBoolean(DELEGATE_PATTERN, "Whether to generate the server files using the delegate pattern")); cliOptions.add(CliOption.newBoolean(JAVA_8, "use java8 default interface")); cliOptions.add(CliOption.newBoolean(ASYNC, "use async Callable controllers")); cliOptions.add(new CliOption(RESPONSE_WRAPPER, "wrap the responses in given type (Future,Callable,CompletableFuture,ListenableFuture,DeferredResult,HystrixCommand,RxObservable,RxSingle or fully qualified type)")); cliOptions.add(CliOption.newBoolean(USE_TAGS, "use tags for creating interface and controller classnames")); cliOptions.add(CliOption.newBoolean(USE_BEANVALIDATION, "Use BeanValidation API annotations")); setLibrary(DEFAULT_LIBRARY); CliOption library = new CliOption(CodegenConstants.LIBRARY, "library template (sub-template) to use"); library.setDefault(DEFAULT_LIBRARY); library.setEnum(supportedLibraries);
supportedLibraries.put("google-api-client", "HTTP client: Google API client 1.23.0. JSON processing: Jackson 2.8.9"); CliOption libraryOption = new CliOption(CodegenConstants.LIBRARY, "library template (sub-template) to use"); 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); }
/** * 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()); }