How to get method name from request proto
I'm trying to make working gprc-web-dev-tools with ts-proto and @improbable-eng/grpc-web. It almost works but to get this working completly I have to get every service method name, and I don't know how to do it. I search in generated proto but I found nothing. Is someone know how to do it ?
@hersentino it's a little adhoc, but you could do something like Object.keys( DashAPICredsClientImpl) using the class:
https://github.com/stephenh/ts-proto/blob/16b4aca98aa9f0266734421314baaa5259e3f4e2/integration/grpc-web/example.ts#L814
If you need something more automatic, there is a outputTypeRegistry flag that currently only does message types, but you could extend it to also include service defs in the output...
Or grpc-web output already includes these "kinda metadata" "Desc"/descriptor consts:
export const DashStateDesc = {
serviceName: 'rpx.DashState',
};
export const DashStateUserSettingsDesc: UnaryMethodDefinitionish = {
methodName: 'UserSettings',
service: DashStateDesc,
requestStream: false,
responseStream: false,
requestType: {
But the service desc isn't updated to have a list of the method descriptors...that shouldn't be hard to do.