-
Notifications
You must be signed in to change notification settings - Fork 944
Switch serializer tests to test round trips + remove deprecated grpc.load() #1699
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,6 +15,7 @@ | |
* limitations under the License. | ||
*/ | ||
|
||
import * as protoLoader from '@grpc/proto-loader'; | ||
import * as grpc from 'grpc'; | ||
import { resolve } from 'path'; | ||
|
||
|
@@ -24,19 +25,22 @@ import { resolve } from 'path'; | |
* @returns The GrpcObject representing our protos. | ||
*/ | ||
export function loadProtos(): grpc.GrpcObject { | ||
const options = { | ||
// Beware that converting fields to camel case does not convert the tag | ||
// fields in oneof groups (!!!). This will likely be fixed when we upgrade | ||
// to protobufjs 6.x | ||
convertFieldsToCamelCase: true | ||
}; | ||
const root = resolve( | ||
__dirname, | ||
process.env.FIRESTORE_PROTO_ROOT || '../protos' | ||
); | ||
const firestoreProtoFile = { | ||
root, | ||
file: 'google/firestore/v1/firestore.proto' | ||
}; | ||
return grpc.load(firestoreProtoFile, /*format=*/ 'proto', options); | ||
const firestoreProtoFile = root + '/google/firestore/v1/firestore.proto'; | ||
|
||
// Beware that converting fields to camel case does not convert the tag fields | ||
// in oneof groups (!!!). This will likely be fixed when we upgrade to | ||
// protobufjs 6.x | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think this comment is probably stale since:
I think this comment is referring to the fact that the tag fields are named |
||
const packageDefinition = protoLoader.loadSync(firestoreProtoFile, { | ||
longs: String, | ||
enums: String, | ||
defaults: true, | ||
oneofs: true, | ||
includeDirs: [root] | ||
}); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I wonder if it's worth commenting these options a bit so somebody (future me) doesn't have to go look up the grpc docs to figure out what they mean... |
||
|
||
return grpc.loadPackageDefinition(packageDefinition); | ||
} |
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.
You need to run
yarn
oryarn install
from the root and check in the resultingyarn.lock
file.