forked from loafle/openapi-generator-original
- [Objc] Fix test after removing license property
- Moved adding License file to DefaultGenerator
This commit is contained in:
parent
c68168fa27
commit
d82c77da34
@ -792,6 +792,8 @@ public class DefaultCodegen {
|
|||||||
importMapping.put("LocalDate", "org.joda.time.*");
|
importMapping.put("LocalDate", "org.joda.time.*");
|
||||||
importMapping.put("LocalTime", "org.joda.time.*");
|
importMapping.put("LocalTime", "org.joda.time.*");
|
||||||
|
|
||||||
|
supportingFiles.add(new SupportingFile.GlobalSupportingFile("LICENSE.mustache", "LICENSE"));
|
||||||
|
|
||||||
cliOptions.add(CliOption.newBoolean(CodegenConstants.SORT_PARAMS_BY_REQUIRED_FLAG,
|
cliOptions.add(CliOption.newBoolean(CodegenConstants.SORT_PARAMS_BY_REQUIRED_FLAG,
|
||||||
CodegenConstants.SORT_PARAMS_BY_REQUIRED_FLAG_DESC).defaultValue(Boolean.TRUE.toString()));
|
CodegenConstants.SORT_PARAMS_BY_REQUIRED_FLAG_DESC).defaultValue(Boolean.TRUE.toString()));
|
||||||
cliOptions.add(CliOption.newBoolean(CodegenConstants.ENSURE_UNIQUE_PARAMS, CodegenConstants
|
cliOptions.add(CliOption.newBoolean(CodegenConstants.ENSURE_UNIQUE_PARAMS, CodegenConstants
|
||||||
|
@ -530,9 +530,12 @@ public class DefaultGenerator extends AbstractGenerator implements Generator {
|
|||||||
LOGGER.info("Skipped overwriting " + outputFilename);
|
LOGGER.info("Skipped overwriting " + outputFilename);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
String templateFile;
|
||||||
String templateFile = getFullTemplateFile(config, support.templateFile);
|
if( support instanceof SupportingFile.GlobalSupportingFile) {
|
||||||
|
templateFile = config.getCommonTemplateDir() + File.separator + support.templateFile;
|
||||||
|
} else {
|
||||||
|
templateFile = getFullTemplateFile(config, support.templateFile);
|
||||||
|
}
|
||||||
boolean shouldGenerate = true;
|
boolean shouldGenerate = true;
|
||||||
if(supportingFilesToGenerate != null && supportingFilesToGenerate.size() > 0) {
|
if(supportingFilesToGenerate != null && supportingFilesToGenerate.size() > 0) {
|
||||||
if(supportingFilesToGenerate.contains(support.destinationFilename)) {
|
if(supportingFilesToGenerate.contains(support.destinationFilename)) {
|
||||||
|
@ -5,6 +5,10 @@ public class SupportingFile {
|
|||||||
public String folder;
|
public String folder;
|
||||||
public String destinationFilename;
|
public String destinationFilename;
|
||||||
|
|
||||||
|
public SupportingFile(String templateFile, String destinationFilename) {
|
||||||
|
this(templateFile, "", destinationFilename);
|
||||||
|
}
|
||||||
|
|
||||||
public SupportingFile(String templateFile, String folder, String destinationFilename) {
|
public SupportingFile(String templateFile, String folder, String destinationFilename) {
|
||||||
this.templateFile = templateFile;
|
this.templateFile = templateFile;
|
||||||
this.folder = folder;
|
this.folder = folder;
|
||||||
@ -44,4 +48,17 @@ public class SupportingFile {
|
|||||||
result = 31 * result + (destinationFilename != null ? destinationFilename.hashCode() : 0);
|
result = 31 * result + (destinationFilename != null ? destinationFilename.hashCode() : 0);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static public class GlobalSupportingFile extends SupportingFile {
|
||||||
|
|
||||||
|
GlobalSupportingFile(String templateFile, String folder, String destinationFilename) {
|
||||||
|
super(templateFile, folder, destinationFilename);
|
||||||
|
}
|
||||||
|
|
||||||
|
GlobalSupportingFile(String templateFile, String destinationFilename) {
|
||||||
|
super(templateFile, destinationFilename);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -251,7 +251,6 @@ public class ObjcClientCodegen extends DefaultCodegen implements CodegenConfig {
|
|||||||
supportingFiles.add(new SupportingFile("README.mustache", "", "README.md"));
|
supportingFiles.add(new SupportingFile("README.mustache", "", "README.md"));
|
||||||
supportingFiles.add(new SupportingFile("git_push.sh.mustache", "", "git_push.sh"));
|
supportingFiles.add(new SupportingFile("git_push.sh.mustache", "", "git_push.sh"));
|
||||||
supportingFiles.add(new SupportingFile("gitignore.mustache", "", ".gitignore"));
|
supportingFiles.add(new SupportingFile("gitignore.mustache", "", ".gitignore"));
|
||||||
supportingFiles.add(new SupportingFile("LICENSE.mustache", "", "LICENSE"));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -38,8 +38,6 @@ public class ObjcClientOptionsTest extends AbstractOptionsTest {
|
|||||||
times = 1;
|
times = 1;
|
||||||
clientCodegen.setGitRepoURL(ObjcClientOptionsProvider.GIT_REPO_URL_VALUE);
|
clientCodegen.setGitRepoURL(ObjcClientOptionsProvider.GIT_REPO_URL_VALUE);
|
||||||
times = 1;
|
times = 1;
|
||||||
clientCodegen.setLicense(ObjcClientOptionsProvider.LICENSE_VALUE);
|
|
||||||
times = 1;
|
|
||||||
}};
|
}};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -14,7 +14,6 @@ public class ObjcClientOptionsProvider implements OptionsProvider {
|
|||||||
public static final String AUTHOR_NAME_VALUE = "SwaggerObjc";
|
public static final String AUTHOR_NAME_VALUE = "SwaggerObjc";
|
||||||
public static final String AUTHOR_EMAIL_VALUE = "objc@swagger.io";
|
public static final String AUTHOR_EMAIL_VALUE = "objc@swagger.io";
|
||||||
public static final String GIT_REPO_URL_VALUE = "https://github.com/swagger-api/swagger-codegen";
|
public static final String GIT_REPO_URL_VALUE = "https://github.com/swagger-api/swagger-codegen";
|
||||||
public static final String LICENSE_VALUE = "MIT";
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getLanguage() {
|
public String getLanguage() {
|
||||||
@ -30,7 +29,6 @@ public class ObjcClientOptionsProvider implements OptionsProvider {
|
|||||||
.put(ObjcClientCodegen.AUTHOR_NAME, AUTHOR_NAME_VALUE)
|
.put(ObjcClientCodegen.AUTHOR_NAME, AUTHOR_NAME_VALUE)
|
||||||
.put(ObjcClientCodegen.AUTHOR_EMAIL, AUTHOR_EMAIL_VALUE)
|
.put(ObjcClientCodegen.AUTHOR_EMAIL, AUTHOR_EMAIL_VALUE)
|
||||||
.put(ObjcClientCodegen.GIT_REPO_URL, GIT_REPO_URL_VALUE)
|
.put(ObjcClientCodegen.GIT_REPO_URL, GIT_REPO_URL_VALUE)
|
||||||
.put(ObjcClientCodegen.LICENSE, LICENSE_VALUE)
|
|
||||||
.build();
|
.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6,7 +6,7 @@ This ObjC package is automatically generated by the [Swagger Codegen](https://gi
|
|||||||
|
|
||||||
- API version: 1.0.0
|
- API version: 1.0.0
|
||||||
- Package version:
|
- Package version:
|
||||||
- Build date: 2016-05-25T18:06:49.729+02:00
|
- Build date: 2016-05-27T12:41:24.581+02:00
|
||||||
- Build package: class io.swagger.codegen.languages.ObjcClientCodegen
|
- Build package: class io.swagger.codegen.languages.ObjcClientCodegen
|
||||||
|
|
||||||
## Requirements
|
## Requirements
|
||||||
|
Loading…
x
Reference in New Issue
Block a user