Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1535,36 +1535,6 @@ public CodegenModel fromModel(String name, Schema schema, Map<String, Schema> al
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) {
addParentContainer(codegenModel, codegenModel.name, schema);
}
Expand Down Expand Up @@ -2958,20 +2928,6 @@ private static List<CodegenParameter> addHasMore(List<CodegenParameter> 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
*
Expand Down Expand Up @@ -3989,19 +3945,6 @@ public static Set<String> getProducesInfo(OpenAPI openAPI, Operation operation)
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) {
if (composedSchema.getAllOf() != null && !composedSchema.getAllOf().isEmpty()) {
Schema schema = composedSchema.getAllOf().get(0);
Expand Down Expand Up @@ -4033,12 +3976,6 @@ protected String getCollectionFormat(Parameter parameter) {
}
}

// 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() {
return null;
}
Expand Down Expand Up @@ -4362,10 +4299,6 @@ public CodegenParameter fromRequestBody(RequestBody body, Map<String, Schema> sc
return codegenParameter;
}

protected void addOption(String key, String description) {
addOption(key, description, null);
}

protected void addOption(String key, String description, String defaultValue) {
CliOption option = new CliOption(key, description);
if (defaultValue != null)
Expand Down