Skip to content

Commit b8f1e5a

Browse files
ackintoshwing328
authored andcommitted
Delete unused methods in DefaultCodegen (#209)
1 parent fe04a0e commit b8f1e5a

File tree

1 file changed

+0
-67
lines changed

1 file changed

+0
-67
lines changed

modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultCodegen.java

Lines changed: 0 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -1535,36 +1535,6 @@ public CodegenModel fromModel(String name, Schema schema, Map<String, Schema> al
15351535
return m;
15361536
}
15371537

1538-
/**
1539-
* Recursively look for a discriminator in the interface tree
1540-
*
1541-
* @param schema composed schema
1542-
* @param allDefinitions all schema defintion
1543-
* @return true if it's a discriminator
1544-
*/
1545-
private boolean isDiscriminatorInInterfaceTree(ComposedSchema schema, Map<String, Schema> allDefinitions) {
1546-
if (schema == null || allDefinitions == null || allDefinitions.isEmpty()) {
1547-
return false;
1548-
}
1549-
if (schema.getDiscriminator() != null) {
1550-
return true;
1551-
}
1552-
final List<Schema> interfaces = getInterfaces(schema);
1553-
if (interfaces == null) {
1554-
return false;
1555-
}
1556-
for (Schema interfaceSchema : interfaces) {
1557-
if (interfaceSchema.getDiscriminator() != null) {
1558-
return true;
1559-
}
1560-
// TODO revise the logic below
1561-
if (interfaceSchema instanceof ComposedSchema) {
1562-
return isDiscriminatorInInterfaceTree((ComposedSchema) interfaceSchema, allDefinitions);
1563-
}
1564-
}
1565-
return false;
1566-
}
1567-
15681538
protected void addAdditionPropertiesToCodeGenModel(CodegenModel codegenModel, Schema schema) {
15691539
addParentContainer(codegenModel, codegenModel.name, schema);
15701540
}
@@ -2958,20 +2928,6 @@ private static List<CodegenParameter> addHasMore(List<CodegenParameter> objs) {
29582928
return objs;
29592929
}
29602930

2961-
private static Map<String, Object> addHasMore(Map<String, Object> objs) {
2962-
if (objs != null) {
2963-
for (int i = 0; i < objs.size() - 1; i++) {
2964-
if (i > 0) {
2965-
objs.put("secondaryParam", true);
2966-
}
2967-
if (i < objs.size() - 1) {
2968-
objs.put("hasMore", true);
2969-
}
2970-
}
2971-
}
2972-
return objs;
2973-
}
2974-
29752931
/**
29762932
* Add operation to group
29772933
*
@@ -3989,19 +3945,6 @@ public static Set<String> getProducesInfo(OpenAPI openAPI, Operation operation)
39893945
return produces;
39903946
}
39913947

3992-
protected Schema detectParent(ComposedSchema composedSchema, Map<String, Schema> allSchemas) {
3993-
if (composedSchema.getAllOf() != null && !composedSchema.getAllOf().isEmpty()) {
3994-
Schema schema = composedSchema.getAllOf().get(0);
3995-
String ref = schema.get$ref();
3996-
if (StringUtils.isBlank(ref)) {
3997-
return null;
3998-
}
3999-
ref = ModelUtils.getSimpleRef(ref);
4000-
return allSchemas.get(ref);
4001-
}
4002-
return null;
4003-
}
4004-
40053948
protected String getParentName(ComposedSchema composedSchema, Map<String, Schema> allSchemas) {
40063949
if (composedSchema.getAllOf() != null && !composedSchema.getAllOf().isEmpty()) {
40073950
Schema schema = composedSchema.getAllOf().get(0);
@@ -4033,12 +3976,6 @@ protected String getCollectionFormat(Parameter parameter) {
40333976
}
40343977
}
40353978

4036-
// TODO do we still need the methdo below?
4037-
protected static boolean hasSchemaProperties(Schema schema) {
4038-
final Object additionalProperties = schema.getAdditionalProperties();
4039-
return additionalProperties != null && additionalProperties instanceof Schema;
4040-
}
4041-
40423979
public CodegenType getTag() {
40433980
return null;
40443981
}
@@ -4362,10 +4299,6 @@ public CodegenParameter fromRequestBody(RequestBody body, Map<String, Schema> sc
43624299
return codegenParameter;
43634300
}
43644301

4365-
protected void addOption(String key, String description) {
4366-
addOption(key, description, null);
4367-
}
4368-
43694302
protected void addOption(String key, String description, String defaultValue) {
43704303
CliOption option = new CliOption(key, description);
43714304
if (defaultValue != null)

0 commit comments

Comments
 (0)