From 67d1a64d022ab89f859ddc6f478f69a1dc85381b Mon Sep 17 00:00:00 2001
From: Richard Whitehouse <richard.whitehouse@metaswitch.com>
Date: Sun, 24 Jan 2021 00:47:03 +0000
Subject: [PATCH 1/3] [Rust Server] Render operations for sanitized tags

---
 .../codegen/languages/RustServerCodegen.java             | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/RustServerCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/RustServerCodegen.java
index 2080fca66a7..8e79b12cbff 100644
--- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/RustServerCodegen.java
+++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/RustServerCodegen.java
@@ -1095,9 +1095,12 @@ public class RustServerCodegen extends DefaultCodegen implements CodegenConfig {
     public void addOperationToGroup(String tag, String resourcePath, Operation operation, CodegenOperation
             co, Map<String, List<CodegenOperation>> operations) {
         // only generate operation for the first tag of the tags
-        if (tag != null && co.tags.size() > 1 && !tag.equals(co.tags.get(0).getName())) {
-            LOGGER.info("generated skip additional tag `" + tag + "` with operationId=" + co.operationId);
-            return;
+        if (tag != null && co.tags.size() > 1) {
+            String expectedTag = sanitizeTag(co.tags.get(0).getName());
+            if (!tag.equals(expectedTag)) {
+                LOGGER.info("generated skip additional tag `" + tag + "` with operationId=" + co.operationId);
+                return;
+            }
         }
         super.addOperationToGroup(tag, resourcePath, operation, co, operations);
     }
-- 
GitLab


From be869dc43f6e0f9d8a8de5959f2a79020bb6bb6b Mon Sep 17 00:00:00 2001
From: Richard Whitehouse <richard.whitehouse@metaswitch.com>
Date: Sun, 24 Jan 2021 00:47:39 +0000
Subject: [PATCH 2/3] [Rust Server] Add test for sanitized tags

---
 .../src/test/resources/3_0/rust-server/openapi-v3.yaml          | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/modules/openapi-generator/src/test/resources/3_0/rust-server/openapi-v3.yaml b/modules/openapi-generator/src/test/resources/3_0/rust-server/openapi-v3.yaml
index 0bcea44a508..34eae5c8ede 100644
--- a/modules/openapi-generator/src/test/resources/3_0/rust-server/openapi-v3.yaml
+++ b/modules/openapi-generator/src/test/resources/3_0/rust-server/openapi-v3.yaml
@@ -365,7 +365,7 @@ paths:
           type: string
         required: true
     get:
-      tags: [Repo, Info]
+      tags: [repo, Info]
       operationId: GetRepoInfo
       responses:
         "200":
-- 
GitLab


From b00563fa5e6e49ed0175b86c46340de897ae2394 Mon Sep 17 00:00:00 2001
From: Richard Whitehouse <richard.whitehouse@metaswitch.com>
Date: Sun, 24 Jan 2021 00:47:46 +0000
Subject: [PATCH 3/3] Update samples

---
 .../petstore/rust-server/output/openapi-v3/api/openapi.yaml     | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/samples/server/petstore/rust-server/output/openapi-v3/api/openapi.yaml b/samples/server/petstore/rust-server/output/openapi-v3/api/openapi.yaml
index fab686f0ebf..b8e584232b8 100644
--- a/samples/server/petstore/rust-server/output/openapi-v3/api/openapi.yaml
+++ b/samples/server/petstore/rust-server/output/openapi-v3/api/openapi.yaml
@@ -389,7 +389,7 @@ paths:
                 $ref: '#/components/schemas/StringObject'
           description: OK
       tags:
-      - Repo
+      - repo
       - Info
   /repos:
     post:
-- 
GitLab