mirror of
https://github.com/OpenAPITools/openapi-generator.git
synced 2026-04-26 00:44:11 +00:00
Fix Rust generation for versions without minor or patch parts (#19946)
This fixes generation of a Rust library for OpenAPI specifications where `info.version` was a single-digit number. This happened to for [this](https://github.com/motis-project/motis/blob/db005f2e55812b8231e2e2dbac4d3abf711a8610/openapi.yaml#L10) specification. The fix for this issue is similar to the one in !17440.
This commit is contained in:
+5
-2
@@ -422,9 +422,12 @@ public class RustClientCodegen extends AbstractRustCodegen implements CodegenCon
|
||||
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";
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user