-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Silent failures When Using 'Class.verify' #685
Comments
For reference: verifier As it is currently, Regarding |
Thank you for the quick response.
const rootNamespace = protobuf.Root.fromJSON(pbJson);
const pbDef = rootNamespace.looup('MyDef');
const writer = protobuf.Writer.create();
pbDef.encodeDelimited(pbDef.fromObject(myObject), writer);
const buffer = writer.finish(); Is this matching the poet's intention? |
Regarding 1.: It only checks whether the object will encode properly. That means it only checks actual field values and no additional properties. For example, if you have a required field on your message, and that's not set, then it will always return an error. If all properties are optional, it won't for anything that can be accessed like an object, like a number. On 2. Exactly, yes. |
I'm happy to report that I successfully upgraded from v5 to v6 and all our tests are passing. We have a very large code base that relies heavily on protobuf. I've added a gulp task to compile the proto files to a JSON (~500KB). I've also tried static-module, but the file size was over 7MB and I didn't see any benefits. For future reference, here's my gulp code: gulp.task('protobuf', (callback) => {
const pbSrc = path.join(__dirname, '../..', PROTO_SOURCE_PATH);
const pbDest = path.join(__dirname, '../..', OUTPUT_FILE_PATH);
const options = ['--target', 'json'];
const command = [...options, '--path', pbSrc, '--out', pbDest, ...protobufFiles];
log('generating static JS code from proto files');
log('pbjs command: ', command.join(' '));
pbjs.main(
command,
(error) => {
if (error) {
log('error: ', error);
callback(error);
return;
}
callback();
});
}); The issue I'm seeing with the Another issue that I've encountered during the upgrade is that v6 is more sensitive to the 'flavor' of base64 strings. I had to modify my code and transform the strings into a non-url-safe flavor. It would be nice if that was covered by the |
This should be fixed with v6.6.4. Feel free to reopen if there are still any issues! |
Thank you |
protobuf.js version: 6.6.3
I'm working on upgrading our pbjs from 5.x to 6.x.
The code is a lot easier to use and I was able to remove quite a bit of custom wrapper code.
So far I ran into 2 issues:
verify
works sometimes. It seems to fail silently, even if I pass "junk" in{ enums: String }
which is great, but when encodingenums
can be specified only byinteger
. Is there a plan to re-introduce support for encodingenum
strings?Thank you @dcodeIO for all the great work.
The text was updated successfully, but these errors were encountered: