Skip to content

Commit

Permalink
fix: restore codegenUtil
Browse files Browse the repository at this point in the history
  • Loading branch information
kridai committed Oct 11, 2023
1 parent 7558aa7 commit 19b04b9
Showing 1 changed file with 1 addition and 36 deletions.
37 changes: 1 addition & 36 deletions src/main/java/com/twilio/oai/CodegenUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,6 @@
import org.openapitools.codegen.CodegenParameter;
import org.openapitools.codegen.CodegenProperty;

import java.util.LinkedHashMap;
import java.util.Map;

public class CodegenUtils {

public static boolean isPropertySchemaEnum(CodegenProperty codegenProperty) {
Expand All @@ -20,29 +17,6 @@ public static boolean isPropertySchemaEnum(CodegenProperty codegenProperty) {
}

public static boolean isParameterSchemaEnum(CodegenParameter codegenParameter) {
if (codegenParameter.isEnum) {
return true;
}
boolean enumValues = codegenParameter.allowableValues != null &&
codegenParameter.allowableValues.containsKey(TwilioJavaGenerator.VALUES);
boolean listEnumValues = codegenParameter.items != null && (codegenParameter.items.allowableValues != null
&& codegenParameter.items.allowableValues.containsKey(TwilioJavaGenerator.VALUES));
return enumValues || listEnumValues;
}

// TODO: Refactor java code.
public static boolean isPropertySchemaEnumJava(CodegenProperty codegenProperty) {
if(codegenProperty.isEnum) {
return false;
}
boolean enumValues = codegenProperty.allowableValues != null &&
codegenProperty.allowableValues.containsKey(TwilioJavaGenerator.VALUES);
boolean listEnumValues = codegenProperty.items != null && (codegenProperty.items.allowableValues != null
&& codegenProperty.items.allowableValues.containsKey(TwilioJavaGenerator.VALUES));
return enumValues || listEnumValues;
}

public static boolean isParameterSchemaEnumJava(CodegenParameter codegenParameter) {
if(codegenParameter.isEnum) {
return true;
}
Expand Down Expand Up @@ -75,13 +49,4 @@ public static boolean isParameterSchemaEnumJava(CodegenParameter codegenParamete
&& codegenParameter.items.allowableValues.containsKey(TwilioJavaGenerator.VALUES));
return enumValues || listEnumValues;
}

public static void mergeVendorExtensionProperty(Map<String, Object> vendorExtensions, LinkedHashMap value, String field ) {
if (value != null && !value.isEmpty()) {
if( vendorExtensions.containsKey(field))
((LinkedHashMap)vendorExtensions.get(field)).putAll(value);
else
vendorExtensions.put(field, value);
}
}
}
}

0 comments on commit 19b04b9

Please sign in to comment.