diff --git a/src/main/java/com/twilio/oai/CodegenUtils.java b/src/main/java/com/twilio/oai/CodegenUtils.java index 0f485104a..87d2572bc 100644 --- a/src/main/java/com/twilio/oai/CodegenUtils.java +++ b/src/main/java/com/twilio/oai/CodegenUtils.java @@ -24,7 +24,9 @@ public static boolean isPropertySchemaEnum(CodegenProperty codegenProperty) { codegenProperty.allowableValues.containsKey(TwilioJavaGenerator.VALUES); boolean listEnumValues = codegenProperty.items != null && (codegenProperty.items.allowableValues != null && codegenProperty.items.allowableValues.containsKey(TwilioJavaGenerator.VALUES)); - return enumValues || listEnumValues; + boolean isEnum = enumValues || listEnumValues; + codegenProperty.vendorExtensions.put("x-enum-object", isEnum); + return isEnum; } public static boolean isParameterSchemaEnum(CodegenParameter codegenParameter) { @@ -38,7 +40,9 @@ public static boolean isParameterSchemaEnum(CodegenParameter codegenParameter) { codegenParameter.allowableValues.containsKey(TwilioJavaGenerator.VALUES); boolean listEnumValues = codegenParameter.items != null && (codegenParameter.items.allowableValues != null && codegenParameter.items.allowableValues.containsKey(TwilioJavaGenerator.VALUES)); - return enumValues || listEnumValues; + boolean isEnum = enumValues || listEnumValues; + codegenParameter.vendorExtensions.put("x-enum-object", isEnum); + return isEnum; } // TODO: Refactor java code. @@ -103,4 +107,4 @@ public static boolean isPredefinedEnum(CodegenParameter codegenParameter) { } return false; } -} \ No newline at end of file +} diff --git a/src/main/resources/twilio-python/modelClasses.handlebars b/src/main/resources/twilio-python/modelClasses.handlebars index ee401b070..b4d34154a 100644 --- a/src/main/resources/twilio-python/modelClasses.handlebars +++ b/src/main/resources/twilio-python/modelClasses.handlebars @@ -12,6 +12,6 @@ def to_dict(self): return { {{#vars}} - "{{{vendorExtensions.json-name}}}": {{#if complexType}}{{#containerType}}[{{name}}.to_dict() for {{name}} in self.{{name}}]{{/containerType}}{{^containerType}}self.{{name}}.to_dict(){{/containerType}}{{else}}self.{{name}}{{/if}},{{/vars}} + "{{{vendorExtensions.json-name}}}": {{#if complexType}}{{#containerType}}[{{name}}.to_dict() for {{name}} in self.{{name}}]{{/containerType}}{{^containerType}}self.{{name}}{{^vendorExtensions.x-enum-object}}.to_dict(){{/vendorExtensions.x-enum-object}}{{/containerType}}{{else}}self.{{name}}{{/if}},{{/vars}} } {{/hasVars}}{{/vendorExtensions.part-of-response-model}}{{/models}}