-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[UBP] Fix usage gRPC sugar.ts
file
#12843
Conversation
In particular avoid the use of `||` against an enum type that can be 0. See: #12767 (comment)
Definitely. 🔭 We could check out |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder why there are so many formatted changes. I thought we have the same formatting config set up on the workspaces.
return <CostCenter> { | ||
id: AttributionId.parse(response.getCostCenter()!.getAttributionId()), | ||
|
||
const attrId = AttributionId.parse(response.getCostCenter()!.getAttributionId()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: It would be a contract violation of the GRPC service to return a costCenter without an attributionID. We should enforce the contract in the API impl itself rather than on the TypeScript bindings.
It looked as though |
Description
Fix the
sugar.ts
file that wraps the usage component gRPC client for typescript clients.Use a return value of the correct shape rather than explicitly casting an incorrect shape.
In particular avoid the use of
||
against an enum type that can be 0.See #12767 (comment) for the full context.
I really dislike these sugar files, they are an untested, handwritten layer over the generated gRPC client in which bugs like this can lurk.
Related Issue(s)
How to test
Release Notes
Documentation
Werft options: