-
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
Seeing a bunch more weirdness in asJSON #620
Comments
Also including #616 There needs to be a better differentiation between 0 and unset. |
The initial thing is probably due to asJSON removing any default values when There, asJSON doesn't really know which property is on the message itself and which one is on the prototype - hence it handles both the same. Testing this through I'll probably throw the current converter stuff away again and try something that iterates over the source's properties instead. |
Thank you! Once this is done, we will be in a really amazing pace, can't wait to get all the big performance improvements with this release. All these are painful because these are breaking changes and we have a large code base with hundreds of messages. |
May I ask what's the exact format of the json data you are using? Does it somewhat correspond to the official proto3 json mapping? The reason why I'm asking is that I'd like to start with the official JSON mapping and then build onto that, ideally eliminating as many of the options as possible. For example, the official json mapping always converts:
|
Yes, official mapping will work with few options for exceptions. |
@dcodeIO just checking to see if you have made some progress on this. |
Not yet, unfortunately. I really want 6.4.X to become stable now, before going for a 6.5.X with new converters. |
Additional notes:
Also worth mentioning: This generates somewhat longish code now, but it is 2-3 times faster than what we had before iirc. Let me know what you think. It's probably still buggy somehow, but it passes the slightly extended test case (which failed for maps btw. with the old converters). |
Sweet! Let me try it |
from is throwing an error. I have a proto which has a message as a nested field message MyProto { optional MyNestedProto proto = 1 } MyProto.from({}) is crashing, its trying to parse MyNestedProto |
still throwing... |
This is working for me: var root = protobuf.Root.fromJSON({
nested: {
MyProto: {
fields: {
proto: {
type: "MyNestedProto",
id: 1
}
}
},
MyNestedProto: {
fields: {
aLong: {
type: "uint64",
id: 1
}
}
}
}
}).resolveAll();
var myProto = root.MyProto.from({});
console.log(myProto); What's the difference? |
Fixed it. Looks like a version skew. I am working off git+https://... in package.json It does not really work well on branches. |
I have gone through several features so far in my giant protobuf conversion branch and I have yet to find anything obviously broken with the entire slew of apps we have. I will have more eyes during code-review and QA. I will post if there are more issues. Closing the bug. please push 6.5.0 when you get a chance, we would prefer not to build production assets directly from git master. |
This is converted with
{ fieldsOnly: true, longs: Number, enums: String, defaults: false, arrays: true }
Array entry 0 is missing color, secondary state and orderings.
Array entry 1 is missing all the fields.
I also have a case where enum is not converted to String.
The text was updated successfully, but these errors were encountered: