diff --git a/src/main/java/com/twilio/oai/TwilioGoGenerator.java b/src/main/java/com/twilio/oai/TwilioGoGenerator.java index d599c84d5..9c85c55b1 100644 --- a/src/main/java/com/twilio/oai/TwilioGoGenerator.java +++ b/src/main/java/com/twilio/oai/TwilioGoGenerator.java @@ -83,7 +83,7 @@ String removeStatusCode(String modelName) { } String removeDigits(String modelName) { - if(modelName == null || modelName.isEmpty()) + if(modelName == null || modelName.isEmpty() || modelName.contains("2010")) return modelName; return modelName.replaceFirst("\\d{3}", ""); } @@ -169,17 +169,17 @@ public OperationsMap postProcessOperationsWithModels(final OperationsMap objs, L final List opList = ops.getOperation(); final Map models = allModels - .stream() - .map(m -> m.get("model")) - .map(CodegenModel.class::cast) - .collect(Collectors.toMap(CodegenModel::getName, Function.identity())); + .stream() + .map(m -> m.get("model")) + .map(CodegenModel.class::cast) + .collect(Collectors.toMap(CodegenModel::getName, Function.identity())); // get the model for the return type final Optional returnModel = opList - .stream() - .filter(op -> models.containsKey(op.returnType)) - .map(op -> models.get(op.returnType)) - .findFirst(); + .stream() + .filter(op -> models.containsKey(op.returnType)) + .map(op -> models.get(op.returnType)) + .findFirst(); for (final CodegenOperation co : opList) { Utility.populateCrudOperations(co); @@ -193,9 +193,9 @@ public OperationsMap postProcessOperationsWithModels(final OperationsMap objs, L // filter the fields in the model and get only the array typed field. Also, make sure there is only one field of type list/array if (returnModel.isPresent()) { CodegenProperty field = returnModel.get().allVars - .stream() - .filter(v -> v.dataType.startsWith("[]")) - .collect(toSingleton()); + .stream() + .filter(v -> v.dataType.startsWith("[]")) + .collect(toSingleton()); co.returnContainer = co.returnType; co.returnType = field.dataType; @@ -209,9 +209,9 @@ public OperationsMap postProcessOperationsWithModels(final OperationsMap objs, L CodegenModel model = (CodegenModel) modelMap.get("model"); final Optional returnModelOther = Optional.ofNullable(model); CodegenProperty field = returnModelOther.get().allVars - .stream() - .filter(v -> v.dataType.startsWith("[]")) - .collect(toSingleton()); + .stream() + .filter(v -> v.dataType.startsWith("[]")) + .collect(toSingleton()); co.returnContainer = co.returnType; co.returnType = field.dataType;