forked from loafle/openapi-generator-original
Removed tabs in TypeScriptClientCodegen
This commit is contained in:
parent
6c37c7180d
commit
9297e59053
@ -57,7 +57,7 @@ public class TypeScriptClientCodegen extends DefaultCodegen implements CodegenCo
|
|||||||
|
|
||||||
public TypeScriptClientCodegen() {
|
public TypeScriptClientCodegen() {
|
||||||
super();
|
super();
|
||||||
|
|
||||||
this.frameworkToHttpLibMap = new HashMap<>();
|
this.frameworkToHttpLibMap = new HashMap<>();
|
||||||
this.frameworkToHttpLibMap.put("fetch-api", "isomorphic-fetch");
|
this.frameworkToHttpLibMap.put("fetch-api", "isomorphic-fetch");
|
||||||
this.frameworkToHttpLibMap.put("jquery", "jquery");
|
this.frameworkToHttpLibMap.put("jquery", "jquery");
|
||||||
@ -135,8 +135,8 @@ public class TypeScriptClientCodegen extends DefaultCodegen implements CodegenCo
|
|||||||
|
|
||||||
CliOption frameworkOption = new CliOption(TypeScriptClientCodegen.FRAMEWORK_SWITCH, TypeScriptClientCodegen.FRAMEWORK_SWITCH_DESC);
|
CliOption frameworkOption = new CliOption(TypeScriptClientCodegen.FRAMEWORK_SWITCH, TypeScriptClientCodegen.FRAMEWORK_SWITCH_DESC);
|
||||||
for (String option: TypeScriptClientCodegen.FRAMEWORKS) {
|
for (String option: TypeScriptClientCodegen.FRAMEWORKS) {
|
||||||
// TODO: improve description?
|
// TODO: improve description?
|
||||||
frameworkOption.addEnum(option, option);
|
frameworkOption.addEnum(option, option);
|
||||||
}
|
}
|
||||||
frameworkOption.defaultValue(FRAMEWORKS[0]);
|
frameworkOption.defaultValue(FRAMEWORKS[0]);
|
||||||
System.out.println("Added framework option");
|
System.out.println("Added framework option");
|
||||||
@ -188,16 +188,16 @@ public class TypeScriptClientCodegen extends DefaultCodegen implements CodegenCo
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Map<String, Object> postProcessSupportingFileData(Map<String, Object> objs) {
|
public Map<String, Object> postProcessSupportingFileData(Map<String, Object> objs) {
|
||||||
Map<String, Boolean> frameworks = new HashMap<>();
|
Map<String, Boolean> frameworks = new HashMap<>();
|
||||||
for (String framework: FRAMEWORKS) {
|
for (String framework: FRAMEWORKS) {
|
||||||
frameworks.put(framework, framework.equals(additionalProperties.get(FRAMEWORK_SWITCH)));
|
frameworks.put(framework, framework.equals(additionalProperties.get(FRAMEWORK_SWITCH)));
|
||||||
}
|
}
|
||||||
objs.put("framework", additionalProperties.get(FRAMEWORK_SWITCH));
|
objs.put("framework", additionalProperties.get(FRAMEWORK_SWITCH));
|
||||||
objs.put("frameworks", frameworks);
|
objs.put("frameworks", frameworks);
|
||||||
|
|
||||||
objs.put("fileContentDataType", additionalProperties.get(FILE_CONTENT_DATA_TYPE));
|
objs.put("fileContentDataType", additionalProperties.get(FILE_CONTENT_DATA_TYPE));
|
||||||
|
|
||||||
return objs;
|
return objs;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -711,21 +711,21 @@ public class TypeScriptClientCodegen extends DefaultCodegen implements CodegenCo
|
|||||||
testPackage = this.testPackage + ".tests";
|
testPackage = this.testPackage + ".tests";
|
||||||
|
|
||||||
if (additionalProperties.containsKey(FRAMEWORK_SWITCH)) {
|
if (additionalProperties.containsKey(FRAMEWORK_SWITCH)) {
|
||||||
supportingFiles.add(new SupportingFile("generators/" + additionalProperties.get(FRAMEWORK_SWITCH) + ".mustache", "index.ts"));
|
supportingFiles.add(new SupportingFile("generators/" + additionalProperties.get(FRAMEWORK_SWITCH) + ".mustache", "index.ts"));
|
||||||
} else {
|
} else {
|
||||||
additionalProperties.put(FRAMEWORK_SWITCH, FRAMEWORKS[0]);
|
additionalProperties.put(FRAMEWORK_SWITCH, FRAMEWORKS[0]);
|
||||||
supportingFiles.add(new SupportingFile("generators" + File.separator + FRAMEWORKS[0] + ".mustache", "index.ts"));
|
supportingFiles.add(new SupportingFile("generators" + File.separator + FRAMEWORKS[0] + ".mustache", "index.ts"));
|
||||||
}
|
}
|
||||||
String httpLibName = this.getHttpLibForFramework(additionalProperties.get(FRAMEWORK_SWITCH).toString());
|
String httpLibName = this.getHttpLibForFramework(additionalProperties.get(FRAMEWORK_SWITCH).toString());
|
||||||
supportingFiles.add(new SupportingFile("http" + File.separator + httpLibName + ".mustache", "http", httpLibName + ".ts"));
|
supportingFiles.add(new SupportingFile("http" + File.separator + httpLibName + ".mustache", "http", httpLibName + ".ts"));
|
||||||
}
|
}
|
||||||
|
|
||||||
private String getHttpLibForFramework(String object) {
|
private String getHttpLibForFramework(String object) {
|
||||||
return this.frameworkToHttpLibMap.get(object);
|
return this.frameworkToHttpLibMap.get(object);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getTypeDeclaration(Schema p) {
|
public String getTypeDeclaration(Schema p) {
|
||||||
Schema inner;
|
Schema inner;
|
||||||
if (ModelUtils.isArraySchema(p)) {
|
if (ModelUtils.isArraySchema(p)) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user