forked from loafle/openapi-generator-original
[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:
@@ -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);
|
||||
}
|
||||
|
||||
@@ -365,7 +365,7 @@ paths:
|
||||
type: string
|
||||
required: true
|
||||
get:
|
||||
tags: [Repo, Info]
|
||||
tags: [repo, Info]
|
||||
operationId: GetRepoInfo
|
||||
responses:
|
||||
"200":
|
||||
|
||||
@@ -390,7 +390,7 @@ paths:
|
||||
$ref: '#/components/schemas/StringObject'
|
||||
description: OK
|
||||
tags:
|
||||
- Repo
|
||||
- repo
|
||||
- Info
|
||||
/repos:
|
||||
post:
|
||||
|
||||
Reference in New Issue
Block a user