use of io.swagger.codegen.v3.CodegenOperation in project flow by vaadin.
the class CodeGenerator method fromOperation.
@Override
public CodegenOperation fromOperation(String path, String httpMethod, Operation operation, Map<String, Schema> schemas, OpenAPI openAPI) {
if (!"POST".equalsIgnoreCase(httpMethod)) {
throw getGeneratorException("Code generator only supports POST requests.");
}
Matcher matcher = PATH_REGEX.matcher(path);
if (!matcher.matches()) {
throw getGeneratorException("Path must be in form of \"/<EndpointName>/<MethodName>\".");
}
CodegenOperation codegenOperation = super.fromOperation(path, httpMethod, operation, schemas, openAPI);
String endpointName = matcher.group(1);
String methodName = matcher.group(2);
codegenOperation.getVendorExtensions().put(EXTENSION_VAADIN_CONNECT_METHOD_NAME, methodName);
codegenOperation.getVendorExtensions().put(EXTENSION_VAADIN_CONNECT_SERVICE_NAME, endpointName);
validateOperationTags(path, httpMethod, operation);
return codegenOperation;
}
Aggregations