Delete unused methods in DefaultCodegen (#209)

This commit is contained in:
Akihito Nakano 2018-06-06 00:02:14 +09:00 committed by William Cheng
parent fe04a0e347
commit b8f1e5afa1

View File

@ -1535,36 +1535,6 @@ public class DefaultCodegen implements CodegenConfig {
return m; return m;
} }
/**
* Recursively look for a discriminator in the interface tree
*
* @param schema composed schema
* @param allDefinitions all schema defintion
* @return true if it's a discriminator
*/
private boolean isDiscriminatorInInterfaceTree(ComposedSchema schema, Map<String, Schema> allDefinitions) {
if (schema == null || allDefinitions == null || allDefinitions.isEmpty()) {
return false;
}
if (schema.getDiscriminator() != null) {
return true;
}
final List<Schema> interfaces = getInterfaces(schema);
if (interfaces == null) {
return false;
}
for (Schema interfaceSchema : interfaces) {
if (interfaceSchema.getDiscriminator() != null) {
return true;
}
// TODO revise the logic below
if (interfaceSchema instanceof ComposedSchema) {
return isDiscriminatorInInterfaceTree((ComposedSchema) interfaceSchema, allDefinitions);
}
}
return false;
}
protected void addAdditionPropertiesToCodeGenModel(CodegenModel codegenModel, Schema schema) { protected void addAdditionPropertiesToCodeGenModel(CodegenModel codegenModel, Schema schema) {
addParentContainer(codegenModel, codegenModel.name, schema); addParentContainer(codegenModel, codegenModel.name, schema);
} }
@ -2958,20 +2928,6 @@ public class DefaultCodegen implements CodegenConfig {
return objs; return objs;
} }
private static Map<String, Object> addHasMore(Map<String, Object> objs) {
if (objs != null) {
for (int i = 0; i < objs.size() - 1; i++) {
if (i > 0) {
objs.put("secondaryParam", true);
}
if (i < objs.size() - 1) {
objs.put("hasMore", true);
}
}
}
return objs;
}
/** /**
* Add operation to group * Add operation to group
* *
@ -3989,19 +3945,6 @@ public class DefaultCodegen implements CodegenConfig {
return produces; return produces;
} }
protected Schema detectParent(ComposedSchema composedSchema, Map<String, Schema> allSchemas) {
if (composedSchema.getAllOf() != null && !composedSchema.getAllOf().isEmpty()) {
Schema schema = composedSchema.getAllOf().get(0);
String ref = schema.get$ref();
if (StringUtils.isBlank(ref)) {
return null;
}
ref = ModelUtils.getSimpleRef(ref);
return allSchemas.get(ref);
}
return null;
}
protected String getParentName(ComposedSchema composedSchema, Map<String, Schema> allSchemas) { protected String getParentName(ComposedSchema composedSchema, Map<String, Schema> allSchemas) {
if (composedSchema.getAllOf() != null && !composedSchema.getAllOf().isEmpty()) { if (composedSchema.getAllOf() != null && !composedSchema.getAllOf().isEmpty()) {
Schema schema = composedSchema.getAllOf().get(0); Schema schema = composedSchema.getAllOf().get(0);
@ -4033,12 +3976,6 @@ public class DefaultCodegen implements CodegenConfig {
} }
} }
// TODO do we still need the methdo below?
protected static boolean hasSchemaProperties(Schema schema) {
final Object additionalProperties = schema.getAdditionalProperties();
return additionalProperties != null && additionalProperties instanceof Schema;
}
public CodegenType getTag() { public CodegenType getTag() {
return null; return null;
} }
@ -4362,10 +4299,6 @@ public class DefaultCodegen implements CodegenConfig {
return codegenParameter; return codegenParameter;
} }
protected void addOption(String key, String description) {
addOption(key, description, null);
}
protected void addOption(String key, String description, String defaultValue) { protected void addOption(String key, String description, String defaultValue) {
CliOption option = new CliOption(key, description); CliOption option = new CliOption(key, description);
if (defaultValue != null) if (defaultValue != null)