diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/RustClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/RustClientCodegen.java index 9fb5b8f3ef5b..0e594e177285 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/RustClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/RustClientCodegen.java @@ -422,9 +422,12 @@ public void execute(Template.Fragment fragment, Writer writer) throws IOExceptio content = content.trim().replace("v", ""); content = content.replace("V", ""); - // convert 5.2 to 5.2.0 for example String[] contents = content.split("[.]"); - if (contents.length == 2) { + if (contents.length == 1) { + // convert 5 to 5.0.0 for example + content += ".0.0"; + } else if (contents.length == 2) { + // convert 5.2 to 5.2.0 for example content += ".0"; }