forked from loafle/openapi-generator-original
[typescript-angular2] Feature/angular2 file post (#4623)
* Merge branch 'www2k-feature/file-response' * Merge pull request #4421 from wing328/fix_isfile_boolean Fix `isPrimitiveType` for file property * roll back to latest working version of swagger paresr for codegen * enable typescript-angular2 to upload file * update typescript-angular2 samples
This commit is contained in:
@@ -41,7 +41,9 @@ public class TypeScriptAngular2ClientCodegen extends AbstractTypeScriptClientCod
|
||||
embeddedTemplateDir = templateDir = "typescript-angular2";
|
||||
modelTemplateFiles.put("model.mustache", ".ts");
|
||||
apiTemplateFiles.put("api.service.mustache", ".ts");
|
||||
languageSpecificPrimitives.add("Blob");
|
||||
typeMapping.put("Date","Date");
|
||||
typeMapping.put("file","Blob");
|
||||
apiPackage = "api";
|
||||
modelPackage = "model";
|
||||
|
||||
@@ -116,6 +118,11 @@ public class TypeScriptAngular2ClientCodegen extends AbstractTypeScriptClientCod
|
||||
return indexPackage.replace('.', File.separatorChar);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isDataTypeFile(final String dataType) {
|
||||
return dataType != null && dataType.equals("Blob");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTypeDeclaration(Property p) {
|
||||
Property inner;
|
||||
@@ -127,7 +134,9 @@ public class TypeScriptAngular2ClientCodegen extends AbstractTypeScriptClientCod
|
||||
MapProperty mp = (MapProperty)p;
|
||||
inner = mp.getAdditionalProperties();
|
||||
return "{ [key: string]: " + this.getTypeDeclaration(inner) + "; }";
|
||||
} else if(p instanceof FileProperty || p instanceof ObjectProperty) {
|
||||
} else if(p instanceof FileProperty) {
|
||||
return "Blob";
|
||||
} else if(p instanceof ObjectProperty) {
|
||||
return "any";
|
||||
} else {
|
||||
return super.getTypeDeclaration(p);
|
||||
|
||||
Reference in New Issue
Block a user