forked from loafle/openapi-generator-original
@@ -18,11 +18,20 @@ import io.swagger.codegen.CodegenProperty;
|
||||
import io.swagger.codegen.CodegenType;
|
||||
import io.swagger.codegen.DefaultCodegen;
|
||||
import io.swagger.models.properties.ArrayProperty;
|
||||
import io.swagger.models.properties.BooleanProperty;
|
||||
import io.swagger.models.properties.DateProperty;
|
||||
import io.swagger.models.properties.DateTimeProperty;
|
||||
import io.swagger.models.properties.DoubleProperty;
|
||||
import io.swagger.models.properties.FileProperty;
|
||||
import io.swagger.models.properties.FloatProperty;
|
||||
import io.swagger.models.properties.IntegerProperty;
|
||||
import io.swagger.models.properties.LongProperty;
|
||||
import io.swagger.models.properties.MapProperty;
|
||||
import io.swagger.models.properties.Property;
|
||||
import io.swagger.models.properties.StringProperty;
|
||||
|
||||
public abstract class AbstractTypeScriptClientCodegen extends DefaultCodegen implements CodegenConfig {
|
||||
private static final String UNDEFINED_VALUE = "undefined";
|
||||
|
||||
protected String modelPropertyNaming= "camelCase";
|
||||
protected Boolean supportsES6 = true;
|
||||
@@ -221,6 +230,49 @@ public abstract class AbstractTypeScriptClientCodegen extends DefaultCodegen imp
|
||||
return super.getTypeDeclaration(p);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toDefaultValue(Property p) {
|
||||
if (p instanceof StringProperty) {
|
||||
StringProperty sp = (StringProperty) p;
|
||||
if (sp.getDefault() != null) {
|
||||
return "\"" + sp.getDefault() + "\"";
|
||||
}
|
||||
return UNDEFINED_VALUE;
|
||||
} else if (p instanceof BooleanProperty) {
|
||||
return UNDEFINED_VALUE;
|
||||
} else if (p instanceof DateProperty) {
|
||||
return UNDEFINED_VALUE;
|
||||
} else if (p instanceof DateTimeProperty) {
|
||||
return UNDEFINED_VALUE;
|
||||
} else if (p instanceof DoubleProperty) {
|
||||
DoubleProperty dp = (DoubleProperty) p;
|
||||
if (dp.getDefault() != null) {
|
||||
return dp.getDefault().toString();
|
||||
}
|
||||
return UNDEFINED_VALUE;
|
||||
} else if (p instanceof FloatProperty) {
|
||||
FloatProperty fp = (FloatProperty) p;
|
||||
if (fp.getDefault() != null) {
|
||||
return fp.getDefault().toString();
|
||||
}
|
||||
return UNDEFINED_VALUE;
|
||||
} else if (p instanceof IntegerProperty) {
|
||||
IntegerProperty ip = (IntegerProperty) p;
|
||||
if (ip.getDefault() != null) {
|
||||
return ip.getDefault().toString();
|
||||
}
|
||||
return UNDEFINED_VALUE;
|
||||
} else if (p instanceof LongProperty) {
|
||||
LongProperty lp = (LongProperty) p;
|
||||
if (lp.getDefault() != null) {
|
||||
return lp.getDefault().toString();
|
||||
}
|
||||
return UNDEFINED_VALUE;
|
||||
} else {
|
||||
return UNDEFINED_VALUE;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSwaggerType(Property p) {
|
||||
String swaggerType = super.getSwaggerType(p);
|
||||
|
||||
Reference in New Issue
Block a user