using isMapSchema in generator

This commit is contained in:
wing328 2018-04-05 13:18:04 +08:00
parent b8031b631d
commit d882ad2fcb
16 changed files with 18 additions and 18 deletions

View File

@ -266,7 +266,7 @@ public abstract class AbstractEiffelCodegen extends DefaultCodegen implements Co
ArraySchema ap = (ArraySchema) p; ArraySchema ap = (ArraySchema) p;
Schema inner = ap.getItems(); Schema inner = ap.getItems();
return "LIST [" + getTypeDeclaration(inner) + "]"; return "LIST [" + getTypeDeclaration(inner) + "]";
} else if (p instanceof MapSchema) { } else if (isMapSchema(p)) {
Schema inner = (Schema) p.getAdditionalProperties(); Schema inner = (Schema) p.getAdditionalProperties();
return getSchemaType(p) + "[" + getTypeDeclaration(inner) + "]"; return getSchemaType(p) + "[" + getTypeDeclaration(inner) + "]";

View File

@ -185,7 +185,7 @@ public abstract class AbstractScalaCodegen extends DefaultCodegen {
@Override @Override
public String toInstantiationType(Schema p) { public String toInstantiationType(Schema p) {
if (p instanceof MapSchema) { if (isMapSchema(p)) {
String inner = getSchemaType((Schema)p.getAdditionalProperties()); String inner = getSchemaType((Schema)p.getAdditionalProperties());
return instantiationTypes.get("map") + "[String, " + inner + "]"; return instantiationTypes.get("map") + "[String, " + inner + "]";
} else if (p instanceof ArraySchema) { } else if (p instanceof ArraySchema) {
@ -211,7 +211,7 @@ public abstract class AbstractScalaCodegen extends DefaultCodegen {
return "null"; return "null";
} else if (p instanceof IntegerSchema) { } else if (p instanceof IntegerSchema) {
return "null"; return "null";
} else if (p instanceof MapSchema) { } else if (isMapSchema(p)) {
MapSchema ap = (MapSchema) p; MapSchema ap = (MapSchema) p;
String inner = getSchemaType((Schema) ap.getAdditionalProperties()); String inner = getSchemaType((Schema) ap.getAdditionalProperties());
return "new HashMap[String, " + inner + "]() "; return "new HashMap[String, " + inner + "]() ";

View File

@ -235,7 +235,7 @@ public abstract class AbstractTypeScriptClientCodegen extends DefaultCodegen imp
ArraySchema mp1 = (ArraySchema) p; ArraySchema mp1 = (ArraySchema) p;
inner = mp1.getItems(); inner = mp1.getItems();
return this.getSchemaType(p) + "<" + this.getParameterDataType(parameter, inner) + ">"; return this.getSchemaType(p) + "<" + this.getParameterDataType(parameter, inner) + ">";
} else if (p instanceof MapSchema) { } else if (isMapSchema(p)) {
inner = (Schema) p.getAdditionalProperties(); inner = (Schema) p.getAdditionalProperties();
return "{ [key: string]: " + this.getParameterDataType(parameter, inner) + "; }"; return "{ [key: string]: " + this.getParameterDataType(parameter, inner) + "; }";
} else if (p instanceof StringSchema) { } else if (p instanceof StringSchema) {

View File

@ -298,7 +298,7 @@ public class CppPistacheServerCodegen extends AbstractCppCodegen {
return "0L"; return "0L";
} }
return "0"; return "0";
} else if (p instanceof MapSchema) { } else if (isMapSchema(p)) {
MapSchema ap = (MapSchema) p; MapSchema ap = (MapSchema) p;
String inner = getSchemaType((Schema) ap.getAdditionalProperties()); String inner = getSchemaType((Schema) ap.getAdditionalProperties());
return "std::map<std::string, " + inner + ">()"; return "std::map<std::string, " + inner + ">()";

View File

@ -322,7 +322,7 @@ public class CppQt5ClientCodegen extends AbstractCppCodegen implements CodegenCo
return "0L"; return "0L";
} }
return "0"; return "0";
} else if (p instanceof MapSchema) { } else if (isMapSchema(p)) {
Schema inner = (Schema) p.getAdditionalProperties(); Schema inner = (Schema) p.getAdditionalProperties();
return "new QMap<QString, " + getTypeDeclaration(inner) + ">()"; return "new QMap<QString, " + getTypeDeclaration(inner) + ">()";
} else if (p instanceof ArraySchema) { } else if (p instanceof ArraySchema) {

View File

@ -313,7 +313,7 @@ public class CppRestClientCodegen extends AbstractCppCodegen {
return "0L"; return "0L";
} }
return "0"; return "0";
} else if (p instanceof MapSchema) { } else if (isMapSchema(p)) {
MapSchema ap = (MapSchema) p; MapSchema ap = (MapSchema) p;
String inner = getSchemaType((Schema) ap.getAdditionalProperties()); String inner = getSchemaType((Schema) ap.getAdditionalProperties());
return "std::map<utility::string_t, " + inner + ">()"; return "std::map<utility::string_t, " + inner + ">()";

View File

@ -301,7 +301,7 @@ public class CppRestbedServerCodegen extends AbstractCppCodegen {
return "0L"; return "0L";
} }
return "0"; return "0";
} else if (p instanceof MapSchema) { } else if (isMapSchema(p)) {
MapSchema ap = (MapSchema) p; MapSchema ap = (MapSchema) p;
String inner = getSchemaType((Schema) ap.getAdditionalProperties()); String inner = getSchemaType((Schema) ap.getAdditionalProperties());
return "std::map<std::string, " + inner + ">()"; return "std::map<std::string, " + inner + ">()";

View File

@ -123,7 +123,7 @@ public class CppTizenClientCodegen extends DefaultCodegen implements CodegenConf
@Override @Override
public String toInstantiationType(Schema p) { public String toInstantiationType(Schema p) {
if (p instanceof MapSchema) { if (isMapSchema(p)) {
return instantiationTypes.get("map"); return instantiationTypes.get("map");
} else if (p instanceof ArraySchema) { } else if (p instanceof ArraySchema) {
return instantiationTypes.get("array"); return instantiationTypes.get("array");
@ -209,7 +209,7 @@ public class CppTizenClientCodegen extends DefaultCodegen implements CodegenConf
return "long(0)"; return "long(0)";
} }
return "int(0)"; return "int(0)";
} else if (p instanceof MapSchema) { } else if (isMapSchema(p)) {
return "new std::map()"; return "new std::map()";
} else if (p instanceof ArraySchema) { } else if (p instanceof ArraySchema) {
return "new std::list()"; return "new std::list()";

View File

@ -459,7 +459,7 @@ public class ElmClientCodegen extends DefaultCodegen implements CodegenConfig {
ArraySchema ap = (ArraySchema) p; ArraySchema ap = (ArraySchema) p;
Schema inner = ap.getItems(); Schema inner = ap.getItems();
return getTypeDeclaration(inner); return getTypeDeclaration(inner);
} else if (p instanceof MapSchema) { } else if (isMapSchema(p)) {
Schema inner = (Schema) p.getAdditionalProperties(); Schema inner = (Schema) p.getAdditionalProperties();
return getTypeDeclaration(inner); return getTypeDeclaration(inner);
} }

View File

@ -553,7 +553,7 @@ public class HaskellHttpClientCodegen extends DefaultCodegen implements CodegenC
@Override @Override
public String toInstantiationType(Schema p) { public String toInstantiationType(Schema p) {
if (p instanceof MapSchema) { if (isMapSchema(p)) {
MapSchema ap = (MapSchema) p; MapSchema ap = (MapSchema) p;
Schema additionalProperties2 = (Schema) ap.getAdditionalProperties(); Schema additionalProperties2 = (Schema) ap.getAdditionalProperties();
String type = additionalProperties2.getType(); String type = additionalProperties2.getType();

View File

@ -306,7 +306,7 @@ public class HaskellServantCodegen extends DefaultCodegen implements CodegenConf
@Override @Override
public String toInstantiationType(Schema p) { public String toInstantiationType(Schema p) {
if (p instanceof MapSchema) { if (isMapSchema(p)) {
MapSchema ap = (MapSchema) p; MapSchema ap = (MapSchema) p;
Schema additionalProperties2 = (Schema) ap.getAdditionalProperties(); Schema additionalProperties2 = (Schema) ap.getAdditionalProperties();
String type = additionalProperties2.getType(); String type = additionalProperties2.getType();

View File

@ -323,7 +323,7 @@ public class LuaClientCodegen extends DefaultCodegen implements CodegenConfig {
ArraySchema ap = (ArraySchema) p; ArraySchema ap = (ArraySchema) p;
Schema inner = ap.getItems(); Schema inner = ap.getItems();
return getTypeDeclaration(inner); return getTypeDeclaration(inner);
} else if (p instanceof MapSchema) { } else if (isMapSchema(p)) {
Schema inner = (Schema) p.getAdditionalProperties(); Schema inner = (Schema) p.getAdditionalProperties();
return getTypeDeclaration(inner); return getTypeDeclaration(inner);
} }

View File

@ -296,7 +296,7 @@ public class ObjcClientCodegen extends DefaultCodegen implements CodegenConfig {
@Override @Override
public String toInstantiationType(Schema p) { public String toInstantiationType(Schema p) {
if (p instanceof MapSchema) { if (isMapSchema(p)) {
return instantiationTypes.get("map"); return instantiationTypes.get("map");
} else if (p instanceof ArraySchema) { } else if (p instanceof ArraySchema) {
return instantiationTypes.get("array"); return instantiationTypes.get("array");

View File

@ -373,7 +373,7 @@ public class Swift3Codegen extends DefaultCodegen implements CodegenConfig {
@Override @Override
public String toInstantiationType(Schema p) { public String toInstantiationType(Schema p) {
if (p instanceof MapSchema) { if (isMapSchema(p)) {
MapSchema ap = (MapSchema) p; MapSchema ap = (MapSchema) p;
String inner = getSchemaType((Schema) ap.getAdditionalProperties()); String inner = getSchemaType((Schema) ap.getAdditionalProperties());
return inner; return inner;

View File

@ -476,7 +476,7 @@ public class Swift4Codegen extends DefaultCodegen implements CodegenConfig {
@Override @Override
public String toInstantiationType(Schema prop) { public String toInstantiationType(Schema prop) {
if (prop instanceof MapSchema) { if (isMapSchema(prop)) {
MapSchema ap = (MapSchema) prop; MapSchema ap = (MapSchema) prop;
String inner = getSchemaType((Schema) ap.getAdditionalProperties()); String inner = getSchemaType((Schema) ap.getAdditionalProperties());
return inner; return inner;

View File

@ -351,7 +351,7 @@ public class SwiftClientCodegen extends DefaultCodegen implements CodegenConfig
@Override @Override
public String toInstantiationType(Schema p) { public String toInstantiationType(Schema p) {
if (p instanceof MapSchema) { if (isMapSchema(p)) {
MapSchema ap = (MapSchema) p; MapSchema ap = (MapSchema) p;
String inner = getSchemaType((Schema) ap.getAdditionalProperties()); String inner = getSchemaType((Schema) ap.getAdditionalProperties());
return "[String:" + inner + "]"; return "[String:" + inner + "]";