forked from loafle/openapi-generator-original
* [Rust Server] Fix issue with multiple tags on an operation generating duplicate methods. * [Rust Server] Add test case yaml with multiple tags on a single operation.
This commit is contained in:
parent
e38498dd5d
commit
38dfed4104
@ -1111,6 +1111,27 @@ public class RustServerCodegen extends DefaultCodegen implements CodegenConfig {
|
||||
return dataType != null && dataType.equals(typeMapping.get("File").toString());
|
||||
}
|
||||
|
||||
/**
|
||||
* Add operation to group
|
||||
*
|
||||
* @param tag name of the tag
|
||||
* @param resourcePath path of the resource
|
||||
* @param operation OAS Operation object
|
||||
* @param co Codegen Operation object
|
||||
* @param operations map of Codegen operations
|
||||
*/
|
||||
@SuppressWarnings("static-method")
|
||||
@Override
|
||||
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;
|
||||
}
|
||||
super.addOperationToGroup(tag, resourcePath, operation, co, operations);
|
||||
}
|
||||
|
||||
// This is a really terrible hack. We're working around the fact that the
|
||||
// base version of `fromRequestBody` checks to see whether the body is a
|
||||
// ref. If so, it unwraps the reference and replaces it with its inner
|
||||
|
@ -362,7 +362,7 @@ paths:
|
||||
type: string
|
||||
required: true
|
||||
get:
|
||||
tags: [Repo]
|
||||
tags: [Repo, Info]
|
||||
operationId: GetRepoInfo
|
||||
responses:
|
||||
"200":
|
||||
|
@ -384,6 +384,7 @@ paths:
|
||||
description: OK
|
||||
tags:
|
||||
- Repo
|
||||
- Info
|
||||
components:
|
||||
schemas:
|
||||
EnumWithStarObject:
|
||||
|
@ -0,0 +1,8 @@
|
||||
# info_api
|
||||
|
||||
All URIs are relative to *http://localhost*
|
||||
|
||||
Method | HTTP request | Description
|
||||
------------- | ------------- | -------------
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user