[Rust Server] Generate operations where tags require sanitization (#12996)

* [Rust Server] Render operations for sanitized tags

* [Rust Server] Add test for sanitized tags

* Update samples

Co-authored-by: Richard Whitehouse <richard.whitehouse@metaswitch.com>
This commit is contained in:
William Cheng
2022-07-23 14:25:05 +08:00
committed by GitHub
parent a87da6ad3c
commit fe8fbaf923
3 changed files with 8 additions and 5 deletions

View File

@@ -1110,9 +1110,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 `{}` with operationId={}", tag, 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 `{}` with operationId={}", tag, co.operationId);
return;
}
}
super.addOperationToGroup(tag, resourcePath, operation, co, operations);
}

View File

@@ -365,7 +365,7 @@ paths:
type: string
required: true
get:
tags: [Repo, Info]
tags: [repo, Info]
operationId: GetRepoInfo
responses:
"200":

View File

@@ -390,7 +390,7 @@ paths:
$ref: '#/components/schemas/StringObject'
description: OK
tags:
- Repo
- repo
- Info
/repos:
post: