diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractGoCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractGoCodegen.java index a3c09824a81b..d5aa594695f7 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractGoCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractGoCodegen.java @@ -144,8 +144,9 @@ public String escapeReservedWord(String name) { @Override public String toVarName(String name) { + // replace - with _ e.g. created-at => created_at - name = sanitizeName(name.replaceAll("-", "_")); + name = sanitizeName(name); // if it's all uppper case, do nothing if (name.matches("^[A-Z_]*$"))