forked from loafle/openapi-generator-original
replace fromOperation with postProcessOperations
This commit is contained in:
parent
9d1ae0dd29
commit
adbde2fb61
@ -14,6 +14,7 @@ import org.openapitools.codegen.SupportingFile;
|
||||
import java.io.File;
|
||||
import java.util.Arrays;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import io.swagger.v3.oas.models.OpenAPI;
|
||||
@ -262,8 +263,10 @@ public class RubyClientCodegen extends DefaultCodegen implements CodegenConfig {
|
||||
}
|
||||
|
||||
@Override
|
||||
public CodegenOperation fromOperation(String path, String httpMethod, Operation operation, Map<String, Schema> schemas, OpenAPI openAPI) {
|
||||
CodegenOperation op = super.fromOperation(path, httpMethod, operation, schemas, openAPI);
|
||||
public Map<String, Object> postProcessOperations(Map<String, Object> objs) {
|
||||
Map<String, Object> operations = (Map<String, Object>) objs.get("operations");
|
||||
List<CodegenOperation> operationList = (List<CodegenOperation>) operations.get("operation");
|
||||
for (CodegenOperation op : operationList) {
|
||||
// Set vendor-extension to be used in template:
|
||||
// x-codegen-hasMoreRequired
|
||||
// x-codegen-hasMoreOptional
|
||||
@ -277,6 +280,7 @@ public class RubyClientCodegen extends DefaultCodegen implements CodegenConfig {
|
||||
lastOptional = p;
|
||||
}
|
||||
}
|
||||
|
||||
for (CodegenParameter p : op.allParams) {
|
||||
if (p == lastRequired) {
|
||||
p.vendorExtensions.put("x-codegen-hasMoreRequired", false);
|
||||
@ -288,7 +292,10 @@ public class RubyClientCodegen extends DefaultCodegen implements CodegenConfig {
|
||||
}
|
||||
}
|
||||
op.vendorExtensions.put("x-codegen-hasRequiredParams", lastRequired != null);
|
||||
return op;
|
||||
|
||||
}
|
||||
|
||||
return objs;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
Loading…
x
Reference in New Issue
Block a user