From 75bb59572aec8a67b04b722473b393dfe8ec213d Mon Sep 17 00:00:00 2001 From: Matthew Davis Date: Thu, 3 Sep 2015 12:54:25 -0700 Subject: [PATCH] added extra CLI options required to generate a valid (lint-able) podspec file. --- .../codegen/languages/ObjcClientCodegen.java | 44 +++++++++++++++++++ 1 file changed, 44 insertions(+) diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/ObjcClientCodegen.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/ObjcClientCodegen.java index dfb4094f2b65..ef369169827a 100644 --- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/ObjcClientCodegen.java +++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/ObjcClientCodegen.java @@ -23,6 +23,10 @@ public class ObjcClientCodegen extends DefaultCodegen implements CodegenConfig { protected String podName = "SwaggerClient"; protected String podVersion = "1.0.0"; protected String classPrefix = "SWG"; + protected String authorName = "Swagger"; + protected String authorEmail = "apiteam@swagger.io"; + protected String license = "MIT"; + protected String gitRepoURL = "https://github.com/swagger-api/swagger-codegen"; public ObjcClientCodegen() { super(); @@ -112,6 +116,10 @@ public class ObjcClientCodegen extends DefaultCodegen implements CodegenConfig { cliOptions.add(new CliOption("classPrefix", "prefix for generated classes (convention: Abbreviation of pod name e.g. `HN` for `HackerNews`), default: `SWG`")); cliOptions.add(new CliOption("podName", "cocoapods package name (convention: CameCase), default: `SwaggerClient`")); cliOptions.add(new CliOption("podVersion", "cocoapods package version, default: `1.0.0`")); + cliOptions.add(new CliOption("authorName", "Name to use in the podspec file, default: `Swagger`")); + cliOptions.add(new CliOption("authorEmail", "Email to use in the podspec file, default: `apiteam@swagger.io`")); + cliOptions.add(new CliOption("gitRepoURL", "URL for the git repo where this podspec should point to, default: `https://github.com/swagger-api/swagger-codegen`")); + cliOptions.add(new CliOption("license", "License to use in the podspec file, default: `MIT`")); } public CodegenType getTag() { @@ -141,10 +149,30 @@ public class ObjcClientCodegen extends DefaultCodegen implements CodegenConfig { if (additionalProperties.containsKey("classPrefix")) { setClassPrefix((String) additionalProperties.get("classPrefix")); } + + if (additionalProperties.containsKey("authorName")) { + setAuthorName((String) additionalProperties.get("authorName")); + } + + if (additionalProperties.containsKey("authorEmail")) { + setAuthorEmail((String) additionalProperties.get("authorEmail")); + } + + if (additionalProperties.containsKey("gitRepoURL")) { + setGitRepoURL((String) additionalProperties.get("gitRepoURL")); + } + + if (additionalProperties.containsKey("license")) { + setLicense((String) additionalProperties.get("license")); + } additionalProperties.put("podName", podName); additionalProperties.put("podVersion", podVersion); additionalProperties.put("classPrefix", classPrefix); + additionalProperties.put("authorName", authorName); + additionalProperties.put("authorEmail", authorEmail); + additionalProperties.put("gitRepoURL", gitRepoURL); + additionalProperties.put("license", license); String swaggerFolder = podName; @@ -384,4 +412,20 @@ public class ObjcClientCodegen extends DefaultCodegen implements CodegenConfig { public void setPodVersion(String podVersion) { this.podVersion = podVersion; } + + public void setAuthorEmail(String authorEmail) { + this.authorEmail = authorEmail; + } + + public void setAuthorName(String authorName) { + this.authorName = authorName; + } + + public void setGitRepoURL(String gitRepoURL) { + this.gitRepoURL = gitRepoURL; + } + + public void setLicense(String license) { + this.license = license; + } }