Open tobq opened 3 years ago
Please post your proto as a sample
@jvmlet Here's an abstracted version
syntax = "proto3";
package org.tobi;
option java_package = "org.tobi.grpc";
option java_multiple_files = true;
import "....proto";
service MyGrpcService {
rpc rpc_method_name(org.tobi...) returns (RpcResponse) {};
}
@jvmlet seems the problem is the generator, at compile time, compiles to camelCase, however at runtime, the library is not doing this same conversion from snake_case to camelCase
Any updates? @jvmlet
@jvmlet I put this hack in place:
private static final Pattern SNAKE_CASE_PATTERN = Pattern.compile("_");
// ...
Function<String, ReflectionUtils.MethodFilter> filterFactory = name -> method -> {
var processedName = SNAKE_CASE_PATTERN.matcher(name).replaceAll("");
return method.getName().equalsIgnoreCase(processedName);
};
I'm aware about this ;-) , but what about this :
service MyGrpcService {
rpc rpc_method_name(org.tobi...) returns (RpcResponse) {};
rpc rpc_mEthod_nAme(org.tobi...) returns (RpcResponse) {};
}
?
@jvmlet ah, so the whole implementation needs to be reworked, because the original implementation simply does an ignoreCase
comparison.
Anyway, I don't have any cases like this so I will keep my hack in place until the package is patched, as it was completely blocking me
You are right... I'll implement your suggestion meanwhile since the original implementation suffers from this anyway. Let's hope grpc java team will provide solution in the nearest future.
@tobq , please try with 4.6.0-SNAPSHOT
, I'll keep the issue open meanwhile. may be grpc team will provide the requested API
@jvmlet I get:
- Gradle Core Plugins (plugin is not in 'org.gradle' namespace)
- Plugin Repositories (could not resolve plugin artifact 'io.github.lognet.grpc-spring-boot:io.github.lognet.grpc-spring-boot.gradle.plugin:4.6.0-SNAPSHOT')
Searched in the following repositories:
maven(https://repo.spring.io/milestone)
maven2(https://repo.spring.io/snapshot)
Gradle Central Plugin Repository
Snapshot version of grpc spring boot gradle plugin is published to sonatype only. Gradle plugins repo doesn't support snapshots. Please add sonatype repo as source for gradle plugins.
@jvmlet I tried
settings.gradle
pluginManagement { repositories { maven { url 'https://oss.sonatype.org/content/repositories/snapshots' } } }
build.gradle
plugins { id "io.github.lognet.grpc-spring-boot" version '4.6.0-SNAPSHOT' }
which doesn't work
org.lognet.springboot.grpc.GRpcServicesRegistry#descriptorToServiceMethod
doesn't map the RPC methods, of the formrpc_method_name
(snake-case) to the generated java methods, of the formrpcMethodName
(camel-case).This causes the following error to be thrown at run-time: