Add Optional Metadata Parameter to Service Interface
See original GitHub issueCurrently, the generated service interface methods accept a single parameter as an argument.
Example:
getPage(request: logbook.getPageRequest): Observable<logbook.Page>;
gRPC allows you to pass optional parameters to service calls in the form of metadata. This information is passed through correctly at the moment due to ...args
spread, however the type signature causes the compiler to complain. I could just add things such as the JWT token to the request proto definition itself, but metadata feels like the appropriate use case.
Do you think it would be appropriate for the interface service definitions to include metadata as an optional parameter?
getPage(request: logbook.getPageRequest, metadata?: any): Observable<logbook.Page>;
I can try to get a PR together if you’d like.
Issue Analytics
- State:
- Created 6 years ago
- Reactions:5
- Comments:10 (9 by maintainers)
Top GitHub Comments
There is some work being done on getting an a typescript definition file for gRPC, see #11020. Luckily for us that contains a definition file, I copied the metadata part below.
With that definition we can type the metadata parameter:
getPage( request: logbook.getPageRequest, metadata ?: Metadata ): Observable<logbook.Page>;
Definition copied from index.d.ts
Released in v0.2.0.