forked from loafle/openapi-generator-original
[C#][netcore] Remove redundant logic in adding ICollection (#9938)
* remove reduce logic in adding IColletion * remove redundant logic in csharp client generator * update samples
This commit is contained in:
parent
8df43a10c1
commit
d99f16edc5
@ -536,33 +536,6 @@ public class CSharpClientCodegen extends AbstractCSharpCodegen {
|
|||||||
return this.modelPropertyNaming;
|
return this.modelPropertyNaming;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public Map<String, Object> postProcessOperationsWithModels(Map<String, Object> objs, List<Object> allModels) {
|
|
||||||
super.postProcessOperationsWithModels(objs, allModels);
|
|
||||||
if (objs != null) {
|
|
||||||
Map<String, Object> operations = (Map<String, Object>) objs.get("operations");
|
|
||||||
if (operations != null) {
|
|
||||||
List<CodegenOperation> ops = (List<CodegenOperation>) operations.get("operation");
|
|
||||||
for (CodegenOperation operation : ops) {
|
|
||||||
if (operation.returnType != null) {
|
|
||||||
operation.returnContainer = operation.returnType;
|
|
||||||
if (this.returnICollection && (
|
|
||||||
operation.returnType.startsWith("List") ||
|
|
||||||
operation.returnType.startsWith("Collection"))) {
|
|
||||||
// NOTE: ICollection works for both List<T> and Collection<T>
|
|
||||||
int genericStart = operation.returnType.indexOf("<");
|
|
||||||
if (genericStart > 0) {
|
|
||||||
operation.returnType = "ICollection" + operation.returnType.substring(genericStart);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return objs;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public CodegenType getTag() {
|
public CodegenType getTag() {
|
||||||
return CodegenType.CLIENT;
|
return CodegenType.CLIENT;
|
||||||
|
@ -468,33 +468,6 @@ public class CSharpNetCoreClientCodegen extends AbstractCSharpCodegen {
|
|||||||
super.postProcessModelProperty(model, property);
|
super.postProcessModelProperty(model, property);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public Map<String, Object> postProcessOperationsWithModels(Map<String, Object> objs, List<Object> allModels) {
|
|
||||||
super.postProcessOperationsWithModels(objs, allModels);
|
|
||||||
if (objs != null) {
|
|
||||||
Map<String, Object> operations = (Map<String, Object>) objs.get("operations");
|
|
||||||
if (operations != null) {
|
|
||||||
List<CodegenOperation> ops = (List<CodegenOperation>) operations.get("operation");
|
|
||||||
for (CodegenOperation operation : ops) {
|
|
||||||
if (operation.returnType != null) {
|
|
||||||
operation.returnContainer = operation.returnType;
|
|
||||||
if (this.returnICollection && (
|
|
||||||
operation.returnType.startsWith("List") ||
|
|
||||||
operation.returnType.startsWith("Collection"))) {
|
|
||||||
// NOTE: ICollection works for both List<T> and Collection<T>
|
|
||||||
int genericStart = operation.returnType.indexOf("<");
|
|
||||||
if (genericStart > 0) {
|
|
||||||
operation.returnType = "ICollection" + operation.returnType.substring(genericStart);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return objs;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void postProcessParameter(CodegenParameter parameter) {
|
public void postProcessParameter(CodegenParameter parameter) {
|
||||||
postProcessPattern(parameter.pattern, parameter.vendorExtensions);
|
postProcessPattern(parameter.pattern, parameter.vendorExtensions);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user